Changeset 1050 for trunk/test


Ignore:
Timestamp:
Feb 7, 2008, 7:47:34 PM (14 years ago)
Author:
Peter
Message:

Simplifying distance structure

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/knn_test.cc

    r1031 r1050  
    6666
    6767  classifier::MatrixLookupWeighted dataviewweighted(data,weights);
    68   classifier::KNN<statistics::pearson_distance_tag> knn(dataviewweighted,targets);
     68  classifier::KNN<statistics::PearsonDistance> knn(dataviewweighted,targets);
    6969  *error << "training KNN" << std::endl;
    7070  knn.train();
  • trunk/test/ncc_test.cc

    r1031 r1050  
    7878  vec[3]="bjds";
    7979  classifier::Target target(vec);
    80   classifier::NCC<statistics::pearson_distance_tag> ncctmp(ml,target);
     80  classifier::NCC<statistics::EuclideanDistance> ncctmp(ml,target);
    8181  *error << "training...\n";
    8282  ncctmp.train();
     
    100100  classifier::Target target1(vec1);
    101101
    102   classifier::NCC<statistics::euclidean_distance_tag> ncc1(ml1,target1);
     102  classifier::NCC<statistics::EuclideanDistance> ncc1(ml1,target1);
    103103  ncc1.train();
    104104  utility::matrix prediction1;
     
    150150     
    151151  classifier::MatrixLookupWeighted dataviewweighted(data,weights);
    152   classifier::NCC<statistics::pearson_distance_tag> ncc(dataviewweighted,targets);
     152  classifier::NCC<statistics::EuclideanDistance> ncc(dataviewweighted,targets);
    153153  *error << "training...\n";
    154154  ncc.train();
  • trunk/test/vector_distance_test.cc

    r1031 r1050  
    5858 
    5959  double tolerance=1e-4;
    60  
    61   double dist=statistics::distance(a.begin(),a.end(),b.begin(),
    62                                           statistics::euclidean_distance_tag());
     60  statistics::EuclideanDistance eucl_dist;
     61  double dist=eucl_dist(a.begin(),a.end(),b.begin());
    6362  if(fabs(dist-2.23607)>tolerance) {
    6463    *error << "Error in unweighted Euclidean distance " << std::endl;
     
    6665  }
    6766 
    68   dist=statistics::distance(a.begin(),a.end(),b.begin(),
    69                                    statistics::pearson_distance_tag());
     67  statistics::PearsonDistance pear_dist;
     68  dist=pear_dist(a.begin(),a.end(),b.begin());
    7069  if(fabs(dist-1.5)>tolerance) {
    7170    *error << "Error in unweighted Pearson distance " << std::endl;
     
    8584  classifier::DataLookupWeighted1D bw(mw,1,true);
    8685 
    87   dist=statistics::distance(aw.begin(),aw.end(),bw.begin(),
    88                                    statistics::euclidean_distance_tag());
     86  dist=eucl_dist(aw.begin(),aw.end(),bw.begin());
    8987 
    9088  if(fabs(dist-sqrt(6))>tolerance) {
     
    9391  }
    9492 
    95   dist=statistics::distance(aw.begin(),aw.end(),bw.begin(),
    96                                    statistics::pearson_distance_tag());
     93  dist=pear_dist(aw.begin(),aw.end(),bw.begin());
    9794 
    9895  if(fabs(dist-2)>tolerance) {
     
    108105  sb[2] = 1;
    109106 
    110   dist=statistics::distance(sa.begin(),sa.end(),sb.begin(),
    111                                    statistics::euclidean_distance_tag());
     107  dist=eucl_dist(sa.begin(),sa.end(),sb.begin());
    112108  if(fabs(dist-2.23607)>tolerance) {
    113109    *error << "Error in distance for std::vector " << std::endl;
     
    118114  std::list<double> la;
    119115  std::copy(sa.begin(),sa.end(),std::back_inserter<std::list<double> >(la));
    120   dist=statistics::distance(la.begin(),la.end(),sb.begin(),
    121                                    statistics::euclidean_distance_tag());
     116  dist=eucl_dist(la.begin(),la.end(),sb.begin());
    122117  if(fabs(dist-2.23607)>tolerance) {
    123118    *error << "Error in distance for std::list " << std::endl;
Note: See TracChangeset for help on using the changeset viewer.