Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to hatch #598

Merged
merged 18 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ the below items:
- [ ] Code is [PEP8](https://www.python.org/dev/peps/pep-0008/)
- [ ] I'm making the PR to `master`
- [ ] I've updated the versions based on [Semantic Versioning](https://semver.org/)
- [ ] `setup.py`
- [ ] `talos/__init__.py`
- [ ] `docs/index.html`
- [ ] `docs/_coverpage.md`
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 9
matrix:
python-version: [3.7, 3.8]
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest]

steps:
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Tests
run: |
export MPLBACKEND=agg
pip install tensorflow>=2.0
pip install tensorflow==2.14.1
pip install coveralls
coverage run --source=talos ./test-ci.py
- name: Coverage
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install hatch
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
hatch build
hatch publish --user __token__ --auth $PYPI_API_TOKEN

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ talos.egg-info
*.npy
test.sh
.vscode
.test_*
test_*/
test/
4 changes: 2 additions & 2 deletions docs/Examples_Generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ return out, model
### Parameter Dictionary
```python
p = {'activation':['relu', 'elu'],
'optimizer': ['AdaDelta'],
'losses': ['logcosh'],
'optimizer': ['Adam'],
'losses': ['LogCosh'],
'shapes': ['brick'],
'first_neuron': [32],
'dropout': [.2, .3],
Expand Down
4 changes: 2 additions & 2 deletions docs/Examples_Generator_Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def mnist_model(x_train, y_train, x_val, y_val, params):
return out, model

p = {'activation':['relu', 'elu'],
'optimizer': ['AdaDelta'],
'losses': ['logcosh'],
'optimizer': ['Adam'],
'losses': ['LogCosh'],
'shapes': ['brick'],
'first_neuron': [32],
'dropout': [.2, .3],
Expand Down
4 changes: 2 additions & 2 deletions docs/Examples_PyTorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ return net, net.parameters()

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


p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'losses': ['logcosh'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['LogCosh'],
'hidden_layers':[0, 1, 2],
'batch_size': (20, 50, 5),
'epochs': [10, 20]}
Expand Down
4 changes: 2 additions & 2 deletions docs/Examples_Typical.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ return out, model
### Parameter Dictionary
```python
p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'losses': ['logcosh'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['LogCosh'],
'hidden_layers':[0, 1, 2],
'batch_size': (20, 50, 5),
'epochs': [10, 20]}
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
4 changes: 2 additions & 2 deletions docs/Hidden_Layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ When hidden layers are used, `dropout`, `shapes`, `hidden_layers`, and `first_ne
```python

p = {'activation':['relu', 'elu'],
'optimizer': ['Nadam', 'Adam'],
'losses': ['logcosh'],
'optimizer': ['Adagrad', 'Adam'],
'losses': ['LogCosh'],
'shapes': ['brick'], # <<< required
'first_neuron': [32, 64], # <<< required
'hidden_layers':[0, 1, 2], # <<< required
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](_media/talos_logo_bg.png)

## v1.3.3
## v1.4

> Hyperparameter Experiments with Tensorflow, PyTorch and Keras
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="app"></div>
<script>
window.$docsify = {
name: 'Talos 1.3.3',
name: 'Talos 1.4',
repo: 'https://github.com/autonomio/talos',
coverpage: true,
loadSidebar: true,
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,16 +145,16 @@
"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",
"from tensorflow.keras.losses import categorical_crossentropy, LogCosh\n",
"\n",
"p = {'lr': (0.1, 10, 10),\n",
" 'first_neuron':[4, 8, 16, 32, 64, 128],\n",
" '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
Loading