Skip to content

Instantly share code, notes, and snippets.

View mikkokotila's full-sized avatar

Mikko Kotila mikkokotila

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mikkokotila on github.
  • I am mikkokotila (https://keybase.io/mikkokotila) on keybase.
  • I have a public key whose fingerprint is 1415 6666 3A1C B257 ECA2 A86F 4308 1E9D C041 D0F8

To claim this, I am signing this object:

org 0x100 ; .com files always start 256 bytes into the segment
; int 21h is going to want...
mov dx, msg ; the address of or message in dx
mov ah, 9 ; ah=9 - "print string" sub-function
int 0x21 ; call dos services
mov dl, 0x0d ; put CR into dl
mov ah, 2 ; ah=2 - "print character" sub-function
@mikkokotila
mikkokotila / breast_cancer_model.py
Last active May 12, 2018 09:01
an example model for Keras hyperparameter optimization with Talos
# first we have to make sure to input data and params into the function
def breast_cancer_model(x_train, y_train, x_val, y_val, params):
# next we can build the model exactly like we would normally do it
model = Sequential()
model.add(Dense(10, input_dim=x_train.shape[1],
activation=params['activation'],
kernel_initializer='normal'))
model.add(Dropout(params['dropout']))
@mikkokotila
mikkokotila / params.py
Last active May 18, 2018 18:07
breast cancer dataset example params
# then we can go ahead and set the parameter space
p = {'lr': (0.5, 5, 10),
'first_neuron':[4, 8, 16, 32, 64],
'hidden_layers':[0, 1, 2],
'batch_size': (2, 30, 10),
'epochs': [150],
'dropout': (0, 0.5, 5),
'weight_regulizer':[None],
'emb_output_dims': [None],
'shape':['brick','long_funnel'],
# and run the experiment
t = ta.Scan(x=x,
y=y,
model=breast_cancer_model,
grid_downsample=0.01,
params=p,
dataset_name='breast_cancer',
experiment_no='1')
p = {'lr': (0.8, 1.2, 3),
'first_neuron':[4, 8, 16, 32, 64],
'hidden_layers':[0, 1, 2],
'batch_size': (1, 5, 5),
'epochs': [50, 100, 150],
'dropout': (0, 0.2, 3),
'weight_regulizer':[None],
'emb_output_dims': [None],
'shape':['brick','long_funnel'],
'kernel_initializer': ['uniform','normal'],
def iris_model(x_train, y_train, x_val, y_val):
model = Sequential()
model.add(Dense(32, input_dim=8, activation='adam'))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='relu', loss='binary_crossentropy')
out = model.fit(x_train, y_train,
batch_size=24,
epochs=100,
import talos
from keras.models import Sequential
from keras.layers import Dense
def minimal():
x, y = talos.templates.datasets.iris()
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
import talos as ta
from keras.models import Sequential
from keras.layers import Dense
def minimal():
x, y = ta.datasets.iris()
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
import signs as signs
import pandas as pd
# load some text
df = pd.read_csv('tweets.csv').text
# load vectors
e = signs.Embeds("glove.twitter.27B.25d.txt")
# get Keras embeddings layer