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: - data : string
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.
- inputs : string or list-of-strings, optional
Specifies the input variables to use in the analysis.
- target : string or list-of-strings, optional
Specifies the target sequence variables to use in the analysis.
- data_specs : DataSpec, optional
Specifies the parameters for the multiple input cases.
- mini_batch_size : int, 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_epochs : int, 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_level : int, 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.
- lr : double, optional
Specifies the learning rate.
- optimizer : Optimizer, optional
Specifies the parameters for the optimizer.
- nominals : string or list-of-strings, optional
Specifies the nominal input variables to use in the analysis.
- texts : string or list-of-strings, optional
Specifies the character variables to treat as raw text. These variables must be specified in the inputs parameter.
- target_sequence : string or list-of-strings, optional
Specifies the target sequence variables to use in the analysis.
- sequence : Sequence, optional
Specifies the settings for sequence data.
- text_parms : TextParms, optional
Specifies the parameters for the text inputs.
- valid_table : string 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_freq : int, optional
Specifies the frequency for scoring the validation table.
- gpu : Gpu, 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.
- attributes : string or list-of-strings, optional
Specifies temporary attributes, such as a format, to apply to input variables.
- weight : string, optional
Specifies the variable/column name in the input table containing the prior weights for the observation.
- seed : double, 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_seed : double, 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.
- missing : string, optional
Specifies the policy for replacing missing values with imputed values.
Valid Values: MAX, MIN, MEAN, NONE
Default: MEAN- target_missing : string, optional
Specifies the policy for replacing target missing values with imputed values.
Valid Values: MAX, MIN, MEAN, NONE
Default: MEAN- repeat_weight_table : bool, optional
Replicates the entire weight table on each worker node when saving weights.
Default: False- force_equal_padding : bool, 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_weights : bool, optional
When set to True, it keeps the weights that provide the smallest loss error.
- n_threads : int, 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_order : string, 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_scratch : bool, optional
When set to True, it ignores the existing weights and trains the model from the scracth.
Returns: - CASResults