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 * Copyright (C) 2012 Sergey Lisitsyn 00008 */ 00009 00010 #ifndef MULTITASKLSREGRESSION_H_ 00011 #define MULTITASKLSREGRESSION_H_ 00012 00013 #include <shogun/lib/config.h> 00014 #include <shogun/transfer/multitask/TaskRelation.h> 00015 #include <shogun/transfer/multitask/MultitaskLinearMachine.h> 00016 00017 namespace shogun 00018 { 00027 class CMultitaskLeastSquaresRegression : public CMultitaskLinearMachine 00028 { 00029 00030 public: 00032 MACHINE_PROBLEM_TYPE(PT_REGRESSION) 00033 00034 00035 CMultitaskLeastSquaresRegression(); 00036 00044 CMultitaskLeastSquaresRegression( 00045 float64_t z, CDotFeatures* training_data, 00046 CRegressionLabels* training_labels, CTaskRelation* task_relation); 00047 00049 virtual ~CMultitaskLeastSquaresRegression(); 00050 00052 virtual const char* get_name() const 00053 { 00054 return "MultitaskLeastSquaresRegression"; 00055 } 00056 00058 int32_t get_max_iter() const; 00060 float64_t get_q() const; 00062 int32_t get_regularization() const; 00064 int32_t get_termination() const; 00066 float64_t get_tolerance() const; 00068 float64_t get_z() const; 00069 00071 void set_max_iter(int32_t max_iter); 00073 void set_q(float64_t q); 00075 void set_regularization(int32_t regularization); 00077 void set_termination(int32_t termination); 00079 void set_tolerance(float64_t tolerance); 00081 void set_z(float64_t z); 00082 00084 virtual float64_t apply_one(int32_t i); 00085 00086 protected: 00087 00089 virtual bool train_machine(CFeatures* data=NULL); 00090 00092 virtual bool train_locked_implementation(SGVector<index_t>* tasks); 00093 00094 private: 00095 00097 void register_parameters(); 00098 00100 void initialize_parameters(); 00101 00102 protected: 00103 00105 int32_t m_regularization; 00106 00108 int32_t m_termination; 00109 00111 int32_t m_max_iter; 00112 00114 float64_t m_tolerance; 00115 00117 float64_t m_q; 00118 00120 float64_t m_z; 00121 00122 }; 00123 } 00124 #endif