use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class DecisionTreeTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector(double x, double y) {
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("x", x);
map.put("y", y);
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 DeleteFloatFeatureFamilyTransformTest method testEmptyFeatureVector.
@Test
public void testEmptyFeatureVector() {
Config config = ConfigFactory.parseString(makeConfig());
Transform transform = TransformFactory.createTransform(config, "test_delete_float_feature_family");
FeatureVector featureVector = new FeatureVector();
transform.doTransform(featureVector);
assertTrue(featureVector.getFloatFeatures() == null);
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class DeleteFloatFeatureFamilyTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector() {
Map<String, Map<String, Double>> floatFeatures = new HashMap<>();
Map<String, Double> family1 = new HashMap<>();
family1.put("A", 1.0);
family1.put("B", 2.0);
Map<String, Double> family2 = new HashMap<>();
family2.put("C", 3.0);
family2.put("D", 4.0);
Map<String, Double> family3 = new HashMap<>();
family3.put("E", 5.0);
family3.put("F", 6.0);
Map<String, Double> family4 = new HashMap<>();
family4.put("G", 7.0);
family4.put("H", 8.0);
floatFeatures.put("F1", family1);
floatFeatures.put("F2", family2);
floatFeatures.put("F3", family3);
floatFeatures.put("F4", family4);
FeatureVector featureVector = new FeatureVector();
featureVector.setFloatFeatures(floatFeatures);
return featureVector;
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class DeleteStringFeatureFamilyTransformTest method testTransform.
@Test
public void testTransform() {
Config config = ConfigFactory.parseString(makeConfig());
Transform transform = TransformFactory.createTransform(config, "test_delete_string_feature_family");
FeatureVector featureVector = makeFeatureVector();
Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
assertNotNull(stringFeatures);
assertTrue(stringFeatures.containsKey("strFeature1"));
assertTrue(stringFeatures.containsKey("strFeature2"));
assertTrue(stringFeatures.containsKey("strFeature3"));
assertTrue(stringFeatures.containsKey("strFeature4"));
assertEquals(4, stringFeatures.size());
transform.doTransform(featureVector);
assertNotNull(stringFeatures);
assertFalse(stringFeatures.containsKey("strFeature1"));
assertFalse(stringFeatures.containsKey("strFeature2"));
assertFalse(stringFeatures.containsKey("strFeature3"));
assertTrue(stringFeatures.containsKey("strFeature4"));
assertEquals(1, stringFeatures.size());
}
use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.
the class DeleteStringFeatureFamilyTransformTest method makeFeatureVector.
public FeatureVector makeFeatureVector() {
Map<String, Set<String>> stringFeatures = new HashMap<>();
Set<String> list1 = new HashSet<>();
list1.add("I am a string in string feature 1");
stringFeatures.put("strFeature1", list1);
Set<String> list2 = new HashSet<>();
list2.add("I am a string in string feature 2");
stringFeatures.put("strFeature2", list2);
Set<String> list3 = new HashSet<>();
list3.add("I am a string in string feature 3");
stringFeatures.put("strFeature3", list3);
Set<String> list4 = new HashSet<>();
list4.add("I am a string in string feature 4");
stringFeatures.put("strFeature4", list4);
FeatureVector featureVector = new FeatureVector();
featureVector.setStringFeatures(stringFeatures);
return featureVector;
}
Aggregations