コード例 #1
0
        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 = XGBoostNative.XGDMatrixCreateFromMat(data1D, nrows, ncols, Missing, out _handle);

            if (output == -1)
            {
                throw new DllFailException(XGBoostNative.XGBGetLastError());
            }

            if (labels != null)
            {
                Label = labels;
            }
        }