pub fn train(&self, parameters: &SvmParam) -> Result<SvmModel> {
        let c_prob = &self.c_problem;
        let c_params: *const sys::CSVMParameter = &parameters.to_c();
        unsafe {
            let result: *const i8 = sys::svm_check_parameter(c_prob, c_params);
            if result.is_null() {
                Ok(SvmModel { c_model: sys::svm_train(c_prob, c_params) })
            } else {
                let c_str: &CStr = CStr::from_ptr(result);
                let buf: &[u8] = c_str.to_bytes();
                Err(SvmErr::ParamError(match str::from_utf8(buf) {
                    Ok(s) => format!("Invalid parameters. Error message: {}", s),
                    Err(_) => "Invalid parameters.".to_owned()
                }))
            }
        }
    }
/// Construct and return an SVM model according to the given training data and parameters.
Construct and return an SVM model according to the given training data and parameters.
Construct and return an SVM model according to the given training data and parameters .
pub fn train(&self, parameters: &SvmParam) -> Result<SvmModel> {
        let c_prob = &self.c_problem;
        let c_params: *const sys::CSVMParameter = &parameters.to_c();
        unsafe {
            let result: *const i8 = sys::svm_check_parameter(c_prob, c_params);
            if result.is_null() {
                Ok(SvmModel { c_model: sys::svm_train(c_prob, c_params) })
            } else {
                let c_str: &CStr = CStr::from_ptr(result);
                let buf: &[u8] = c_str.to_bytes();
                Err(SvmErr::ParamError(match str::from_utf8(buf) {
                    Ok(s) => format!("Invalid parameters. Error message: {}", s),
                    Err(_) => "Invalid parameters.".to_owned()
                }))
            }
        }
    }
pub fn train ( & self , parameters : & SvmParam ) -> Result < SvmModel > { let c_prob = & self . c_problem ; let c_params : * const sys :: CSVMParameter = & parameters . to_c ( ) ; unsafe { let result : * const i8 = sys :: svm_check_parameter ( c_prob , c_params ) ; if result . is_null ( ) { Ok ( SvmModel { c_model : sys :: svm_train ( c_prob , c_params ) } ) } else { let c_str : & CStr = CStr :: from_ptr ( result ) ; let buf : & [ u8 ] = c_str . to_bytes ( ) ; Err ( SvmErr :: ParamError ( match str :: from_utf8 ( buf ) { Ok ( s ) => format ! ( " " s ) , Err ( _ ) => " " . to_owned ( ) } ) ) } } }
Construct and return an SVM model according to the given training data and parameters.
Construct and return an SVM model according to the given training data and parameters .
&self
parameters
&SvmParam
&self
parameters
&SvmParam