Class RecommenderMappingExtensions
Extension methods to simplify mapping chaining syntax.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
Assembly: Microsoft.ML.Probabilistic.Learners.Recommender.dll
Syntax
public static class RecommenderMappingExtensions
Methods
ForEvaluation<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>)
Chains a given recommender mapping with an evaluator mapping, making it possible to evaluate a recommender on the mapped data.
Declaration
public static RecommenderEvaluatorMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> ForEvaluation<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(this IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> mapping)
Parameters
Type | Name | Description |
---|---|---|
IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | mapping | The recommender mapping to chain with the evaluator mapping. |
Returns
Type | Description |
---|---|
RecommenderEvaluatorMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | The evaluator mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TRating | The type of a rating. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |
ForEvaluation<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>)
Chains a given recommender mapping with an evaluator mapping, making it possible to evaluate a recommender on the mapped data.
Declaration
public static StarRatingRecommenderEvaluatorMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> ForEvaluation<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(this IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> mapping)
Parameters
Type | Name | Description |
---|---|---|
IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | mapping | The recommender mapping to chain with the evaluator mapping. |
Returns
Type | Description |
---|---|
StarRatingRecommenderEvaluatorMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | The evaluator mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TRating | The type of a rating. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |
SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>, Double, Double, Double, Double, Double, Double, Boolean)
Chains a given recommender mapping with a splitting mapping, which splits the mapped data into training and test parts.
Declaration
public static TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(this IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> mapping, double trainingOnlyUserFraction, double testUserRatingTrainingFraction, double coldUserFraction = 0, double coldItemFraction = 0, double ignoredUserFraction = 0, double ignoredItemFraction = 0, bool removeOccasionalColdItems = false)
Parameters
Type | Name | Description |
---|---|---|
IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> | mapping | The recommender mapping to chain with the splitting mapping. |
Double | trainingOnlyUserFraction | The fraction of users included in the training set only. |
Double | testUserRatingTrainingFraction | The fraction of ratings in the training set for each user who is presented in both sets. |
Double | coldUserFraction | The fraction of users included in the test set only. |
Double | coldItemFraction | The fraction of items included in the test set only. |
Double | ignoredUserFraction | The fraction of users not included in either the training or the test set. |
Double | ignoredItemFraction | The fraction of items not included in either the training or the test set. |
Boolean | removeOccasionalColdItems | Whether the occasionally produced cold items should be removed from the test set. |
Returns
Type | Description |
---|---|
TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> | The train/test splitting mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |
SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>, Double, Double, Double, Double, Double, Double, Boolean)
Chains a given recommender mapping with a splitting mapping, which splits the mapped data into training and test parts.
Declaration
public static TrainTestSplittingRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(this IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> mapping, double trainingOnlyUserFraction, double testUserRatingTrainingFraction, double coldUserFraction = 0, double coldItemFraction = 0, double ignoredUserFraction = 0, double ignoredItemFraction = 0, bool removeOccasionalColdItems = false)
Parameters
Type | Name | Description |
---|---|---|
IRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | mapping | The recommender mapping to chain with the splitting mapping. |
Double | trainingOnlyUserFraction | The fraction of users included in the training set only. |
Double | testUserRatingTrainingFraction | The fraction of ratings in the training set for each user who is presented in both sets. |
Double | coldUserFraction | The fraction of users included in the test set only. |
Double | coldItemFraction | The fraction of items included in the test set only. |
Double | ignoredUserFraction | The fraction of users not included in either the training or the test set. |
Double | ignoredItemFraction | The fraction of items not included in either the training or the test set. |
Boolean | removeOccasionalColdItems | Whether the occasionally produced cold items should be removed from the test set. |
Returns
Type | Description |
---|---|
TrainTestSplittingRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | The train/test splitting mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TRating | The type of a rating. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |
SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>, Double, Double, Double, Double, Double, Double, Boolean)
Chains a given recommender mapping with a splitting mapping, which splits the mapped data into training and test parts.
Declaration
public static TrainTestSplittingStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>(this IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> mapping, double trainingOnlyUserFraction, double testUserRatingTrainingFraction, double coldUserFraction = 0, double coldItemFraction = 0, double ignoredUserFraction = 0, double ignoredItemFraction = 0, bool removeOccasionalColdItems = false)
Parameters
Type | Name | Description |
---|---|---|
IStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | mapping | The recommender mapping to chain with the splitting mapping. |
Double | trainingOnlyUserFraction | The fraction of users included in the training set only. |
Double | testUserRatingTrainingFraction | The fraction of ratings in the training set for each user who is presented in both sets. |
Double | coldUserFraction | The fraction of users included in the test set only. |
Double | coldItemFraction | The fraction of items included in the test set only. |
Double | ignoredUserFraction | The fraction of users not included in either the training or the test set. |
Double | ignoredItemFraction | The fraction of items not included in either the training or the test set. |
Boolean | removeOccasionalColdItems | Whether the occasionally produced cold items should be removed from the test set. |
Returns
Type | Description |
---|---|
TrainTestSplittingStarRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues> | The train/test splitting mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TRating | The type of a rating. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |
WithGeneratedNegativeData<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>, Double)
Chains a given recommender mapping with a mapping that augments the mapped data with negative examples, while treating all instances provided by the original mapping as positive.
Declaration
public static NegativeDataGeneratorMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> WithGeneratedNegativeData<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(this IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> mapping, double itemHistogramAdjustment = 1.2)
Parameters
Type | Name | Description |
---|---|---|
IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> | mapping | The mapping to chain with the negative data generator mapping. |
Double | itemHistogramAdjustment | The degree to which each element of the item histogram is raised before sampling. Should be different from 1.0 if it is believed that there is some quality bar which drives popular items to be more generally liked. |
Returns
Type | Description |
---|---|
NegativeDataGeneratorMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> | The negative data generator mapping. |
Type Parameters
Name | Description |
---|---|
TInstanceSource | The type of a source of instances. |
TInstance | The type of an instance. |
TUser | The type of a user. |
TItem | The type of an item. |
TFeatureSource | The type of a feature source. |
TFeatureValues | The type of the feature values. |