You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2019/03/21 15:02:19 UTC

[GitHub] [ignite] dmitrievanthony commented on a change in pull request #6232: IGNITE-11449: Vectorizer API for feature/label extracting

dmitrievanthony commented on a change in pull request #6232: IGNITE-11449: Vectorizer API for feature/label extracting
URL: https://github.com/apache/ignite/pull/6232#discussion_r267770654
 
 

 ##########
 File path: examples/src/main/java/org/apache/ignite/examples/ml/TrainingWithBinaryObjectExample.java
 ##########
 @@ -49,17 +48,14 @@ public static void main(String[] args) throws Exception {
             CacheBasedDatasetBuilder<Integer, BinaryObject> datasetBuilder =
                 new CacheBasedDatasetBuilder<>(ignite, dataCache).withKeepBinary(true);
 
-            //
-            IgniteBiFunction<Integer, BinaryObject, Vector> featureExtractor
-                = (k, v) -> VectorUtils.of(new double[] {v.field("feature1")});
-
-            IgniteBiFunction<Integer, BinaryObject, Double> lbExtractor = (k, v) -> (double)v.field("label");
+            Vectorizer<Integer, BinaryObject, String, Double> vectorizer =
+                new BinaryObjectVectorizer<Integer>("feature1").labeled("label");
 
             KMeansTrainer trainer = new KMeansTrainer();
-
-            KMeansModel kmdl = trainer.fit(datasetBuilder, featureExtractor, lbExtractor);
+            KMeansModel kmdl = trainer.fit(datasetBuilder, vectorizer);
 
             System.out.println(">>> Model trained over binary objects. Model " + kmdl);
+            dataCache.destroy();
 
 Review comment:
   Try-finally, please?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services