Train the Model

Prerequisites

Before training a model, make sure you have formed a data layout and imported your data through our batch loading API. For more infomation, please see:

Configuring a model

Once you have your data imported, you can move on to configuring and training your recommender model.

Model training is initiated via an API call to the /recommender/train endpoint. This endpoint has several parameters to customize your model.

ParameterDescription

model_id

An optional unique ID for this model. If this model_id has been used before, then this trained model will replace the previous model.

maximum_interaction_age_days

An optional integer value, specifying the maximum age of an interaction, in days. For example, if you specify 90, then interactions older than 90 days will be ignored by the model. Interactions that do not have a timestamp associated with them will always be included.

data_tags

An optional list of data tags to include when training your model. This can be used to filter which data is used, allowing different models to be trained on different datasets.

data_filters

An optional set of filters to act on both entities and interactions to only include a subset.

callback_url

A URL to trigger when the training is complete. This can be used to notify your site or app when the model is ready.

Note that the data_filters are currently in beta and may not yet be fully functional.

Training the model

Training typically takes several minutes to hours, depending on the size of your dataset. To see the size of your dataset before training, please refer to the section on querying batch metadata.

When you initiate a training request via the train/ endpoint, you will be returned status information. While the model is training, you can also query the status/ endpoint to check on progress.

NameDescription

model_id

The unique model identifier assigned to this model when training was initiated.

start_timestamp

The timestamp for when training started.

end_timestamp

The timestamp for when training completed.

status

The status: will be running, completed, or error

message

Any error messages associated with the run if something goes wrong.

progress

An estimate of the progress, ranging from 0-100.

data_batch_ids

A list of the data batch_id values used for training this model.

Lucid recommends that you use the callback_url to set a webhook for when the training is completed. This allows immediate notification without needing to repeatedly query the training status.

Last updated