Ignore:
Timestamp:
Feb 22, 2008, 4:29:56 PM (14 years ago)
Author:
Peter
Message:

fixes #308

File:
1 edited

Legend:

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

    r1115 r1121  
    3232#include "SupervisedClassifier.h"
    3333#include "Target.h"
    34 #include "yat/utility/matrix.h"
     34#include "yat/utility/Matrix.h"
    3535#include "yat/utility/yat_assert.h"
    3636
     
    107107    ///
    108108    ///
    109     void predict(const DataLookup2D&, utility::matrix&) const;
     109    void predict(const DataLookup2D&, utility::Matrix&) const;
    110110
    111111
     
    129129    /// generated and needs to be deleted by the caller.
    130130    ///
    131     utility::matrix* calculate_distances(const DataLookup2D&) const;
     131    utility::Matrix* calculate_distances(const DataLookup2D&) const;
    132132
    133133    void calculate_unweighted(const MatrixLookup&,
    134134                              const MatrixLookup&,
    135                               utility::matrix*) const;
     135                              utility::Matrix*) const;
    136136    void calculate_weighted(const MatrixLookupWeighted&,
    137137                            const MatrixLookupWeighted&,
    138                             utility::matrix*) const;
     138                            utility::Matrix*) const;
    139139  };
    140140 
     
    162162 
    163163  template <typename Distance, typename NeighborWeighting>
    164   utility::matrix* KNN<Distance, NeighborWeighting>::calculate_distances
     164  utility::Matrix* KNN<Distance, NeighborWeighting>::calculate_distances
    165165  (const DataLookup2D& test) const
    166166  {
    167167    // matrix with training samples as rows and test samples as columns
    168     utility::matrix* distances =
    169       new utility::matrix(data_.columns(),test.columns());
     168    utility::Matrix* distances =
     169      new utility::Matrix(data_.columns(),test.columns());
    170170   
    171171   
     
    210210  void  KNN<Distance, NeighborWeighting>::calculate_unweighted
    211211  (const MatrixLookup& training, const MatrixLookup& test,
    212    utility::matrix* distances) const
     212   utility::Matrix* distances) const
    213213  {
    214214    for(size_t i=0; i<training.columns(); i++) {
     
    226226  KNN<Distance, NeighborWeighting>::calculate_weighted
    227227  (const MatrixLookupWeighted& training, const MatrixLookupWeighted& test,
    228    utility::matrix* distances) const
     228   utility::Matrix* distances) const
    229229  {
    230230    for(size_t i=0; i<training.columns(); i++) {
     
    295295  template <typename Distance, typename NeighborWeighting>
    296296  void KNN<Distance, NeighborWeighting>::predict(const DataLookup2D& test,
    297                                                  utility::matrix& prediction) const
     297                                                 utility::Matrix& prediction) const
    298298  {   
    299299    utility::yat_assert<std::runtime_error>(data_.rows()==test.rows());
    300300
    301     utility::matrix* distances=calculate_distances(test);
     301    utility::Matrix* distances=calculate_distances(test);
    302302   
    303303    prediction.resize(target_.nof_classes(),test.columns(),0.0);
Note: See TracChangeset for help on using the changeset viewer.