Skip to main content

Learners : Matchbox recommender : Learner API

Setting up a recommender

Once you have an instance of a data mapping, creating a recommender is as easy as calling one factory method: MatchboxRecommender.Create. This method has two overloads which take either a native data format mapping (an implementation of IMatchboxRecommenderMapping) or a standard data format mapping (an implementation of IStarRatingRecommenderMapping). Both creation routines are very lightweight - no data access or computations is performed at this stage. The return type of the factory is IMatchboxRecommender, which provides concrete settings and means to perform training and prediction.

var dataMapping = new  DataMapping();  
var recommender = MatchboxRecommender.Create(dataMapping);

The settings are obtained through the Settings property of the newly instantiated recommender. They can refer either to the training algorithm, or the prediction one.

Training settings

Prediction settings

SetPredictionLossFunction sets the loss function to be used during rating prediction for a given user-item pair when converting a probability distribution over the ratings into a point estimate. There are four options here.