public class URP extends Recommender
Modifier and Type | Field and Description |
---|---|
protected double[] |
alpha
Alpha parameter
|
protected double[][][] |
beta
Beta parameter
|
protected static double |
DEFAULT_H |
protected static double |
EPSILON |
protected double[][] |
gamma
Gamma parameter
|
protected double |
H
Heuristic factor to control number of iterations during E-Step
|
protected int |
numFactors
Number of latent factors
|
protected int |
numIters
Number of iterations
|
protected Map<Integer,double[][]> |
phi
Phi parameter
|
protected double[] |
ratings
Plausible ratings (must be sorted in ascending order)
|
datamodel
Constructor and Description |
---|
URP(DataModel datamodel,
int numFactors,
double[] ratings,
int numIters)
Model constructor
|
URP(DataModel datamodel,
int numFactors,
double[] ratings,
int numIters,
double H)
Model constructor
|
URP(DataModel datamodel,
int numFactors,
double[] ratings,
int numIters,
double H,
long seed)
Model constructor
|
URP(DataModel datamodel,
int numFactors,
double[] ratings,
int numIters,
long seed)
Model constructor
|
URP(DataModel datamodel,
Map<String,Object> params)
Model constructor from a Map containing the model's hyper-parameters values.
|
Modifier and Type | Method and Description |
---|---|
void |
fit()
Estimates model parameters given the hyper-parameters
|
double |
getH()
Get the H value
|
int |
getNumFactors()
Get the number of factors of the model
|
int |
getNumIters()
Get the number of iterations
|
double[] |
getPredictionProbabilityDistribution(int userIndex,
int itemIndex)
Returns the probability distribution of a prediction.
|
double[] |
getRatings()
Get the plausible ratings
|
double |
predict(int userIndex,
int itemIndex)
Computes a rating prediction
|
String |
toString() |
getDataModel, predict
protected static final double DEFAULT_H
protected static final double EPSILON
protected final int numIters
protected final int numFactors
protected final double H
protected final double[] ratings
protected final double[][] gamma
protected final double[][][] beta
protected final double[] alpha
public URP(DataModel datamodel, Map<String,Object> params)
datamodel
- DataModel instanceparams
- Model's hyper-parameters valuespublic URP(DataModel datamodel, int numFactors, double[] ratings, int numIters)
datamodel
- DataModel instancenumFactors
- Number of latent factorsratings
- Plausible ratings (must be sorted in ascending order)numIters
- Number of iterationspublic URP(DataModel datamodel, int numFactors, double[] ratings, int numIters, long seed)
datamodel
- DataModel instancenumFactors
- Number of latent factorsratings
- Plausible ratings (must be sorted in ascending order)numIters
- Number of iterationsseed
- Seed for random numbers generationpublic URP(DataModel datamodel, int numFactors, double[] ratings, int numIters, double H)
datamodel
- DataModel instancenumFactors
- Number of latent factorsratings
- Plausible ratings (must be sorted in ascending order)numIters
- Number of iterationsH
- Heuristic factor to control number of iterations during E-Step. The number of
iterations is defined by H * number_of_user_ratingspublic URP(DataModel datamodel, int numFactors, double[] ratings, int numIters, double H, long seed)
datamodel
- DataModel instancenumFactors
- Number of latent factorsratings
- Plausible ratings (must be sorted in ascending order)numIters
- Number of iterationsH
- Heuristic factor to control number of iterations during E-Step. The number of
iterations is defined by H * number_of_user_ratingsseed
- Seed for random numbers generationpublic int getNumFactors()
public int getNumIters()
public double[] getRatings()
public double getH()
public void fit()
Recommender
fit
in class Recommender
public double predict(int userIndex, int itemIndex)
Recommender
predict
in class Recommender
userIndex
- Index of the user in the array of Users of the DataModel instanceitemIndex
- Index of the item in the array of Items of the DataModel instancepublic double[] getPredictionProbabilityDistribution(int userIndex, int itemIndex)
userIndex
- UseritemIndex
- ItemCopyright © 2020. All rights reserved.