Changeset 448


Ignore:
Timestamp:
Dec 15, 2005, 8:05:57 PM (17 years ago)
Author:
Peter
Message:

oops, at least compiling now

Location:
trunk/lib/statistics
Files:
2 edited

Legend:

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

    r447 r448  
    1515
    1616
    17   void expected(double& a, double& b, double& c, double& d)
     17  void Fisher::expected(double& a, double& b, double& c, double& d)
    1818  {
    19     double N=a_+b_+c_+d_;
     19    double N = a_+b_+c_+d_;
    2020    a =((a_+b_)*(a_+c_)) / N;
    2121    b =((a_+b_)*(b_+d_)) / N;
     
    4646  {
    4747    double p=1;
    48     if (a<minimum_size_ || b<minimum_size_ ||
    49         c<minimum_size_ || d<minimum_size_){
     48    if (a_<minimum_size_ || b_<minimum_size_ ||
     49        c_<minimum_size_ || d_<minimum_size_){
    5050
    5151      p=p_value_exact();
     
    6262  double Fisher::p_value_approximative() const
    6363  {
    64    
     64    return 1.0;
    6565  }
    6666
     
    128128      train_set_ = train_set;
    129129
     130    double a=0;
     131    double b=0;
     132    double c=0;
     133    double d=0;
     134
    130135    for (size_t i=0; i<train_set_.size(); i++)
    131136      if (x(train_set_[i]) < cutoff_column_)
    132137        if (y(train_set_[i]) < cutoff_row_)
    133           a_+=w(train_set_[i]);
     138          a+=w(train_set_[i]);
    134139        else
    135           c_+=w(train_set_[i]);
     140          c+=w(train_set_[i]);
    136141      else
    137142        if (y(train_set_[i]) < cutoff_column_)
    138           b_+=w(train_set_[i]);
     143          b+=w(train_set_[i]);
    139144        else
    140           d_+=w(train_set_[i]);
     145          d+=w(train_set_[i]);
    141146
    142147    return oddsratio(a_,b_,c_,d_);
    143148  }
    144149
    145   double Fisher::score(const double a, const double b,
    146                        const double c, const double d)
     150  double Fisher::score(const u_int a, const u_int b,
     151                       const u_int c, const u_int d)
    147152  {
    148153    a_=a;
  • trunk/lib/statistics/Fisher.h

    r447 r448  
    77#include <c++_tools/gslapi/vector.h>
    88
     9#include <cmath>
    910
    1011namespace theplu {
     
    7677    /// a' = (a+c)(a+b)/(a+b+c+d)
    7778    ///
    78     void expected(u_int& a, u_int& b, u_unt& c, u_int& d);
     79    void expected(double& a, double& b, double& c, double& d);
    7980
    8081    ///
     
    142143    std::vector<size_t> train_set_;
    143144    gslapi::vector weight_;
    144     double a_;
    145     double b_;
    146     double c_;
    147     double d_;
     145    u_int a_;
     146    u_int b_;
     147    u_int c_;
     148    u_int d_;
    148149    double cutoff_column_;
    149150    double cutoff_row_;
    150     double minimum_size_;
     151    u_int minimum_size_;
    151152
    152153  };
Note: See TracChangeset for help on using the changeset viewer.