GradientEvaluation.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 Jacob Walker
00008  */
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/GradientResult.h>
00017 
00018 namespace shogun
00019 {
00025 class CGradientEvaluation: public CMachineEvaluation
00026 {
00027 
00028 public:
00029 
00030     /*Constructor*/
00031     CGradientEvaluation();
00032 
00040     CGradientEvaluation(CMachine* machine, CFeatures* features, CLabels* labels,
00041             CEvaluation* evaluation_criterion, bool autolock = true);
00042 
00043     /*Destructor*/
00044     virtual ~CGradientEvaluation();
00045 
00051     virtual const char* get_name() const
00052     {
00053         return "GradientEvaluation";
00054     }
00055 
00056     /*Evaluates differentiable function for value
00057      * and derivative.
00058      *
00059      * @return GradientResult containing value and
00060      * gradient
00061      */
00062     virtual CEvaluationResult* evaluate();
00063 
00068     inline void set_function(CDifferentiableFunction* d)
00069     {
00070         SG_REF(d);
00071         SG_UNREF(m_diff);
00072         m_diff = d;
00073     };
00074 
00079     inline CDifferentiableFunction* get_function()
00080     {
00081         SG_REF(m_diff);
00082         return m_diff;
00083     };
00084 
00085 private:
00086 
00087     /*Initializer*/
00088     void init();
00089 
00090 private:
00091 
00092     CDifferentiableFunction* m_diff;
00093 };
00094 
00095 } /* namespace shogun */
00096 
00097 #endif /* CGRADIENTEVALUATION_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation