philsupertramp/game-math
Loading...
Searching...
No Matches
Public Member Functions | List of all members
AdalineGD Class Reference

#include <AdalineGD.h>

Inheritance diagram for AdalineGD:
ANNClassifier Classifier Predictor

Public Member Functions

 AdalineGD (double _eta=0.01, int iter=10)
 
void fit (const Matrix< double > &X, const Matrix< double > &y) override
 
Matrix< double > netInput (const Matrix< double > &X) override
 
Matrix< double > activation (const Matrix< double > &X) override
 
Matrix< double > predict (const Matrix< double > &X) override
 
double costFunction (const Matrix< double > &X) override
 
- Public Member Functions inherited from ANNClassifier
 ANNClassifier (double _eta, int _n_iter)
 
virtual Matrix< double > activation (const Matrix< double > &)=0
 
virtual Matrix< double > netInput (const Matrix< double > &)=0
 
virtual double costFunction (const Matrix< double > &)=0
 
- Public Member Functions inherited from Classifier
 Classifier ()
 
void initialize_weights (size_t numRows, size_t numColumns=1)
 
void update_weights (const Matrix< double > &update, const Matrix< double > &delta)
 
Matrix< double > transform (const Matrix< double > &in) override
 
virtual void fit (const Matrix< double > &X, const Matrix< double > &y)=0
 
virtual Matrix< double > predict (const Matrix< double > &)=0
 
virtual Matrix< double > transform (const Matrix< double > &)=0
 

Additional Inherited Members

- Public Attributes inherited from Classifier
Matrix< double > weights
 Vector holding weights. More...
 
Matrix< double > costs
 Vector holding classification error per epoch. More...
 
- Protected Attributes inherited from ANNClassifier
double eta
 Learning rate. More...
 
int n_iter
 number epochs More...
 
- Protected Attributes inherited from Classifier
bool w_initialized = false
 flag to initialize weights only once More...
 

Detailed Description

Adaline neuron classifier using gradient decent method

Examples
ds/TestAdalineGD.cpp.

Constructor & Destructor Documentation

◆ AdalineGD()

AdalineGD::AdalineGD ( double  _eta = 0.01,
int  iter = 10 
)
inlineexplicit

default constructor

Parameters
_etalearning rate
itermax number iterations

Member Function Documentation

◆ activation()

Matrix< double > AdalineGD::activation ( const Matrix< double > &  X)
inlineoverridevirtual

activates given input

Parameters
Xinput
Returns
activated input

Implements ANNClassifier.

◆ costFunction()

double AdalineGD::costFunction ( const Matrix< double > &  X)
inlineoverridevirtual

calculates cost

$$\frac{\sum X^2}{2}

Parameters
Xinput values
Returns
squared cost

Implements ANNClassifier.

◆ fit()

void AdalineGD::fit ( const Matrix< double > &  X,
const Matrix< double > &  y 
)
inlineoverridevirtual

fit method to train the classifier using gradient decent method

Parameters
Xinput
ytarget output

Implements Predictor.

◆ netInput()

Matrix< double > AdalineGD::netInput ( const Matrix< double > &  X)
inlineoverridevirtual

calculates $$ X \cdot w + b

Parameters
Xinput values
Returns

Implements ANNClassifier.

◆ predict()

Matrix< double > AdalineGD::predict ( const Matrix< double > &  X)
inlineoverridevirtual

predicts class of given input

Parameters
Xinput values
Returns
prediction

Implements Predictor.


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