Changeset 1727
- Timestamp:
- Jan 15, 2009, 10:49:39 PM (15 years ago)
- Location:
- trunk/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/data/knni_matrix.data
r1725 r1727 11 11 .2234 .77639 .38783 .28953 .62376 .5445 .32489 .22388 .238746 .23468 .1234 12 12 .2388 .234688 .43687 .86456 .65654 .6864 .879645 .98454 .98731 .164897 .1234 13 .1968 .153987 .13684 .14685 .316135 .5286 .69435 .13634 .18351 .1984531 .123413 .1968 .153987 .13684 .14685 .316135 .5286 .69435 .13634 .18351 .1984531 Inf 14 14 .6865 .213687 .12368 .18564 .897654 .4945 .789654 .45547 .98466 .66136 .1234 15 15 .9835 .963154 .964664 .132369 .983316 .3276 .376513 .34941 .387433 .31685 .1234 -
trunk/test/data/knni_result.data
r1554 r1727 9 9 0.2234 0.77639 0.38783 0.28953 0.62376 0.5445 0.32489 0.22388 0.238746 0.23468 0.1234 10 10 0.2388 0.234688 0.43687 0.86456 0.65654 0.6864 0.879645 0.98454 0.98731 0.164897 0.1234 11 0.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577643004747 0.123411 0.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577643004747 Inf 12 12 0.6865 0.213687 0.12368 0.18564 0.897654 0.4945 0.789654 0.45547 0.98466 0.66136 0.1234 13 13 0.9835 0.963154 0.964664 0.132369 0.983316 0.3276 0.376513 0.34941 0.387433 0.31685 0.1234 -
trunk/test/data/wenni_result.data
r1554 r1727 9 9 0.2234 0.77639 0.38783 0.28953 0.62376 0.5445 0.32489 0.22388 0.238746 0.23468 0.1234 10 10 0.2388 0.234688 0.43687 0.86456 0.65654 0.6864 0.879645 0.98454 0.98731 0.164897 0.1234 11 0.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577488912729 0.123411 0.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577488912729 Inf 12 12 0.6865 0.213687 0.12368 0.18564 0.897654 0.4945 0.789654 0.45547 0.98466 0.66136 0.1234 13 13 0.9835 0.963154 0.964664 0.132369 0.983316 0.3276 0.376513 0.34941 0.387433 0.31685 0.1234 -
trunk/test/nni_test.cc
r1726 r1727 48 48 { 49 49 test::Suite suite(argc, argv); 50 suite.err() << "Testing NNI algorithms" << std::endl; 50 51 52 suite.err() << "Reading data" << std::endl; 51 53 unsigned int neighbours=3; 52 54 std::string knni_data(test::filename("data/knni_matrix.data")); … … 64 66 65 67 // test kNNI 68 suite.err() << "Testing kNNI" << std::endl; 66 69 std::ifstream data_stream(knni_data.c_str()); 67 70 std::ifstream weight_stream(knni_weight.c_str()); … … 79 82 for (unsigned int i=0; i<control.rows(); i++) 80 83 for (unsigned int j=0; j<control.columns(); j++) 81 if (!suite.equal_fix(knni.imputed_data()(i,j),control(i,j),error_bound)) { 84 if ((i==10) && (j==10)) { 85 if (!std::isnan(knni.imputed_data()(i,j)-control(i,j))) { 86 suite.err() << "kNNI FAILED, error on row " << i << " and " 87 << "column " << j << " expected NaN" << std::endl; 88 suite.add(false); 89 } 90 } 91 else if (!suite.equal_fix(knni.imputed_data()(i,j),control(i,j),error_bound)) { 82 92 suite.err() << "kNNI FAILED, error on row " << i << " and " 83 << "column " << j << " is" <<std::endl;93 << "column " << j << std::endl; 84 94 suite.add(false); // calculation result out of accepted error bounds 85 95 } … … 89 99 90 100 // test WeNNI 101 suite.err() << "Testing WeNNI" << std::endl; 91 102 data_stream.open(wenni_data.c_str()); 92 103 data=utility::Matrix(data_stream); … … 103 114 for (unsigned int i=0; i<control.rows(); i++) 104 115 for (unsigned int j=0; j<control.columns(); j++) 105 if (!suite.equal_fix(wenni.imputed_data()(i,j),control(i,j),error_bound)){ 116 if ((i==10) && (j==10)) { 117 if (!std::isnan(knni.imputed_data()(i,j)-control(i,j))) { 118 suite.err() << "WeNNI FAILED, error on row " << i << " and " 119 << "column " << j << " expected NaN" << std::endl; 120 suite.add(false); 121 } 122 } 123 else if (!suite.equal_fix(wenni.imputed_data()(i,j),control(i,j),error_bound)){ 106 124 suite.err() << "WeNNI FAILED, error on row " << i << " and " 107 125 << "column " << j << std::endl; … … 113 131 114 132 // test WeNNI with binary weights 133 suite.err() << "Testing WeNNI with binary weights" << std::endl; 115 134 data_stream.open(knni_data.c_str()); 116 135 data=utility::Matrix(data_stream); … … 128 147 for (unsigned int i=0; i<control.rows(); i++) 129 148 for (unsigned int j=0; j<control.columns(); j++) 130 if (!suite.equal_fix(wenni2.imputed_data()(i,j),control(i,j),error_bound)){ 149 if ((i==10) && (j==10)) { 150 if (!std::isnan(knni.imputed_data()(i,j)-control(i,j))) { 151 suite.err() << "binary WeNNI FAILED, error on row " << i << " and " 152 << "column " << j << " expected NaN" << std::endl; 153 suite.add(false); 154 } 155 } 156 else if (!suite.equal_fix(wenni2.imputed_data()(i,j),control(i,j),error_bound)){ 131 157 suite.err() << "WeNNI binary weight test FAILED.\nError on row " << i 132 158 << " and column " << j << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.