/// <summary> /// Get the default Decision tree training parameters /// </summary> /// <returns>The default Decision tree training parameters</returns> public static MCvBoostParams GetDefaultParameter() { IntPtr ptr = MlInvoke.CvBoostParamsCreate(); MCvBoostParams p = (MCvBoostParams)Marshal.PtrToStructure(ptr, typeof(MCvBoostParams)); MlInvoke.CvBoostParamsRelease(ref ptr); return(p); }
/// <summary> /// Train the boost tree using the specific traning data /// </summary> /// <param name="trainData">The training data. A 32-bit floating-point, single-channel matrix, one vector per row</param> /// <param name="tflag">data layout type</param> /// <param name="responses">A floating-point matrix of the corresponding output vectors, one vector per row. </param> /// <param name="varIdx">Can be null if not needed. When specified, identifies variables (features) of interest. It is a Matrix>int< of nx1</param> /// <param name="sampleIdx">Can be null if not needed. When specified, identifies samples of interest. It is a Matrix>int< of nx1</param> /// <param name="varType">The types of input variables</param> /// <param name="missingMask">Can be null if not needed. When specified, it is an 8-bit matrix of the same size as <paramref name="trainData"/>, is used to mark the missed values (non-zero elements of the mask)</param> /// <param name="param">The parameters for training the boost tree</param> /// <param name="update">specifies whether the classifier needs to be updated (i.e. the new weak tree classifiers added to the existing ensemble), or the classifier needs to be rebuilt from scratch</param> /// <returns></returns> public bool Train( Matrix<float> trainData, MlEnum.DATA_LAYOUT_TYPE tflag, Matrix<float> responses, Matrix<Byte> varIdx, Matrix<Byte> sampleIdx, Matrix<Byte> varType, Matrix<Byte> missingMask, MCvBoostParams param, bool update) { return MlInvoke.CvBoostTrain( _ptr, trainData.Ptr, tflag, responses.Ptr, varIdx == null ? IntPtr.Zero : varIdx.Ptr, sampleIdx == null ? IntPtr.Zero : sampleIdx.Ptr, varType == null ? IntPtr.Zero : varType.Ptr, missingMask == null ? IntPtr.Zero : missingMask.Ptr, param, update); }
public static extern bool CvBoostTrain( IntPtr model, IntPtr trainData, MlEnum.DATA_LAYOUT_TYPE tFlag, IntPtr responses, IntPtr varIdx, IntPtr sampleIdx, IntPtr varType, IntPtr missingMask, MCvBoostParams param, [MarshalAs(UnmanagedType.I1)] bool update);