A quick walkthrough on running experiments as designed in this library.
from lemonpie.basics import *
from lemonpie.preprocessing.transform import *
from lemonpie.experiment import *
from fastai.imports import *
Note: This assumes you have run the previous ’quick walkthrough’ and have the 1K dataset setup and pre-processed.
labels = ['diabetes', 'stroke', 'alzheimers', 'coronary_heart', 'breast_cancer', 'epilepsy']
First, we create an experiment with minimal settings, default values will be used for the rest.
lstm_base = Experiment.create('lstm_base', 'baseline for LSTMs', PATH_1K, labels, 'Adagrad', 'LSTM')
Print out details of the experiment config
lstm_base
Run fit with mostly default settings
lstm_base.fit(10, verbosity=.5)
Load the saved experiment
lstm_base_reloaded = Experiment.load('lstm_base')
To resume training - load model from checkpoint, to restart training from scratch, don't load from checkpoint.
lstm_base_reloaded.fit(5, from_checkpoint=True)
Run predict on the test dataset
- this will do everything needed to load the test dataset first then run predict
lstm_base_reloaded.predict()
Create a CNN experiment with minimal settings, default for the rest.
cnn_base = Experiment.create('cnn_base', 'baseline for CNNs', PATH_1K, labels, 'Adagrad', 'CNN')
cnn_base
cnn_base.fit(10, verbosity=.35)
Run a few more epochs - so load model from checkpoint
cnn_base.fit(5, from_checkpoint=True)
cnn_base.predict()