Changeset 1447


Ignore:
Timestamp:
Aug 28, 2008, 4:56:42 AM (13 years ago)
Author:
Peter
Message:

Changed the interface of QuantileNormalizer?. The interface now has one matrix& and one const&. The former is object for normalization, and the latter is the base for calculating the distributions (Quantiles). The reason to change the interface is to allow normalization based on a nother matrix, e.g., normalizing a test data matrix based on the training data matrix. Also it is more inline with the Centralizer added earlier today. refs #425

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r1437 r1447  
    8484ncc_test_SOURCES = ncc_test.cc
    8585nni_test_SOURCES = nni_test.cc
     86normalization_test_SOURCES = normalization_test.cc
    8687pca_test_SOURCES = pca_test.cc
    8788range_test_SOURCES = range_test.cc
  • trunk/test/normalization_test.cc

    r1445 r1447  
    7171  m(1,1) = 4;
    7272  normalization::QuantileNormalizer qn;
    73   qn(m);
     73  qn(m, m);
    7474  suite.err() << "Testing m(0,0)\n";
    7575  suite.add(suite.equal(m(0,0), 2));
  • trunk/yat/normalization/QuantileNormalizer.cc

    r1432 r1447  
    3535namespace normalization {
    3636
    37   void QuantileNormalizer::operator()(utility::Matrix& data) const
     37  void QuantileNormalizer::operator()(const utility::Matrix& data,
     38                                      utility::Matrix& result) const
    3839  {
    3940    utility::Matrix data_copy(data);
     
    5051    }
    5152
    52     for (size_t column=0; column<data.columns(); ++column){
     53    for (size_t column=0; column<result.columns(); ++column){
    5354      std::vector<size_t> index;
    54       utility::sort_index(index, data.column_const_view(column));
     55      utility::sort_index(index, result.column_const_view(column));
    5556                               
    56       for (size_t row=0; row<data.rows(); ++row)
    57         data(index[row], column) = averager[row].mean();
     57      for (size_t row=0; row<result.rows(); ++row)
     58        result(index[row], column) = averager[row].mean();
    5859    }
    5960  }
  • trunk/yat/normalization/QuantileNormalizer.h

    r1445 r1447  
    4545       within a column is preserved in the normalization.
    4646     */
    47     void operator()(utility::Matrix& matrix) const;
     47    void operator()(const utility::Matrix& matrix,
     48                    utility::Matrix& result) const;
    4849  };
    4950
Note: See TracChangeset for help on using the changeset viewer.