Ignore:
Timestamp:
Dec 17, 2005, 12:19:24 AM (17 years ago)
Author:
Peter
Message:

implemented score for WilcoxonFoldChange?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/statistics/WilcoxonFoldChange.cc

    r461 r465  
    11// $Id$
    22
    3 #include "WilcoxonFoldChange.h"
     3#include <c++_tools/statistics/WilcoxonFoldChange.h>
     4#include <c++_tools/statistics/utility.h>
    45
    5 #include "Score.h"
    6 #include "Averager.h"
    7 #include "AveragerWeighted.h"
     6#include <cmath>
    87
    98namespace theplu {
     
    2827      train_set_=train_set;
    2928
     29    std::vector<double> distance;
     30    //Peter, should reserve the vector to avoid reallocations   
    3031    weighted_=false;
    31 
     32    for (size_t i=0; i<train_set_.size(); i++) {
     33      for (size_t j=0; i<j; j++) {
     34        if (target(train_set_[i])==target(train_set_[j])) continue;
     35        distance.push_back(value(train_set_[i])-value(train_set_[j]));
     36      }
     37    }
     38    if (absolute_)
     39      return fabs(median(distance));
     40    return median(distance);
    3241  }
    3342
     
    3746                                   const std::vector<size_t>& train_set)
    3847  {
    39     if (!train_set_.size())
    40       for (size_t i=0; i<target_.size(); i++)
    41         train_set_.push_back(i); 
    42     else
    43       train_set_=train_set;
    44 
    45     weighted_=true;
     48    return 0;
    4649  }
    4750
Note: See TracChangeset for help on using the changeset viewer.