public class BNMF extends Recommender
Modifier and Type | Field and Description |
---|---|
protected double[][] |
a
User factors
|
protected double |
alpha
This hyper-parameter is related to the possibility of obtaining overlapping groups of users
sharing the same tastes.
|
protected double[][] |
b
Item factors
|
protected double |
beta
This hyper-parameter represents the amount of evidence that the algorithm requires to deduce
that a group of users likes an item.
|
protected static double |
DEFAULT_R |
protected double[][] |
epsilonMinus
Epsilon- parameters
|
protected double[][] |
epsilonPlus
Epsilon+ parameters
|
protected double[][] |
gamma
Gamma parameters
|
protected int |
numFactors
Number of factors
|
protected int |
numIters
Number of iterations
|
protected double |
r
Hyper-parameter of the binomial distribution.
|
datamodel
Constructor and Description |
---|
BNMF(DataModel datamodel,
int numFactors,
int numIters,
double alpha,
double beta)
Model constructor
|
BNMF(DataModel datamodel,
int numFactors,
int numIters,
double alpha,
double beta,
double r,
long seed)
Model constructor
|
BNMF(DataModel datamodel,
int numFactors,
int numIters,
double alpha,
double beta,
long seed)
Model constructor
|
BNMF(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 |
getAlpha()
Get the alpha value
|
double |
getBeta()
Get the beta value
|
double[] |
getEpsilonMinus(int itemIndex)
Get the epsilon- vector of an item
|
double[] |
getEpsilonPlus(int itemIndex)
Get the epsilon+ vector of an item
|
double[] |
getGamma(int userIndex)
Get the gamma vector of an user
|
double[] |
getItemFactors(int itemIndex)
Get the latent factors vector of an item (bi)
|
int |
getNumFactors()
Get the number of factors of the model
|
int |
getNumIters()
Get the number of iterations
|
double |
getR()
Get the r value
|
double[] |
getUserFactors(int userIndex)
Get the latent factors vector of a user (au)
|
double |
predict(int userIndex,
int itemIndex)
Computes a rating prediction
|
String |
toString() |
getDataModel, predict
protected static final double DEFAULT_R
protected double[][] a
protected double[][] b
protected double[][] gamma
protected double[][] epsilonPlus
protected double[][] epsilonMinus
protected final double alpha
protected final double beta
protected final double r
protected final int numFactors
protected final int numIters
public BNMF(DataModel datamodel, Map<String,Object> params)
datamodel
- DataModel instanceparams
- Model's hyper-parameters valuespublic BNMF(DataModel datamodel, int numFactors, int numIters, double alpha, double beta)
datamodel
- DataModel instancenumFactors
- Number of factorsnumIters
- Number of iterationsalpha
- This parameter is related to the possibility of obtaining overlapping groups of
users sharing the same tastesbeta
- Amount of evidences that the algorithm requires to deduce that a group of users
likes an itempublic BNMF(DataModel datamodel, int numFactors, int numIters, double alpha, double beta, long seed)
datamodel
- DataModel instancenumFactors
- Number of factorsnumIters
- Number of iterationsalpha
- This parameter is related to the possibility of obtaining overlapping groups of
users sharing the same tastesbeta
- Amount of evidences that the algorithm requires to deduce that a group of users
likes an itemseed
- Seed for random numbers generationpublic BNMF(DataModel datamodel, int numFactors, int numIters, double alpha, double beta, double r, long seed)
datamodel
- DataModel instancenumFactors
- Number of factorsnumIters
- Number of iterationsalpha
- This parameter is related to the possibility of obtaining overlapping groups of
users sharing the same tastesbeta
- Amount of evidences that the algorithm requires to deduce that a group of users
likes an itemr
- Parameter of the binomial distribution (fixed to 4)seed
- Seed for random numbers generationpublic int getNumFactors()
public int getNumIters()
public double getAlpha()
public double getBeta()
public double getR()
public double[] getGamma(int userIndex)
userIndex
- user indexpublic double[] getEpsilonPlus(int itemIndex)
itemIndex
- item indexpublic double[] getEpsilonMinus(int itemIndex)
itemIndex
- item indexpublic double[] getUserFactors(int userIndex)
userIndex
- Userpublic double[] getItemFactors(int itemIndex)
itemIndex
- Userpublic 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 instanceCopyright © 2020. All rights reserved.