public TreeVisitor( CompressedTree ct ) { _ts = new AutoBuffer((_ct=ct)._bits); _gcmp = new IcedBitSet(0); }
/** * @param tree binary form of a singlenoderf.Tree * @return AutoBuffer that contain all bytes in the singlenoderf.Tree */ public static byte[] toDTreeCompressedTreeAB(byte[] tree, boolean regression) { AutoBuffer ab = new AutoBuffer(tree); AutoBuffer result = new AutoBuffer(); return toDTreeCompressedTree(ab, regression).buf(); }
public JsonObject toJSON() { final String json = new String(writeJSON(new AutoBuffer()).buf()); if (json.length() == 0) return new JsonObject(); JsonObject jo = (JsonObject)new JsonParser().parse(json); jo.remove("Request2"); jo.remove("response_info"); return jo; }
public JsonObject toJSON() { final String json = new String(writeJSON(new AutoBuffer()).buf()); if (json.length() == 0) return new JsonObject(); JsonObject jo = (JsonObject)new JsonParser().parse(json); jo.addProperty("id", this.getId()); return jo; } }
static void build_and_multicast( H2O cloud, HeartBeat hb ) { // Paxos.print_debug("send: heartbeat ",cloud._memset); assert hb._cloud_hash != 0; // Set before send, please H2O.SELF._heartbeat = hb; hb.write(new AutoBuffer(H2O.SELF).putUdp(UDP.udp.heartbeat)).close(); } }
static public String printx16( long lo, long hi ) { set8(pbuf,0,lo); set8(pbuf,8,hi); return udp.UDPS[(int)(lo&0xFF)]._udp.print16(new AutoBuffer(pbuf)); }
public Value(Key k, Freezable pojo) { _key = k; _pojo = pojo; _type = (short)pojo.frozenType(); _mem = pojo.write(new AutoBuffer()).buf(); _max = _mem.length; _persist = ICE; _rwlock = new AtomicInteger(0); _replicas = k.home() ? new NonBlockingSetInt() : null; } // Nullary constructor for weaving
public DataInfo deep_clone() { AutoBuffer ab = new AutoBuffer(); this.write(ab); ab.flipForReading(); return new DataInfo().read(ab); }
Errors deep_clone() { AutoBuffer ab = new AutoBuffer(); this.write(ab); ab.flipForReading(); return new Errors().read(ab); }
DeepLearningModelInfo deep_clone() { AutoBuffer ab = new AutoBuffer(); this.write(ab); ab.flipForReading(); return new DeepLearningModelInfo().read(ab); }
public void send(H2ONode target) { assert this != none; new AutoBuffer(target).putUdp(udp.rebooted).put1(ordinal()).close(); } public void broadcast() { send(H2O.SELF); }
public Key toCompressedKey() { AutoBuffer bs = new AutoBuffer(); TreeModel.CompressedTree compressedTree = compress(); Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF); UKV.put(key, new Value(key, compressedTree)); return key; }
public <T extends Iced> T get() { touch(); Iced pojo = (Iced)_pojo; // Read once! if( pojo != null ) return (T)pojo; pojo = TypeMap.newInstance(_type); pojo.read(new AutoBuffer(memOrLoad())); pojo.init(_key); return (T)(_pojo = pojo); } public <T extends Freezable> T get(Class<T> fc) {
public <T extends Freezable> T getFreezable() { touch(); Freezable pojo = _pojo; // Read once! if( pojo != null ) return (T)pojo; pojo = TypeMap.newFreezable(_type); pojo.read(new AutoBuffer(memOrLoad())); if( pojo instanceof Iced ) ((Iced)pojo).init(_key); return (T)(_pojo = pojo); }
public CompressedTree compress(int tid, int cls, String[][] domains) { int sz = root().size(); if( root() instanceof LeafNode ) sz += 3; // Oops - tree-stump AutoBuffer ab = new AutoBuffer(sz); _abAux = new AutoBuffer(); if( root() instanceof LeafNode ) // Oops - tree-stump ab.put1(0).put2((char)65535); // Flag it special so the decompress doesn't look for top-level decision root().compress(ab, _abAux); // Compress whole tree assert ab.position() == sz; return new CompressedTree(ab.buf(), _seed,tid,cls); }
AutoBuffer call(AutoBuffer ab) { int tnum = ab.getTask(); RPC<?> t = ab._h2o.taskGet(tnum); assert t== null || t._tasknum == tnum; if( t != null ) t.response(ab); // Do the 2nd half of this task, includes ACKACK else ab.close(); // Else forgotten task, but still must ACKACK return new AutoBuffer(ab._h2o).putTask(UDP.udp.ackack.ordinal(),tnum); }
public static void assertModelBinaryEquals(Model a, Model b) { assertArrayEquals("The serialized models are not binary same!", a.write(new AutoBuffer()).buf(), b.write(new AutoBuffer()).buf()); }
public static void assertIcedBinaryEquals(String msg, Iced a, Iced b) { if (a == null) { Assert.assertEquals(msg, null, b); } else { assertArrayEquals(msg, a.write(new AutoBuffer()).buf(), b.write(new AutoBuffer()).buf()); } }
public Key toKey() { AutoBuffer bs = new AutoBuffer(); bs.put4(_data_id); bs.put8(_seed); bs.put1(_producerId); _tree.write(bs); Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF); DKV.put(key,new Value(key, bs.buf())); return key; }
public TreeModel.CompressedTree compress() { int sz = root().size(); if( root() instanceof LeafNode ) sz += 3; // Oops - tree-stump AutoBuffer ab = new AutoBuffer(sz); if( root() instanceof LeafNode ) // Oops - tree-stump ab.put1(0).put2((char)65535); // Flag it special so the decompress doesn't look for top-level decision root().compress(ab); // Compress whole tree assert ab.position() == sz; return new TreeModel.CompressedTree(ab.buf(),_nclass,_seed); } /** Save this tree into DKV store under default random Key. */