opencv::prelude

Trait LogisticRegressionTraitConst

source
pub trait LogisticRegressionTraitConst: StatModelTraitConst {
    // Required method
    fn as_raw_LogisticRegression(&self) -> *const c_void;

    // Provided methods
    fn get_learning_rate(&self) -> Result<f64> { ... }
    fn get_iterations(&self) -> Result<i32> { ... }
    fn get_regularization(&self) -> Result<i32> { ... }
    fn get_train_method(&self) -> Result<i32> { ... }
    fn get_mini_batch_size(&self) -> Result<i32> { ... }
    fn get_term_criteria(&self) -> Result<TermCriteria> { ... }
    fn predict(
        &self,
        samples: &impl ToInputArray,
        results: &mut impl ToOutputArray,
        flags: i32,
    ) -> Result<f32> { ... }
    fn predict_def(&self, samples: &impl ToInputArray) -> Result<f32> { ... }
    fn get_learnt_thetas(&self) -> Result<Mat> { ... }
}
Expand description

Constant methods for crate::ml::LogisticRegression

Required Methods§

Provided Methods§

source

fn get_learning_rate(&self) -> Result<f64>

Learning rate.

§See also

setLearningRate

source

fn get_iterations(&self) -> Result<i32>

Number of iterations.

§See also

setIterations

source

fn get_regularization(&self) -> Result<i32>

Kind of regularization to be applied. See LogisticRegression::RegKinds.

§See also

setRegularization

source

fn get_train_method(&self) -> Result<i32>

Kind of training method used. See LogisticRegression::Methods.

§See also

setTrainMethod

source

fn get_mini_batch_size(&self) -> Result<i32>

Specifies the number of training samples taken in each step of Mini-Batch Gradient Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It has to take values less than the total number of training samples.

§See also

setMiniBatchSize

source

fn get_term_criteria(&self) -> Result<TermCriteria>

Termination criteria of the algorithm.

§See also

setTermCriteria

source

fn predict( &self, samples: &impl ToInputArray, results: &mut impl ToOutputArray, flags: i32, ) -> Result<f32>

Predicts responses for input samples and returns a float type.

§Parameters
  • samples: The input data for the prediction algorithm. Matrix [m x n], where each row contains variables (features) of one object being classified. Should have data type CV_32F.
  • results: Predicted labels as a column matrix of type CV_32S.
  • flags: Not used.
§C++ default parameters
  • results: noArray()
  • flags: 0
source

fn predict_def(&self, samples: &impl ToInputArray) -> Result<f32>

Predicts responses for input samples and returns a float type.

§Parameters
  • samples: The input data for the prediction algorithm. Matrix [m x n], where each row contains variables (features) of one object being classified. Should have data type CV_32F.
  • results: Predicted labels as a column matrix of type CV_32S.
  • flags: Not used.
§Note

This alternative version of LogisticRegressionTraitConst::predict function uses the following default values for its arguments:

  • results: noArray()
  • flags: 0
source

fn get_learnt_thetas(&self) -> Result<Mat>

This function returns the trained parameters arranged across rows.

For a two class classification problem, it returns a row matrix. It returns learnt parameters of the Logistic Regression as a matrix of type CV_32F.

Object Safety§

This trait is not object safe.

Implementors§