public final class DelegateGenerationManager extends Object implements GenerationManager
Manages one generation of the underlying recommender model. Input is read from a local file system, written to a local file system, and the intermediate model is stored on a local file system.
| Constructor and Description |
|---|
DelegateGenerationManager(File localInputDir) |
DelegateGenerationManager(String bucket,
String instanceID,
File localInputDir,
int partition,
ReloadingReference<List<?>> allPartitions,
File licenseFile) |
| Modifier and Type | Method and Description |
|---|---|
void |
append(long userID,
long itemID,
float value,
boolean bulk)
Sends a new user / item association to the component responsible for later recomputing
the model based on this, and other, updates.
|
void |
appendItemTag(String tag,
long itemID,
float value,
boolean bulk)
Sends a new tag / item association to the component responsible for later recomputing
the model based on this, and other, updates.
|
void |
appendUserTag(long userID,
String tag,
float value,
boolean bulk)
Sends a new user / tag association to the component responsible for later recomputing
the model based on this, and other, updates.
|
void |
bulkDone()
Signals the end of a string of updates from a bulk update, like an
ingest request. |
void |
close() |
String |
getBucket()
Not used.
|
Generation |
getCurrentGeneration() |
String |
getInstanceID()
Not used.
|
void |
refresh()
Triggers a refresh of the object's internal state, which particularly includes rebuilding or reloading
a matrix model.
|
void |
remove(long userID,
long itemID,
boolean bulk)
Records that the user-item association should be removed.
|
public DelegateGenerationManager(File localInputDir) throws IOException
localInputDir - local work directory from which input is read,
and to which additional input is written. The model file is stored here too. Input in CSV format can
be placed in this directory at any time. The file name should end in ".csv" and the file should
contain lines of the form "userID,itemID(,value)".IOExceptionpublic DelegateGenerationManager(String bucket, String instanceID, File localInputDir, int partition, ReloadingReference<List<?>> allPartitions, File licenseFile) throws IOException
bucket - not used in local mode; required for API compatibility internallyinstanceID - not used in local mode; required for API compatibility internallylocalInputDir - local work directory from which input is read,
and to which additional input is written. The model file is stored here too. Input in CSV format can
be placed in this directory at any time. The file name should end in ".csv" and the file should
contain lines of the form "userID,itemID(,value)".partition - not used; required for API compatibility internallyallPartitions - not used; required for API compatibility internallylicenseFile - not used; required for API compatibility internallyIOExceptionpublic String getBucket()
getBucket in interface GenerationManagerpublic String getInstanceID()
getInstanceID in interface GenerationManagerpublic void append(long userID,
long itemID,
float value,
boolean bulk)
throws IOException
GenerationManagerappend in interface GenerationManageruserID - user involved in new associationitemID - item involvedvalue - strength of the user/item associationbulk - if true, part of a bulk update and should expect many method calls in a rowIOException - if an error occurs while sending the updatepublic void appendUserTag(long userID,
String tag,
float value,
boolean bulk)
throws IOException
GenerationManagerappendUserTag in interface GenerationManageruserID - user involved in new associationtag - the tagvalue - strength of the user/item associationbulk - if true, part of a bulk update and should expect many method calls in a rowIOException - if an error occurs while sending the updatepublic void appendItemTag(String tag, long itemID, float value, boolean bulk) throws IOException
GenerationManagerappendItemTag in interface GenerationManagertag - the tagitemID - item involved in new associationvalue - strength of the tag/item associationbulk - if true, part of a bulk update and should expect many method calls in a rowIOException - if an error occurs while sending the updatepublic void remove(long userID,
long itemID,
boolean bulk)
throws IOException
GenerationManagerremove in interface GenerationManageruserID - user involved in new associationitemID - item involvedbulk - if true, part of a bulk update and should expect many method calls in a rowIOException - if an error occurs while sending the updatepublic void bulkDone()
throws IOException
GenerationManageringest request.bulkDone in interface GenerationManagerIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void refresh()
GenerationManagerrefresh in interface GenerationManagerpublic Generation getCurrentGeneration()
getCurrentGeneration in interface GenerationManagerGeneration that has been made available by the
implementation.Copyright © 2012-2013 Myrrix Ltd. All Rights Reserved.