SamplingCandidateItemsStrategy ClassNReco.Recommender Class Library

Returns all items that have not been rated by the user (3) and that were preferred by another user (2) that has preferred at least one item (1) that the current user has preferred too.

This strategy uses sampling to limit the number of items that are considered, by sampling three different things, noted above:

  1. The items that the user has preferred
  2. The users who also prefer each of those items
  3. The items those users also prefer

There is a maximum associated with each of these three things; if the number of items or users exceeds that max, it is sampled so that the expected number of items or users actually used in that part of the computation is equal to the max.

Three arguments control these three maxima. Each is a "factor" f, which establishes the max at f * log2(n), where n is the number of users or items in the data. For example if factor #2 is 5, which controls the number of users sampled per item, then 5 * log2(# users) is the maximum for this part of the computation.

Each can be set to not do any limiting with value NO_LIMIT_FACTOR.

Inheritance Hierarchy

System Object
  NReco.CF.Taste.Impl.Recommender AbstractCandidateItemsStrategy
    NReco.CF.Taste.Impl.Recommender SamplingCandidateItemsStrategy

Namespace: NReco.CF.Taste.Impl.Recommender
Assembly: NReco.Recommender (in NReco.Recommender.dll) Version: (

public class SamplingCandidateItemsStrategy : AbstractCandidateItemsStrategy

The SamplingCandidateItemsStrategy type exposes the following members.


Public methodSamplingCandidateItemsStrategy(Int32, Int32)
Initializes a new instance of the SamplingCandidateItemsStrategy class
Public methodSamplingCandidateItemsStrategy(Int32, Int32, Int32, Int32, Int32)
Initializes a new instance of the SamplingCandidateItemsStrategy class

Protected methoddoGetCandidateItems (Overrides AbstractCandidateItemsStrategy doGetCandidateItems( Int64 , IDataModel).)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetCandidateItems( Int64 , IDataModel) (Inherited from AbstractCandidateItemsStrategy.)
Public methodGetCandidateItems(Int64, IPreferenceArray, IDataModel) (Inherited from AbstractCandidateItemsStrategy.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRefresh (Inherited from AbstractCandidateItemsStrategy.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

Public fieldStatic memberDEFAULT_FACTOR
Public fieldStatic memberNO_LIMIT_FACTOR
See Also