/** * Abstraction of strategies for iterating over potential neighboring items. This is used by the * item-item model builder to iterate over the potential neighbors of an item. It is abstracted * so that different strategies can be used depending on the properties of the similarity function * and data set. * * @since 2.1 * @author <a href="http://www.grouplens.org">GroupLens Research</a> */ @DefaultProvider(DefaultNeighborIterationStrategyProvider.class) public interface NeighborIterationStrategy { /** * Get an iterator over possible neighbors of an item. * @param context The build context (to get item & neighbor information). * @param item The item ID. The item may or may not be included in the returned items. * @param onlyAfter If {@code true}, only consider item IDs after {@code item}, because * the caller only needs unique unordered pairs. * @return An iterator over possible neighbors of {@code item}. */ LongIterator neighborIterator(ItemItemBuildContext context, long item, boolean onlyAfter); }
@DefaultProvider(PreferenceDomainQuantizer.AutoProvider.class) public interface Quantizer {
/** * The Poisson Factorization Model. This extends the SVD model. * * Poisson Factorization models each item as a vector of K latent attributes, * and each user as a vector of K latent preferences. * Then each rating is modeled as a Poisson distribution, * and the rate (mean) of the Poisson distribution is the inner product of * corresponding item latent vector and user latent vector. */ @DefaultProvider(HPFModelParallelProvider.class) @Shareable public final class HPFModel extends MFModel { private static final long serialVersionUID = 4L; /** * Construct a Poisson Factorization Model. * @param umat The user feature matrix (users x features). * @param imat The item feature matrix (items x features). * @param uidx The user index mapping * @param iidx The item index mapping */ public HPFModel(RealMatrix umat, RealMatrix imat, KeyIndex uidx, KeyIndex iidx) { super(umat, imat, uidx, iidx); } }
@DefaultProvider(RandomDataSplitStrategyProvider.class) @Shareable public class RandomDataSplitStrategy implements DataSplitStrategy, Serializable {
@DefaultProvider(FunkSVDModelProvider.class) @Shareable public final class FunkSVDModel extends MFModel {
/** * Bias model that provides global and item biases. The item biases are precomputed and are *not* updated based on * new data added since the model builds */ @Shareable @Immutable @DefaultProvider(ItemAverageRatingBiasModelProvider.class) public class ItemBiasModel extends UserItemBiasModel { private static final long serialVersionUID = 1L; /** * Construct a new item bias model. * @param global The global bias. * @param items The item biases. */ public ItemBiasModel(double global, Long2DoubleMap items) { super(global, Long2DoubleMaps.EMPTY_MAP, items); } }
/** * Bias model that provides global and user biases. The user biases are precomputed and are *not* refreshed based * on user data added since the model build. */ @Shareable @Immutable @DefaultProvider(UserAverageRatingBiasModelProvider.class) public class UserBiasModel extends UserItemBiasModel { private static final long serialVersionUID = 1L; /** * Construct a new user bias model. * @param global The global bias. * @param users The user biases. */ public UserBiasModel(double global, Long2DoubleMap users) { super(global, users, Long2DoubleMaps.EMPTY_MAP); } }
@DefaultProvider(RatingSummaryProvider.class) public class RatingSummary implements Serializable { private static final long serialVersionUID = 1L;
@DefaultProvider(SlopeOneModelProvider.class) @Shareable public class SlopeOneModel implements Serializable {
@DefaultProvider(ItemItemModelProvider.class) @Shareable public class SimilarityMatrixModel implements Serializable, ItemItemModel {
@DefaultProvider(PackedRatingMatrixProvider.class) @Shareable public class PackedRatingMatrix implements RatingMatrix {
@DefaultProvider(LeastSquaresItemScorer.Builder.class) @Shareable public class LeastSquaresItemScorer extends AbstractItemScorer implements Serializable {
@DefaultProvider(ItemItemBuildContextProvider.class) @Shareable @Immutable
@DefaultProvider(GlobalAverageRatingBiasModelProvider.class) public class GlobalBiasModel implements BiasModel, Serializable { private static final long serialVersionUID = 1L;
@DefaultProvider(UserItemAverageRatingBiasModelProvider.class) public class UserItemBiasModel implements BiasModel, Serializable { private static final long serialVersionUID = 1L;
@DefaultProvider(UserSnapshot.Builder.class) public class UserSnapshot implements Serializable { private static final long serialVersionUID = 1L;
@DefaultProvider(InteractionStatistics.ISProvider.class) public class InteractionStatistics implements Serializable { private static final long serialVersionUID = 1L;
/** * Abstraction of strategies for iterating over potential neighboring items. This is used by the * item-item model builder to iterate over the potential neighbors of an item. It is abstracted * so that different strategies can be used depending on the properties of the similarity function * and data set. * * @since 2.1 * @author <a href="http://www.grouplens.org">GroupLens Research</a> */ @DefaultProvider(DefaultNeighborIterationStrategyProvider.class) public interface NeighborIterationStrategy { /** * Get an iterator over possible neighbors of an item. * @param context The build context (to get item & neighbor information). * @param item The item ID. The item may or may not be included in the returned items. * @param onlyAfter If {@code true}, only consider item IDs after {@code item}, because * the caller only needs unique unordered pairs. * @return An iterator over possible neighbors of {@code item}. */ LongIterator neighborIterator(ItemItemBuildContext context, long item, boolean onlyAfter); }
/** * Bias model that provides global and user biases. The user biases are precomputed and are *not* refreshed based * on user data added since the model build. */ @Shareable @Immutable @DefaultProvider(UserAverageRatingBiasModelProvider.class) public class UserBiasModel extends UserItemBiasModel { private static final long serialVersionUID = 1L; /** * Construct a new user bias model. * @param global The global bias. * @param users The user biases. */ public UserBiasModel(double global, Long2DoubleMap users) { super(global, users, Long2DoubleMaps.EMPTY_MAP); } }
/** * Bias model that provides global and item biases. The item biases are precomputed and are *not* updated based on * new data added since the model builds */ @Shareable @Immutable @DefaultProvider(ItemAverageRatingBiasModelProvider.class) public class ItemBiasModel extends UserItemBiasModel { private static final long serialVersionUID = 1L; /** * Construct a new item bias model. * @param global The global bias. * @param items The item biases. */ public ItemBiasModel(double global, Long2DoubleMap items) { super(global, Long2DoubleMaps.EMPTY_MAP, items); } }