Search in sources :

Example 26 with FeatureVector

use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.

the class FloatToDenseTransformTest method makeFeatureVectorPartial.

public FeatureVector makeFeatureVectorPartial() {
    Map<String, Map<String, Double>> floatFeatures = new HashMap<>();
    Map<String, Double> floatFeature1 = new HashMap<>();
    floatFeature1.put("x", 50.0);
    floatFeature1.put("s", 2000.0);
    Map<String, Double> floatFeature2 = new HashMap<>();
    floatFeature2.put("z", 2000.0);
    floatFeature2.put("k", 2000.0);
    floatFeatures.put("floatFeature1", floatFeature1);
    floatFeatures.put("floatFeature2", floatFeature2);
    FeatureVector featureVector = new FeatureVector();
    featureVector.setFloatFeatures(floatFeatures);
    return featureVector;
}
Also used : FeatureVector(com.airbnb.aerosolve.core.FeatureVector) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 27 with FeatureVector

use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.

the class FloatToDenseTransformTest method makeFeatureVectorString.

public FeatureVector makeFeatureVectorString() {
    Map<String, Map<String, Double>> floatFeatures = new HashMap<>();
    Map<String, Double> floatFeature1 = new HashMap<>();
    floatFeature1.put("s", 2000.0);
    Map<String, Double> floatFeature2 = new HashMap<>();
    floatFeature2.put("k", 2000.0);
    floatFeatures.put("floatFeature1", floatFeature1);
    floatFeatures.put("floatFeature2", floatFeature2);
    FeatureVector featureVector = new FeatureVector();
    featureVector.setFloatFeatures(floatFeatures);
    return featureVector;
}
Also used : FeatureVector(com.airbnb.aerosolve.core.FeatureVector) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 28 with FeatureVector

use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.

the class FloatToDenseTransformTest method testPartial.

@Test
public void testPartial() {
    FeatureVector featureVector = testTransform(makeFeatureVectorPartial());
    Map<String, List<Double>> denseFeatures = featureVector.getDenseFeatures();
    assertNull(denseFeatures);
}
Also used : FeatureVector(com.airbnb.aerosolve.core.FeatureVector) List(java.util.List) Test(org.junit.Test)

Example 29 with FeatureVector

use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.

the class FloatToDenseTransformTest method testFloat.

@Test
public void testFloat() {
    FeatureVector featureVector = testTransform(makeFeatureVectorFloat());
    Map<String, Map<String, Double>> features = featureVector.getFloatFeatures();
    assertNotNull(features);
    assertEquals(2, features.size());
    Map<String, Double> out = features.get("floatFeature1");
    assertEquals(2, out.size());
}
Also used : FeatureVector(com.airbnb.aerosolve.core.FeatureVector) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 30 with FeatureVector

use of com.airbnb.aerosolve.core.FeatureVector in project aerosolve by airbnb.

the class FloatToDenseTransformTest method testMissFamily.

@Test
public void testMissFamily() {
    FeatureVector featureVector = testTransform(makeFeatureVectorMissFamily());
    Map<String, List<Double>> denseFeatures = featureVector.getDenseFeatures();
    assertNull(denseFeatures);
}
Also used : FeatureVector(com.airbnb.aerosolve.core.FeatureVector) List(java.util.List) Test(org.junit.Test)

Aggregations

FeatureVector (com.airbnb.aerosolve.core.FeatureVector)225 Test (org.junit.Test)154 Config (com.typesafe.config.Config)117 Set (java.util.Set)59 HashMap (java.util.HashMap)58 HashSet (java.util.HashSet)50 Map (java.util.Map)46 ArrayList (java.util.ArrayList)11 Example (com.airbnb.aerosolve.core.Example)9 List (java.util.List)9 ModelRecord (com.airbnb.aerosolve.core.ModelRecord)5 ModelHeader (com.airbnb.aerosolve.core.ModelHeader)4 BufferedReader (java.io.BufferedReader)4 IOException (java.io.IOException)4 MulticlassScoringResult (com.airbnb.aerosolve.core.MulticlassScoringResult)3 BufferedWriter (java.io.BufferedWriter)3 CharArrayWriter (java.io.CharArrayWriter)3 StringReader (java.io.StringReader)3 DebugScoreRecord (com.airbnb.aerosolve.core.DebugScoreRecord)2 SimpleEntry (java.util.AbstractMap.SimpleEntry)2