dlpy.embedding_model.EmbeddingModel.fit_embedding_model

EmbeddingModel.fit_embedding_model(optimizer, data=None, path=None, n_samples=512, label_level=- 2, resize_width=None, resize_height=None, max_iter=1, valid_table=None, valid_freq=1, gpu=None, seed=0, record_seed=0, save_best_weights=False, n_threads=None, train_from_scratch=None)

Fitting a deep learning model for embedding learning.

Parameters
optimizerOptimizer

Specifies the parameters for the optimizer.

dataclass:ImageEmbeddingTable, optional

This is the input data. It muse be a ImageEmbeddingTable object. Either data or path has to be specified.

pathstring, optional

The path to the image directory on the server. Path may be absolute, or relative to the current caslib root. when path is specified, the data option will be ignored. A new sample of data will be randomly generated after the number of epochs defined in Optimizer. max_iter defines how many iterations the random sample will be generated.

n_samplesint, optional

Number of samples to generate. Default: 512

label_levelint, optional

Specifies which path level should be used to generate the class labels for each image. This class label determines whether a given image pair belongs to the same class. For instance, label_level = 1 means the first directory and label_level = -2 means the last directory. This internally use the SAS scan function (check https://www.sascrunch.com/scan-function.html for more details). Default: -2

resize_widthint, optional

Specifies the image width that needs be resized to. When resize_width is not given, it will be reset to the specified resize_height.

resize_heightint, optional

Specifies the image height that needs be resized to. When resize_height is not given, it will be reset to the specified resize_width.

max_iterint, optional

Hard limit on iterations when randomly generating data. Default: 1

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.

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.

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.

train_from_scratchbool, optional

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

Returns
CASResults or a list of CASResults when the path option is specified