Changeset 1158


Ignore:
Timestamp:
Feb 26, 2008, 2:49:38 PM (16 years ago)
Author:
Markus Ringnér
Message:

Fixed #322

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/ncc_test.cc

    r1157 r1158  
    2222*/
    2323
    24 #include "yat/classifier/IGP.h"
    2524#include "yat/classifier/Kernel_MEV.h"
    2625#include "yat/classifier/KernelLookup.h"
  • trunk/yat/classifier/IGP.h

    r1120 r1158  
    5151 
    5252  public:
     53    ///
     54    /// Constructor taking the training data and the target vector and
     55    /// as input.
     56    ///
     57    IGP(const MatrixLookup&, const Target&);
     58
     59
    5360    ///
    5461    /// Constructor taking the training data, the target vector and
    5562    /// the distance measure as input.
    5663    ///
    57     IGP(const MatrixLookup&, const Target&);
     64    IGP(const MatrixLookup&, const Target&, const Distance&);
    5865
    5966    ///
     
    6976
    7077  private:
     78    void calculate();
     79
    7180    utility::Vector igp_;
    7281    Distance distance_;
     
    8392    : matrix_(data), target_(target)
    8493  {   
     94    calculate();
     95  }
     96
     97  template <typename Distance>
     98  IGP<Distance>::IGP(const MatrixLookup& data, const Target& target, const Distance& dist)
     99    : matrix_(data), target_(target), distance_(dist)
     100  {   
     101    calculate();
     102  }
     103
     104 
     105  template <typename Distance>
     106  IGP<Distance>::~IGP()   
     107  {
     108  }
     109
     110  template <typename Distance>
     111  void IGP<Distance>::calculate()
     112  {
    85113    utility::yat_assert<std::runtime_error>(target_.size()==matrix_.columns());
    86114   
     
    108136    }
    109137  }
    110  
    111   template <typename Distance>
    112   IGP<Distance>::~IGP()   
    113   {
    114   }
    115138
    116139 
  • trunk/yat/classifier/KNN.h

    r1157 r1158  
    6363
    6464    ///
     65    /// @brief Constructor
     66    ///
     67    KNN(const Distance&);
     68
     69
     70    ///
    6571    /// @brief Destructor
    6672    ///
     
    141147  KNN<Distance, NeighborWeighting>::KNN()
    142148    : SupervisedClassifier(),data_(0),target_(0),k_(3)
     149  {
     150  }
     151
     152  template <typename Distance, typename NeighborWeighting>
     153  KNN<Distance, NeighborWeighting>::KNN(const Distance& dist)
     154    : SupervisedClassifier(),data_(0),target_(0),k_(3), distance_(dist)
    143155  {
    144156  }
  • trunk/yat/classifier/NCC.h

    r1157 r1158  
    6969    NCC(void);
    7070   
     71    ///
     72    /// @brief Constructor
     73    ///
     74    NCC(const Distance&);
     75
    7176
    7277    ///
     
    123128  NCC<Distance>::NCC()
    124129    : SupervisedClassifier(), centroids_(0), centroids_nan_(false)
     130  {
     131  }
     132
     133  template <typename Distance>
     134  NCC<Distance>::NCC(const Distance& dist)
     135    : SupervisedClassifier(), centroids_(0), centroids_nan_(false), distance_(dist)
    125136  {
    126137  }
Note: See TracChangeset for help on using the changeset viewer.