00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* Flood: An Open Source Neural Networks C++ Library */ 00004 /* www.cimne.com/flood */ 00005 /* */ 00006 /* N E W T O N M E T H O D C L A S S H E A D E R */ 00007 /* */ 00008 /* Roberto Lopez */ 00009 /* International Center for Numerical Methods in Engineering (CIMNE) */ 00010 /* Technical University of Catalonia (UPC) */ 00011 /* Barcelona, Spain */ 00012 /* E-mail: rlopez@cimne.upc.edu */ 00013 /* */ 00014 /****************************************************************************************************************/ 00015 00016 #ifndef __NEWTONMETHOD_H__ 00017 #define __NEWTONMETHOD_H__ 00018 00019 // Flood includes 00020 00021 #include "TrainingAlgorithm.h" 00022 #include "../ObjectiveFunctional/ObjectiveFunctional.h" 00023 00024 namespace Flood 00025 { 00026 00027 00030 00031 class NewtonMethod : public TrainingAlgorithm 00032 { 00033 00034 public: 00035 00036 // GENERAL CONSTRUCTOR 00037 00038 explicit NewtonMethod(ObjectiveFunctional*); 00039 00040 00041 // DEFAULT CONSTRUCTOR 00042 00043 explicit NewtonMethod(void); 00044 00045 00046 // DESTRUCTOR 00047 00048 virtual ~NewtonMethod(void); 00049 00050 00051 // METHODS 00052 00053 // Train methods 00054 00055 Vector<double> calculate_training_direction(const Vector<double>&, const Matrix<double>&); 00056 Vector<double> calculate_gradient_descent_training_direction(const Vector<double>&); 00057 00058 void train(void); 00059 00060 // Training history methods 00061 00062 void set_reserve_all_training_history(bool); 00063 void resize_training_history(int); 00064 00065 std::string get_training_history_XML(bool); 00066 00067 // Utility methods 00068 00069 std::string to_XML(bool); 00070 void load(const char*); 00071 }; 00072 00073 } 00074 00075 #endif 00076 00077 00078 // Flood: An Open Source Neural Networks C++ Library. 00079 // Copyright (C) 2005-2010 Roberto Lopez 00080 // 00081 // This library is free software; you can redistribute it and/or 00082 // modify it under the s of the GNU Lesser General Public 00083 // License as published by the Free Software Foundation; either 00084 // version 2.1 of the License, or any later version. 00085 // 00086 // This library is distributed in the hope that it will be useful, 00087 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00088 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00089 // Lesser General Public License for more details. 00090 00091 // You should have received a copy of the GNU Lesser General Public 00092 // License along with this library; if not, write to the Free Software 00093 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA