Exemplo n.º 1
0
        /// <summary>
        /// ブーストされた分類器の学習
        /// </summary>
        /// <param name="train_data"></param>
		/// <param name="tflag"></param>
        /// <param name="responses"></param>
		/// <param name="var_idx"></param>
        /// <param name="sample_idx"></param>
        /// <param name="var_type"></param>
        /// <param name="missing_mask"></param>
        /// <param name="params"></param>
		/// <returns></returns>
#else
		/// <summary>
        /// Trains boosted tree classifier
        /// </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="params"></param>
		/// <returns></returns>
#endif
		public virtual bool Train(CvMat trainData, DTreeDataLayout tflag, CvMat responses, 
			CvMat varIdx, CvMat sampleIdx, CvMat varType, CvMat missingMask, 
			CvBoostParams @params )
		{    
			return Train(trainData, tflag, responses, varIdx, sampleIdx, varType, missingMask, @params, false);
		}
Exemplo n.º 2
0
        /// <summary>
        /// ブーストされた分類器の学習
        /// </summary>
        /// <param name="train_data"></param>
		/// <param name="tflag"></param>
        /// <param name="responses"></param>
		/// <param name="var_idx"></param>
        /// <param name="sample_idx"></param>
        /// <param name="var_type"></param>
        /// <param name="missing_mask"></param>
        /// <param name="params"></param>
		/// <param name="update"></param>
		/// <returns></returns>
#else
		/// <summary>
        /// Trains boosted tree classifier
        /// </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="params"></param>
        /// <param name="update"></param>
		/// <returns></returns>
#endif
		public virtual bool Train(CvMat trainData, DTreeDataLayout tflag, CvMat responses, 
			CvMat varIdx, CvMat sampleIdx, CvMat varType, CvMat missingMask, 
			CvBoostParams @params, Boolean update )
		{    
			if (trainData == null)
                throw new ArgumentNullException("trainData");
            if (responses == null)
                throw new ArgumentNullException("responses");
			
			if(@params == null)
				@params = new CvBoostParams();

            IntPtr varIdxPtr = (varIdx == null) ? IntPtr.Zero : varIdx.CvPtr;
            IntPtr sampleIdxPtr = (sampleIdx == null) ? IntPtr.Zero : sampleIdx.CvPtr;
            IntPtr varTypePtr = (varType == null) ? IntPtr.Zero : varType.CvPtr;
            IntPtr missingMaskPtr = (missingMask == null) ? IntPtr.Zero : missingMask.CvPtr;

			return MLInvoke.CvBoost_train(
                ptr,
				trainData.CvPtr, 
				(int)tflag,
				responses.CvPtr,
				varIdxPtr, 
                sampleIdxPtr, 
                varTypePtr, 
                missingMaskPtr,
				@params.CvPtr,
				update
			);
		}
Exemplo n.º 3
0
        /// <summary>
        /// 学習データを与えて初期化
        /// </summary>
        /// <param name="train_data"></param>
		/// <param name="tflag"></param>
        /// <param name="responses"></param>
		/// <param name="var_idx"></param>
        /// <param name="sample_idx"></param>
        /// <param name="var_type"></param>
        /// <param name="missing_mask"></param>
        /// <param name="params"></param>
#else
		/// <summary>
        /// Training constructor
        /// </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="params"></param>
#endif
		public CvBoost(CvMat trainData, DTreeDataLayout tflag, CvMat responses, 
			CvMat varIdx, CvMat sampleIdx, CvMat varType, CvMat missingMask, CvBoostParams @params )
		{    
			if (trainData == null)
                throw new ArgumentNullException("trainData");
            if (responses == null)
                throw new ArgumentNullException("responses");
			
			if(@params == null)
				@params = new CvBoostParams();

            IntPtr varIdxPtr = (varIdx == null) ? IntPtr.Zero : varIdx.CvPtr;
            IntPtr sampleIdxPtr = (sampleIdx == null) ? IntPtr.Zero : sampleIdx.CvPtr;
            IntPtr varTypePtr = (varType == null) ? IntPtr.Zero : varType.CvPtr;
            IntPtr missingMaskPtr = (missingMask == null) ? IntPtr.Zero : missingMask.CvPtr;

			ptr = MLInvoke.CvBoost_construct_training(
				trainData.CvPtr, 
				(int)tflag,
				responses.CvPtr,
				varIdxPtr, 
                sampleIdxPtr, 
                varTypePtr, 
                missingMaskPtr,
				@params.CvPtr
			);

			NotifyMemoryPressure(SizeOf);
		}