public DMatrix(float[] data1D, ulong nrows, ulong ncols, float[] labels = null) { int output = XGBOOST_NATIVE_METHODS.XGDMatrixCreateFromMat(data1D, nrows, ncols, Missing, out _handle); if (output == -1) { throw new DllFailException(XGBOOST_NATIVE_METHODS.XGBGetLastError()); } if (labels != null) { Label = labels; } }
public DMatrix(float[][] data, float[] labels = null) { float[] data1D = Flatten2DArray(data); ulong nrows = unchecked ((ulong)data.Length); ulong ncols = unchecked ((ulong)data[0].Length); int output = XGBOOST_NATIVE_METHODS.XGDMatrixCreateFromMat(data1D, nrows, ncols, Missing, out _handle); if (output == -1) { throw new DllFailException(XGBOOST_NATIVE_METHODS.XGBGetLastError()); } if (labels != null) { Label = labels; } }