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) 2007-2010 Soeren Sonnenburg 00008 * Written (W) 2011 Shashwat Lal Das 00009 * Copyright (c) 2007-2009 The LIBLINEAR Project. 00010 * Copyright (C) 2007-2010 Fraunhofer Institute FIRST and Max-Planck-Society 00011 */ 00012 00013 #ifndef _ONLINELIBLINEAR_H__ 00014 #define _ONLINELIBLINEAR_H__ 00015 00016 #include <shogun/lib/config.h> 00017 00018 #include <shogun/lib/common.h> 00019 #include <shogun/base/Parameter.h> 00020 #include <shogun/machine/OnlineLinearMachine.h> 00021 00022 namespace shogun 00023 { 00026 class COnlineLibLinear : public COnlineLinearMachine 00027 { 00028 public: 00030 COnlineLibLinear(); 00031 00037 COnlineLibLinear(float64_t C); 00038 00045 COnlineLibLinear(float64_t C, CStreamingDotFeatures* traindat); 00046 00048 virtual ~COnlineLibLinear(); 00049 00058 virtual bool train(CFeatures* data=NULL); 00059 00066 virtual void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; } 00067 00073 virtual float64_t get_C1() { return C1; } 00074 00080 float64_t get_C2() { return C2; } 00081 00087 virtual void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; } 00088 00094 virtual bool get_bias_enabled() { return use_bias; } 00095 00097 inline virtual const char* get_name() const { return "OnlineLibLinear"; } 00098 00099 private: 00101 void init(); 00102 00103 private: 00105 bool use_bias; 00107 float64_t C1; 00109 float64_t C2; 00110 }; 00111 } 00112 #endif // _ONLINELIBLINEAR_H__