public class NMF extends Recommender
Modifier and Type | Field and Description |
---|---|
protected double[][] |
h
Item factors
|
protected int |
numFactors
Number of factors
|
protected int |
numIters
Number of iterations
|
protected double[][] |
w
User factors
|
datamodel
Constructor and Description |
---|
NMF(DataModel datamodel,
int numFactors,
int numIters)
Model constructor
|
NMF(DataModel datamodel,
int numFactors,
int numIters,
long seed)
Model constructor
|
NMF(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
|
int |
getNumFactors()
Get the number of factors of the model
|
int |
getNumIters()
Get the number of iterations
|
double |
predict(int userIndex,
int itemIndex)
Computes a rating prediction
|
String |
toString() |
getDataModel, predict
protected final double[][] w
protected final double[][] h
protected final int numFactors
protected final int numIters
public NMF(DataModel datamodel, Map<String,Object> params)
datamodel
- DataModel instanceparams
- Model's hyper-parameters valuespublic NMF(DataModel datamodel, int numFactors, int numIters)
datamodel
- DataModel instancenumFactors
- Number of factorsnumIters
- Number of iterationspublic NMF(DataModel datamodel, int numFactors, int numIters, long seed)
datamodel
- DataModel instancenumFactors
- Number of factorsnumIters
- Number of iterationsseed
- Seed for random numbers generationpublic int getNumFactors()
public int getNumIters()
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 instanceCopyright © 2020. All rights reserved.