Search Results for

    Show / Hide Table of Contents

    Class TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>

    Represents the data splitting mapping that can be wrapped around any other recommender mapping to split the underlying data into the training and test parts.

    Inheritance
    Object
    TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>
    TrainTestSplittingRatingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TRating, TFeatureSource, TFeatureValues>
    Implements
    IRecommenderMapping<SplitInstanceSource<TInstanceSource>, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Learners.Mappings
    Assembly: Microsoft.ML.Probabilistic.Learners.Recommender.dll
    Syntax
    public class TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> : IRecommenderMapping<SplitInstanceSource<TInstanceSource>, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>
    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.

    Remarks

    1. The requested fraction of items is removed from the consideration (thus, ignored) with all the associated observations.
    2. The requested fraction of items is put into the test set (so called cold items) with all the associated observations.
    3. The requested fraction of the users remaining after (1-2) is removed from consideration (thus, ignored) with all the associated observations.
    4. The requested fraction of the users remaining after (1-2) is put into the test set (so called cold users) with all the associated observations.
    5. The requested fraction of the users remaining after (1-2) is put into the training set with all the associated observations.
    6. For each user remaining after (1-5) the requested fraction of observations is put into the training set, while the rest is put into the test set. At least one observation is always put into the training set for each user.
    7. If requested, instances associated with the occasionally produced cold items are removed from the test set. An item is said to be "occasionally cold" if it is covered only by the test set but wasn't explicitly chosen as cold. Such items can be produced by the steps (4) and (6). This option is supposed to be used when the requested number of cold users and items is set to zero, in order to ensure that all the entities in the test set are covered by the training set.

    Constructors

    TrainTestSplittingRecommenderMapping(IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>, Double, Double, Double, Double, Double, Double, Boolean)

    Initializes a new instance of the TrainTestSplittingRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues> class.

    Declaration
    public TrainTestSplittingRecommenderMapping(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 wrapped recommender 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.

    Methods

    GetInstances(SplitInstanceSource<TInstanceSource>)

    Retrieves a list of instances from a given instance source. Dependent on IsTrainingSet, the instances of the training or test set are returned.

    Declaration
    public IEnumerable<TInstance> GetInstances(SplitInstanceSource<TInstanceSource> instanceSource)
    Parameters
    Type Name Description
    SplitInstanceSource<TInstanceSource> instanceSource

    The source to retrieve instances from.

    Returns
    Type Description
    IEnumerable<TInstance>

    The list of retrieved instances.

    GetItem(SplitInstanceSource<TInstanceSource>, TInstance)

    Extracts an item from a given instance by delegating the call to the wrapped mapping.

    Declaration
    public TItem GetItem(SplitInstanceSource<TInstanceSource> instanceSource, TInstance instance)
    Parameters
    Type Name Description
    SplitInstanceSource<TInstanceSource> instanceSource

    The source of instances providing the instance.

    TInstance instance

    The instance to extract the item from.

    Returns
    Type Description
    TItem

    The extracted item.

    GetItemFeatures(TFeatureSource, TItem)

    Provides the features for a given item by delegating the call to the wrapped mapping.

    Declaration
    public TFeatureValues GetItemFeatures(TFeatureSource featureSource, TItem item)
    Parameters
    Type Name Description
    TFeatureSource featureSource

    The source of the features.

    TItem item

    The item to provide the features for.

    Returns
    Type Description
    TFeatureValues

    The features for item.

    GetUser(SplitInstanceSource<TInstanceSource>, TInstance)

    Extracts a user from a given instance by delegating the call to the wrapped mapping.

    Declaration
    public TUser GetUser(SplitInstanceSource<TInstanceSource> instanceSource, TInstance instance)
    Parameters
    Type Name Description
    SplitInstanceSource<TInstanceSource> instanceSource

    The source of instances providing the instance.

    TInstance instance

    The instance to extract the user from.

    Returns
    Type Description
    TUser

    The extracted user.

    GetUserFeatures(TFeatureSource, TUser)

    Provides the features for a given user by delegating the call to the wrapped mapping.

    Declaration
    public TFeatureValues GetUserFeatures(TFeatureSource featureSource, TUser user)
    Parameters
    Type Name Description
    TFeatureSource featureSource

    The source of the features.

    TUser user

    The user to provide the features for.

    Returns
    Type Description
    TFeatureValues

    The features for user.

    Implements

    IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>

    Extension Methods

    RecommenderMappingExtensions.SplitToTrainTest<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>, Double, Double, Double, Double, Double, Double, Boolean)
    RecommenderMappingExtensions.WithGeneratedNegativeData<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>(IRecommenderMapping<TInstanceSource, TInstance, TUser, TItem, TFeatureSource, TFeatureValues>, Double)
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.