use of org.apache.ignite.ml.dataset.feature.extractor.impl.BinaryObjectVectorizer in project ignite by apache.
the class KeepBinaryTest method test.
/**
* Startup Ignite, populate cache and train some model.
*/
@Test
public void test() {
IgniteCache<Integer, BinaryObject> dataCache = populateCache(ignite);
KMeansTrainer trainer = new KMeansTrainer();
CacheBasedDatasetBuilder<Integer, BinaryObject> datasetBuilder = new CacheBasedDatasetBuilder<>(ignite, dataCache).withKeepBinary(true);
KMeansModel mdl = trainer.fit(datasetBuilder, new BinaryObjectVectorizer<Integer>("feature1").labeled("label"));
Integer zeroCentre = mdl.predict(VectorUtils.num2Vec(0.0));
assertTrue(mdl.centers()[zeroCentre].get(0) == 0);
}
Aggregations