jacobian

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit a69f7eb86e9dbc6811690ba4fdb515842b9d678e
parent f1eac97a35c5046541dfce774449dcbabc66abdf
Author: David Freifeld <freifeld.david@gmail.com>
Date:   Fri, 10 Jul 2020 16:16:12 -0700

Attempts to use wandb sweep

Diffstat:
Mexample.py | 47++++++++++++++++++++---------------------------
Asweep.yaml | 36++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/example.py b/example.py @@ -1,3 +1,6 @@ +import sys +sys.path.append("/Users/davidfreifeld/projects/Jacobian/") +print(sys.path) import mrbpnn import numpy as np import matplotlib.pyplot as plt @@ -5,39 +8,29 @@ import numpy import time import wandb -batch_sz = 10 -layers = 1 -epochs = 50 -lr = 0.0155 -bias_lr = 0.03 -neurons = 10 -l = 0.5 -ratio = 0.9 -layers_list = [] +data_split = 0.75 + +hyperparameter_defaults = dict(batch_size = 10, + hidden_layers = 1, + epochs = 50, + learning_rate = 0.0155, + bias_lr = 0.03, + activation = "lecun_tanh", + neurons = 10, + l = 0.5) + +wandb.init(project="jacobian", config=hyperparameter_defaults) +config = wandb.config init = time.time() -net = mrbpnn.Network("./data_banknote_authentication.txt", batch_sz, lr, bias_lr, l, ratio) +net = mrbpnn.Network("./data_banknote_authentication.txt", config.batch_size, config.learning_rate, config.bias_lr, config.l, data_split) net.add_layer(4, "linear") -layers_list.append(4) -for i in range(layers): - net.add_layer(neurons, "lecun_tanh") - layers_list.append(neurons) +for i in range(config.hidden_layers): + net.add_layer(config.neurons, config.activation) net.add_layer(1, "resig") -layers_list.append(1) net.initialize() -wandb.init(project="jacobian") -wandb.config.update({"epochs": epochs, - "batch_size": batch_sz, - "learning_rate": lr, - "bias_lr": bias_lr, - "hidden_layers": layers, - "activation":"lecun_tanh", - "neurons": neurons, - "lambda" : l, - "data_split":ratio}) - -for i in range(epochs): +for i in range(config.epochs): net.train() wandb.log({'accuracy': net.get_acc(), 'cost': net.get_cost(), 'val_accuracy': net.get_val_acc(), 'val_cost': net.get_val_cost()}) end = time.time() diff --git a/sweep.yaml b/sweep.yaml @@ -0,0 +1,36 @@ +program: example.py +method: bayes +metric: + name: val_cost + goal: minimize +parameters: + epochs: + distribution: int_uniform + min: 25 + max: 100 + batch_size: + distribution: int_uniform + min: 5 + max: 200 + hidden_layers: + distribution: int_uniform + min: 1 + max: 6 + bias_lr: + distribution: uniform + min: 0.0015 + max: 0.06 + neurons: + distribution: int_uniform + min: 2 + max: 40 + activation: + distribution: categorical + values: + - lecun_tanh + - relu + - sigmoid + learning_rate: + distribution: uniform + min: 0.001 + max: 0.5