Skip to content

Commit

Permalink
what feels like many small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkokotila committed Apr 20, 2024
1 parent 6e4d2b1 commit 23bde18
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 46 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/deploy-old.yml

This file was deleted.

2 changes: 1 addition & 1 deletion talos/autom8/autoparams.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from tensorflow.keras.optimizers import Adam, Nadam, Adadelta, SGD
from tensorflow.keras.optimizers.legacy import Adam, Nadam, Adadelta, SGD


loss = {'binary': ['binary_crossentropy', 'logcosh'],
Expand Down
4 changes: 2 additions & 2 deletions talos/model/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def lr_normalizer(lr, optimizer):
The optimizer. For example, Adagrad, Adam, RMSprop.
"""

from tensorflow.keras.optimizers import SGD, Adam, Adadelta, Adagrad, Adamax, RMSprop
from tensorflow.keras.optimizers import Nadam
from tensorflow.keras.optimizers.legacy import SGD, Adam, Adadelta, Adagrad, Adamax, RMSprop
from tensorflow.keras.optimizers.legacy import Nadam
from talos.utils.exceptions import TalosModelError

if optimizer == Adadelta:
Expand Down
4 changes: 2 additions & 2 deletions talos/templates/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def telco_churn(quantile=.5):

df = pd.read_csv('https://raw.githubusercontent.com/autonomio/examples/master/telco_churn/telco_churn_for_sensitivity.csv')

df = df.drop(['val_acc', 'loss', 'f1score', 'acc', 'round_epochs'], 1)
df = df.drop(['val_acc', 'loss', 'f1score', 'acc', 'round_epochs'], axis=1)

for col in df.iloc[:, 2:].columns:
df = wrangle.col_to_multilabel(df, col)
Expand All @@ -34,7 +34,7 @@ def telco_churn(quantile=.5):
y1 = df.C0.values
y2 = df.C1.values

x = df.drop(['C0', 'C1'], 1).values
x = df.drop(['C0', 'C1'], axis=1).values

return x, [y1, y2]

Expand Down
7 changes: 4 additions & 3 deletions talos/templates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ def titanic(x_train, y_train, x_val, y_val, params):
metrics=['acc'])

# here we are also using the early_stopper function for a callback
out = model.fit(x=x_train,
y=y_train,
out = model.fit(x=x_train.astype('float32'),
y=y_train.astype('float32'),
batch_size=params['batch_size'],
epochs=params['epochs'],
verbose=0,
validation_data=(x_val, y_val))
validation_data=(x_val.astype('float32'),
y_val.astype('float32')))

return out, model

Expand Down
6 changes: 3 additions & 3 deletions talos/templates/params.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def titanic(debug=False):

from tensorflow.keras.optimizers import Adam, Nadam
from tensorflow.keras.optimizers.legacy import Adam, Nadam

# here use a standard 2d dictionary for inputting the param boundaries
p = {'lr': (0.5, 5, 10),
Expand Down Expand Up @@ -34,7 +34,7 @@ def titanic(debug=False):

def iris():

from tensorflow.keras.optimizers import Adam, Nadam
from tensorflow.keras.optimizers.legacy import Adam, Nadam
from tensorflow.keras.losses import logcosh, categorical_crossentropy
from tensorflow.keras.activations import relu, elu, softmax

Expand All @@ -58,7 +58,7 @@ def iris():

def breast_cancer():

from tensorflow.keras.optimizers import Adam, Nadam, RMSprop
from tensorflow.keras.optimizers.legacy import Adam, Nadam, RMSprop
from tensorflow.keras.losses import logcosh, binary_crossentropy
from tensorflow.keras.activations import relu, elu, sigmoid

Expand Down
5 changes: 3 additions & 2 deletions talos/templates/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def titanic(round_limit=2, random_method='uniform_mersenne', debug=False):

'''Performs a Scan with Iris dataset and simple dense net'''
import talos as ta
scan_object = ta.Scan(ta.templates.datasets.titanic()[0],
ta.templates.datasets.titanic()[1],

scan_object = ta.Scan(ta.templates.datasets.titanic()[0].astype('float32'),
ta.templates.datasets.titanic()[1].astype('float32'),
ta.templates.params.titanic(debug),
ta.templates.models.titanic,
'test',
Expand Down
2 changes: 1 addition & 1 deletion talos/utils/recover_best_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def recover_best_model(x_train,

# get the params for the model and train it
params = df.sort_values(metric, ascending=False)
params = params.drop(metric, 1).iloc[i].to_dict()
params = params.drop(metric, axis=1).iloc[i].to_dict()
_history, model = input_model(x_train, y_train, x_val, y_val, params)

# start kfold cross-validation
Expand Down
8 changes: 4 additions & 4 deletions test-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

from tests.commands import *

scan_object = test_scan()
'''
test_latest()
scan_object = test_scan()
recover_best_model()
test_random_methods()
test_autom8()
test_templates()

# test_analyze(scan_object)
test_templates()'''
test_analyze(scan_object)

test_lr_normalizer()
test_predict()
Expand Down
20 changes: 18 additions & 2 deletions tests/commands/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,30 @@ def test_analyze(scan_object):

# test the object properties
r.best_params('val_loss', ['val_acc'])
r.correlate('val_loss', ['val_acc'])
r.correlate('val_loss', ['val_acc',
'start',
'end',
'activation',
'optimizer',
'losses',
'shapes'])
r.data
r.high('val_acc')
r.low('val_acc')





# r.plot_bars('first_neuron', 'val_acc', 'dropout', 'hidden_layers')
r.plot_box('first_neuron', 'val_acc')
r.plot_corr('val_loss', ['val_acc'])
r.plot_corr('val_loss', ['val_acc',
'start',
'end',
'activation',
'optimizer',
'losses',
'shapes'])
r.plot_hist('val_acc')
r.plot_kde('val_acc')
r.plot_line('val_acc')
Expand Down

0 comments on commit 23bde18

Please sign in to comment.