Class HPF
- java.lang.Object
-
- es.upm.etsisi.cf4j.recommender.Recommender
-
- es.upm.etsisi.cf4j.recommender.matrixFactorization.HPF
-
public class HPF extends Recommender
Implements Gopalan, P., Hofman, J. M., & Blei, D. M. (2015, July). Scalable Recommendation with Hierarchical Poisson Factorization. In UAI (pp. 326-335).
-
-
Field Summary
Fields Modifier and Type Field Description protected double
a
protected double
aPrime
protected double
bPrime
protected double
c
protected double
cPrime
protected static double
DEFAULT_A
protected static double
DEFAULT_A_PRIME
protected static double
DEFAULT_B_PRIME
protected static double
DEFAULT_C
protected static double
DEFAULT_C_PRIME
protected static double
DEFAULT_D_PRIME
protected double
dPrime
protected double[][]
gamma
protected double[][]
gammaRte
protected double[][]
gammaShp
protected double[]
kappaRte
protected double
kappaShp
protected double[][]
lambda
protected double[][]
lambdaRte
protected double[][]
lambdaShp
protected int
numFactors
Number of latent factorsprotected int
numIters
Number of iterationsprotected double[]
tauRte
protected double
tauShp
-
Fields inherited from class es.upm.etsisi.cf4j.recommender.Recommender
datamodel
-
-
Constructor Summary
Constructors Constructor Description HPF(DataModel datamodel, int numFactors, int numIters)
Models constructorHPF(DataModel datamodel, int numFactors, int numIters, double a, double aPrime, double bPrime, double c, double cPrime, double dPrime)
Models constructorHPF(DataModel datamodel, int numFactors, int numIters, double a, double aPrime, double bPrime, double c, double cPrime, double dPrime, long seed)
Models constructorHPF(DataModel datamodel, int numFactors, int numIters, long seed)
Models constructorHPF(DataModel datamodel, Map<String,Object> params)
Model constructor from a Map containing the model's hyper-parameters values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fit()
Estimates model parameters given the hyper-parametersint
getNumFactors()
Get the number of factors of the modelint
getNumIters()
Get the number of iterationsdouble
predict(int userIndex, int itemIndex)
Computes a rating predictionString
toString()
-
Methods inherited from class es.upm.etsisi.cf4j.recommender.Recommender
getDataModel, predict
-
-
-
-
Field Detail
-
DEFAULT_A
protected static final double DEFAULT_A
- See Also:
- Constant Field Values
-
DEFAULT_A_PRIME
protected static final double DEFAULT_A_PRIME
- See Also:
- Constant Field Values
-
DEFAULT_B_PRIME
protected static final double DEFAULT_B_PRIME
- See Also:
- Constant Field Values
-
DEFAULT_C
protected static final double DEFAULT_C
- See Also:
- Constant Field Values
-
DEFAULT_C_PRIME
protected static final double DEFAULT_C_PRIME
- See Also:
- Constant Field Values
-
DEFAULT_D_PRIME
protected static final double DEFAULT_D_PRIME
- See Also:
- Constant Field Values
-
numFactors
protected final int numFactors
Number of latent factors
-
numIters
protected final int numIters
Number of iterations
-
a
protected final double a
-
aPrime
protected final double aPrime
-
bPrime
protected final double bPrime
-
c
protected final double c
-
cPrime
protected final double cPrime
-
dPrime
protected final double dPrime
-
gamma
protected final double[][] gamma
-
gammaShp
protected final double[][] gammaShp
-
gammaRte
protected final double[][] gammaRte
-
kappaShp
protected final double kappaShp
-
kappaRte
protected final double[] kappaRte
-
lambda
protected final double[][] lambda
-
lambdaShp
protected final double[][] lambdaShp
-
lambdaRte
protected final double[][] lambdaRte
-
tauShp
protected final double tauShp
-
tauRte
protected final double[] tauRte
-
-
Constructor Detail
-
HPF
public HPF(DataModel datamodel, Map<String,Object> params)
Model constructor from a Map containing the model's hyper-parameters values. Map object must contains the following keys:- numFactors: int value with the number of latent factors.
- numIters:: int value with the number of iterations.
- a (optional): double value with the a hyper-parameter. If missing, it is set to 0.3.
- aPrime (optional): double value with the a' hyper-parameter. If missing, it is set to 0.3.
- bPrime (optional): double value with the b' hyper-parameter. If missing, it is set to 1.0.
- c (optional): double value with the c hyper-parameter. If missing, it is set to 0.3.
- cPrime (optional): double value with the c' hyper-parameter. If missing, it is set to 0.3.
- dPrime (optional): double value with the d' hyper-parameter. If missing, it is set to 1.0.
- seed (optional): random seed for random numbers generation. If missing, random value is used.
- Parameters:
datamodel
- DataModel instanceparams
- Model's hyper-parameters values
-
HPF
public HPF(DataModel datamodel, int numFactors, int numIters)
Models constructor- Parameters:
datamodel
- DataModel instancenumFactors
- Number of latent factorsnumIters
- Number of iterations
-
HPF
public HPF(DataModel datamodel, int numFactors, int numIters, long seed)
Models constructor- Parameters:
datamodel
- DataModel instancenumFactors
- Number of latent factorsnumIters
- Number of iterationsseed
- Seed for random numbers generation
-
HPF
public HPF(DataModel datamodel, int numFactors, int numIters, double a, double aPrime, double bPrime, double c, double cPrime, double dPrime)
Models constructor- Parameters:
datamodel
- DataModel instancenumFactors
- Number of latent factorsnumIters
- Number of iterationsa
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.aPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.bPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.c
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.cPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.dPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.
-
HPF
public HPF(DataModel datamodel, int numFactors, int numIters, double a, double aPrime, double bPrime, double c, double cPrime, double dPrime, long seed)
Models constructor- Parameters:
datamodel
- DataModel instancenumFactors
- Number of latent factorsnumIters
- Number of iterationsa
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.aPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.bPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.c
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.cPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.dPrime
- Model hyper-parameter. Read the paper for more information related to this hyper-parameter.seed
- Seed for random numbers generation
-
-
Method Detail
-
fit
public void fit()
Description copied from class:Recommender
Estimates model parameters given the hyper-parameters- Specified by:
fit
in classRecommender
-
predict
public double predict(int userIndex, int itemIndex)
Description copied from class:Recommender
Computes a rating prediction- Specified by:
predict
in classRecommender
- Parameters:
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 instance- Returns:
- Prediction
-
getNumFactors
public int getNumFactors()
Get the number of factors of the model- Returns:
- Number of factors
-
getNumIters
public int getNumIters()
Get the number of iterations- Returns:
- Number of iterations
-
-