dlpy.model.Model.fit

Model.fit(data, inputs=None, target=None, data_specs=None, mini_batch_size=1, max_epochs=5, log_level=3, lr=0.01, optimizer=None, nominals=None, texts=None, target_sequence=None, sequence=None, text_parms=None, valid_table=None, valid_freq=1, gpu=None, attributes=None, weight=None, seed=0, record_seed=0, missing='mean', target_missing='mean', repeat_weight_table=False, force_equal_padding=None, save_best_weights=False, n_threads=None, target_order='ascending', train_from_scratch=None)

Fitting a deep learning model.

Note that this function surfaces several parameters from other parameters. For example, while learning rate is a parameter of Solver (that is a parameter of Optimizer), it is leveled up so that our users can easily set learning rate without changing the default optimizer and solver. If a non-default solver or optimizer is passed, then these leveled-up parameters will be ignored - even they are set - and the ones coming from the custom solver and custom optimizer will be used. In addition to learning_rate (lr), max_epochs and log_level are another examples of such parameters.

Parameters
datastring

This is the input data. It might be a string that is the name of a cas table. Alternatively, this might be a cas table.

inputsstring or list-of-strings, optional

Specifies the input variables to use in the analysis.

targetstring or list-of-strings, optional

Specifies the target sequence variables to use in the analysis.

data_specsDataSpec, optional

Specifies the parameters for the multiple input cases.

mini_batch_sizeint, optional

Specifies the number of observations per thread in a mini-batch. You can use this parameter to control the number of observations that the action uses on each worker for each thread to compute the gradient prior to updating the weights. Larger values use more memory. When synchronous SGD is used (the default), the total mini-batch size is equal to miniBatchSize * number of threads * number of workers. When asynchronous SGD is used (by specifying the elasticSyncFreq parameter), each worker trains its own local model. In this case, the total mini-batch size for each worker is miniBatchSize * number of threads.

max_epochsint, optional

specifies the maximum number of epochs. For SGD with a single-machine server or a session that uses one worker on a distributed server, one epoch is reached when the action passes through the data one time. For a session that uses more than one worker, one epoch is reached when all the workers exchange the weights with the controller one time. The syncFreq parameter specifies the number of times each worker passes through the data before exchanging weights with the controller. For L-BFGS with full batch, each L-BFGS iteration might process more than one epoch, and final number of epochs might exceed the maximum number of epochs.

log_levelint, optional

Specifies how progress messages are sent to the client. The default value, 0, indicates that no messages are sent. Specify 1 to receive start and end messages. Specify 2 to include the iteration history.

lrdouble, optional

Specifies the learning rate.

optimizerOptimizer, optional

Specifies the parameters for the optimizer.

nominalsstring or list-of-strings, optional

Specifies the nominal input variables to use in the analysis.

textsstring or list-of-strings, optional

Specifies the character variables to treat as raw text. These variables must be specified in the inputs parameter.

target_sequencestring or list-of-strings, optional

Specifies the target sequence variables to use in the analysis.

sequenceSequence, optional

Specifies the settings for sequence data.

text_parmsTextParms, optional

Specifies the parameters for the text inputs.

valid_tablestring or CASTable, optional

Specifies the table with the validation data. The validation table must have the same columns and data types as the training table.

valid_freqint, optional

Specifies the frequency for scoring the validation table.

gpuGpu, optional

When specified, the action uses graphical processing unit hardware. The simplest way to use GPU processing is to specify “gpu=1”. In this case, the default values of other GPU parameters are used. Setting gpu=1 enables all available GPU devices for use. Setting gpu=0 disables GPU processing.

attributesstring or list-of-strings, optional

Specifies temporary attributes, such as a format, to apply to input variables.

weightstring, optional

Specifies the variable/column name in the input table containing the prior weights for the observation.

seeddouble, optional

specifies the random number seed for the random number generator in SGD. The default value, 0, and negative values indicate to use random number streams based on the computer clock. Specify a value that is greater than 0 for a reproducible random number sequence.

record_seeddouble, optional

specifies the random number seed for the random record selection within a worker. The default value 0 disables random record selection. Records are read as they are laid out in memory. Negative values indicate to use random number streams based on the computer clock.

missingstring, optional

Specifies the policy for replacing missing values with imputed values. Valid Values: MAX, MIN, MEAN, NONE Default: MEAN

target_missingstring, optional

Specifies the policy for replacing target missing values with imputed values. Valid Values: MAX, MIN, MEAN, NONE Default: MEAN

repeat_weight_tablebool, optional

Replicates the entire weight table on each worker node when saving weights. Default: False

force_equal_paddingbool, optional

For convolution or pooling layers, this setting forces left padding to equal right padding, and top padding to equal bottom padding. This setting might result in an output image that is larger than the input image. Default: False

save_best_weightsbool, optional

When set to True, it keeps the weights that provide the smallest loss error.

n_threadsint, optional

Specifies the number of threads to use. If nothing is set then all of the cores available in the machine(s) will be used.

target_orderstring, optional

Specifies the order of the labels. It can follow the natural order of the labels or order them in the order they are recieved with training data samples. Valid Values: ‘ascending’, ‘descending’, ‘hash’ Default: ‘ascending’

train_from_scratchbool, optional

When set to True, it ignores the existing weights and trains the model from the scracth.

Returns
CASResults