- Timestamp:
- Sep 10, 2007, 3:18:40 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/feature_selection_test.cc
r831 r862 25 25 #include "yat/classifier/FeatureSelectorIR.h" 26 26 #include "yat/classifier/FeatureSelectorRandom.h" 27 #include "yat/classifier/MatrixLookupWeighted.h" 28 #include "yat/classifier/Target.h" 27 29 #include "yat/statistics/AUC.h" 28 30 31 #include "yat/utility/matrix.h" 32 33 #include <algorithm> 34 #include <cmath> 29 35 #include <fstream> 36 #include <iterator> 30 37 #include <iostream> 31 38 #include <string> … … 43 50 std::cout << "feature_selection -v : for printing extra information\n"; 44 51 } 45 *error << "testing fe rature_selection" << std::endl;52 *error << "testing feature_selection" << std::endl; 46 53 bool ok = true; 47 54 … … 50 57 classifier::FeatureSelectorRandom f2(12); 51 58 59 *error << "Reading in Sorlie data to identify top gene ..." << std::endl; 60 std::ifstream is("data/sorlie_centroid_data.txt"); 61 utility::matrix data(is,'\t'); 62 is.close(); 63 64 is.open("data/sorlie_centroid_classes.txt"); 65 classifier::Target targets(is); 66 is.close(); 67 68 *error << "... done" << std::endl; 69 70 // Generate weight matrix with 0 for missing values and 1 for others. 71 utility::matrix weights(data.rows(),data.columns(),0.0); 72 for(size_t i=0;i<data.rows();++i) 73 for(size_t j=0;j<data.columns();++j) 74 if(!std::isnan(data(i,j))) 75 weights(i,j)=1.0; 76 77 classifier::MatrixLookupWeighted dataviewweighted(data,weights); 78 79 f2.update(dataviewweighted,targets); 80 *error << "\nRandomly ordered features (top 12):\n"; 81 std::vector<size_t> features=f2.features(); 82 std::copy(features.begin(),features.end(), 83 std::ostream_iterator<size_t>(*error," ")); 84 *error << std::endl; 85 86 f.update(dataviewweighted,targets); 87 *error << "\nAUC ordered ordered features (top 12):\n"; 88 features=f.features(); 89 std::copy(features.begin(),features.end(), 90 std::ostream_iterator<size_t>(*error," ")); 91 *error << std::endl; 92 93 52 94 if (ok) 53 95 return 0; -
trunk/test/score_test.cc
r831 r862 27 27 #include "yat/statistics/AUC.h" 28 28 #include "yat/statistics/SAMScore.h" 29 #include "yat/statistics/SNRScore.h" 29 30 #include "yat/statistics/tScore.h" 30 31 #include "yat/statistics/WilcoxonFoldChange.h" … … 131 132 statistics::SAMScore sam(1.0,true); 132 133 134 *error << "testing SNRScore" << std::endl; 135 statistics::SNRScore snr(true); 136 133 137 134 138 if (ok) -
trunk/yat/classifier/FeatureSelectorIR.cc
r831 r862 26 26 #include "FeatureSelector.h" 27 27 #include "MatrixLookup.h" 28 #include "MatrixLookupWeighted.h" 28 29 #include "InputRanker.h" 29 30 #include "Target.h" … … 72 73 const Target& target) 73 74 { 75 assert(data.columns()==target.size()); 74 76 InputRanker ir = InputRanker(data, target, score_); 75 77 features_.resize(N_); -
trunk/yat/classifier/InputRanker.cc
r831 r862 92 92 id_.resize(nof_genes); 93 93 rank_.resize(nof_genes); 94 score_.resize(nof_genes); 94 95 for (size_t i=0; i<nof_genes; i++){ 95 96 id_[i]=score[i].second;
Note: See TracChangeset
for help on using the changeset viewer.