single layer perceptron implementation using nn::Linear
More...
#include <perceptron.h>
|
| perceptron (std::vector< std::vector< double > > const &, const int epochs=100, const double learning_rate=0.001) |
| default constructor for perceptron class
|
|
void | fit () |
| fit a single perceptron on the input data
|
|
double | predict (std::vector< double > const &) |
| performs inference, classifying to 1 or -1
|
|
single layer perceptron implementation using nn::Linear
◆ perceptron()
perceptron::perceptron |
( |
std::vector< std::vector< double > > const & | data, |
|
|
const int | epochs = 100, |
|
|
const double | learning_rate = 0.001 ) |
|
inlineexplicit |
default constructor for perceptron class
- Parameters
-
data | 2D vector, The input data. As usual, the last element of each sub-vector represents the label of the row |
epochs(int) | The number of epochs |
learning_rate(double) | The learning rate |
◆ predict()
double perceptron::predict |
( |
std::vector< double > const & | input | ) |
|
|
inline |
performs inference, classifying to 1 or -1
- Parameters
-
input | 1D vector, the passed validation data |
- Returns
- double: 1.0 or -1.0(binary)
The documentation for this class was generated from the following file:
- /Users/runner/work/AlgoPlus/AlgoPlus/src/machine_learning/nn/perceptron.h