Skip to content

Commit

Permalink
clean up / pepify
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkokotila committed Mar 4, 2019
1 parent cdcf7e9 commit 09ef9ca
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,3 +12,4 @@ talos.egg-info
*.h5
*.json
*.npy
test.sh
9 changes: 4 additions & 5 deletions talos/commands/deploy.py
Expand Up @@ -12,11 +12,10 @@ class Deploy:

def __init__(self, scan_object, model_name, metric='val_acc', asc=False):


'''Deploy a model to be used later or in a different system.
NOTE: for a metric that is to be minimized, set asc=True or otherwise
you will end up with the model that has the highest loss.
you will end up with the model that has the highest loss.
Deploy() takes in the object from Scan() and creates a package locally
that can be later activated with Restore().
Expand All @@ -26,10 +25,10 @@ def __init__(self, scan_object, model_name, metric='val_acc', asc=False):
model_name : str
Name for the .zip file to be created.
metric : str
The metric to be used for picking the best model.
The metric to be used for picking the best model.
asc: bool
Make this True for metrics that are to be minimized (e.g. loss) , and
False when the metric is to be maximized (e.g. acc)
Make this True for metrics that are to be minimized (e.g. loss) ,
and False when the metric is to be maximized (e.g. acc)
'''

Expand Down
3 changes: 2 additions & 1 deletion talos/commands/kerasmodel.py
Expand Up @@ -73,7 +73,8 @@ def _create_input_model(self, x_train, y_train, x_val, y_val, params):
activation=params['last_activation']))

# bundle the optimizer with learning rate changes
optimizer = params['optimizer'](lr=lr_normalizer(params['lr'], params['optimizer']))
optimizer = params['optimizer'](lr=lr_normalizer(params['lr'],
params['optimizer']))

# compile the model
model.compile(optimizer=optimizer,
Expand Down
5 changes: 0 additions & 5 deletions talos/commands/predict.py
@@ -1,8 +1,3 @@
from numpy import mean, std

from sklearn.metrics import f1_score

from ..utils.validation_split import kfold
from ..utils.best_model import best_model, activate_model


Expand Down
3 changes: 1 addition & 2 deletions talos/commands/reporting.py
@@ -1,11 +1,10 @@
from pandas import read_csv
from ..utils.connection_check import is_connected
from ..metrics.names import metric_names

if is_connected() is True:
from astetik import line, hist, corr, regs, bargrid, kde, box

from ..metrics.names import metric_names


class Reporting:

Expand Down
12 changes: 10 additions & 2 deletions talos/commands/restore.py
Expand Up @@ -8,8 +8,16 @@

class Restore:

'''Utility class for restoring the assets from Deploy()
package.'''
'''Restores the scan_object that had been stored locally as a result
of talos.Deploy(scan_object, 'example')
USE:
diabetes = ta.Scan(x, y, p, input_model)
ta.Deploy(diabetes, 'diabetes')
ta.Restore('diabetes.zip')
'''

def __init__(self, path_to_zip):

Expand Down

0 comments on commit 09ef9ca

Please sign in to comment.