DirectorKernelMachine.h

Go to the documentation of this file.
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 Evgeniy Andreev (gsomix)
00008  */
00009 
00010 #ifndef _DIRECTORKERNELMACHINE_H___
00011 #define _DIRECTORKERNELMACHINE_H___
00012 
00013 #ifdef USE_SWIG_DIRECTORS
00014 #include <shogun/lib/common.h>
00015 #include <shogun/lib/DataType.h>
00016 #include <shogun/machine/Machine.h>
00017 #include <shogun/machine/KernelMachine.h>
00018 
00019 namespace shogun
00020 {
00021 
00022 #define IGNORE_IN_CLASSLIST 
00023 IGNORE_IN_CLASSLIST class CDirectorKernelMachine : public CKernelMachine
00024 {
00025     public:
00026         /* default constructor */
00027         CDirectorKernelMachine()
00028         : CKernelMachine()
00029         {
00030 
00031         }
00032 
00041         CDirectorKernelMachine(CKernel* k, const SGVector<float64_t> alphas, const SGVector<int32_t> svs, float64_t b)
00042         : CKernelMachine(k, alphas, svs, b)     
00043         {
00044         }
00045 
00046         /* destructor */
00047         virtual ~CDirectorKernelMachine()
00048         {
00049 
00050         }
00051 
00061         virtual bool train(CFeatures* data=NULL)
00062         {
00063             return CKernelMachine::train(data);
00064         }
00065 
00066         virtual bool train_function(CFeatures* data=NULL)
00067         {
00068             SG_ERROR("Train function of Director Kernel Machine needs to be overridden.\n");
00069             return false;
00070         }
00071 
00078         virtual CLabels* apply(CFeatures* data=NULL)
00079         {
00080             return CKernelMachine::apply(data);
00081         }
00082 
00084         virtual CBinaryLabels* apply_binary(CFeatures* data=NULL)
00085         {
00086             return CKernelMachine::apply_binary(data);
00087         }
00088 
00090         virtual CRegressionLabels* apply_regression(CFeatures* data=NULL)
00091         {
00092             return CKernelMachine::apply_regression(data);
00093         }
00094 
00096         using CKernelMachine::apply_multiclass;
00097 
00103         virtual float64_t apply_one(int32_t num)
00104         {
00105             return CKernelMachine::apply_one(num);
00106         }
00107 
00112         virtual void set_labels(CLabels* lab)
00113         {
00114             CKernelMachine::set_labels(lab);
00115         }
00116 
00121         virtual CLabels* get_labels()
00122         {
00123             return CKernelMachine::get_labels();
00124         }
00125 
00130         virtual EMachineType get_classifier_type() { return CT_DIRECTORKERNEL; }
00131 
00137         virtual void set_store_model_features(bool store_model)
00138         {
00139             CKernelMachine::set_store_model_features(store_model);
00140         }
00141 
00150         virtual bool train_locked(SGVector<index_t> indices)
00151         {
00152             return CKernelMachine::train_locked(indices);
00153         }
00154 
00160         virtual CLabels* apply_locked(SGVector<index_t> indices)
00161         {
00162             return CKernelMachine::apply_locked(indices);
00163         }
00164 
00165         virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
00166         {
00167             return CKernelMachine::apply_locked_binary(indices);
00168         }
00169 
00170         virtual CRegressionLabels* apply_locked_regression(
00171                 SGVector<index_t> indices)
00172         {
00173             return CKernelMachine::apply_locked_regression(indices);
00174         }
00175 
00176         using CKernelMachine::apply_locked_multiclass;
00177 
00184         virtual SGVector<float64_t> apply_locked_get_output(
00185                 SGVector<index_t> indices)
00186         {
00187             return CKernelMachine::apply_locked_get_output(indices);
00188         }
00189 
00198         virtual void data_lock(CLabels* labs, CFeatures* features)
00199         {
00200             CKernelMachine::data_lock(labs, features);
00201         }
00202 
00204         virtual void data_unlock()
00205         {
00206             CKernelMachine::data_unlock();
00207         }
00208 
00210         virtual bool supports_locking() const 
00211         {
00212             return CKernelMachine::supports_locking();
00213         }
00214 
00215         //TODO change to pure virtual
00216         virtual EProblemType get_machine_problem_type() const
00217         {
00218             return CKernelMachine::get_machine_problem_type();
00219         }
00220 
00221         virtual const char* get_name() const { return "DirectorKernelMachine"; }
00222 
00223     protected:
00234         virtual bool train_machine(CFeatures* data=NULL)
00235         {
00236             return train_function(data);
00237         }
00238 };
00239 
00240 }
00241 
00242 #endif /* USE_SWIG_DIRECTORS */
00243 #endif /* _DIRECTORKERNELMACHINE_H___ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation