Changeset 1031 for trunk/test


Ignore:
Timestamp:
Feb 4, 2008, 4:44:44 PM (14 years ago)
Author:
Markus Ringnér
Message:

Fixes #272

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/knn_test.cc

    r999 r1031  
    2424#include "yat/classifier/KNN.h"
    2525#include "yat/classifier/MatrixLookupWeighted.h"
    26 #include "yat/statistics/euclidean_vector_distance.h"
    27 #include "yat/statistics/pearson_vector_distance.h"
     26#include "yat/statistics/euclidean_distance.h"
     27#include "yat/statistics/pearson_distance.h"
    2828#include "yat/utility/matrix.h"
    2929
     
    6666
    6767  classifier::MatrixLookupWeighted dataviewweighted(data,weights);
    68   classifier::KNN<statistics::pearson_vector_distance_tag> knn(dataviewweighted,targets);
     68  classifier::KNN<statistics::pearson_distance_tag> knn(dataviewweighted,targets);
    6969  *error << "training KNN" << std::endl;
    7070  knn.train();
  • trunk/test/ncc_test.cc

    r1013 r1031  
    3131#include "yat/classifier/Target.h"
    3232#include "yat/utility/matrix.h"
    33 #include "yat/statistics/euclidean_vector_distance.h"
    34 #include "yat/statistics/pearson_vector_distance.h"
     33#include "yat/statistics/euclidean_distance.h"
     34#include "yat/statistics/pearson_distance.h"
    3535#include "yat/utility/utility.h"
    3636
     
    7878  vec[3]="bjds";
    7979  classifier::Target target(vec);
    80   classifier::NCC<statistics::pearson_vector_distance_tag> ncctmp(ml,target);
     80  classifier::NCC<statistics::pearson_distance_tag> ncctmp(ml,target);
    8181  *error << "training...\n";
    8282  ncctmp.train();
     
    100100  classifier::Target target1(vec1);
    101101
    102   classifier::NCC<statistics::euclidean_vector_distance_tag> ncc1(ml1,target1);
     102  classifier::NCC<statistics::euclidean_distance_tag> ncc1(ml1,target1);
    103103  ncc1.train();
    104104  utility::matrix prediction1;
     
    150150     
    151151  classifier::MatrixLookupWeighted dataviewweighted(data,weights);
    152   classifier::NCC<statistics::pearson_vector_distance_tag> ncc(dataviewweighted,targets);
     152  classifier::NCC<statistics::pearson_distance_tag> ncc(dataviewweighted,targets);
    153153  *error << "training...\n";
    154154  ncc.train();
  • trunk/test/vector_distance_test.cc

    r1012 r1031  
    2424#include "yat/classifier/DataLookupWeighted1D.h"
    2525#include "yat/classifier/MatrixLookupWeighted.h"
    26 #include "yat/statistics/euclidean_vector_distance.h"
    27 #include "yat/statistics/pearson_vector_distance.h"
     26#include "yat/statistics/euclidean_distance.h"
     27#include "yat/statistics/pearson_distance.h"
    2828#include "yat/utility/matrix.h"
    2929#include "yat/utility/vector.h"
     
    4747    error = new std::ofstream("/dev/null");
    4848    if (argc>1)
    49       std::cout << "vector_distance_test -v : for printing extra information\n";
     49      std::cout << "distance_test -v : for printing extra information\n";
    5050  }
    51   *error << "testing vector_distance" << std::endl;
     51  *error << "testing distance" << std::endl;
    5252  bool ok = true;
    5353 
     
    5959  double tolerance=1e-4;
    6060 
    61   double dist=statistics::vector_distance(a.begin(),a.end(),b.begin(),
    62                                           statistics::euclidean_vector_distance_tag());
     61  double dist=statistics::distance(a.begin(),a.end(),b.begin(),
     62                                          statistics::euclidean_distance_tag());
    6363  if(fabs(dist-2.23607)>tolerance) {
    64     *error << "Error in unweighted Euclidean vector_distance " << std::endl;
     64    *error << "Error in unweighted Euclidean distance " << std::endl;
    6565    ok=false;
    6666  }
    6767 
    68   dist=statistics::vector_distance(a.begin(),a.end(),b.begin(),
    69                                    statistics::pearson_vector_distance_tag()); 
     68  dist=statistics::distance(a.begin(),a.end(),b.begin(),
     69                                   statistics::pearson_distance_tag());
    7070  if(fabs(dist-1.5)>tolerance) {
    71     *error << "Error in unweighted Pearson vector_distance " << std::endl;
     71    *error << "Error in unweighted Pearson distance " << std::endl;
    7272    ok=false;
    7373  }
     
    8585  classifier::DataLookupWeighted1D bw(mw,1,true);
    8686 
    87   dist=statistics::vector_distance(aw.begin(),aw.end(),bw.begin(),
    88                                    statistics::euclidean_vector_distance_tag());
     87  dist=statistics::distance(aw.begin(),aw.end(),bw.begin(),
     88                                   statistics::euclidean_distance_tag());
    8989 
    9090  if(fabs(dist-sqrt(6))>tolerance) {
    91     *error << "Error in weighted Euclidean vector_distance " << std::endl;
     91    *error << "Error in weighted Euclidean distance " << std::endl;
    9292    ok=false;
    9393  }
    9494 
    95   dist=statistics::vector_distance(aw.begin(),aw.end(),bw.begin(),
    96                                    statistics::pearson_vector_distance_tag());
     95  dist=statistics::distance(aw.begin(),aw.end(),bw.begin(),
     96                                   statistics::pearson_distance_tag());
    9797 
    9898  if(fabs(dist-2)>tolerance) {
    99     *error << "Error in weighted Pearson vector_distance " << std::endl;
     99    *error << "Error in weighted Pearson distance " << std::endl;
    100100    ok=false;
    101101  }
     
    108108  sb[2] = 1;
    109109 
    110   dist=statistics::vector_distance(sa.begin(),sa.end(),sb.begin(),
    111                                    statistics::euclidean_vector_distance_tag()); 
     110  dist=statistics::distance(sa.begin(),sa.end(),sb.begin(),
     111                                   statistics::euclidean_distance_tag());
    112112  if(fabs(dist-2.23607)>tolerance) {
    113     *error << "Error in vector_distance for std::vector " << std::endl;
     113    *error << "Error in distance for std::vector " << std::endl;
    114114    ok=false;
    115115  }
     
    118118  std::list<double> la;
    119119  std::copy(sa.begin(),sa.end(),std::back_inserter<std::list<double> >(la));
    120   dist=statistics::vector_distance(la.begin(),la.end(),sb.begin(),
    121                                    statistics::euclidean_vector_distance_tag()); 
     120  dist=statistics::distance(la.begin(),la.end(),sb.begin(),
     121                                   statistics::euclidean_distance_tag());
    122122  if(fabs(dist-2.23607)>tolerance) {
    123     *error << "Error in vector_distance for std::list " << std::endl;
     123    *error << "Error in distance for std::list " << std::endl;
    124124    ok=false;
    125125  }
    126126 
    127127  if(!ok) {
    128     *error << "vector_distance_test failed" << std::endl;
     128    *error << "distance_test failed" << std::endl;
    129129  }
    130130  if (error!=&std::cerr)
Note: See TracChangeset for help on using the changeset viewer.