Logistic Regression model for binary classification tasks.
More...
#include <LogisticRegression.hpp>
|
| | LogisticRegression (double learningRate=0.01, int iterations=1000, bool useBias=true) |
| | Constructor initializing the learning rate and iteration count. More...
|
| |
| void | train (const std::vector< std::vector< double >> &features, const std::vector< int > &labels) |
| | Train the model using features and labels. More...
|
| |
| int | predict (const std::vector< double > &features) const |
| | Predicts the class label for a given input. More...
|
| |
| double | predictProbability (const std::vector< double > &features) const |
| | Predicts the probability of class 1 for a given input. More...
|
| |
Logistic Regression model for binary classification tasks.
◆ LogisticRegression()
| LogisticRegression::LogisticRegression |
( |
double |
learningRate = 0.01, |
|
|
int |
iterations = 1000, |
|
|
bool |
useBias = true |
|
) |
| |
|
inline |
Constructor initializing the learning rate and iteration count.
- Parameters
-
| learningRate | The rate at which the model learns. |
| iterations | Number of training iterations. |
| useBias | Whether to include a bias term. |
◆ predict()
| int LogisticRegression::predict |
( |
const std::vector< double > & |
features | ) |
const |
|
inline |
Predicts the class label for a given input.
- Parameters
-
| features | Input feature vector. |
- Returns
- Predicted class label (0 or 1).
◆ predictProbability()
| double LogisticRegression::predictProbability |
( |
const std::vector< double > & |
features | ) |
const |
|
inline |
Predicts the probability of class 1 for a given input.
- Parameters
-
| features | Input feature vector. |
- Returns
- Probability of the input belonging to class 1.
◆ train()
| void LogisticRegression::train |
( |
const std::vector< std::vector< double >> & |
features, |
|
|
const std::vector< int > & |
labels |
|
) |
| |
|
inline |
Train the model using features and labels.
- Parameters
-
| features | Input feature matrix. |
| labels | Binary labels (0 or 1). |
The documentation for this class was generated from the following file: