Class Perceptron implements the standard linear (online) perceptron.
Given a maximum number of iterations (the standard perceptron algorithm is not guaranteed to converge) and a fixed lerning rate, the result is a linear classifier.
Definition at line 28 of file Perceptron.h.
Public Member Functions | |
CPerceptron () | |
CPerceptron (CDotFeatures *traindat, CLabels *trainlab) | |
virtual | ~CPerceptron () |
virtual EClassifierType | get_classifier_type () |
virtual bool | train () |
void | set_learn_rate (float64_t r) |
set learn rate of gradient descent training algorithm | |
void | set_max_iter (int32_t i) |
set maximum number of iterations | |
virtual const char * | get_name () const |
Protected Attributes | |
float64_t | learn_rate |
int32_t | max_iter |
CPerceptron::CPerceptron | ( | ) |
default constructor
Definition at line 15 of file Perceptron.cpp.
CPerceptron::CPerceptron | ( | CDotFeatures * | traindat, | |
CLabels * | trainlab | |||
) |
constructor
traindat | training features | |
trainlab | labels for training features |
Definition at line 20 of file Perceptron.cpp.
CPerceptron::~CPerceptron | ( | ) | [virtual] |
Definition at line 27 of file Perceptron.cpp.
virtual EClassifierType CPerceptron::get_classifier_type | ( | ) | [virtual] |
get classifier type
Reimplemented from CClassifier.
Definition at line 46 of file Perceptron.h.
virtual const char* CPerceptron::get_name | ( | ) | const [virtual] |
void CPerceptron::set_learn_rate | ( | float64_t | r | ) |
set learn rate of gradient descent training algorithm
Definition at line 55 of file Perceptron.h.
void CPerceptron::set_max_iter | ( | int32_t | i | ) |
set maximum number of iterations
Definition at line 61 of file Perceptron.h.
bool CPerceptron::train | ( | ) | [virtual] |
train classifier
Reimplemented from CClassifier.
Definition at line 31 of file Perceptron.cpp.
float64_t CPerceptron::learn_rate [protected] |
learning rate
Definition at line 71 of file Perceptron.h.
int32_t CPerceptron::max_iter [protected] |
maximum number of iterations
Definition at line 73 of file Perceptron.h.