Ignore:
Timestamp:
Sep 19, 2014, 7:38:10 AM (9 years ago)
Author:
Peter
Message:

remove trailing ws

File:
1 edited

Legend:

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

    r2384 r3316  
    1 #ifndef _theplu_yat_classifier_igp_ 
    2 #define _theplu_yat_classifier_igp_ 
     1#ifndef _theplu_yat_classifier_igp_
     2#define _theplu_yat_classifier_igp_
    33
    44// $Id$
     
    3939namespace theplu {
    4040namespace yat {
    41 namespace classifier { 
     41namespace classifier {
    4242
    4343  class Target;
     
    5252  class IGP
    5353  {
    54  
     54
    5555  public:
    5656    ///
    5757    /// Constructor taking the training data and the target vector and
    58     /// as input. 
     58    /// as input.
    5959    ///
    6060    IGP(const MatrixLookup&, const Target&);
     
    6363    ///
    6464    /// Constructor taking the training data, the target vector and
    65     /// the distance measure as input. 
     65    /// the distance measure as input.
    6666    ///
    6767    IGP(const MatrixLookup&, const Target&, const Distance&);
     
    8686    const MatrixLookup& matrix_;
    8787    const Target& target_;
    88   }; 
     88  };
    8989
    90  
     90
    9191  // templates
    9292
    9393  template <typename Distance>
    94   IGP<Distance>::IGP(const MatrixLookup& data, const Target& target) 
     94  IGP<Distance>::IGP(const MatrixLookup& data, const Target& target)
    9595    : matrix_(data), target_(target)
    96   {   
     96  {
    9797    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    9898    calculate();
     
    100100
    101101  template <typename Distance>
    102   IGP<Distance>::IGP(const MatrixLookup& data, const Target& target, const Distance& dist) 
     102  IGP<Distance>::IGP(const MatrixLookup& data, const Target& target, const Distance& dist)
    103103    : matrix_(data), target_(target), distance_(dist)
    104   {   
     104  {
    105105    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    106106    calculate();
    107107  }
    108108
    109  
     109
    110110  template <typename Distance>
    111   IGP<Distance>::~IGP()   
     111  IGP<Distance>::~IGP()
    112112  {
    113113  }
    114114
    115115  template <typename Distance>
    116   void IGP<Distance>::calculate() 
     116  void IGP<Distance>::calculate()
    117117  {
    118118    YAT_ASSERT(target_.size()==matrix_.columns());
    119    
     119
    120120    // Calculate IGP for each class
    121121    igp_ = utility::Vector(target_.nof_classes());
    122    
     122
    123123    for(size_t i=0; i<target_.size(); i++) {
    124124      size_t neighbor=i;
    125125      double mindist=std::numeric_limits<double>::max();
    126       for(size_t j=0; j<target_.size(); j++) {           
     126      for(size_t j=0; j<target_.size(); j++) {
    127127        if (i==j) // avoid self-self comparison
    128128          continue;
    129         double dist = distance_(matrix_.begin_column(i), matrix_.end_column(i), 
     129        double dist = distance_(matrix_.begin_column(i), matrix_.end_column(i),
    130130                                matrix_.begin_column(j));
    131131        if(dist<mindist) {
     
    136136      if(target_(i)==target_(neighbor))
    137137        igp_(target_(i))++;
    138      
     138
    139139    }
    140140    for(size_t i=0; i<target_.nof_classes(); i++) {
     
    143143  }
    144144
    145  
     145
    146146  template <typename Distance>
    147   const utility::Vector& IGP<Distance>::score(void) const 
     147  const utility::Vector& IGP<Distance>::score(void) const
    148148  {
    149149    return igp_;
    150150  }
    151  
     151
    152152}}} // of namespace classifier, yat, and theplu
    153153
Note: See TracChangeset for help on using the changeset viewer.