Changeset 525 for trunk/lib/classifier/NCC.cc
- Timestamp:
- Feb 24, 2006, 5:29:22 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/classifier/NCC.cc
r523 r525 5 5 #include <c++_tools/classifier/DataLookup1D.h> 6 6 #include <c++_tools/classifier/DataLookup2D.h> 7 #include <c++_tools/classifier/InputRanker.h> 7 8 #include <c++_tools/classifier/Target.h> 8 9 #include <c++_tools/gslapi/vector.h> … … 24 25 } 25 26 27 NCC::NCC(const DataLookup2D& data, const Target& target, 28 const statistics::Distance& distance, 29 statistics::Score& score, size_t nof_inputs) 30 : SupervisedClassifier(target, &score, nof_inputs), 31 distance_(distance), matrix_(data) 32 { 33 } 34 35 NCC::~NCC() 36 { 37 if(ranker_) 38 delete ranker_; 39 } 40 41 26 42 SupervisedClassifier* 27 43 NCC::make_classifier(const DataLookup2D& data, 28 44 const Target& target) const 29 45 { 30 NCC* sc= new NCC(data,target,this->distance_); 31 return sc; 46 NCC* ncc= new NCC(data,target,this->distance_); 47 ncc->score_=this->score_; 48 ncc->nof_inputs_=this->nof_inputs_; 49 return ncc; 32 50 } 33 51 … … 35 53 bool NCC::train() 36 54 { 55 if(ranker_) 56 delete ranker_; 57 if(score_) 58 ranker_=new InputRanker(matrix_, target_, *score_); 59 // Markus : ranker_ should be taken into account if used!!! 60 37 61 // Calculate the centroids for each class 38 62 centroids_=gslapi::matrix(matrix_.rows(),target_.nof_classes()); … … 54 78 gslapi::vector& prediction) const 55 79 { 80 // Markus : ranker_ should be taken into account if used!!! 81 56 82 prediction=gslapi::vector(centroids_.columns()); 57 83 gslapi::vector w(input.size(),0); … … 68 94 gslapi::matrix& prediction) const 69 95 { 96 // Markus : ranker_ should be taken into account if used!!! 97 70 98 prediction=gslapi::matrix(centroids_.columns(), input.columns()); 71 99 for(size_t j=0; j<input.columns();j++) {
Note: See TracChangeset
for help on using the changeset viewer.