Skip to content

Commit

Permalink
Merge pull request #339 from autonomio/daily-dev
Browse files Browse the repository at this point in the history
v.0.6 to Dev
  • Loading branch information
mikkokotila authored Jul 5, 2019
2 parents 1e9f96c + 9aeef74 commit 8f38a4a
Show file tree
Hide file tree
Showing 55 changed files with 1,013 additions and 930 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ notifications:
on_success: never
on_failure: always
python:
- '2.7'
- '3.5'
- '3.6'
install:
Expand Down
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ Talos radically transforms ordinary Keras workflows without taking away any of K

Talos is made for data scientists and data engineers that want to remain in **complete control of their Keras models**, but are tired of mindless parameter hopping and confusing optimization solutions that add complexity instead of reducing it. Within minutes, without learning any new syntax, Talos allows you to configure, perform, and evaluate hyperparameter optimization experiments that yield state-of-the-art results across a wide range of prediction tasks. Talos provides the **simplest and yet most powerful** available method for hyperparameter optimization with Keras.

### Key Features
<hr>

### :wrench: Key Features

Based on what no doubt constitutes a "biased" review (being our own) of more than ~30 hyperparameter tuning and optimization solutions, Talos comes on top in terms of intuitive, easy-to-learn, highly permissive access to critical hyperparameter optimization capabilities. Key features include:

Expand All @@ -68,7 +70,9 @@ Based on what no doubt constitutes a "biased" review (being our own) of more tha

Talos works on **Linux, Mac OSX**, and **Windows** systems and can be operated cpu, gpu, and multi-gpu systems.

### Examples
<hr>

### 📈 Examples

Get the below code [here](https://gist.github.com/mikkokotila/4c0d6298ff0a22dc561fb387a1b4b0bb). More examples further below.

Expand All @@ -88,7 +92,9 @@ For more information on how Talos can help with your Keras workflow, visit the [

You may also want to check out a visualization of the [Talos Hyperparameter Tuning workflow](https://github.com/autonomio/talos/wiki/Workflow).

### Install
<hr>

### 💾 Install

Stable version:

Expand All @@ -98,18 +104,34 @@ Daily development version:

#### `pip install git+https://github.com/autonomio/talos.git@daily-dev`

### Support
<hr>

### 💬 How to get Support

Check out [common errors](https://github.com/autonomio/talos/wiki/Troubleshooting) in the Wiki.
| I want to... | Go to... |
| -------------------------------- | ---------------------------------------------------------- |
| **...troubleshoot** | [Docs] · [Wiki] · [GitHub Issue Tracker] |
| **...report a bug** | [GitHub Issue Tracker] |
| **...suggest a new feature** | [GitHub Issue Tracker] |
| **...get support** | [Stack Overflow] · [Spectrum Chat] |
| **...have a discussion** | [Spectrum Chat] |

[github issue tracker]: https://github.com/automio/talos/issues
[docs]: https://autonomio.github.io/docs_talos
[wiki]: https://github.com/autonomio/talos/wiki
[stack overflow]: https://stackoverflow.com/questions/tagged/talos
[spectrum chat]: https://spectrum.chat/talos

Check the [Docs](https://autonomio.github.io/docs_talos) which is generally keeping up with Master (and pip package).
<hr>

If you want ask a **"how can I use Talos to..."** question, the right place is [StackOverflow](https://stackoverflow.com/questions/ask).
### 📢 Citations

If you found a bug or want to suggest a feature, check the [issues](https://github.com/autonomio/talos/issues) or [create](https://github.com/autonomio/talos/issues/new/choose) a new issue.
If you use Talos for published work, please cite:

`Autonomio Talos [Computer software]. (2019). Retrieved from http://github.com/autonomio/talos.`

<hr>

### License
### 📃 License

[MIT License](https://github.com/autonomio/talos/blob/master/LICENSE)
2 changes: 1 addition & 1 deletion examples/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from keras.models import Sequential
from keras.layers import Dropout, Dense
from ..model.normalizers import lr_normalizer
from ..model.layers import hidden_layers
from ..model.hidden_layers import hidden_layers
from ..metrics.keras_metrics import fmeasure


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wrangle
pandas
numpy
keras
Expand All @@ -6,5 +7,4 @@ tqdm
sklearn
chances
kerasplotlib
wrangle
requests
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
URL = 'http://autonom.io'
LICENSE = 'MIT'
DOWNLOAD_URL = 'https://github.com/autonomio/talos/'
VERSION = '0.5.0'
VERSION = '0.6.0'

try:
from setuptools import setup
_has_setuptools = True
except ImportError:
from distutils.core import setup

install_requires = ['numpy',
install_requires = ['wrangle',
'numpy',
'pandas',
'keras',
'astetik',
'sklearn',
'tqdm',
'chances',
'kerasplotlib',
'wrangle',
'requests']


Expand All @@ -52,13 +52,14 @@
install_requires=install_requires,
packages=['talos',
'talos.scan',
'talos.examples',
'talos.templates',
'talos.utils',
'talos.model',
'talos.parameters',
'talos.reducers',
'talos.metrics',
'talos.commands'],
'talos.commands',
'talos.logging'],

classifiers=['Intended Audience :: Science/Research',
'Programming Language :: Python :: 2.7',
Expand Down
16 changes: 4 additions & 12 deletions talos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@
from .commands.params import Params
from .commands.kerasmodel import KerasModel
from . import utils
from . import examples as templates
from . import templates

# the purpose of everything below is to keep the namespace completely clean

del_from_utils = ['best_model', 'connection_check', 'detector',
'exceptions', 'last_neuron', 'load_model', 'validation_split',
'pred_class', 'results', 'string_cols_to_numeric']

for key in del_from_utils:
if key.startswith('__') is False:
delattr(utils, key)

template_sub = [templates.datasets,
templates.models,
templates.params,
Expand All @@ -35,7 +27,7 @@
if key not in keep_from_templates:
delattr(sub, key)

del commands, parameters, scan, reducers, model, metrics, key, del_from_utils
del examples, sub, keep_from_templates, template_sub
del commands, scan, model, metrics, key
del sub, keep_from_templates, template_sub

__version__ = "0.5.0"
__version__ = "0.6.0"
3 changes: 0 additions & 3 deletions talos/commands/autom8.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from ..scan.Scan import Scan


def Autom8(scan_object,
x_val,
y_val,
Expand Down
28 changes: 18 additions & 10 deletions talos/commands/deploy.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import os
import pandas as pd
import shutil
import numpy as np

from ..utils.best_model import best_model, activate_model


class Deploy:

'''Functionality for deploying a model to a filename'''
Expand All @@ -32,13 +24,17 @@ def __init__(self, scan_object, model_name, metric='val_acc', asc=False):
'''

import os

self.scan_object = scan_object
os.mkdir(model_name)
self.path = model_name + '/' + model_name
self.model_name = model_name
self.metric = metric
self.asc = asc
self.data = scan_object.data

from ..utils.best_model import best_model, activate_model
self.best_model = best_model(scan_object, metric, asc)
self.model = activate_model(scan_object, self.best_model)

Expand Down Expand Up @@ -71,8 +67,16 @@ def save_details(self):

def save_data(self):

x = pd.DataFrame(self.scan_object.x[:100])
y = pd.DataFrame(self.scan_object.y[:100])
import pandas as pd

try:
x = pd.DataFrame(self.scan_object.x[:100])
y = pd.DataFrame(self.scan_object.y[:100])

except ValueError:
t.x = np.zeros(500)
t.y = np.zeros(500)
print("data is not 2d, dummy data written instead.")

x.to_csv(self.path + '_x.csv', header=None, index=None)
y.to_csv(self.path + '_y.csv', header=None, index=None)
Expand All @@ -83,6 +87,8 @@ def save_results(self):

def save_params(self):

import numpy as np

np.save(self.path + '_params', self.scan_object.params)

def save_readme(self):
Expand All @@ -95,5 +101,7 @@ def save_readme(self):

def package(self):

import shutil

shutil.make_archive(self.model_name, 'zip', self.model_name)
shutil.rmtree(self.model_name)
27 changes: 13 additions & 14 deletions talos/commands/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
from sklearn.metrics import mean_absolute_error, f1_score
from numpy import mean, std

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


class Evaluate:

'''Class for evaluating models based on the Scan() object'''
Expand Down Expand Up @@ -58,12 +51,18 @@ def evaluate(self, x, y,
'''

import numpy as np
import sklearn as sk

out = []
if model_id is None:
from ..utils.best_model import best_model
model_id = best_model(self.scan_object, metric, asc)

from ..utils.best_model import activate_model
model = activate_model(self.scan_object, model_id)

from ..utils.validation_split import kfold
kx, ky = kfold(x, y, folds, shuffle)

for i in range(folds):
Expand All @@ -72,25 +71,25 @@ def evaluate(self, x, y,

if mode == 'binary':
y_pred = y_pred >= .5
scores = f1_score(y_pred, ky[i], average='binary')
scores = sk.metrics.f1_score(y_pred, ky[i], average='binary')

elif mode == 'multi_class':
y_pred = y_pred.argmax(axis=-1)
scores = f1_score(y_pred, ky[i], average='macro')
scores = sk.metrics.f1_score(y_pred, ky[i], average='macro')

if mode == 'multi_label':
y_pred = model.predict(kx[i]).argmax(axis=1)
scores = f1_score(y_pred,
ky[i].argmax(axis=1),
average='macro')
scores = sk.metrics.f1_score(y_pred,
ky[i].argmax(axis=1),
average='macro')

elif mode == 'regression':
y_pred = model.predict(kx[i])
scores = mean_absolute_error(y_pred, ky[i])
scores = sk.metrics.mean_absolute_error(y_pred, ky[i])

out.append(scores)

if print_out is True:
print("mean : %.2f \n std : %.2f" % (mean(out), std(out)))
print("mean : %.2f \n std : %.2f" % (np.mean(out), np.std(out)))

return out
Loading

0 comments on commit 8f38a4a

Please sign in to comment.