Alien-XGBoost

 view release on metacpan or  search on metacpan

xgboost/jvm-packages/xgboost4j/src/main/scala/ml/dmlc/xgboost4j/scala/rabit/handler/RabitWorkerHandler.scala  view on Meta::CPAN

      // echo back the magic number
      connection ! Tcp.Write(magic)
      goto(AwaitingCommand) using StructTrackerCommand
  }

  when(AwaitingCommand) {
    case Event(Tcp.Received(bytes), validator) =>
      bytes.asByteBuffers.foreach { buf => readBuffer.put(buf) }
      if (validator.verify(readBuffer)) {
        Try(decodeCommand(readBuffer)) match {
          case scala.util.Success(decodedCommand) =>
            tracker ! decodedCommand
          case scala.util.Failure(th: java.nio.BufferUnderflowException) =>
            // BufferUnderflowException would occur if the message to print has not arrived yet.
            // Do nothing, wait for next Tcp.Received event
          case scala.util.Failure(th: Throwable) => throw th
        }
      }

      stay
    // when rank for a worker is assigned, send encoded rank information
    // back to worker over Tcp socket.

xgboost/jvm-packages/xgboost4j/src/main/scala/ml/dmlc/xgboost4j/scala/rabit/handler/RabitWorkerHandler.scala  view on Meta::CPAN

    IntField, IntField, StringField, StringField
  ), 0)

  // ---- Messages between RabitTrackerHandler and RabitTrackerConnectionHandler ----

  // RabitWorkerHandler --> RabitTrackerHandler
  sealed trait RabitWorkerRequest
  // RabitWorkerHandler <-- RabitTrackerHandler
  sealed trait RabitWorkerResponse

  // Representations of decoded worker commands.
  abstract class TrackerCommand(val command: String) extends RabitWorkerRequest {
    def rank: Int
    def worldSize: Int
    def jobId: String

    def encode: ByteString = {
      val buf = ByteBuffer.allocate(4 * 4 + jobId.length + command.length)
        .order(ByteOrder.nativeOrder())

      buf.putInt(rank).putInt(worldSize).putInt(jobId.length).put(jobId.getBytes())

xgboost/src/tree/updater_basemaker-inl.h  view on Meta::CPAN

      const int nid = qexpand[i];
      if (!tree[nid].is_leaf()) {
        newnodes.push_back(tree[nid].cleft());
        newnodes.push_back(tree[nid].cright());
      }
    }
    // use new nodes for qexpand
    qexpand = newnodes;
    this->UpdateNode2WorkIndex(tree);
  }
  // return decoded position
  inline int DecodePosition(bst_uint ridx) const {
    const int pid = position[ridx];
    return pid < 0 ? ~pid : pid;
  }
  // encode the encoded position value for ridx
  inline void SetEncodePosition(bst_uint ridx, int nid) {
    if (position[ridx] < 0) {
      position[ridx] = ~nid;
    } else {
      position[ridx] = nid;

xgboost/src/tree/updater_colmaker.cc  view on Meta::CPAN

                this->SetEncodePosition(ridx, tree[nid].cleft());
              } else {
                this->SetEncodePosition(ridx, tree[nid].cright());
              }
            }
          }
        }
      }
    }
    // utils to get/set position, with encoded format
    // return decoded position
    inline int DecodePosition(bst_uint ridx) const {
      const int pid = position[ridx];
      return pid < 0 ? ~pid : pid;
    }
    // encode the encoded position value for ridx
    inline void SetEncodePosition(bst_uint ridx, int nid) {
      if (position[ridx] < 0) {
        position[ridx] = ~nid;
      } else {
        position[ridx] = nid;



( run in 0.277 second using v1.01-cache-2.11-cpan-26ccb49234f )