public final class FunkSVDUpdater extends Object
Encapsulation of the FunkSVD update process. Using this class takes a two-step process:
prepare(int, double, double, double, double, double)
to prepare
an update.getItemFeatureUpdate()
and getUserFeatureUpdate()
to get the
deltas to apply to the item-feature and user-feature values, respectively.The updater can be reused for multiple updates, but cannot be shared between threads. It is typical to create one updater and reuse it for much of the training process.
The updater also tracks statistics across runs.
Modifier and Type | Method and Description |
---|---|
double |
getError()
Get the error from the prepared update.
|
double |
getItemFeatureUpdate()
Get the update for the item-feature value.
|
double |
getRMSE()
Get the RMSE of all updates done since the last reset.
|
int |
getUpdateCount()
Get the number of updates this updater has prepared since the last reset.
|
double |
getUserFeatureUpdate()
Get the update for the user-feature value.
|
void |
prepare(int feature,
double rating,
double estimate,
double uv,
double iv,
double trail)
Prepare the updater for updating the feature values for a particular user/item ID.
|
void |
resetStatistics()
Reset the statistics and counters tracked by this updater.
|
public void resetStatistics()
Reset the statistics and counters tracked by this updater.
public int getUpdateCount()
Get the number of updates this updater has prepared since the last reset.
resetStatistics()
public double getRMSE()
Get the RMSE of all updates done since the last reset.
public void prepare(int feature, double rating, double estimate, double uv, double iv, double trail)
Prepare the updater for updating the feature values for a particular user/item ID.
feature
- The feature we are training.rating
- The rating value.estimate
- The estimate through the previous feature.uv
- The user feature value.iv
- The item feature value.trail
- The sum of the trailing feature value products.public double getError()
Get the error from the prepared update.
public double getUserFeatureUpdate()
Get the update for the user-feature value.
public double getItemFeatureUpdate()
Get the update for the item-feature value.