public final class Ratings
extends java.lang.Object
Utilities for working with ratings.
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<Rating> |
TIMESTAMP_COMPARATOR
Compare two events by timestamp.
|
Modifier and Type | Method and Description |
---|---|
static Long2DoubleMap |
itemRatingVector(java.util.Collection<? extends Rating> ratings)
Construct a rating vector that contains the ratings provided by each user.
|
static Rating |
make(long uid,
long iid,
double value)
Deprecated.
|
static Rating |
make(long uid,
long iid,
double value,
long ts)
Deprecated.
|
static Equivalence<Preference> |
preferenceEquivalence()
An equivalence relation over preferences.
|
static Long2DoubleMap |
userRatingVector(java.util.Collection<Rating> ratings)
Construct a rating vector that contains the ratings provided for each item.
|
static Long2DoubleMap |
userRatingVector(ObjectStream<? extends Rating> ratings)
Extract a user rating vector from a rating stream.
|
public static final java.util.Comparator<Rating> TIMESTAMP_COMPARATOR
Compare two events by timestamp.
public static Long2DoubleMap itemRatingVector(@Nonnull java.util.Collection<? extends Rating> ratings)
Construct a rating vector that contains the ratings provided by each user. If all ratings in ratings are for the same item, then this will be a valid item rating vector. If multiple ratings are by the same user, the one with the highest timestamp is retained. If two ratings by the same user have identical timestamps, then the one that occurs last when the collection is iterated is retained.
ratings
- Some ratings (they should all be for the same item)public static Long2DoubleMap userRatingVector(@Nonnull java.util.Collection<Rating> ratings)
Construct a rating vector that contains the ratings provided for each item. If all ratings in ratings are by the same user, then this will be a valid user rating vector.
ratings
- A collection of ratings (should all be by the same user)public static Long2DoubleMap userRatingVector(@WillClose ObjectStream<? extends Rating> ratings)
Extract a user rating vector from a rating stream.
ratings
- The rating stream.userRatingVector(Collection)
public static Equivalence<Preference> preferenceEquivalence()
An equivalence relation over preferences.
@Deprecated public static Rating make(long uid, long iid, double value)
Rating.create(long, long, double)
.Make a fresh rating object with no timestamp.
make(long, long, double, long)
@Deprecated public static Rating make(long uid, long iid, double value, long ts)
Rating.create(long, long, double, long)
Make a fresh rating event.