features1.add("good");
features1.add("opinion");
udtf.update(features1, 1, 0.f);
/* check weights */
FeatureValue word1 = FeatureValue.parse(new String("good"));
assertEquals(1.f, udtf.model.get(word1.getFeature()).get(), 1e-5f);
FeatureValue word2 = FeatureValue.parse(new String("opinion"));
assertEquals(1.f, udtf.model.get(word2.getFeature()).get(), 1e-5f);
/* update weights by List<Object> */
List<String> features2 = new ArrayList<String>();
features2.add("bad");
features2.add("opinion");
udtf.update(features2, -1, 0.f);
/* check weights */
assertEquals(1.f, udtf.model.get(word1.getFeature()).get(), 1e-5f);
FeatureValue word3 = FeatureValue.parse(new String("bad"));
assertEquals(-1.f, udtf.model.get(word3.getFeature()).get(), 1e-5f);
FeatureValue word4 = FeatureValue.parse(new String("opinion"));
assertEquals(0.f, udtf.model.get(word4.getFeature()).get(), 1e-5f);
}