[ML] IgniteDistributedModel for XGBoost doesn't work in
example
This closes
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();
+ }
}
