use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CustomLinearLogQuantizeTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector() {
Map<String, Set<String>> stringFeatures = new HashMap<>();
Map<String, Map<String, Double>> floatFeatures = new HashMap<>();
Set list = new HashSet<String>();
list.add("aaa");
list.add("bbb");
stringFeatures.put("strFeature1", list);
Map<String, Double> map = new HashMap<>();
map.put("a", 0.0);
map.put("b", 0.13);
map.put("c", 1.23);
map.put("d", 5.0);
map.put("e", 17.5);
map.put("f", 99.98);
map.put("g", 365.0);
map.put("h", 65537.0);
map.put("i", -1.0);
map.put("j", -23.0);
floatFeatures.put("loc", map);
FeatureVector featureVector = new FeatureVector();
featureVector.setStringFeatures(stringFeatures);
featureVector.setFloatFeatures(floatFeatures);
return featureVector;
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CustomLinearLogQuantizeTransformTest method testEmptyFeatureVector.
@Test
public void testEmptyFeatureVector() {
Config config = ConfigFactory.parseString(makeConfig());
Transform transform = TransformFactory.createTransform(config, "test_quantize");
FeatureVector featureVector = new FeatureVector();
transform.doTransform(featureVector);
assertTrue(featureVector.getStringFeatures() == null);
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CustomMultiscaleQuantizeTransformTest method testEmptyFeatureVector.
@Test
public void testEmptyFeatureVector() {
Config config = ConfigFactory.parseString(makeConfig(""));
Transform transform = TransformFactory.createTransform(config, "test_quantize");
FeatureVector featureVector = new FeatureVector();
transform.doTransform(featureVector);
assertTrue(featureVector.getStringFeatures() == null);
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CustomMultiscaleQuantizeTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector() {
Map<String, Set<String>> stringFeatures = new HashMap<>();
Map<String, Map<String, Double>> floatFeatures = new HashMap<>();
Set list = new HashSet<String>();
list.add("aaa");
list.add("bbb");
stringFeatures.put("strFeature1", list);
Map<String, Double> map = new HashMap<>();
map.put("lat", 37.7);
map.put("long", 40.0);
map.put("zero", 0.0);
map.put("negative", -1.0);
floatFeatures.put("loc", map);
FeatureVector featureVector = new FeatureVector();
featureVector.setStringFeatures(stringFeatures);
featureVector.setFloatFeatures(floatFeatures);
return featureVector;
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CustomMultiscaleQuantizeTransformTest method testExcludeFeatures.
@Test
public void testExcludeFeatures() {
Config config = ConfigFactory.parseString(makeConfig("exclude_features: [\"lat\"] \n"));
Transform transform = TransformFactory.createTransform(config, "test_quantize");
FeatureVector featureVector = makeFeatureVector();
transform.doTransform(featureVector);
Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
assertTrue(stringFeatures.size() == 2);
Set<String> out = stringFeatures.get("loc_quantized");
log.info("quantize output");
for (String string : out) {
log.info(string);
}
assertTrue(out.size() == 5);
assertTrue(out.contains("long[1.0]=40.0"));
assertTrue(out.contains("long[10.0]=40.0"));
assertTrue(out.contains("zero=0"));
assertTrue(out.contains("negative[1.0]=-1.0"));
assertTrue(out.contains("negative[10.0]=0.0"));
}
Aggregations