|
SHOGUN
v1.1.0
|
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 30 of file Perceptron.h.

Public Member Functions | |
| CPerceptron () | |
| CPerceptron (CDotFeatures *traindat, CLabels *trainlab) | |
| virtual | ~CPerceptron () |
| virtual EClassifierType | get_classifier_type () |
| 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 |
Public Member Functions inherited from CLinearMachine | |
| CLinearMachine () | |
| virtual | ~CLinearMachine () |
| void | get_w (float64_t *&dst_w, int32_t &dst_dims) |
| SGVector< float64_t > | get_w () |
| void | set_w (SGVector< float64_t > src_w) |
| void | set_bias (float64_t b) |
| float64_t | get_bias () |
| virtual bool | load (FILE *srcfile) |
| virtual bool | save (FILE *dstfile) |
| virtual void | set_features (CDotFeatures *feat) |
| virtual CLabels * | apply () |
| virtual CLabels * | apply (CFeatures *data) |
| virtual float64_t | apply (int32_t vec_idx) |
| get output for example "vec_idx" | |
| virtual CDotFeatures * | get_features () |
Public Member Functions inherited from CMachine | |
| CMachine () | |
| virtual | ~CMachine () |
| virtual bool | train (CFeatures *data=NULL) |
| virtual void | set_labels (CLabels *lab) |
| virtual CLabels * | get_labels () |
| virtual float64_t | get_label (int32_t i) |
| void | set_max_train_time (float64_t t) |
| float64_t | get_max_train_time () |
| void | set_solver_type (ESolverType st) |
| ESolverType | get_solver_type () |
| virtual void | set_store_model_features (bool store_model) |
Public Member Functions inherited from CSGObject | |
| CSGObject () | |
| CSGObject (const CSGObject &orig) | |
| virtual | ~CSGObject () |
| virtual bool | is_generic (EPrimitiveType *generic) const |
| template<class T > | |
| void | set_generic () |
| void | unset_generic () |
| virtual void | print_serializable (const char *prefix="") |
| virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
| virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
| void | set_global_io (SGIO *io) |
| SGIO * | get_global_io () |
| void | set_global_parallel (Parallel *parallel) |
| Parallel * | get_global_parallel () |
| void | set_global_version (Version *version) |
| Version * | get_global_version () |
| SGVector< char * > | get_modelsel_names () |
| char * | get_modsel_param_descr (const char *param_name) |
| index_t | get_modsel_param_index (const char *param_name) |
Protected Member Functions | |
| virtual bool | train_machine (CFeatures *data=NULL) |
Protected Member Functions inherited from CLinearMachine | |
| virtual void | store_model_features () |
Protected Attributes | |
| float64_t | learn_rate |
| int32_t | max_iter |
Protected Attributes inherited from CLinearMachine | |
| int32_t | w_dim |
| float64_t * | w |
| float64_t | bias |
| CDotFeatures * | features |
Protected Attributes inherited from CMachine | |
| float64_t | max_train_time |
| CLabels * | labels |
| ESolverType | solver_type |
| bool | m_store_model_features |
Additional Inherited Members | |
Public Attributes inherited from CSGObject | |
| SGIO * | io |
| Parallel * | parallel |
| Version * | version |
| Parameter * | m_parameters |
| Parameter * | m_model_selection_parameters |
| CPerceptron | ( | ) |
default constructor
Definition at line 17 of file Perceptron.cpp.
| CPerceptron | ( | CDotFeatures * | traindat, |
| CLabels * | trainlab | ||
| ) |
constructor
| traindat | training features |
| trainlab | labels for training features |
Definition at line 22 of file Perceptron.cpp.
|
virtual |
Definition at line 29 of file Perceptron.cpp.
|
virtual |
get classifier type
Reimplemented from CMachine.
Definition at line 48 of file Perceptron.h.
|
virtual |
| void set_learn_rate | ( | float64_t | r | ) |
set learn rate of gradient descent training algorithm
Definition at line 51 of file Perceptron.h.
| void set_max_iter | ( | int32_t | i | ) |
set maximum number of iterations
Definition at line 57 of file Perceptron.h.
|
protectedvirtual |
train classifier
| data | training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data) |
Reimplemented from CMachine.
Definition at line 33 of file Perceptron.cpp.
|
protected |
learning rate
Definition at line 78 of file Perceptron.h.
|
protected |
maximum number of iterations
Definition at line 80 of file Perceptron.h.