@@ -0,0 +1,2571 @@
+package com.airbnb.aerosolve.core.transforms;%0A%0Aimport com.airbnb.aerosolve.core.FeatureVector;%0Aimport com.airbnb.aerosolve.core.util.Util;%0A%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aimport com.typesafe.config.Config;%0A%0A/**%0A * Takes the floats in fieldName1 and quantizes them into buckets. If the quantized float is%0A * less than or equal to a maximum specified bucket value or greater than or equal to a minimum%0A * specified bucket value, then the quantized float is stored as a string in a new string%0A * feature output specified by stringOutputName. Otherwise, the original, unchanged float is%0A * stored in a new float feature output specified by floatOutputName. The input float feature%0A * remains unchanged.%0A */%0Apublic class MoveFloatToStringAndFloatTransform implements Transform %7B%0A  private String fieldName1;%0A  private double bucket;%0A  private double maxBucket;%0A  private double minBucket;%0A  private String stringOutputName;%0A  private String floatOutputName;%0A%0A  @Override%0A  public void configure(Config config, String key) %7B%0A    fieldName1 = config.getString(key + %22.field1%22);%0A    bucket = config.getDouble(key + %22.bucket%22);%0A    maxBucket = config.getDouble(key + %22.max_bucket%22);%0A    minBucket = config.getDouble(key + %22.min_bucket%22);%0A    stringOutputName = config.getString(key + %22.string_output%22);%0A    floatOutputName = config.getString(key + %22.float_output%22);%0A  %7D%0A%0A  @Override%0A  public void doTransform(FeatureVector featureVector) %7B%0A    Map%3CString, Map%3CString, Double%3E%3E floatFeatures = featureVector.floatFeatures;%0A%0A    if (floatFeatures == null %7C%7C floatFeatures.isEmpty()) %7B%0A      return;%0A    %7D%0A%0A    Map%3CString, Double%3E input = floatFeatures.get(fieldName1);%0A%0A    if (input == null %7C%7C input.isEmpty()) %7B%0A      return;%0A    %7D%0A%0A    Map%3CString, Set%3CString%3E%3E stringFeatures = featureVector.getStringFeatures();%0A    Set%3CString%3E stringOutput = Util.getOrCreateStringFeature(stringOutputName, stringFeatures);%0A%0A    Map%3CString, Double%3E floatOutput = Util.getOrCreateFloatFeature(floatOutputName, floatFeatures);%0A%0A    for (Map.Entry%3CString, Double%3E inputEntry : input.entrySet()) %7B%0A      String inputFloatKey = inputEntry.getKey();%0A      Double inputFloatValue = inputEntry.getValue();%0A%0A      Double inputFloatQuantized = LinearLogQuantizeTransform.quantize(inputFloatValue, bucket);%0A%0A      if (inputFloatQuantized %3E= minBucket && inputFloatQuantized %3C= maxBucket) %7B%0A        String movedFloat = inputFloatKey + %22=%22 + inputFloatQuantized;%0A        stringOutput.add(movedFloat);%0A      %7D else %7B%0A        floatOutput.put(inputFloatKey, inputFloatValue);%0A      %7D%0A    %7D%0A  %7D%0A%7D%0A

Add MoveFloatToStringAndFloatTransform