Changeset 1156
- Timestamp:
- Feb 26, 2008, 9:46:49 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r1148 r1156 137 137 [quiet_nan=no]) 138 138 AC_MSG_RESULT($quiet_nan) 139 # Check for infinity support for doubles in OS 140 # At run-time, but this has the disadvantage that yat cannot be built 141 # for cross-compilation 142 AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) 143 AC_RUN_IFELSE( 144 [AC_LANG_PROGRAM( 145 [#include <limits>], 146 [return !std::numeric_limits<double>::has_infinity])], 147 [has_infinity=yes], 148 [has_infinity=no]) 149 AC_MSG_RESULT($has_infinity) 150 139 151 140 152 # yat specific settings … … 182 194 Yat will not work on this system!]) 183 195 fi 196 197 # No support for infinity is fatal -- sub-sequent compilation, or execution 198 # of created binary, will fail. 199 if test "${has_infinity}" = "no" ; then 200 all_reqs_ok="false" 201 AC_MSG_WARN([ 202 Support for infinity required. 203 Yat will not work on this system!]) 204 fi 205 184 206 185 207 # Non-existing BLAS is fatal -- sub-sequent compilation will fail. -
trunk/doc/concepts.doxygen
r1115 r1156 99 99 distance. For each class the function calculates a total vote based on 100 100 the the nearest neighbors of the test sample that belong to the 101 class. The total vote for each class is stored in the vector \a prediction. 101 class. The total vote for each class is stored in the vector \a 102 prediction. The function should be implemented such that nearest 103 neighbors with distance infinity do not vote. 102 104 103 105 \section Implementations -
trunk/yat/classifier/KNN.h
r1144 r1156 245 245 (*distances)(i,j) = distance_(training1.begin(), training1.end(), 246 246 test1.begin()); 247 // If the distance is NaN (no common variables with non-zero weights), 248 // the distance is set to infinity to be sorted as a neighbor at the end 249 if(std::isnan((*distances)(i,j))) 250 (*distances)(i,j)=std::numeric_limits<double>::infinity(); 247 251 } 248 252 } -
trunk/yat/classifier/KNN_ReciprocalRank.cc
r1112 r1156 7 7 #include "yat/utility/VectorMutable.h" 8 8 9 #include <cmath> 9 10 #include <vector> 10 11 … … 19 20 { 20 21 for(size_t j=0;j<k_sorted.size();j++) 21 prediction(target(k_sorted[j]))+=1.0/(j+1); 22 if(!std::isinf(distance(k_sorted[j]))) 23 prediction(target(k_sorted[j]))+=1.0/(j+1); 22 24 } 23 25 -
trunk/yat/classifier/KNN_Uniform.cc
r1142 r1156 7 7 #include "yat/utility/VectorMutable.h" 8 8 9 #include <cmath> 9 10 #include <vector> 10 11 … … 19 20 { 20 21 for(size_t j=0;j<k_sorted.size();j++) 21 prediction(target(k_sorted[j]))+=1.0; 22 if(!std::isinf(distance(k_sorted[j]))) 23 prediction(target(k_sorted[j]))+=1.0; 22 24 } 23 25
Note: See TracChangeset
for help on using the changeset viewer.