xgboost4j_2.12 1.2.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package ml
  Definition Classes
    root
-  package dmlc
  Definition Classes
    ml
-  package xgboost4j
  Definition Classes
    dmlc
-  package java
  Definition Classes
    xgboost4j
-  package util
  Definition Classes
    java
- Booster
- DMatrix
- ExternalCheckpointManager
- GpuTestSuite
- IEvaluation
- IObjective
- IRabitTracker
- Rabit
- RabitTracker
- TrackerProperties
- XGBoost
- XGBoostError

c

ml.dmlc.xgboost4j.java

# DMatrix 

###

#### class DMatrix extends AnyRef

DMatrix for xgboost.

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. DMatrix
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new DMatrix(handle: Long)

   used for DMatrix slice

   used for DMatrix slice

   Attributes
     protected[ml.dmlc.xgboost4j.java]
2.  new DMatrix(matrix: BigDenseMatrix, missing: Float)

   create DMatrix from dense matrix

   create DMatrix from dense matrix

   matrix

     instance of BigDenseMatrix

   missing

     the specified value to represent the missing value

3.  new DMatrix(data: Array[Float], nrow: Int, ncol: Int, missing: Float)

   create DMatrix from dense matrix

   create DMatrix from dense matrix

   data

     data values

   nrow

     number of rows

   ncol

     number of columns

   missing

     the specified value to represent the missing value

4.  new DMatrix(matrix: BigDenseMatrix)

   create DMatrix from a BigDenseMatrix

   create DMatrix from a BigDenseMatrix

   matrix

     instance of BigDenseMatrix

   Exceptions thrown

     `XGBoostError` native error

5.  new DMatrix(data: Array[Float], nrow: Int, ncol: Int)

   create DMatrix from dense matrix

   create DMatrix from dense matrix

   data

     data values

   nrow

     number of rows

   ncol

     number of columns

   Exceptions thrown

     `XGBoostError` native error

6.  new DMatrix(headers: Array[Long], indices: Array[Int], data: Array[Float], st: SparseType, shapeParam: Int)

   Create DMatrix from Sparse matrix in CSR/CSC format.

   Create DMatrix from Sparse matrix in CSR/CSC format.

   headers

     The row index of the matrix.

   indices

     The indices of presenting entries.

   data

     The data content.

   st

     Type of sparsity.

   shapeParam

     when st is CSR, it specifies the column number, otherwise it is taken as row number

   Exceptions thrown
7.  new DMatrix(headers: Array[Long], indices: Array[Int], data: Array[Float], st: SparseType)

   Create DMatrix from Sparse matrix in CSR/CSC format.

   Create DMatrix from Sparse matrix in CSR/CSC format.

   headers

     The row index of the matrix.

   indices

     The indices of presenting entries.

   data

     The data content.

   st

     Type of sparsity.

   Exceptions thrown
8.  new DMatrix(dataPath: String)

   Create DMatrix by loading libsvm file from dataPath

   Create DMatrix by loading libsvm file from dataPath

   dataPath

     The path to the data.

   Exceptions thrown
9.  new DMatrix(iter: Iterator[LabeledPoint], cacheInfo: String)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
6.  def dispose(): Unit
7.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
8.  def equals(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
9.  def finalize(): Unit
   Attributes
     protected[ml.dmlc.xgboost4j.java]
   Definition Classes
     DMatrix → AnyRef
10.  def getBaseMargin(): Array[Float]

    Get base margin of the DMatrix.

11.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
12.  def getGroup(): Array[Int]

    Get group sizes of DMatrix

    Get group sizes of DMatrix

    returns

      group size as array

    Exceptions thrown

      `XGBoostError` native error

13.  def getHandle(): Long

    Get the handle

14.  def getLabel(): Array[Float]

    get label values

    get label values

    returns

      label

    Exceptions thrown

      `XGBoostError` native error

15.  def getWeight(): Array[Float]

    get weight of the DMatrix

    get weight of the DMatrix

    returns

      weights

    Exceptions thrown

      `XGBoostError` native error

16.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
17.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
18.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
19.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
20.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
21.  def rowNum(): Long

    get the row number of DMatrix

    get the row number of DMatrix

    returns

      number of rows

    Exceptions thrown

      `XGBoostError` native error

22.  def saveBinary(filePath: String): Unit

    save DMatrix to filePath

23.  def setBaseMargin(baseMargin: Array[Array[Float]]): Unit

    Set base margin (initial prediction).

24.  def setBaseMargin(baseMargin: Array[Float]): Unit

    Set base margin (initial prediction).

    Set base margin (initial prediction).

    The margin must have the same number of elements as the number of rows in this matrix.

25.  def setGroup(group: Array[Int]): Unit

    Set group sizes of DMatrix (used for ranking)

    Set group sizes of DMatrix (used for ranking)

    group

      group size as array

    Exceptions thrown

      `XGBoostError` native error

26.  def setLabel(labels: Array[Float]): Unit

    set label of dmatrix

    set label of dmatrix

    labels

      labels

    Exceptions thrown

      `XGBoostError` native error

27.  def setWeight(weights: Array[Float]): Unit

    set weight of each instance

    set weight of each instance

    weights

      weights

    Exceptions thrown

      `XGBoostError` native error

28.  def slice(rowIndex: Array[Int]): DMatrix

    Slice the DMatrix and return a new DMatrix that only contains `rowIndex`.

    Slice the DMatrix and return a new DMatrix that only contains `rowIndex`.

    rowIndex

      row index

    returns

      sliced new DMatrix

    Exceptions thrown

      `XGBoostError` native error

29.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
30.  def toString(): String
    Definition Classes
      AnyRef → Any
31.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
32.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
33.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped