Changeset 1484


Ignore:
Timestamp:
Sep 9, 2008, 7:01:43 PM (13 years ago)
Author:
Peter
Message:

refs #396

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/knn_test.cc

    r1437 r1484  
    171171  ind[1]=3;
    172172  classifier::Target target2(target1,utility::Index(ind));
    173   classifier::MatrixLookupWeighted mlw4(data1,weights2,utility::Index(ind),false);
     173  classifier::MatrixLookupWeighted mlw4(data1,weights2,
     174                                        utility::Index(data1.rows()),
     175                                        utility::Index(ind));
    174176  classifier::KNN<statistics::EuclideanDistance> knn5;
    175177  knn5.k(3);
  • trunk/test/ncc_test.cc

    r1483 r1484  
    185185  ind[1]=3;
    186186  classifier::Target target2(target1,utility::Index(ind));
    187   classifier::MatrixLookupWeighted mlw3(data1,weights2,utility::Index(ind),false);
     187  classifier::MatrixLookupWeighted mlw3(data1,weights2,
     188                                        utility::Index(data1.rows()),
     189                                        utility::Index(ind));
    188190  classifier::NCC<statistics::PearsonDistance> ncc5;
    189191  ncc5.train(mlw3,target2);
  • trunk/yat/classifier/MatrixLookupWeighted.cc

    r1483 r1484  
    8888
    8989
    90   /*
    91   MatrixLookupWeighted::MatrixLookupWeighted(const utility::Matrix& data)
    92     : data_(MatrixP(&data, false))
    93   {
    94     utility::Matrix weights;
    95     utility::nan(*data_,weights);
    96     weights_= MatrixP(new utility::Matrix(weights));
    97     row_index_ = utility::Index(data.rows());
    98     column_index_ = utility::Index(data.columns());
    99     assert(validate());
    100   }
    101   */
    102 
    103 
    10490  MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookup& ml)
    10591    : column_index_(ml.column_index_), data_(ml.data_),
     
    115101                                             const utility::Index& row,
    116102                                             const utility::Index& col)
    117     : column_index_(col), data_(MatrixP(new utility::Matrix(data), false)),
    118       row_index_(row), weights_(MatrixP(new utility::Matrix(weights), false))
    119   {
    120     assert(validate());
    121   }
    122  
    123 
    124 
     103    : column_index_(col), data_(MatrixP(&data, false)),
     104      row_index_(row), weights_(MatrixP(&weights, false))
     105  {
     106    assert(validate());
     107  }
     108 
     109
     110
     111  /*
    125112  MatrixLookupWeighted::MatrixLookupWeighted(const utility::Matrix& data,
    126113                                             const utility::Matrix& weights,
     
    142129    assert(validate());
    143130  }
    144  
     131  */
    145132
    146133  /*
     
    295282  {
    296283    for (size_t i=0; i<row_index_.size(); ++i)
    297       if (row_index_[i]>=data_->rows())
     284      if (row_index_[i]>=data_->rows()) {
     285        std::cerr << i << " " << row_index_[i] << std::endl;
    298286        return false;
     287      }
    299288    for (size_t i=0; i<column_index_.size(); ++i)
    300289      if (column_index_[i]>=data_->columns())
  • trunk/yat/classifier/MatrixLookupWeighted.h

    r1483 r1484  
    4141
    4242namespace utility {
    43   class Index;
    4443  class Matrix;
    4544  class MatrixWeighted;
     
    120119                         const utility::Matrix& weights,
    121120                         const bool owner=false);
    122 
    123121   
    124     ///
    125     /// Constructor creating a lookup into the entire @a matrix.  A
    126     /// weight matrix is constructed with weights 1 for values and 0
    127     /// for nan's in @a matrix.
    128     ///
    129     /// \see  bool utility::nan(const Matrix&, Matrix&);
    130     ///
    131     /// @note If @a matrix goes out of scope or
    132     /// is deleted, the MatrixLookupWeighted becomes invalid and the
    133     /// result of further use is undefined.
    134     ///
    135     //MatrixLookupWeighted(const utility::Matrix& matrix);
    136 
    137 
    138122    /**
    139123       Constructor creating a MatrixLookupWeighted from a MatrixLookup. A
     
    146130       result of further use is undefined.
    147131    */
    148     MatrixLookupWeighted(const MatrixLookup& matrix);
     132    explicit MatrixLookupWeighted(const MatrixLookup& matrix);
    149133
    150134
     
    186170    /// result of further use is undefined.
    187171    ///
     172    /*
    188173    MatrixLookupWeighted(const utility::Matrix& matrix,
    189174                         const utility::Matrix& weights,
    190175                         const utility::Index& index,
    191176                         const bool row_vectors);
     177    */
    192178
    193179    ///
Note: See TracChangeset for help on using the changeset viewer.