MyMediaLite  3.10
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
Ratings Class Reference

Data structure for storing ratings More...

Inheritance diagram for Ratings:
DataSet IRatings IDataSet IDataSet CombinedRatings RatingsProxy StaticRatings TimedRatings StaticByteRatings TimedRatingsProxy

Public Member Functions

virtual void Add (int user_id, int item_id, byte rating)
 Add byte-valued rating to the collection
virtual void Add (int user_id, int item_id, float rating)
 Add float-valued rating to the collection
void Add (float item)
void Clear ()
bool Contains (float item)
void CopyTo (float[] array, int index)
virtual float Get (int user_id, int item_id, ICollection< int > indexes)
 Directly access rating by user and item
int GetIndex (int user_id, int item_id)
 Get index for a given user and item
int GetIndex (int user_id, int item_id, ICollection< int > indexes)
 Get index for given user and item
ISet< int > GetItems (IList< int > indices)
 Get all items that are referenced by a given list of indices
override void GetObjectData (SerializationInfo info, StreamingContext context)
ISet< int > GetUsers (IList< int > indices)
 Get all users that are referenced by a given list of indices
int IndexOf (float item)
virtual void InitScale ()
 Initialize the Scale property
void Insert (int index, float item)
 Ratings ()
 Default constructor
 Ratings (SerializationInfo info, StreamingContext context)
bool Remove (float item)
virtual void RemoveAt (int index)
override void RemoveItem (int item_id)
 Remove all events related to a given item
override void RemoveUser (int user_id)
 Remove all events related to a given user
virtual bool TryGet (int user_id, int item_id, out float rating)
 Try to retrieve a rating for a given user-item combination
virtual bool TryGet (int user_id, int item_id, ICollection< int > indexes, out float rating)
 Try to retrieve a rating for a given user-item combination
bool TryGetIndex (int user_id, int item_id, out int index)
 Try to get the index for given user and item
bool TryGetIndex (int user_id, int item_id, ICollection< int > indexes, out int index)
 Try to get the index for given user and item

Protected Member Functions

void UpdateCountsAndIndices (ISet< int > users, ISet< int > items)
 update user- and item-wise counts and indices

Protected Attributes

IList< IList< int > > by_item
 Indices organized by item
IList< IList< int > > by_user
 Indices organized by user
IList< int > count_by_item
 field for storing the count per item
IList< int > count_by_user
 field for storing the count per user
IList< float > Values

Properties

IList< int > AllItems [get]
IList< int > AllUsers [get]
float Average [get]
IList< IList< int > > ByItem [get]
IList< IList< int > > ByUser [get]
new int Count [get]
virtual int Count [get]
IList< int > CountByItem [get]
IList< int > CountByUser [get]
bool IsReadOnly [get]
IList< int > Items [get, set]
int MaxItemID [get, set]
int MaxUserID [get, set]
IList< int > RandomIndex [get]
RatingScale Scale [get, set]
virtual float this[int index] [get, set]
virtual float this[int user_id, int item_id] [get]
IList< int > Users [get, set]

Detailed Description

Data structure for storing ratings

Small memory overhead for added flexibility.

This data structure supports incremental updates.

Constructor & Destructor Documentation

Ratings ( )
inline

Default constructor

Member Function Documentation

virtual void Add ( int  user_id,
int  item_id,
byte  rating 
)
inlinevirtual

Add byte-valued rating to the collection

Parameters
user_idthe user ID
item_idthe item ID
ratingthe rating

Implements IRatings.

Reimplemented in StaticByteRatings.

virtual void Add ( int  user_id,
int  item_id,
float  rating 
)
inlinevirtual

Add float-valued rating to the collection

Parameters
user_idthe user ID
item_idthe item ID
ratingthe rating

Implements IRatings.

Reimplemented in StaticByteRatings, StaticRatings, and TimedRatings.

virtual float Get ( int  user_id,
int  item_id,
ICollection< int >  indexes 
)
inlinevirtual

Directly access rating by user and item

Parameters
user_idthe user ID
item_idthe item ID
indexesthe indexes to look at
Returns
the first rating encountered that matches the user ID and item ID

Implements IRatings.

Reimplemented in StaticByteRatings.

int GetIndex ( int  user_id,
int  item_id 
)
inlineinherited

Get index for a given user and item

Parameters
user_idthe user ID
item_idthe item ID
Returns
the index of the first event encountered that matches the user ID and item ID

Implements IDataSet.

int GetIndex ( int  user_id,
int  item_id,
ICollection< int >  indexes 
)
inlineinherited

Get index for given user and item

Parameters
user_idthe user ID
item_idthe item ID
indexesthe indexes to look at
Returns
the index of the first event encountered that matches the user ID and item ID

Implements IDataSet.

ISet<int> GetItems ( IList< int >  indices)
inlineinherited

Get all items that are referenced by a given list of indices

Parameters
indicesthe indices to take into account
Returns
all items referenced by the list of indices

Implements IDataSet.

ISet<int> GetUsers ( IList< int >  indices)
inlineinherited

Get all users that are referenced by a given list of indices

Parameters
indicesthe indices to take into account
Returns
all users referenced by the list of indices

Implements IDataSet.

virtual void InitScale ( )
inlinevirtual

Initialize the Scale property

Implements IRatings.

Reimplemented in StaticByteRatings.

override void RemoveItem ( int  item_id)
inlinevirtual

Remove all events related to a given item

Parameters
item_idthe item ID

Implements DataSet.

Reimplemented in StaticRatings, and RatingsProxy.

override void RemoveUser ( int  user_id)
inlinevirtual

Remove all events related to a given user

Parameters
user_idthe user ID

Implements DataSet.

Reimplemented in StaticRatings, and RatingsProxy.

virtual bool TryGet ( int  user_id,
int  item_id,
out float  rating 
)
inlinevirtual

Try to retrieve a rating for a given user-item combination

Parameters
user_idthe user ID
item_idthe item ID
ratingwill contain the first rating encountered that matches the user ID and item ID
Returns
true if a rating was found for the user and item

Implements IRatings.

Reimplemented in StaticByteRatings.

virtual bool TryGet ( int  user_id,
int  item_id,
ICollection< int >  indexes,
out float  rating 
)
inlinevirtual

Try to retrieve a rating for a given user-item combination

Parameters
user_idthe user ID
item_idthe item ID
indexesthe indexes to look at
ratingwill contain the first rating encountered that matches the user ID and item ID
Returns
true if a rating was found for the user and item

Implements IRatings.

Reimplemented in StaticByteRatings.

bool TryGetIndex ( int  user_id,
int  item_id,
out int  index 
)
inlineinherited

Try to get the index for given user and item

Parameters
user_idthe user ID
item_idthe item ID
indexwill contain the index of the first event encountered that matches the user ID and item ID
Returns
true if an index was found for the user and item

Implements IDataSet.

bool TryGetIndex ( int  user_id,
int  item_id,
ICollection< int >  indexes,
out int  index 
)
inlineinherited

Try to get the index for given user and item

Parameters
user_idthe user ID
item_idthe item ID
indexesthe indexes to look at
indexwill contain the index of the first event encountered that matches the user ID and item ID
Returns
true if an index was found for the user and item

Implements IDataSet.

void UpdateCountsAndIndices ( ISet< int >  users,
ISet< int >  items 
)
inlineprotected

update user- and item-wise counts and indices

Parameters
usersthe modified users
itemsthe modified itemsItems.

Member Data Documentation

IList<IList<int> > by_item
protectedinherited

Indices organized by item

IList<IList<int> > by_user
protectedinherited

Indices organized by user

IList<int> count_by_item
protectedinherited

field for storing the count per item

IList<int> count_by_user
protectedinherited

field for storing the count per user


The documentation for this class was generated from the following file: