MLpp
ml::LogisticRegression::Result Struct Reference

Result of binomial logistic regression. More...

#include <LogisticRegression.hpp>

Public Member Functions

void predict (Eigen::Ref< const Eigen::MatrixXd > X, Eigen::Ref< Eigen::VectorXd > y) const
 Predicts labels for features X given w. More...
 
Eigen::VectorXd predict (Eigen::Ref< const Eigen::MatrixXd > X) const
 Predicts labels for features X given w. Version which returns a new vector. More...
 
double predict_single (Eigen::Ref< const Eigen::VectorXd > x) const
 Predicts label for feature x given w. More...
 
std::string to_string () const
 Formats the result as string.
 

Public Attributes

Eigen::VectorXd w
 
unsigned int steps_taken
 
bool converged
 

Detailed Description

Result of binomial logistic regression.

Member Function Documentation

◆ predict() [1/2]

void ml::LogisticRegression::Result::predict ( Eigen::Ref< const Eigen::MatrixXd >  X,
Eigen::Ref< Eigen::VectorXd >  y 
) const

Predicts labels for features X given w.

Parameters
XD x N matrix of X values, with data points in columns.
[out]yY vector with length N.
Returns
Fills y with -1 or 1 values.
Exceptions
std::invalid_argumentIf matrix or vector dimensions do not match.

◆ predict() [2/2]

Eigen::VectorXd ml::LogisticRegression::Result::predict ( Eigen::Ref< const Eigen::MatrixXd >  X) const
inline

Predicts labels for features X given w. Version which returns a new vector.

Parameters
XD x N matrix of X values, with data points in columns.
Returns
Vector with -1 or 1 values.
Exceptions
std::invalid_argumentIf matrix or vector dimensions do not match.

◆ predict_single()

double ml::LogisticRegression::Result::predict_single ( Eigen::Ref< const Eigen::VectorXd >  x) const

Predicts label for feature x given w.

Parameters
xD-dimensional vector.
Returns
-1 or 1.
Exceptions
std::invalid_argumentIf vector dimensions do not match.

Member Data Documentation

◆ w

Eigen::VectorXd ml::LogisticRegression::Result::w

Fitted coefficients of the LR model.

◆ steps_taken

unsigned int ml::LogisticRegression::Result::steps_taken

Number of steps taken to converge.

◆ converged

bool ml::LogisticRegression::Result::converged

Did it converge?


The documentation for this struct was generated from the following file: