use of com.airbnb.aerosolve.core.features.SparseLabeledPoint in project aerosolve by airbnb.
the class AdditiveModel method update.
public void update(float gradWithLearningRate, SparseLabeledPoint point, double dropout, Random rand) {
for (int i = 0; i < point.indices.length; i++) {
if (dropout <= 0 || rand.nextDouble() > dropout) {
int index = point.indices[i];
Function function = weightVector[index];
float value = point.values[i];
function.update(-gradWithLearningRate, value);
}
}
for (int i = 0; i < point.denseIndices.length; i++) {
if (dropout <= 0 || rand.nextDouble() > dropout) {
int index = point.denseIndices[i];
Function function = weightVector[index];
float[] value = point.denseValues[i];
function.update(-gradWithLearningRate, value);
}
}
}
use of com.airbnb.aerosolve.core.features.SparseLabeledPoint in project aerosolve by airbnb.
the class AdditiveModel method scoreFeatures.
public float scoreFeatures(SparseLabeledPoint point, double dropout, Random rand) {
float prediction = 0;
for (int i = 0; i < point.indices.length; i++) {
if (dropout <= 0 || rand.nextDouble() > dropout) {
int index = point.indices[i];
Function function = weightVector[index];
float value = point.values[i];
prediction += function.evaluate(value);
}
}
for (int i = 0; i < point.denseIndices.length; i++) {
if (dropout <= 0 || rand.nextDouble() > dropout) {
int index = point.denseIndices[i];
Function function = weightVector[index];
float[] value = point.denseValues[i];
prediction += function.evaluate(value);
}
}
return prediction;
}
Aggregations