yadll.model.save_model(model, file=None)[source]

Save the model to file with cPickle This function is used by the training function to save the model. Parameters ———- model : yadll.model.Model

model to be saved in file
file : string
file name

load (unpickle) a saved model


file : `string’

file name


a yadll.model.Model


>>> my_model = load_model('my_best_model.ym')
class yadll.model.Model(network=None, data=None, hyperparameters=None, name='model', updates=<function sgd>, objective=<function categorical_crossentropy_error>, evaluation_metric=<function categorical_accuracy>, file=None)[source]

The yadll.model.Model contains the data, the network, the hyperparameters, and the report. It pre-trains unsupervised layers, trains the network and save it to file.


network : yadll.network.Network

the network to be trained

data : yadll.data.Data

the training, validating and testing set

name : string

the name of the model

updates : yadll.updates()

an update function

file : string

name of the file to save the model. If omitted a name is generated with the model name + date + time of training

compile(*args, **kwargs)[source]

Compile theano functions of the model


compile_arg: `string` or `List` of `string`

value can be ‘train’, ‘validate’, ‘test’, ‘predict’ and ‘all’


build model from conf object or conf file

pretrain(*args, **kwargs)[source]

Pre-training of the unsupervised layers sequentially

Returns:update unsupervised layers weights

Save model as a conf object or conf file

train(*args, **kwargs)[source]

Training the network


unsupervised_training: `bool`, (default is True)

pre-training of the unsupervised layers if any

save_mode : {None, ‘end’, ‘each’}

None (default), model will not be saved unless name specified in the model definition. ‘end’, model will only be saved at the end of the training ‘each’, model will be saved each time the model is improved

early_stop : bool, (default is True)

early stopping when validation score is not improving

shuffle : bool, (default is True)

reshuffle the training set at each epoch. Batches will then be different from one epoch to another