Changeset 2335


Ignore:
Timestamp:
Oct 15, 2010, 2:22:13 PM (13 years ago)
Author:
Peter
Message:

prefer lines shorter than 80 characters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/KNN.h

    r2334 r2335  
    199199  template <typename Distance, typename NeighborWeighting>
    200200  KNN<Distance, NeighborWeighting>::KNN(const Distance& dist)
    201     : SupervisedClassifier(),data_ml_(0),data_mlw_(0),target_(0),k_(3), distance_(dist)
     201    : SupervisedClassifier(), data_ml_(0), data_mlw_(0), target_(0), k_(3),
     202      distance_(dist)
    202203  {
    203204    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
     
    218219    for(size_t i=0; i<training.columns(); i++) {
    219220      for(size_t j=0; j<test.columns(); j++) {
    220         (*distances)(i,j) = distance_(training.begin_column(i), training.end_column(i),
     221        (*distances)(i,j) = distance_(training.begin_column(i),
     222                                      training.end_column(i),
    221223                                      test.begin_column(j));
    222224        YAT_ASSERT(!std::isnan((*distances)(i,j)));
     
    234236    for(size_t i=0; i<training.columns(); i++) {
    235237      for(size_t j=0; j<test.columns(); j++) {
    236         (*distances)(i,j) = distance_(training.begin_column(i), training.end_column(i),
     238        (*distances)(i,j) = distance_(training.begin_column(i),
     239                                      training.end_column(i),
    237240                                      test.begin_column(j));
    238241        // If the distance is NaN (no common variables with non-zero weights),
     
    303306
    304307  template <typename Distance, typename NeighborWeighting>
    305   void KNN<Distance, NeighborWeighting>::predict(const MatrixLookup& test,
    306                                                  utility::Matrix& prediction) const
     308  void
     309  KNN<Distance, NeighborWeighting>::predict(const MatrixLookup& test,
     310                                            utility::Matrix& prediction) const
    307311  {   
    308312    // matrix with training samples as rows and test samples as columns
     
    336340
    337341  template <typename Distance, typename NeighborWeighting>
    338   void KNN<Distance, NeighborWeighting>::predict(const MatrixLookupWeighted& test,
    339                                                  utility::Matrix& prediction) const
     342  void
     343  KNN<Distance, NeighborWeighting>::predict(const MatrixLookupWeighted& test,
     344                                            utility::Matrix& prediction) const
    340345  {   
    341346    // matrix with training samples as rows and test samples as columns
     
    387392          prediction(c,j)=std::numeric_limits<double>::quiet_NaN();
    388393  }
    389 
    390 
    391394}}} // of namespace classifier, yat, and theplu
    392395
    393396#endif
    394 
Note: See TracChangeset for help on using the changeset viewer.