@Override public float produceFeature(BaseInformationRecords.BaseInformationOrBuilder record, int featureIndex) { int value = getIntegerValue(record); assert value<=maxCategoryIndex : String.format("value %d cannot be more than maxCategoryIndex(%d)", value,maxCategoryIndex); value=Math.min(value,maxCategoryIndex); return value-minCategoryIndex; } }
@Override public void mapFeatures(BaseInformationRecords.BaseInformationOrBuilder record, INDArray inputs, int indexOfRecord) { indices[0] = indexOfRecord; for (int featureIndex = 0; featureIndex < numberOfFeatures(); featureIndex++) { indices[1] = featureIndex; inputs.putScalar(indices, produceFeature(record, featureIndex)); } }