mrk-andreev commented on a change in pull request #8466:
URL: https://github.com/apache/ignite/pull/8466#discussion_r535917147



##########
File path: 
modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java
##########
@@ -343,6 +441,81 @@ else if (lbVal instanceof Double)
         return categoryFrequencies;
     }
 
+    /**
+     * Updates frequencies by values and features.
+     *
+     * @param row Feature vector.
+     * @param targetCounters Holds the frequencies of categories by values and 
features.
+     * @return target counter.
+     */
+    private TargetCounter[] updateTargetCountersForNextRow(LabeledVector row,
+                                                           TargetCounter[] 
targetCounters) {
+        if (targetCounters == null)
+            targetCounters = initializeTargetCounters(row);
+        else
+            assert targetCounters.length == row.size() : "Base preprocessor 
must return exactly "
+                + targetCounters.length + " features";
+
+        double targetValue = row.features().get(targetLabelIndex);
+
+        for (int i = 0; i < targetCounters.length; i++) {
+            if (handledIndices.contains(i)) {
+                String strVal;
+                Object featureVal = row.features().getRaw(i);
+
+                if (featureVal.equals(Double.NaN)) {
+                    strVal = EncoderPreprocessor.KEY_FOR_NULL_VALUES;
+                    row.features().setRaw(i, strVal);
+                }
+                else if (featureVal instanceof String)
+                    strVal = (String)featureVal;
+                else if (featureVal instanceof Double)

Review comment:
       Add `Number` & `Boolean`




----------------------------------------------------------------
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:
[email protected]


Reply via email to