public class MFModel extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
featureCount |
protected int |
itemCount |
protected IdIndexMapping |
itemIndex |
protected mikera.matrixx.impl.ImmutableMatrix |
itemMatrix |
protected int |
userCount |
protected IdIndexMapping |
userIndex |
protected mikera.matrixx.impl.ImmutableMatrix |
userMatrix |
Constructor and Description |
---|
MFModel(mikera.matrixx.impl.ImmutableMatrix umat,
mikera.matrixx.impl.ImmutableMatrix imat,
IdIndexMapping uidx,
IdIndexMapping iidx)
Construct a matrix factorization model.
|
Modifier and Type | Method and Description |
---|---|
int |
getFeatureCount()
Get the model's feature count.
|
int |
getItemCount()
The number of items.
|
double |
getItemFeature(long iid,
int feature)
Get a particular feature value for an item.
|
IdIndexMapping |
getItemIndex()
The item index mapping.
|
mikera.matrixx.IMatrix |
getItemMatrix()
Get the item matrix.
|
mikera.vectorz.AVector |
getItemVector(long item) |
int |
getUserCount()
The number of users.
|
double |
getUserFeature(long uid,
int feature)
Get a particular feature value for an user.
|
IdIndexMapping |
getUserIndex()
The user index mapping.
|
mikera.matrixx.IMatrix |
getUserMatrix()
Get the user matrix.
|
mikera.vectorz.AVector |
getUserVector(long user) |
String |
toString() |
protected int featureCount
protected int userCount
protected int itemCount
protected mikera.matrixx.impl.ImmutableMatrix userMatrix
protected mikera.matrixx.impl.ImmutableMatrix itemMatrix
protected IdIndexMapping userIndex
protected IdIndexMapping itemIndex
public MFModel(mikera.matrixx.impl.ImmutableMatrix umat, mikera.matrixx.impl.ImmutableMatrix imat, IdIndexMapping uidx, IdIndexMapping iidx)
umat
- The user feature matrix (users x features).imat
- The item feature matrix (items x features).uidx
- The user index mapping.iidx
- The item index mapping.public int getFeatureCount()
public int getUserCount()
public int getItemCount()
public IdIndexMapping getItemIndex()
public IdIndexMapping getUserIndex()
public mikera.matrixx.IMatrix getUserMatrix()
public mikera.matrixx.IMatrix getItemMatrix()
@Nullable public mikera.vectorz.AVector getUserVector(long user)
@Nullable public mikera.vectorz.AVector getItemVector(long item)
public double getUserFeature(long uid, int feature)
uid
- The item ID.feature
- The feature.public double getItemFeature(long iid, int feature)
iid
- The item ID.feature
- The feature.