|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mymedialite.itemrec.ItemRecommender
public abstract class ItemRecommender
Abstract item recommender class that loads the (positive-only implicit feedback) training data into memory and provides flexible access to it.
Field Summary | |
---|---|
protected IPosOnlyFeedback |
feedback
The feedback data to be used for training |
protected int |
maxItemID
The maximum item ID |
protected int |
maxUserID
The maximum user ID |
Constructor Summary | |
---|---|
protected |
ItemRecommender()
|
Method Summary | |
---|---|
boolean |
canPredict(int user_id,
int item_id)
Check whether a useful prediction can be made for a given user-item combination. |
ItemRecommender |
clone()
Create a shallow copy of the object. |
IPosOnlyFeedback |
getFeedback()
|
abstract void |
loadModel(java.io.BufferedReader reader)
|
abstract void |
loadModel(java.lang.String filename)
Get the model parameters from a file |
abstract double |
predict(int userId,
int itemId)
Predict the rating or score for a given user-item combination. |
abstract void |
saveModel(java.io.PrintWriter writer)
|
abstract void |
saveModel(java.lang.String filename)
Save the model parameters to a file |
void |
setFeedback(IPosOnlyFeedback feedback)
|
java.lang.String |
toString()
Return a string representation of the recommender |
abstract void |
train()
Learn the model parameters of the recommender from the training data |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int maxUserID
protected int maxItemID
protected IPosOnlyFeedback feedback
Constructor Detail |
---|
protected ItemRecommender()
Method Detail |
---|
public IPosOnlyFeedback getFeedback()
public void setFeedback(IPosOnlyFeedback feedback)
public ItemRecommender clone()
clone
in class java.lang.Object
public abstract double predict(int userId, int itemId)
IRecommender
predict
in interface IRecommender
userId
- the user IDitemId
- the item ID
public boolean canPredict(int user_id, int item_id)
IRecommender
canPredict
in interface IRecommender
user_id
- the user IDitem_id
- the item ID
public abstract void train()
IRecommender
train
in interface IRecommender
public abstract void loadModel(java.lang.String filename) throws java.io.IOException
IRecommender
loadModel
in interface IRecommender
filename
- the file to read from
java.io.IOException
public abstract void loadModel(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException
public abstract void saveModel(java.lang.String filename) throws java.io.IOException
IRecommender
saveModel
in interface IRecommender
filename
- the file to write to
java.io.IOException
public abstract void saveModel(java.io.PrintWriter writer) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
IRecommender
toString
in interface IRecommender
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |