U
- type of the usersI
- type of the itemspublic class Factorization<U,I> extends Object implements FastItemIndex<I>, FastUserIndex<U>
Modifier and Type | Field and Description |
---|---|
protected FastItemIndex<I> |
iIndex
item index
|
protected cern.colt.matrix.impl.DenseDoubleMatrix2D |
itemMatrix
item matrix
|
protected int |
K
dimensionality of the vector space
|
protected FastUserIndex<U> |
uIndex
user index
|
protected cern.colt.matrix.impl.DenseDoubleMatrix2D |
userMatrix
user matrix
|
Constructor and Description |
---|
Factorization(FastUserIndex<U> uIndex,
FastItemIndex<I> iIndex,
cern.colt.matrix.impl.DenseDoubleMatrix2D userMatrix,
cern.colt.matrix.impl.DenseDoubleMatrix2D itemMatrix,
int K)
Constructor for stored factorizations.
|
Factorization(FastUserIndex<U> uIndex,
FastItemIndex<I> iIndex,
int K,
cern.colt.function.DoubleFunction initFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsItem(I i)
Checks whether the index contains an item.
|
boolean |
containsUser(U u)
Checks whether the index contains a user.
|
cern.colt.matrix.impl.DenseDoubleMatrix2D |
getItemMatrix()
Returns the whole item matrix.
|
cern.colt.matrix.DoubleMatrix1D |
getItemVector(I i)
Returns the row of the item matrix corresponding to the given item.
|
int |
getK()
Returns the dimension of the latent feature space.
|
cern.colt.matrix.impl.DenseDoubleMatrix2D |
getUserMatrix()
Returns the whole user matrix.
|
cern.colt.matrix.DoubleMatrix1D |
getUserVector(U u)
Returns the row of the user matrix corresponding to the given user.
|
I |
iidx2item(int iidx)
Returns the item represented with the index.
|
int |
item2iidx(I i)
Returns the index assigned to the item.
|
int |
numItems()
Counts the number of indexed items.
|
int |
numUsers()
Counts the number of indexed users.
|
U |
uidx2user(int uidx)
Returns the user represented with the index.
|
int |
user2uidx(U u)
Returns the index assigned to the user.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllIidx, getAllItems, iidx2item, iidx2item, item2iidx, item2iidx
getAllUidx, getAllUsers, uidx2user, uidx2user, user2uidx, user2uidx
protected final cern.colt.matrix.impl.DenseDoubleMatrix2D userMatrix
protected final cern.colt.matrix.impl.DenseDoubleMatrix2D itemMatrix
protected final int K
protected final FastUserIndex<U> uIndex
protected final FastItemIndex<I> iIndex
public Factorization(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, int K, cern.colt.function.DoubleFunction initFunction)
uIndex
- fast user indexiIndex
- fast item indexK
- dimension of the latent feature spaceinitFunction
- function to initialize the cells of the matricespublic Factorization(FastUserIndex<U> uIndex, FastItemIndex<I> iIndex, cern.colt.matrix.impl.DenseDoubleMatrix2D userMatrix, cern.colt.matrix.impl.DenseDoubleMatrix2D itemMatrix, int K)
uIndex
- fast user indexiIndex
- fast item indexuserMatrix
- user matrixitemMatrix
- item matrixK
- dimension of the latent feature spacepublic int numUsers()
UserIndex
public int user2uidx(U u)
FastUserIndex
user2uidx
in interface FastUserIndex<U>
u
- userpublic U uidx2user(int uidx)
FastUserIndex
uidx2user
in interface FastUserIndex<U>
uidx
- user indexpublic int numItems()
ItemIndex
public int item2iidx(I i)
FastItemIndex
item2iidx
in interface FastItemIndex<I>
i
- itempublic I iidx2item(int iidx)
FastItemIndex
iidx2item
in interface FastItemIndex<I>
iidx
- item indexpublic boolean containsUser(U u)
UserIndex
containsUser
in interface UserIndex<U>
containsUser
in interface FastUserIndex<U>
u
- userpublic boolean containsItem(I i)
ItemIndex
containsItem
in interface ItemIndex<I>
containsItem
in interface FastItemIndex<I>
i
- itempublic cern.colt.matrix.DoubleMatrix1D getUserVector(U u)
u
- userpublic cern.colt.matrix.DoubleMatrix1D getItemVector(I i)
i
- itempublic cern.colt.matrix.impl.DenseDoubleMatrix2D getUserMatrix()
public cern.colt.matrix.impl.DenseDoubleMatrix2D getItemMatrix()
public int getK()
Copyright © 2016. All rights reserved.