Changeset 1726


Ignore:
Timestamp:
Jan 15, 2009, 10:15:26 PM (12 years ago)
Author:
Jari Häkkinen
Message:

Fixes #476. Improved estimate() doc and added test on estimate() return value.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/nni_test.cc

    r1669 r1726  
    6969  utility::Matrix weight(weight_stream);
    7070  utility::kNNI knni(data,weight,neighbours);
    71   knni.estimate();
     71  unsigned int nonimputed=knni.estimate();
     72  if (!suite.equal(nonimputed,15)) {
     73    suite.err() << "kNNI FAILED, unexpected number of non imputed rows" << std::endl;
     74    suite.add(false);
     75  }
    7276  std::ifstream control_stream(knni_result.c_str());
    7377  utility::Matrix control(control_stream);
     
    9094  weight=utility::Matrix(weight_stream);
    9195  utility::WeNNI wenni(data,weight,neighbours);
    92   wenni.estimate();
     96  nonimputed=wenni.estimate();
     97  if (!suite.equal(nonimputed,15)) {
     98    suite.err() << "WeNNI FAILED, unexpected number of non imputed rows" << std::endl;
     99    suite.add(false);
     100  }
    93101  control_stream.open(wenni_result.c_str());
    94102  control=utility::Matrix(control_stream);
     
    110118  weight=utility::Matrix(weight_stream);
    111119  utility::WeNNI wenni2(data,weight,neighbours);
    112   wenni2.estimate();
     120  nonimputed=wenni2.estimate();
     121  if (!suite.equal(nonimputed,15)) {
     122    suite.err() << "binary WeNNI FAILED, unexpected number of non imputed rows"
     123                << std::endl;
     124    suite.add(false);
     125  }
    113126  control_stream.open(knni_result.c_str());
    114127  control=utility::Matrix(control_stream);
  • trunk/yat/utility/NNI.h

    r1487 r1726  
    9090    virtual ~NNI(void) {};
    9191
    92     ///
    93     /// Function doing the imputation.
    94     ///
    95     /// @return number of rows not imputed
    96     ///
     92    /**
     93       \brief Function doing the imputation.
     94
     95       The return value can be used as an indication of how well the
     96       imputation worked. The return value should be zero if proper
     97       pre-processing of data is done. An example of bad data is a
     98       matrix with a column of zero weights, another is a
     99       corresponding situation with a row with all weights zero.
     100
     101       \return The number of rows that have at least one value not
     102       imputed.
     103    */
    97104    virtual unsigned int estimate(void)=0;
    98105
  • trunk/yat/utility/WeNNI.h

    r1725 r1726  
    6262          const unsigned int neighbours);
    6363
    64     ///
    65     /// Perform WeNNI on data in \a matrix with continuous uncertainty
    66     /// weights in \a weight using \a neighbours for the new impute
    67     /// value.
    68     ///
     64    /**
     65       \brief Function doing WeNNI imputation.
     66
     67       Perform WeNNI on data in \a matrix with continuous uncertainty
     68       weights in \a weight using \a neighbours for the new impute
     69       value.
     70
     71       The return value can be used as an indication of how well the
     72       imputation worked. The return value should be zero if proper
     73       pre-processing of data is done. An example of bad data is a
     74       matrix with a column of zero weights, another is a
     75       corresponding situation with a row with all weights zero.
     76
     77       \return The number of rows that have at least one value not
     78       imputed.
     79    */
    6980    unsigned int estimate(void);
    7081
  • trunk/yat/utility/kNNI.h

    r1487 r1726  
    5757         const unsigned int neighbours);
    5858
    59     ///
    60     /// Perform kNNI on data in \a matrix with binary uncertainty
    61     /// weights in \a weight using \a neighbours for the new impute
    62     /// value.
    63     ///
     59    /**
     60       \brief Function doing kNNI imputation.
     61
     62       Perform kNNI on data in \a matrix with binary uncertainty
     63       weights in \a weight using \a neighbours for the new impute
     64       value.
     65
     66       The return value can be used as an indication of how well the
     67       imputation worked. The return value should be zero if proper
     68       pre-processing of data is done. An example of bad data is a
     69       matrix with a column of zero weights, another is a
     70       corresponding situation with a row with all weights zero.
     71
     72       \return The number of rows that have at least one value not
     73       imputed.
     74    */
    6475    unsigned int estimate(void);
    6576
Note: See TracChangeset for help on using the changeset viewer.