Пример #1
0
        /// <summary>
        /// ランダムツリーモデルの学習
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#else
        /// <summary>
        /// Trains Random Trees model
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#endif
        public virtual bool Train(
            Mat trainData,
            DTreeDataLayout tflag,
            Mat responses,
            Mat varIdx       = null,
            Mat sampleIdx    = null,
            Mat varType      = null,
            Mat missingMask  = null,
            CvRTParams param = null)
        {
            if (trainData == null)
            {
                throw new ArgumentNullException("trainData");
            }
            if (responses == null)
            {
                throw new ArgumentNullException("responses");
            }

            if (param == null)
            {
                param = new CvRTParams();
            }

            return(NativeMethods.ml_CvRTrees_train_CvMat(
                       ptr,
                       trainData.CvPtr,
                       (int)tflag,
                       responses.CvPtr,
                       Cv2.ToPtr(varIdx),
                       Cv2.ToPtr(sampleIdx),
                       Cv2.ToPtr(varType),
                       Cv2.ToPtr(missingMask),
                       param.CvPtr) != 0);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#else
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#endif
        public bool Train(CvMLData data, CvRTParams param)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (param == null)
            {
                param = new CvRTParams();
            }

            return(NativeMethods.ml_CvERTrees_train2(ptr, data.CvPtr, param.CvPtr) != 0);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#else
        /// <summary>
        ///
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#endif
        public virtual bool Train(
            CvMat trainData,
            int tflag,
            CvMat responses,
            CvMat varIdx      = null,
            CvMat sampleIdx   = null,
            CvMat varType     = null,
            CvMat missingMask = null,
            CvRTParams param  = null)
        {
            if (trainData == null)
            {
                throw new ArgumentNullException("trainData");
            }
            if (responses == null)
            {
                throw new ArgumentNullException("responses");
            }
            trainData.ThrowIfDisposed();
            responses.ThrowIfDisposed();

            if (param == null)
            {
                param = new CvRTParams();
            }

            return(NativeMethods.ml_CvERTrees_train1(
                       ptr,
                       trainData.CvPtr,
                       tflag,
                       responses.CvPtr,
                       Cv2.ToPtr(varIdx),
                       Cv2.ToPtr(sampleIdx),
                       Cv2.ToPtr(varType),
                       Cv2.ToPtr(missingMask),
                       param.CvPtr) != 0);
        }
Пример #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#else
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#endif
        public bool Train(CvMLData data, CvRTParams param)
        {
            if (data == null)
                throw new ArgumentNullException("data");
            if (param == null)
                param = new CvRTParams();

            return NativeMethods.ml_CvERTrees_train2(ptr, data.CvPtr, param.CvPtr) != 0;
        }
Пример #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#else
        /// <summary>
        /// 
        /// </summary>
        /// <param name="trainData"></param>
        /// <param name="tflag"></param>
        /// <param name="responses"></param>
        /// <param name="varIdx"></param>
        /// <param name="sampleIdx"></param>
        /// <param name="varType"></param>
        /// <param name="missingMask"></param>
        /// <param name="param"></param>
        /// <returns></returns>
#endif
        public virtual bool Train(
            CvMat trainData,
            int tflag, 
            CvMat responses, 
            CvMat varIdx = null, 
            CvMat sampleIdx = null,
            CvMat varType = null, 
            CvMat missingMask = null, 
            CvRTParams param = null)
        {
            if (trainData == null)
                throw new ArgumentNullException("trainData");
            if (responses == null)
                throw new ArgumentNullException("responses");
            trainData.ThrowIfDisposed();
            responses.ThrowIfDisposed();

            if (param == null)
                param = new CvRTParams();

            return NativeMethods.ml_CvERTrees_train1(
                ptr,
                trainData.CvPtr, 
                tflag, 
                responses.CvPtr, 
                Cv2.ToPtr(varIdx), 
                Cv2.ToPtr(sampleIdx), 
                Cv2.ToPtr(varType),
                Cv2.ToPtr(missingMask),
                param.CvPtr) != 0;
        }