use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CrossTransformTest method testEmptyFeatureVector.
@Test
public void testEmptyFeatureVector() {
Config config = ConfigFactory.parseString(makeConfig());
Transform transform = TransformFactory.createTransform(config, "test_cross");
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 CrossTransformTest method testTransform.
@Test
public void testTransform() {
Config config = ConfigFactory.parseString(makeConfig());
Transform transform = TransformFactory.createTransform(config, "test_cross");
FeatureVector featureVector = makeFeatureVector();
transform.doTransform(featureVector);
Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
assertTrue(stringFeatures.size() == 3);
Set<String> out = stringFeatures.get("out");
assertTrue(out.size() == 4);
log.info("Cross output");
for (String string : out) {
log.info(string);
}
assertTrue(out.contains("aaa^11"));
assertTrue(out.contains("aaa^22"));
assertTrue(out.contains("bbb^11"));
assertTrue(out.contains("bbb^22"));
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CrossTransformTest method testTwoKeysTransform.
@Test
public void testTwoKeysTransform() {
Config config = ConfigFactory.parseString(makeBothKeyConfig());
Transform transform = TransformFactory.createTransform(config, "test_cross");
FeatureVector featureVector = makeFeatureVector();
transform.doTransform(featureVector);
Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
assertTrue(stringFeatures.size() == 3);
Set<String> out = stringFeatures.get("out");
log.info("Cross output");
for (String string : out) {
log.info(string);
}
assertEquals(1, out.size());
assertTrue(out.contains("aaa^22"));
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class CrossTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector() {
HashMap stringFeatures = new HashMap<String, Set<String>>();
Set list = new HashSet<String>();
list.add("aaa");
list.add("bbb");
stringFeatures.put("feature1", list);
Set list2 = new HashSet<String>();
list2.add("11");
list2.add("22");
stringFeatures.put("feature2", list2);
FeatureVector featureVector = new FeatureVector();
featureVector.setStringFeatures(stringFeatures);
return featureVector;
}
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;
}
Aggregations