You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ch...@apache.org on 2019/03/20 10:17:10 UTC

[ignite] branch master updated: IGNITE-11561: [ML] IgniteDistributedModel for XGBoost doesn't work in example

This is an automated email from the ASF dual-hosted git repository.

chief pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 9473492  IGNITE-11561: [ML] IgniteDistributedModel for XGBoost doesn't work in example
9473492 is described below

commit 9473492d9187ae8aa0e24dac0138feafeaa4d70f
Author: dmitrievanthony <dm...@gmail.com>
AuthorDate: Wed Mar 20 13:16:34 2019 +0300

    IGNITE-11561: [ML] IgniteDistributedModel for XGBoost doesn't work in
    example
    
    This closes #6289
---
 .../vector/impl/DelegatingNamedVector.java         | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingNamedVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingNamedVector.java
index 149e546..5b45a38 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingNamedVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingNamedVector.java
@@ -17,13 +17,15 @@
 
 package org.apache.ignite.ml.math.primitives.vector.impl;
 
-import org.apache.ignite.ml.math.primitives.vector.NamedVector;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import org.apache.ignite.ml.math.primitives.vector.NamedVector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Delegating named vector that delegates all operations to underlying vector and adds implementation of
@@ -34,7 +36,7 @@ public class DelegatingNamedVector extends DelegatingVector implements NamedVect
     private static final long serialVersionUID = -3425468245964928754L;
 
     /** Map that maps string index on real integer index. */
-    private final Map<String, Integer> map;
+    private Map<String, Integer> map;
 
     /**
      * Constructs a new instance of delegating named vector.
@@ -75,4 +77,18 @@ public class DelegatingNamedVector extends DelegatingVector implements NamedVect
     @Override public Set<String> getKeys() {
         return map.keySet();
     }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(map);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        map = (Map<String, Integer>)in.readObject();
+    }
 }