Basic binary logistic regression.
More...
#include <binary_logistic_regression.h>
|
| BinaryLogisticRegression (uint64_t features, bool bias_enabled=true) |
| Constructor for BinaryLogisticRegression class.
|
|
uint64_t | Features () const |
| Get number of features in each sample for the model.
|
|
Eigen::MatrixXf | Parameters () const |
| Get current parameters of the model.
|
|
void | SetParameters (const Eigen::MatrixXf ¶meters) |
| Set desired parameters for the model.
|
|
void | FitSGD (const Eigen::MatrixXf &samples, const Eigen::MatrixXf &targets, float learning_rate, uint64_t batch_size, uint64_t epochs) |
| Fit model using stochastic gradient descent with given hyperparameters.
|
|
Eigen::MatrixXf | Predict (Eigen::MatrixXf samples) |
| Get predictions for a given matrix of samples.
|
|
Basic binary logistic regression.
◆ BinaryLogisticRegression()
plusml::BinaryLogisticRegression::BinaryLogisticRegression |
( |
uint64_t | features, |
|
|
bool | bias_enabled = true ) |
|
explicit |
Constructor for BinaryLogisticRegression class.
- Parameters
-
features | Number of features in each sample |
bias_enabled | Specifies whether to use bias or not |
Initializes model's parameters to zero
◆ Features()
uint64_t plusml::BinaryLogisticRegression::Features |
( |
| ) |
const |
Get number of features in each sample for the model.
- Returns
- Number of features in each sample for the model
◆ FitSGD()
void plusml::BinaryLogisticRegression::FitSGD |
( |
const Eigen::MatrixXf & | samples, |
|
|
const Eigen::MatrixXf & | targets, |
|
|
float | learning_rate, |
|
|
uint64_t | batch_size, |
|
|
uint64_t | epochs ) |
Fit model using stochastic gradient descent with given hyperparameters.
- Parameters
-
samples | Matrix of samples (MxN where M is number of samples and N is number of features in each sample) |
targets | Matrix of targets (Mx1 where M is number of samples) |
learning_rate | Learning rate for SGD |
batch_size | Batch size for SGD |
epochs | Number of epochs for SGD |
◆ Parameters()
Eigen::MatrixXf plusml::BinaryLogisticRegression::Parameters |
( |
| ) |
const |
Get current parameters of the model.
- Returns
- Parameters matrix
◆ Predict()
Eigen::MatrixXf plusml::BinaryLogisticRegression::Predict |
( |
Eigen::MatrixXf | samples | ) |
|
Get predictions for a given matrix of samples.
- Parameters
-
samples | Matrix of samples (MxN where M is number of samples and N is number of features in each sample) |
- Returns
- Matrix of predicted classes (Mx1 where M is number of samples)
◆ SetParameters()
void plusml::BinaryLogisticRegression::SetParameters |
( |
const Eigen::MatrixXf & | parameters | ) |
|
Set desired parameters for the model.
- Parameters
-
parameters | Matrix representing parameters to set |
The documentation for this class was generated from the following files: