Changeset 465


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

implemented score for WilcoxonFoldChange?

Location:
trunk/lib/statistics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/statistics/ROC.h

    r447 r465  
    3535    /// belonges to class + otherwise sample belongs to class
    3636    /// -. @return the area under the ROC curve. If the area is less
    37     /// than 0.5 and absolute=true, 1-area is returned.
     37    /// than 0.5 and absolute=true, 1-area is returned. Complexity is
     38    /// \f$ N\log N \f$ where \f$ N \f$ is number of samples.
    3839    ///
    3940    double score(const gslapi::vector& target, const gslapi::vector& value,
     
    4849    /// -. @return wheighted version of area under the ROC curve. If
    4950    /// the area is less than 0.5 and absolute=true, 1-area is
    50     /// returned.
     51    /// returned. Complexity is \f$ N^2 \f$ where \f$ N \f$ is number
     52    /// of samples.
    5153    ///
    5254    double score(const gslapi::vector& target, const gslapi::vector& value,
  • 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
  • trunk/lib/statistics/WilcoxonFoldChange.h

    r461 r465  
    44#define _theplu_statistics_wilcoxonfoldchange_
    55
    6 #include "Score.h"
     6#include <c++_tools/statistics/Score.h>
    77
    88namespace theplu {
     
    3434          const std::vector<size_t>& train_set = std::vector<size_t>());
    3535 
    36     ///
     36    /// @todo
    3737    /// @return difference of the weighted means of the two classes
    3838    ///
     
    4242    /// @train_set defining which values to use (number of values used
    4343    /// in the calculation is equal to size of \a train_set)
    44     ///
     44    ///
     45    /// @note not implemented
     46    ///
    4547    double
    4648    score(const gslapi::vector& target,
Note: See TracChangeset for help on using the changeset viewer.