Changeset 635
- Timestamp:
- Sep 6, 2006, 3:20:24 AM (17 years ago)
- Location:
- trunk/c++_tools/classifier
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/c++_tools/classifier/EnsembleBuilder.cc
r619 r635 31 31 while(subset_.more()) { 32 32 SupervisedClassifier* classifier= 33 mother_.make_classifier(subset_); 33 mother_.make_classifier(subset_.training_data(), 34 subset_.training_target()); 34 35 classifier->train(); 35 36 classifier_.push_back(classifier); -
trunk/c++_tools/classifier/NCC.cc
r634 r635 7 7 #include <c++_tools/classifier/MatrixLookup.h> 8 8 #include <c++_tools/classifier/MatrixLookupWeighted.h> 9 #include <c++_tools/classifier/SubsetGenerator.h>10 9 #include <c++_tools/classifier/Target.h> 11 10 #include <c++_tools/utility/matrix.h> … … 40 39 41 40 SupervisedClassifier* 42 NCC::make_classifier(const SubsetGenerator& cs) const41 NCC::make_classifier(const DataLookup2D& data, const Target& target) const 43 42 { 44 43 NCC* ncc=0; 45 if( cs.training_data().weighted()) {46 ncc=new NCC(dynamic_cast<const MatrixLookupWeighted&>( cs.training_data()),47 cs.training_target(),this->distance_);44 if(data.weighted()) { 45 ncc=new NCC(dynamic_cast<const MatrixLookupWeighted&>(data), 46 target,this->distance_); 48 47 } 49 48 else { 50 ncc=new NCC(dynamic_cast<const MatrixLookup&>( cs.training_data()),51 cs.training_target(),this->distance_);49 ncc=new NCC(dynamic_cast<const MatrixLookup&>(data), 50 target,this->distance_); 52 51 } 53 52 return ncc; -
trunk/c++_tools/classifier/NCC.h
r634 r635 22 22 namespace classifier { 23 23 24 class SubsetGenerator;25 24 class DataLookup1D; 26 25 class DataLookup2D; … … 57 56 inline const utility::matrix& centroids(void) const {return centroids_;} 58 57 59 SupervisedClassifier* make_classifier(const SubsetGenerator&) const; 58 SupervisedClassifier* make_classifier(const DataLookup2D&, 59 const Target&) const; 60 60 61 61 /// -
trunk/c++_tools/classifier/SVM.cc
r628 r635 4 4 5 5 #include <c++_tools/classifier/DataLookup2D.h> 6 #include <c++_tools/classifier/SubsetGenerator.h>7 6 #include <c++_tools/random/random.h> 8 7 #include <c++_tools/statistics/Averager.h> … … 70 69 71 70 72 SupervisedClassifier* SVM::make_classifier(const SubsetGenerator& cs) const 73 { 74 // Peter, should check success of dynamic_cast 75 const KernelLookup& data = 76 dynamic_cast<const KernelLookup&>(cs.training_data()); 77 const Target& target=cs.training_target(); 71 SupervisedClassifier* SVM::make_classifier(const DataLookup2D& data, 72 const Target& target) const 73 { 74 const KernelLookup& kernel = 75 dynamic_cast<const KernelLookup&>(data); 78 76 79 77 assert(data.rows()==data.columns()); 80 78 assert(data.columns()==target.size()); 81 79 SVM* sc; 82 sc = new SVM( data,target);80 sc = new SVM(kernel,target); 83 81 84 82 -
trunk/c++_tools/classifier/SVM.h
r628 r635 4 4 // $Id$ 5 5 6 #include <c++_tools/classifier/DataLookup2D.h>7 6 #include <c++_tools/classifier/KernelLookup.h> 8 7 #include <c++_tools/classifier/SupervisedClassifier.h> … … 18 17 namespace classifier { 19 18 20 // forward declarations 21 class SubsetGenerator; 22 19 class DataLookup2D; 23 20 // @internal Class keeping track of which samples are support vectors and 24 21 // not. The first nof_sv elements in the vector are indices of the … … 124 121 125 122 /// 126 /// @todo doc123 /// If DataLookup2D is not a KernelLookup a bad_cast exception is thrown. 127 124 /// 128 125 SupervisedClassifier* 129 make_classifier(const SubsetGenerator&) const;126 make_classifier(const DataLookup2D&, const Target&) const; 130 127 131 128 /// -
trunk/c++_tools/classifier/SupervisedClassifier.h
r626 r635 15 15 16 16 class DataLookup2D; 17 class SubsetGenerator;18 17 class Target; 19 18 … … 46 45 /// 47 46 virtual SupervisedClassifier* 48 make_classifier(const SubsetGenerator&) const =0;47 make_classifier(const DataLookup2D&, const Target&) const =0; 49 48 50 49
Note: See TracChangeset
for help on using the changeset viewer.