PredictForMatsMulti() public method

public PredictForMatsMulti ( PredictType predictType, Array data, int startIteration, int numIteration ) : ].double[
predictType PredictType
data Array
startIteration int
numIteration int
return ].double[
Exemplo n.º 1
0
        /// <summary>
        /// Evaluates the native LightGBM model on the given feature vector
        /// </summary>
        /// <param name="predictType"></param>
        /// <param name="row"></param>
        /// <returns></returns>
        public double[,] Evaluate(Booster.PredictType predictType, float[][] rows, int startIteration, int numIterations)
        {
            if (Booster == null)
            {
                throw new Exception("Model has not been trained");
            }
            var rslt = Booster.PredictForMatsMulti(predictType, rows, startIteration, numIterations);

            return(rslt);
        }
Exemplo n.º 2
0
        public override double[][] GetOutputs(float[][] rows)
        {
            var output = Booster.PredictForMatsMulti(Booster.PredictType.Normal, rows, MaxNumTrees);

            // convert from 2D array to array of rows
            var numRows = output.GetLength(0);
            var numCols = output.GetLength(1);
            var rslt    = new double[numRows][];

            for (int i = 0; i < rslt.Length; i++)
            {
                var row = new double[numCols];
                for (int j = 0; j < row.Length; j++)
                {
                    row[j] = output[i, j];
                }
                rslt[i] = row;
            }
            return(rslt);
        }