SHOGUN
v3.2.0
|
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) 2013 Roman Votyakov 00008 * Copyright (C) 2012 Jacob Walker 00009 */ 00010 00011 #ifndef CGRADIENTEVALUATION_H_ 00012 #define CGRADIENTEVALUATION_H_ 00013 00014 #include <shogun/evaluation/MachineEvaluation.h> 00015 #include <shogun/evaluation/DifferentiableFunction.h> 00016 #include <shogun/evaluation/EvaluationResult.h> 00017 00018 namespace shogun 00019 { 00020 00024 class CGradientEvaluation: public CMachineEvaluation 00025 { 00026 public: 00028 CGradientEvaluation(); 00029 00038 CGradientEvaluation(CMachine* machine, CFeatures* features, CLabels* labels, 00039 CEvaluation* evaluation_criterion, bool autolock=true); 00040 00041 virtual ~CGradientEvaluation(); 00042 00047 virtual const char* get_name() const { return "GradientEvaluation"; } 00048 00053 virtual CEvaluationResult* evaluate(); 00054 00059 inline void set_function(CDifferentiableFunction* diff) 00060 { 00061 SG_REF(diff); 00062 SG_UNREF(m_diff); 00063 m_diff=diff; 00064 } 00065 00070 inline CDifferentiableFunction* get_function() 00071 { 00072 SG_REF(m_diff); 00073 return m_diff; 00074 } 00075 00076 private: 00078 void init(); 00079 00081 void update_parameter_dictionary(); 00082 00083 private: 00085 CDifferentiableFunction* m_diff; 00086 00088 CMap<TParameter*, CSGObject*>* m_parameter_dictionary; 00089 }; 00090 } 00091 #endif /* CGRADIENTEVALUATION_H_ */