00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2011 Hidekazu Oiwa 00008 */ 00009 00010 #ifndef _AVERAGEDPERCEPTRON_H___ 00011 #define _AVERAGEDPERCEPTRON_H___ 00012 00013 #include <stdio.h> 00014 #include <shogun/lib/common.h> 00015 #include <shogun/features/DotFeatures.h> 00016 #include <shogun/machine/LinearMachine.h> 00017 00018 namespace shogun 00019 { 00030 class CAveragedPerceptron : public CLinearMachine 00031 { 00032 public: 00034 MACHINE_PROBLEM_TYPE(PT_BINARY); 00035 00037 CAveragedPerceptron(); 00038 00044 CAveragedPerceptron(CDotFeatures* traindat, CLabels* trainlab); 00045 virtual ~CAveragedPerceptron(); 00046 00051 virtual EMachineType get_classifier_type() { return CT_AVERAGEDPERCEPTRON; } 00052 00054 inline void set_learn_rate(float64_t r) 00055 { 00056 learn_rate=r; 00057 } 00058 00060 inline void set_max_iter(int32_t i) 00061 { 00062 max_iter=i; 00063 } 00064 00066 virtual const char* get_name() const { return "AveragedPerceptron"; } 00067 00068 protected: 00069 00078 virtual bool train_machine(CFeatures* data=NULL); 00079 00080 protected: 00082 float64_t learn_rate; 00084 int32_t max_iter; 00085 }; 00086 } 00087 #endif