Model wrappers

Version: 9.1

In the context of the Cortex Processing Engine, a model wrapper is an implementation of Sitecore.Processing.Engine.ML.Abstractions.IModel. A model wrapper is passed in as part of the worker options dictionary when you register a task and defines the following:

  • Model training logic (TrainAsync()) for a specific model.

  • Model evaluation logic (EvaluateAsync()) for a specific model.

  • Projection logic (Projection) that defines the structure

Different workers use different parts of the same model, and some workers - such as the merge worker - do not require a model wrapper at all. For example, in the model training task chain:

  • The projection worker uses the projection logic - for example, to project xConnect data into a format that can be used in a machine learning context.

  • The merger worker does not use the model wrapper.

  • The training worker executes model training logic.

Note

If you want to use projection in a context other than machine learning, you still need to create an implementation of IModel. If you do not require model training and evaluation, you can return empty results.

Model wrappers and trained models

There is no direct relationship between a class that implements IModel and a trained machine learning model. An IModel does not contain a reference to the location of the trained model in blob storage.

The relationship between a model wrapper and a trained model is limited to custom logic in the TrainAsync() and EvaluateAsync() methods of the model wrapper.

For example, if you are using the Microsoft Machine Learning Server (MMLS) integration, your model implementation will include references to the training and evaluation R scripts that are sent to MMLS. These scripts include the location and name of the model in blob storage.

Do you have some feedback for us?

If you have suggestions for improving this article,