This IDataModel decorator class is useful in a situation where you wish to recommend to a user that doesn't really exist yet in your actual IDataModel. For example maybe you wish to recommend DVDs to a user who has browsed a few titles on your DVD store site, but, the user is not yet registered.
This enables you to temporarily add a temporary user to an existing IDataModel in a way that recommenders can then produce recommendations anyway.
Inheritance Hierarchy
NReco.CF.Taste.Impl.Model PlusAnonymousUserDataModel
NReco.CF.Taste.Impl.Model PlusAnonymousConcurrentUserDataModel
Namespace: NReco.CF.Taste.Impl.Model
Assembly: NReco.Recommender (in NReco.Recommender.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
The PlusAnonymousUserDataModel type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| PlusAnonymousUserDataModel | Initializes a new instance of the PlusAnonymousUserDataModel class |
Methods
| Name | Description | |
|---|---|---|
| clearTempPrefs | ||
| Equals | (Inherited from Object.) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| getDelegate | ||
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetItemIDs | ||
| GetItemIDsFromUser | ||
| GetMaxPreference | ||
| GetMinPreference | ||
| GetNumItems | ||
| GetNumUsers | ||
| GetNumUsersWithPreferenceFor(Int64) | ||
| GetNumUsersWithPreferenceFor(Int64, Int64) | ||
| GetPreferencesForItem | ||
| GetPreferencesFromUser | ||
| GetPreferenceTime | ||
| GetPreferenceValue | ||
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| GetUserIDs | ||
| HasPreferenceValues | ||
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Refresh | ||
| RemovePreference | ||
| SetPreference | ||
| SetTempPrefs | ||
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
Fields
| Name | Description | |
|---|---|---|
| TEMP_USER_ID |
Examples
IDataModel realModel = ...; IDataModel plusModel = new PlusAnonymousUserDataModel(realModel); ... var similarity = new LogLikelihoodSimilarity(realModel); // not plusModel
But, you may continue to use
realModel
IRecommender recommender = ...; ... lock(...) { IPreferenceArray tempPrefs = ...; plusModel.SetTempPrefs(tempPrefs); recommender.Recommend(PlusAnonymousUserDataModel.TEMP_USER_ID, 10); plusModel.SetTempPrefs(null); }
See Also