Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

learning.h

Go to the documentation of this file.
00001 
00025 #ifndef __INANNA_LEARNING_H__
00026 #define __INANNA_LEARNING_H__
00027 
00028 #include <magic/mobject.h>
00029 #include <magic/mmath.h>
00030 #include <magic/mstring.h>
00031 #include <magic/mpararr.h>
00032 
00033 // External
00034 class PatternSource;
00035 class PatternSet;
00036 class ANNetwork;
00037 class Terminator;
00038 
00042 struct ClassifResults {
00043 
00045     double          mse;
00046 
00048     int             failures;
00049 
00051     PackArray<int>  classcnts;
00052 
00054     PackArray<int>  classSizes;
00055 };
00056 
00057 
00058 
00060 //                                                                           //
00061 //                _   |   | |   |                           |                //
00062 //               / \  |\  | |\  |  ___   |                  |                //
00063 //              /   \ | \ | | \ | /   ) -+- \    /  __  |/\ | /              //
00064 //              |---| |  \| |  \| |---   |   \\//  /  \ |   |/               //
00065 //              |   | |   | |   |  \__    \   VV   \__/ |   | \              //
00066 //                                                                           //
00068 
00069 //#define LearningMapping AnyNetwork
00070 //#define Learner         AnyNetwork
00071 
00081 class Learner {
00082   public:
00083 
00084                             Learner         ();
00085     virtual                 ~Learner        () {;}
00086     
00087     virtual void            make            (const char* description) = 0;
00088     virtual void            init            (double r=-1) = 0;
00089 
00090     virtual double          train           (const PatternSet& set, int cycles, int cycint=-1, int vsize=-1);
00091     double                  train           (const PatternSet& trainSet,
00092                                              const PatternSet& validationSet,
00093                                              int cycles,
00094                                              int cycint=-1);
00095     virtual double          trainOnce       (const PatternSet& trainset);
00096     virtual Vector          testPattern     (const PatternSource& set, int pattern) const;
00097 
00098     // These should not be overridden usually
00099     
00100     virtual double          test            (const PatternSource& set) const;
00101     virtual ClassifResults* testClassify    (const PatternSource& set) const;
00102 
00103     // Common conversions
00104 
00105     virtual void            copyFreeNet     (const ANNetwork& fnet, bool onlyWeights = false);
00106     virtual void            copy            (const Learner& fnet, bool onlyWeights = false);
00107     virtual ANNetwork*      toANNetwork     () const;
00108 };
00109 
00110 
00111 #endif
00112 
00113 

Generated on Thu Feb 10 20:06:44 2005 for Inanna by doxygen1.2.18