Ejemplo n.º 1
0
        /// <summary>
	    /// 初期化
	    /// </summary>
	    /// <param name="_svm_type">SVMの種類</param>
	    /// <param name="_kernel_type">SVMカーネルの種類</param>
	    /// <param name="_degree">poly 用</param>
	    /// <param name="_gamma">poly/rbf/sigmoid 用</param>
	    /// <param name="_coef0">poly/sigmoid 用</param>
	    /// <param name="_C">SVMType.CSvc, SVMType.EpsSvr, SVMType.NuSvr 用</param>
	    /// <param name="_nu">SVMType.NuSvc, SVMType.OneClass, SVMType.NuSvr 用</param>
	    /// <param name="p">SVMType.EpsSvr 用</param>
	    /// <param name="_class_weights">SVMType.CSvc 用</param>
	    /// <param name="_term_crit">終了条件</param>
#else
		/// <summary>
	    /// Constructor
	    /// </summary>
	    /// <param name="_svm_type">Type of SVM</param>
	    /// <param name="_kernel_type">The kernel type</param>
	    /// <param name="_degree">for poly</param>
	    /// <param name="_gamma">for poly/rbf/sigmoid</param>
	    /// <param name="_coef0">for poly/sigmoid</param>
	    /// <param name="_C">for SVMType.CSvc, SVMType.EpsSvr and SVMType.NuSvr</param>
	    /// <param name="_nu">for SVMType.NuSvc, SVMType.OneClass and SVMType.NuSvr</param>
	    /// <param name="_p">for SVMType.EpsSvr</param>
	    /// <param name="_class_weights">for SVMType.CSvc</param>
	    /// <param name="_term_crit">Termination criteria</param>
#endif
		public CvSVMParams(SVMType _svm_type, SVMKernelType _kernel_type, double _degree, double _gamma, double _coef0, 
            double _C, double _nu, double _p, CvMat _class_weights, CvTermCriteria _term_crit )
	    {
            _data = new WCvSVMParams();
            IntPtr _class_weights_ptr = (_class_weights == null) ? IntPtr.Zero : _class_weights.CvPtr;
            MLInvoke.CvSVMParams_construct(ref _data, (int)_svm_type, (int)_kernel_type, _degree, _gamma, _coef0, _C, _nu, _p, _class_weights_ptr, _term_crit);
	    }
Ejemplo n.º 2
0
        /// <summary>
	    /// 初期化
	    /// </summary>
        /// <param name="svmType">SVMの種類</param>
        /// <param name="kernelType">SVMカーネルの種類</param>
        /// <param name="degree">poly 用</param>
        /// <param name="gamma">poly/rbf/sigmoid 用</param>
        /// <param name="coef0">poly/sigmoid 用</param>
	    /// <param name="c">SVMType.CSvc, SVMType.EpsSvr, SVMType.NuSvr 用</param>
	    /// <param name="nu">SVMType.NuSvc, SVMType.OneClass, SVMType.NuSvr 用</param>
	    /// <param name="p">SVMType.EpsSvr 用</param>
        /// <param name="classWeights">SVMType.CSvc 用</param>
        /// <param name="termCrit">終了条件</param>
#else
		/// <summary>
	    /// Constructor
	    /// </summary>
	    /// <param name="svmType">Type of SVM</param>
	    /// <param name="kernelType">The kernel type</param>
	    /// <param name="degree">for poly</param>
	    /// <param name="gamma">for poly/rbf/sigmoid</param>
	    /// <param name="coef0">for poly/sigmoid</param>
	    /// <param name="c">for SVMType.CSvc, SVMType.EpsSvr and SVMType.NuSvr</param>
	    /// <param name="nu">for SVMType.NuSvc, SVMType.OneClass and SVMType.NuSvr</param>
	    /// <param name="p">for SVMType.EpsSvr</param>
	    /// <param name="classWeights">for SVMType.CSvc</param>
	    /// <param name="termCrit">Termination criteria</param>
#endif
		public CvSVMParams(SVMType svmType, SVMKernelType kernelType, double degree, 
            double gamma, double coef0, double c, double nu, double p, 
            CvMat classWeights, CvTermCriteria termCrit )
	    {
            data = new WCvSVMParams();
            NativeMethods.ml_CvSVMParams_new2(
                ref data, (int)svmType, (int)kernelType, degree, gamma, coef0,
                c, nu, p, Cv2.ToPtr(classWeights), termCrit);
	    }