Changeset 1874
- Timestamp:
- Mar 17, 2009, 11:09:01 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS
r1863 r1874 9 9 A complete list of closed tickets can be found here [[br]] 10 10 http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.6 11 12 Version 0.5.2 (released 17 March 2009) 13 14 - fixed compilation error in IGP (issue #503) 15 - fixed incorrect error message from CommandLine (issue #508) 16 17 A complete list of closed tickets can be found here [[br]] 18 http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.5.2 11 19 12 20 Version 0.5.1 (released 26 February 2009) -
trunk/build_support/svn_support.am
r1804 r1874 68 68 esac 69 69 70 version-check: 71 @case `sed 200q $(srcdir)/m4/version.m4` in \ 72 *yat-$(VERSION)*$(YAT_LT_VERSION)*);; \ 73 *) \ 74 echo "version.m4: YAT_LT_VERSION not updated;" 1>&2;\ 75 echo " expected to find 'yat-$(VERSION) $(YAT_LT_VERSION)'" 1>&2;\ 76 echo " not releasing" 1>&2;\ 77 exit 1;; \ 78 esac 79 70 80 # check that wc is updated and pristine 71 81 svn-check: … … 77 87 fi 78 88 79 release: svn-check news-check maintainer-check89 release: svn-check news-check version-check maintainer-check 80 90 md5sum $(distdir).tar.gz > $(distdir).tar.gz.MD5 -
trunk/m4/version.m4
r1840 r1874 56 56 # yat-0.5 1:2:0* 57 57 # yat-0.5.1 2:0:0 58 # yat-0.5.2 2:1:0 58 59 # 59 60 m4_define([YAT_LT_VERSION_INFO], [3:0:0]) -
trunk/test/Makefile.am
r1861 r1874 52 52 data_weight_test data_weight_proxy_test distance_test \ 53 53 ensemble_test feature_selection_test fileutil_test \ 54 fisher_test i ndex_test inputranker_test interpolation_test \54 fisher_test igp_test index_test inputranker_test interpolation_test \ 55 55 iterator_test kernel_lookup_test kernel_test \ 56 56 knn_test kolmogorov_smirnov_test large_file_test matrix_lookup_test \ … … 97 97 fileutil_test_SOURCES = fileutil_test.cc 98 98 fisher_test_SOURCES = fisher_test.cc 99 igp_test_SOURCES = igp_test.cc 99 100 index_test_SOURCES = index_test.cc 100 101 inputranker_test_SOURCES = inputranker_test.cc -
trunk/test/commandline_test.cc
r1634 r1874 3 3 /* 4 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 5 6 6 7 This file is part of the yat library, http://dev.thep.lu.se/yat … … 36 37 bool test_switch(yat::test::Suite& error); 37 38 bool test_arg(yat::test::Suite& error); 39 void test_exception_msg(yat::test::Suite& error); 38 40 bool test_file(yat::test::Suite& error); 39 41 bool test_failures(yat::test::Suite& error); … … 56 58 suite.add(test_option_name_clash(suite)); 57 59 suite.add(test_free_arg(suite)); 60 test_exception_msg(suite); 58 61 } 59 62 catch (std::runtime_error& e) { … … 86 89 } 87 90 91 92 void test_exception_msg(yat::test::Suite& suite) 93 { 94 // test for ticket 508 95 using namespace theplu::yat::utility; 96 CommandLine cmd; 97 OptionHelp help(cmd, "h,help", ""); 98 OptionFile indata(cmd, "i,in", "input file", true, true,"r"); 99 OptionSwitch cmd_memory(cmd, "m", "transpose in a memory cheap manner"); 100 OptionArg<size_t> cmd_n(cmd, "n", "number of rows to print in each iteration"); 101 OptionSwitch cmd_numeric(cmd, "numeric", 102 "input is a numeric matrix"); 103 OptionFile outdata(cmd, "o,out", "output file",true, false,"w"); 104 OptionSwitch verbose(cmd, "v,verbose", "display progress"); 105 int ac = 2; 106 char* av[] = { "test_prog", "--haha" }; 107 try { 108 cmd.parse(ac,av); 109 } 110 catch (std::runtime_error& e) { 111 std::string msg(e.what()); 112 if (msg.size()<15) { 113 suite.xadd(false); 114 suite.err() << "Error: short exception message\n" 115 << " exception message is: `" << msg 116 << "' that is " << msg.size() << " characters long.\n" 117 << " expected at least 15 characters\n"; 118 } 119 } 120 } 121 122 88 123 bool test_switch(yat::test::Suite& suite) 89 124 { -
trunk/yat/classifier/IGP.h
r1858 r1874 25 25 */ 26 26 27 #include "DataLookup1D.h"28 27 #include "MatrixLookup.h" 29 28 #include "Target.h" … … 120 119 size_t neighbor=i; 121 120 double mindist=std::numeric_limits<double>::max(); 122 const DataLookup1D a(matrix_,i,false);123 121 for(size_t j=0; j<target_.size(); j++) { 124 DataLookup1D b(matrix_,j,false); 125 double dist=distance_(a.begin, a.end(), b.begin()); 126 if(j!=i && dist<mindist) { 122 if (i==j) // avoid self-self comparison 123 continue; 124 double dist = distance_(matrix_.begin_column(i), matrix_.end_column(i), 125 matrix_.begin_column(j)); 126 if(dist<mindist) { 127 127 mindist=dist; 128 128 neighbor=j; -
trunk/yat/statistics/KolmogorovSmirnov.h
r1797 r1874 159 159 Same as score() but keeping the sign, in other words, 160 160 abs(signed_score())==score() 161 162 A positive score implies that values in class \c true \em on 163 \em average are smaller than values in class \c false. 161 164 162 165 \since New in yat 0.5 -
trunk/yat/statistics/utility.h
r1835 r1874 48 48 49 49 /** 50 \brief 50th percentile51 @see Percentiler52 */53 template <class T>54 double median(T first, T last, const bool sorted=false);55 56 /**57 \see Percentiler58 */59 template <class T>60 double percentile(T first, T last, double p, bool sorted=false) YAT_DEPRECATE;61 62 /**63 50 Adding a range [\a first, \a last) into an object of type T. The 64 51 requirements for the type T is to have an add(double, bool, double) … … 67 54 template <typename T, typename ForwardIterator> 68 55 void add(T& o, ForwardIterator first, ForwardIterator last, 69 const classifier::Target& target) 70 { 71 for (size_t i=0; first!=last; ++i, ++first) 72 o.add(utility::iterator_traits<ForwardIterator>().data(first), 73 target.binary(i), 74 utility::iterator_traits<ForwardIterator>().weight(first)); 75 } 56 const classifier::Target& target); 76 57 77 58 /// … … 123 104 /// 124 105 template <class T> 106 double mad(T first, T last, const bool sorted=false); 107 108 109 /// 110 /// Median is defined to be value in the middle. If number of values 111 /// is even median is the average of the two middle values. the 112 /// median value is given by p equal to 50. If \a sorted is false 113 /// (default), the range is copied, the copy is sorted, and then 114 /// used to calculate the median. 115 /// 116 /// Function is a non-mutable function, i.e., \a first and \a last 117 /// can be const_iterators. 118 /// 119 /// Requirements: T should be an iterator over a range of doubles (or 120 /// any type being convertable to double). 121 /// 122 /// @return median of range 123 /// 124 template <class T> 125 double median(T first, T last, const bool sorted=false); 126 127 128 /** 129 The percentile is determined by the \a p, a number between 0 and 130 100. The percentile is found by interpolation, using the formula 131 \f$ percentile = (1 - \delta) x_i + \delta x_{i+1} \f$ where \a 132 p is floor\f$((n - 1)p/100)\f$ and \f$ \delta \f$ is \f$ 133 (n-1)p/100 - i \f$.Thus the minimum value of the vector is given 134 by p equal to zero, the maximum is given by p equal to 100 and 135 the median value is given by p equal to 50. If @a sorted 136 is false (default), the vector is copied, the copy is sorted, 137 and then used to calculate the median. 138 139 Function is a non-mutable function, i.e., \a first and \a last 140 can be const_iterators. 141 142 Requirements: RandomAccessIterator is an iterator over a range of 143 doubles (or any type being convertable to double). 144 145 @return \a p'th percentile of range 146 147 \deprecated percentile2 will replace this function in the future 148 149 \note the definition of percentile used here is not identical to 150 that one used in percentile2 and Percentile. The difference is 151 smaller for large ranges. 152 */ 153 template <class RandomAccessIterator> 154 double percentile(RandomAccessIterator first, RandomAccessIterator last, 155 double p, bool sorted=false) YAT_DEPRECATE; 156 157 158 /** 159 \see Percentiler 160 161 \since new in yat 0.5 162 */ 163 template <class RandomAccessIterator> 164 double percentile2(RandomAccessIterator first, RandomAccessIterator last, 165 double p, bool sorted=false) 166 { 167 Percentiler percentiler(p, sorted); 168 return percentiler(first, last); 169 } 170 171 /// 172 /// @brief Computes the skewness of the data in a vector. 173 /// 174 /// The skewness measures the asymmetry of the tails of a 175 /// distribution. 176 /// 177 double skewness(const utility::VectorBase&); 178 179 180 //////// template implementations /////////// 181 182 template <typename T, typename ForwardIterator> 183 void add(T& o, ForwardIterator first, ForwardIterator last, 184 const classifier::Target& target) 185 { 186 for (size_t i=0; first!=last; ++i, ++first) 187 o.add(utility::iterator_traits<ForwardIterator>().data(first), 188 target.binary(i), 189 utility::iterator_traits<ForwardIterator>().weight(first)); 190 } 191 192 193 template <class T> 125 194 double mad(T first, T last, const bool sorted=false) 126 195 { 127 196 double m = median(first, last, sorted); 128 129 197 typedef std::vector<typename std::iterator_traits<T>::value_type> Vec; 130 198 Vec ad; … … 142 210 143 211 144 ///145 /// Median is defined to be value in the middle. If number of values146 /// is even median is the average of the two middle values. the147 /// median value is given by p equal to 50. If \a sorted is false148 /// (default), the range is copied, the copy is sorted, and then149 /// used to calculate the median.150 ///151 /// Function is a non-mutable function, i.e., \a first and \a last152 /// can be const_iterators.153 ///154 /// Requirements: T should be an iterator over a range of doubles (or155 /// any type being convertable to double).156 ///157 /// @return median of range158 ///159 212 template <class T> 160 213 double median(T first, T last, const bool sorted=false) 161 { return percentile2(first, last, 50.0, sorted); } 162 163 /** 164 The percentile is determined by the \a p, a number between 0 and 165 100. The percentile is found by interpolation, using the formula 166 \f$ percentile = (1 - \delta) x_i + \delta x_{i+1} \f$ where \a 167 p is floor\f$((n - 1)p/100)\f$ and \f$ \delta \f$ is \f$ 168 (n-1)p/100 - i \f$.Thus the minimum value of the vector is given 169 by p equal to zero, the maximum is given by p equal to 100 and 170 the median value is given by p equal to 50. If @a sorted 171 is false (default), the vector is copied, the copy is sorted, 172 and then used to calculate the median. 173 174 Function is a non-mutable function, i.e., \a first and \a last 175 can be const_iterators. 176 177 Requirements: T should be an iterator over a range of doubles (or 178 any type being convertable to double). 179 180 @return \a p'th percentile of range 181 182 \deprecated percentile2 will replace this function in the future 183 184 \note the definition of percentile used here is not identical to 185 that one used in percentile2 and Percentile. The difference is 186 smaller for large ranges. 187 */ 214 { 215 return percentile2(first, last, 50.0, sorted); 216 } 217 218 188 219 template <class RandomAccessIterator> 189 220 double percentile(RandomAccessIterator first, RandomAccessIterator last, … … 216 247 217 248 218 /**219 \see Percentiler220 221 \since new in yat 0.5222 */223 template <class RandomAccessIterator>224 double percentile2(RandomAccessIterator first, RandomAccessIterator last,225 double p, bool sorted=false)226 {227 Percentiler percentiler(p, sorted);228 return percentiler(first, last);229 }230 231 ///232 /// @brief Computes the skewness of the data in a vector.233 ///234 /// The skewness measures the asymmetry of the tails of a235 /// distribution.236 ///237 double skewness(const utility::VectorBase&);238 239 249 }}} // of namespace statistics, yat, and theplu 240 250 -
trunk/yat/utility/CommandLine.cc
r1797 r1874 122 122 if (is_long_option(*arg)) { 123 123 std::string key(arg->substr(2)); 124 std::stringstream ss (key);125 getline(ss , key, '=');124 std::stringstream ss2(key); 125 getline(ss2, key, '='); 126 126 std::string value; 127 getline(ss , value, '\0');127 getline(ss2, value, '\0'); 128 128 if (!value.empty()){ 129 129 *arg = value; … … 142 142 } 143 143 else if (iter==long_options_.end()) { 144 s s.str("");145 ss << ": unrecognized option `" << key << "'\n" << try_help();146 throw cmd_error(ss .str());144 std::stringstream ss3; 145 ss3 << ": unrecognized option `" << key << "'\n" << try_help(); 146 throw cmd_error(ss3.str()); 147 147 } 148 148 } … … 153 153 iter(short_options_.find((*arg)[i])); 154 154 if (iter==short_options_.end()) { 155 std::stringstream ss ;156 ss << ": invalid option -- " << (*arg)[i] << "\n"157 158 throw cmd_error(ss .str());155 std::stringstream ss2; 156 ss2 << ": invalid option -- " << (*arg)[i] << "\n" 157 << try_help() << "\n"; 158 throw cmd_error(ss2.str()); 159 159 } 160 160 else … … 165 165 free_arg_.push_back(*arg); 166 166 if (free_arg_.size()>free_arg_max_) { 167 std::stringstream ss ;168 ss << ": invalid option -- " << *arg << "\n"169 170 throw cmd_error(ss .str());167 std::stringstream ss2; 168 ss2 << ": invalid option -- " << *arg << "\n" 169 << try_help() << "\n"; 170 throw cmd_error(ss2.str()); 171 171 } 172 172 } … … 176 176 } 177 177 catch (cmd_error& e){ 178 std::stringstream ss ;179 ss << program_name_ << ": " << e.what();180 throw cmd_error(ss .str());178 std::stringstream ss2; 179 ss2 << program_name_ << ": " << e.what(); 180 throw cmd_error(ss2.str()); 181 181 } 182 182
Note: See TracChangeset
for help on using the changeset viewer.