Skip to content

Commit

Permalink
remove Nadam from automl
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkokotila committed Apr 21, 2024
1 parent d5463f3 commit f190198
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion docs/Examples_PyTorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ return net, net.parameters()

```python
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['logcosh'],
'hidden_layers':[0, 1, 2],
'batch_size': (20, 50, 5),
Expand Down
2 changes: 1 addition & 1 deletion docs/Examples_PyTorch_Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def breast_cancer(x_train, y_train, x_val, y_val, params):


p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['logcosh'],
'hidden_layers':[0, 1, 2],
'batch_size': (20, 50, 5),
Expand Down
2 changes: 1 addition & 1 deletion docs/Examples_Typical.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ return out, model
### Parameter Dictionary
```python
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['logcosh'],
'hidden_layers':[0, 1, 2],
'batch_size': (20, 50, 5),
Expand Down
2 changes: 1 addition & 1 deletion docs/Examples_Typical_Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def iris_model(x_train, y_train, x_val, y_val, params):

# set the parameter space boundaries
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['categorical_crossentropy'],
'epochs': [100, 200],
'batch_size': [4, 6, 8]}
Expand Down
2 changes: 1 addition & 1 deletion docs/Hidden_Layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ When hidden layers are used, `dropout`, `shapes`, `hidden_layers`, and `first_ne
```python

p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['logcosh'],
'shapes': ['brick'], # <<< required
'first_neuron': [32, 64], # <<< required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
" 'epochs': [100],\n",
" 'dropout': [0],\n",
" 'kernel_initializer': ['uniform','normal'],\n",
" 'optimizer': ['Nadam', 'Adam'],\n",
" 'optimizer': ['Adagrad', 'Adam'],\n",
" 'losses': ['binary_crossentropy'],\n",
" 'activation':['relu', 'elu'],\n",
" 'last_activation': ['sigmoid']}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src='https://raw.githubusercontent.com/autonomio/hyperio/master/logo.png' width=250px>"
],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook is a compliment to the *Hyperparameter Optimization on Keras* article. "
],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overview\n",
"\n",
Expand All @@ -28,19 +29,20 @@
"3) Defining the Parameter Space Boundaries \n",
"\n",
"4) Running the Experiment"
],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. The Required Inputs and Data"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from tensorflow.keras.models import Sequential\n",
"from tensorflow.keras.layers import Dropout, Dense\n",
Expand All @@ -50,33 +52,33 @@
"import sys\n",
"sys.path.insert(0, '/Users/mikko/Documents/GitHub/talos')\n",
"import talos"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# then we load the dataset\n",
"x, y = talos.templates.datasets.breast_cancer()\n",
"\n",
"# and normalize every feature to mean 0, std 1\n",
"x = talos.utils.rescale_meanzero(x)"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Creating the Keras Model"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# first we have to make sure to input data and params into the function\n",
"def breast_cancer_model(x_train, y_train, x_val, y_val, params):\n",
Expand Down Expand Up @@ -106,20 +108,20 @@
" verbose=0)\n",
"\n",
" return history, model"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Defining the Parameter Space Boundary"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# then we can go ahead and set the parameter space\n",
"p = {'first_neuron':[9, 10, 11],\n",
Expand All @@ -128,24 +130,26 @@
" 'epochs': [100],\n",
" 'dropout': [0],\n",
" 'kernel_initializer': ['uniform','normal'],\n",
" 'optimizer': ['Nadam', 'Adam'],\n",
" 'optimizer': ['Adagrad', 'Adam'],\n",
" 'losses': ['binary_crossentropy'],\n",
" 'activation':['relu', 'elu'],\n",
" 'last_activation': ['sigmoid']}"
],
"outputs": [],
"metadata": {}
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. Starting the Experiment"
],
"metadata": {}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# and run the experiment\n",
"t = talos.Scan(x=x,\n",
Expand All @@ -155,11 +159,7 @@
" experiment_name='breast_cancer',\n",
" round_limit=50,\n",
" disable_progress_bar=True)"
],
"outputs": [],
"metadata": {
"collapsed": true
}
]
}
],
"metadata": {
Expand All @@ -183,4 +183,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"from tensorflow.keras.optimizers import Adam, Nadam\n",
"from tensorflow.keras.optimizers.legacy import Adam, Adagrad\n",
"from tensorflow.keras.activations import softmax\n",
"from tensorflow.keras.losses import categorical_crossentropy, logcosh\n",
"\n",
Expand All @@ -154,7 +154,7 @@
" 'batch_size': [2, 3, 4],\n",
" 'epochs': [200],\n",
" 'dropout': (0, 0.40, 10),\n",
" 'optimizer': [Adam, Nadam],\n",
" 'optimizer': [Adam, Adagrad],\n",
" 'loss': ['categorical_crossentropy'],\n",
" 'last_activation': ['softmax'],\n",
" 'weight_regulizer': [None]}"
Expand Down
Loading

0 comments on commit f190198

Please sign in to comment.