00001 /* VowelManager.h 00002 * 00003 * Copyright (C) 2002-2003 -- Sebastian Nowozin 00004 */ 00005 00006 #ifndef VOWELMANAGER_H 00007 #define VOWELMANAGER_H 00008 00009 #include <vowel/VowelSample.h> 00010 #include <vowel/VowelClassifier.h> 00011 #include <audio/AudioPreprocessing.h> 00012 00013 #include <vector> 00014 #include <fstream> 00015 00016 00019 class 00020 VowelSet { 00021 public: 00024 char * name; 00025 00031 VowelSet (const char *name = "SetName"); 00032 00035 ~VowelSet (void); 00036 00041 VowelSet (VowelSet& source); 00042 00057 bool load (fstream& fs, AudioPreprocessing& prep, 00058 void (* cback)(void *) = NULL, void *user = NULL); 00059 00064 void save (fstream& fs); 00065 00070 void setName (const char *name); 00071 00079 bool addSample (VowelSample *sample); 00080 00089 bool addSample (const char *filename, AudioPreprocessing& prep); 00090 00101 bool removeSample (VowelSample *sample); 00102 00105 void clearList (void); 00106 00112 VowelSample * findSample (const char * filename); 00113 00118 vector<VowelSample *>& getSampleList (void); 00119 00120 private: 00123 vector<VowelSample *> vowels; 00124 }; 00125 00126 00141 class 00142 VowelManager { 00143 public: 00150 VowelSet * train; 00151 00156 VowelSet * test; 00157 00166 VowelClassifier * classifier; 00167 00178 AudioPreprocessing * prep_template; 00179 00182 VowelManager (void); 00183 00186 ~VowelManager (void); 00187 00196 void learnEpochOnline (void); 00197 00204 void learnEpochBatch (void); 00205 00222 vector<double> getErrorMedian (VowelSet *set); 00223 00228 unsigned int getEpochCounter (void); 00229 00232 void resetEpochCounter (void); 00233 00234 private: 00239 unsigned int epoch_count; 00240 00241 00251 bool checkExpertCorrect (unsigned int expert, 00252 vector<double>& exp_output, VowelSampleType correct); 00253 00260 unsigned int getMostActiveIndex (vector<double>& res); 00261 }; 00262 00263 #endif 00264