Open alaeddinms opened 8 years ago
Hi,
This library don't provide any functions to handle labeled feature vector, so you should write & use code like below:
public class FVecFloatArrayWithLabel implements FVec {
private final float[] values;
private final boolean treatsZeroAsNA;
FVecFloatArrayWithLabel(float[] values, boolean treatsZeroAsNA) {
this.values = values;
this.treatsZeroAsNA = treatsZeroAsNA;
}
@Override
public double fvalue(int index) {
if (values.length <= index + 1) {
return Double.NaN;
}
double result = values[index + 1];
if (treatsZeroAsNA && result == 0) {
return Double.NaN;
}
return result;
}
}
Hi,
When creating feature vector from dense representation by array, do you use the first element in the array for the first feature and the second for the second and so on or is the first element for the label as a placeholder?
Thanks,