This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import requests | |
from urllib.parse import urlparse | |
import os | |
import urllib.request | |
import shutil | |
def download_url(url, file_name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train(gan, | |
num_iters, | |
batch_size=128, | |
print_every=1, | |
epochs=1, | |
min_disc_acc = 0.5, | |
min_gan_acc = 0.2, | |
normal_noise=True, | |
save_example_name=None, | |
save_model_name=None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def train(gan, | |
num_iters, | |
batch_size=128, | |
print_every=1, | |
epochs=1, | |
min_disc_acc = 0.5, | |
min_gan_acc = 0.2, | |
normal_noise=True, | |
save_example_name=None, | |
save_model_name=None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from keras.layers import Input, Dense, Lambda, Flatten, Reshape | |
from keras.models import Model | |
from keras import backend as K | |
from keras.callbacks import EarlyStopping | |
from keras import objectives | |
import numpy as np | |
from itertools import product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2.8 Variational autoencoder (VAE) | |
import matplotlib.pyplot as plt | |
import matplotlib as mpl | |
from keras.layers import Input, Dense, Lambda, Flatten, Reshape | |
from keras.models import Model | |
from keras import backend as K | |
from keras.callbacks import EarlyStopping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from datetime import datetime as dt | |
from dateutil import parser | |
""" | |
logs | |
botrank | |
[user] | |
good | |
summary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from datetime import datetime as dt | |
from dateutil import parser | |
### HELPERS | |
class NoYearHandlingParserInfo(parser.parserinfo): | |
yearFirst=True | |
def convertyear(self, year, *args, **kwargs): | |
""" dateutils.parser.parse parses 1 as 2001. This corrects it to parse 1 as in 1AD """ | |
return int(year) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@flow | |
import CalcUtils from "./CalculatorUtils"; | |
import {lastOrNull, isInArray} from './Utils'; | |
import {DECIMAL, Operation} from "../core/Operations"; | |
import {OperationType, OperationSubType, OperationArgs} from '../core/OperationTypes'; | |
export default class Validator { | |
static getLastEffectiveOperator(queue: Array<Operation>): Operation { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getResult(): string { | |
const numbers: Array<Operation> = this.queue.filter(op => op.operationType === OperationType.Constant); | |
const operatorsWithParenthesis = CalcUtils.getOperatorsWithParenthesis(this.queue); | |
const evaluatedOps = this.evaluateParenthesis(operatorsWithParenthesis); | |
try { | |
const out = this.evaluate(numbers, evaluatedOps, null); | |
if (out !== null && out !== undefined) { | |
return numberWithCommas(out.toString()); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getDisplay(): string { | |
if (this.queue.length === 0) { | |
return ' ' | |
} | |
return this.queue.map(x => ( | |
x.operationType == OperationType.Constant && | |
!x.operationArgs.has(OperationArgs.PrintAsString)) ? | |
numberWithCommas(x.stringVal, false) : | |
x.stringVal).join(' ') | |
} |