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) 1999-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _PERCEPTRON_H___ 00012 #define _PERCEPTRON_H___ 00013 00014 #include <stdio.h> 00015 #include <shogun/lib/common.h> 00016 #include <shogun/features/DotFeatures.h> 00017 #include <shogun/machine/LinearMachine.h> 00018 00019 namespace shogun 00020 { 00030 class CPerceptron : public CLinearMachine 00031 { 00032 public: 00034 CPerceptron(); 00035 00041 CPerceptron(CDotFeatures* traindat, CLabels* trainlab); 00042 virtual ~CPerceptron(); 00043 00048 virtual inline EClassifierType get_classifier_type() { return CT_PERCEPTRON; } 00049 00051 inline void set_learn_rate(float64_t r) 00052 { 00053 learn_rate=r; 00054 } 00055 00057 inline void set_max_iter(int32_t i) 00058 { 00059 max_iter=i; 00060 } 00061 00063 inline virtual const char* get_name() const { return "Perceptron"; } 00064 00065 protected: 00074 virtual bool train_machine(CFeatures* data=NULL); 00075 00076 protected: 00078 float64_t learn_rate; 00080 int32_t max_iter; 00081 }; 00082 } 00083 #endif