public unsafe double[,] PredictForMatsMulti(PredictType predictType, float[][] data, int numIteration = -1) { if (predictType == PredictType.LeafIndex) { throw new NotImplementedException("TODO: PredictType.LeafIndex"); } var outResult = new double[data.Length, NumClasses]; if (data.Length > 0) { long outLen = outResult.GetLength(0) * outResult.GetLength(1); var hdl = GCHandle.Alloc(outResult, GCHandleType.Pinned); try { PInvokeException.Check(PInvoke.BoosterPredictForMats(Handle , data , /*nCol*/ data[0].Length , (PInvoke.CApiPredictType)predictType , (numIteration == -1) ? BestIteration : numIteration , "" , outLen , (double *)hdl.AddrOfPinnedObject().ToPointer() ), nameof(PInvoke.BoosterPredictForMats)); } finally { if (hdl.IsAllocated) { hdl.Free(); } } } return(outResult); }
public unsafe double[] PredictForMats(PredictType predictType, float[][] data, int numIteration = -1) { if (predictType == PredictType.LeafIndex) { throw new NotImplementedException("TODO: PredictType.LeafIndex"); } if (NumClasses != 1) { throw new Exception("Call PredictForMatsMulti when NumClasses > 1"); } var outResult = new double[data.Length]; if (data.Length > 0) { fixed(double *ptr = outResult) PInvokeException.Check(PInvoke.BoosterPredictForMats(Handle , data , /*nCol*/ data[0].Length , (PInvoke.CApiPredictType)predictType , (numIteration == -1) ? BestIteration : numIteration , "" , outResult.Length , ptr ), nameof(PInvoke.BoosterPredictForMats)); } return(outResult); }