Basic binary classification SVM.
More...
#include <binary_svm.h>
|
| BinarySVM (uint64_t features, bool bias_enabled=true) |
| Constructor for BinarySVM 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, float l2_alpha, uint64_t batch_size, uint64_t epochs) |
| Fit model using stochastic gradient descent with given hyperparameters.
|
|
Eigen::MatrixXf | Predict (Eigen::MatrixXf samples, bool sign=true) |
| Get predictions for a given matrix of samples.
|
|
Basic binary classification SVM.
◆ BinarySVM()
plusml::BinarySVM::BinarySVM |
( |
uint64_t | features, |
|
|
bool | bias_enabled = true ) |
|
explicit |
Constructor for BinarySVM 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::BinarySVM::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::BinarySVM::FitSGD |
( |
const Eigen::MatrixXf & | samples, |
|
|
const Eigen::MatrixXf & | targets, |
|
|
float | learning_rate, |
|
|
float | l2_alpha, |
|
|
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 |
l2_alpha | Coefficient for L2 regularization |
batch_size | Batch size for SGD |
epochs | Number of epochs for SGD |
◆ Parameters()
Eigen::MatrixXf plusml::BinarySVM::Parameters |
( |
| ) |
const |
Get current parameters of the model.
- Returns
- Parameters matrix
◆ Predict()
Eigen::MatrixXf plusml::BinarySVM::Predict |
( |
Eigen::MatrixXf | samples, |
|
|
bool | sign = true ) |
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) |
sign | Apply the Sign function to predictions (default: true) |
- Returns
- Matrix of predicted classes (Mx1 where M is number of samples)
◆ SetParameters()
void plusml::BinarySVM::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: