KNearestNeighbor.h

00001 #ifndef __K_NEAREST_NEIGHBOR_
00002 #define __K_NEAREST_NEIGHBOR_
00003 
00004 #include "StandardAlgorithm.h"
00005 #include "Framework.h"
00006 
00007 using namespace std;
00008 
00022 class KNearestNeighbor : public StandardAlgorithm, public Framework
00023 {
00024 public:
00025     KNearestNeighbor();
00026     ~KNearestNeighbor();
00027 
00028     virtual void modelInit();
00029     virtual void modelUpdate ( REAL* input, REAL* target, uint nSamples, uint crossRun );
00030     virtual void predictAllOutputs ( REAL* rawInputs, REAL* outputs, uint nSamples, uint crossRun );
00031     virtual void readSpecificMaps();
00032     virtual void saveWeights ( int cross );
00033     virtual void loadWeights ( int cross );
00034     virtual void loadMetaWeights ( int cross );
00035 
00036     static string templateGenerator ( int id, string preEffect, int nameID, bool blendStop );
00037 
00038 private:
00039 
00040     // tmp vars
00041     REAL** m_targetActualPtr;
00042     int* m_lengthActual;
00043     bool m_isLoadWeights;
00044 
00045     REAL** m_xNormalized;
00046     REAL* m_allCorrelations;
00047     REAL* m_allCorrelationsTransposed;
00048     REAL* m_predictionAllOutputs;
00049 
00050     // for all prediction
00051     REAL* m_predictionAllOutputsAllTargets;
00052 
00053     // params
00054     double m_scale;
00055     double m_scale2;
00056     double m_offset;
00057     double m_globalOffset;
00058     double m_power;
00059     int m_k;
00060     double m_euclideanPower;
00061     double m_euclideanLimit;
00062 
00063     // dsc file
00064     int m_evaluationBlockSize;
00065     bool m_enableAdvancedKNN;
00066     bool m_dataDenormalization;
00067     bool m_takeEuclideanDistance;
00068     bool m_optimizeEuclideanPower;
00069 };
00070 
00071 
00072 #endif

Generated on Tue Jan 26 09:20:59 2010 for ELF by  doxygen 1.5.8