source: branches/peters_vector/lib/statistics/WilcoxonFoldChange.cc @ 469

Last change on this file since 469 was 469, checked in by Peter, 17 years ago

non compiling checking before revision after design meeting

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.1 KB
RevLine 
[461]1// $Id: WilcoxonFoldChange.cc 469 2005-12-19 14:58:29Z peter $
2
[465]3#include <c++_tools/statistics/WilcoxonFoldChange.h>
[469]4#include <c++_tools/classifier/VectorAbstract.h>
[465]5#include <c++_tools/statistics/utility.h>
[469]6#include <c++_tools/classifier/Target.h>
[461]7
[465]8#include <cmath>
[469]9#include <vector>
[461]10
11namespace theplu {
12namespace statistics {
13
14
15  WilcoxonFoldChange::WilcoxonFoldChange(bool absolute)
16    : Score(absolute)
17  {
18  }
19
20
21
[469]22  double WilcoxonFoldChange::score(const classifier::Target& target, 
23                                   const classifier::VectorAbstract& value)
[461]24  {
[465]25    std::vector<double> distance;
26    //Peter, should reserve the vector to avoid reallocations   
[461]27    weighted_=false;
[469]28    for (size_t i=0; i<target.size(); i++) {
[465]29      for (size_t j=0; i<j; j++) {
[469]30        if (target(i)==target(j)) continue;
31        distance.push_back(value(i)-value(j));
[465]32      }
33    }
34    if (absolute_)
35      return fabs(median(distance));
36    return median(distance);
[461]37  }
38
[469]39  double WilcoxonFoldChange::score(const classifier::Target& target, 
40                                   const classifier::VectorAbstract& value,
41                                   const classifier::VectorAbstract& weight)
[461]42  {
[465]43    return 0;
[461]44  }
45
46} // of namespace statistics
47} // of namespace theplu
Note: See TracBrowser for help on using the repository browser.