Changeset 148


Ignore:
Timestamp:
Sep 9, 2004, 3:22:41 PM (17 years ago)
Author:
Peter
Message:

modified score function

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ROC.cc

    r140 r148  
    8989
    9090    // Normalizing the area to [0,1]
    91     area_ = (area_/nof_pos_-(nof_pos_-1)/2 )/(value_.size()-nof_pos_);
     91    area_ = ( (area_-nof_pos_*(nof_pos_-1)/2 ) /
     92              (nof_pos_*(value_.size()-nof_pos_)) );
    9293   
    93     return area_;
     94    //Returning score larger 0.5 that you get by random
     95    if (area_>0.5)
     96      return area_;
     97    else
     98      return 1.0-area_;
    9499  }
    95100
     
    125130    }
    126131    area_/=max_area;
    127     return area_;
     132    if (area_>0.5)
     133      return area_;
     134    else
     135      return 1-area_;
    128136  }
    129137
  • trunk/src/ROC.h

    r140 r148  
    3434    virtual ~ROC(void) {};
    3535         
    36     /// Function taking \a value, target (+1 or -1) and vector
    37     /// defining what samples to use. The score is equivalent to the
    38     /// Mann-Whitney score but normalized to be between zero and
    39     /// one. @return the area under the ROC curve
     36    /// Function taking \a value, \a target (+1 or -1) and vector
     37    /// defining what samples to use. The score is equivalent to
     38    /// Mann-Whitney statistics @return the area under the ROC
     39    /// curve. If the area is less than 0.5, is 1-area returned.
    4040    ///
    4141    double score(const gslapi::vector& value, const gslapi::vector& target,
     
    4747    /// over all pairs where value+ is larger than value-. The
    4848    /// denominator goes over all pairs. @return wheighted version of
    49     /// area under the ROC curve
     49    /// area under the ROC curve. If the area is less than 0.5, is
     50    /// 1-area returned.
    5051    ///
    5152    double score(const gslapi::vector&, const gslapi::vector&,
  • trunk/src/tScore.cc

    r119 r148  
    4242                  /(positive.n()-1+negative.n()-1));
    4343    t_=diff/s;
    44     return t_;
     44   
     45    if (t_>0)
     46      return t_;
     47    else
     48      return -t_;
    4549  }
    4650
     
    7074                  (positive.sum_w()+negative.sum_w()));
    7175    t_=diff/s;
    72     return t_;
     76    if (t_>0)
     77      return t_;
     78    else
     79      return -t_;
    7380  }
    7481
  • trunk/src/tScore.h

    r119 r148  
    3737   
    3838    ///
    39     /// Calculates the t-score, i.e. the ratio between difference in
    40     /// mean and standard deviation of this difference.
    41     /// @return \f$ \frac{\frac{1}{n_x}\sum x_i - \frac{1}{n_y}\sum y_i}
    42     /// {\frac{\sum x_i^2 + \sum y_i^2}{n_x-1+n_y-1}} \f$
     39    /// Calculates the absolute value of t-score, i.e. the ratio
     40    /// between difference in mean and standard deviation of this
     41    /// difference.  /// @return \f$ \frac{ \vert \frac{1}{n_x}\sum x_i
     42    /// - \frac{1}{n_y}\sum y_i \vert } {\frac{\sum x_i^2 + \sum
     43    /// y_i^2}{n_x-1+n_y-1}} \f$
    4344    ///
    4445    double score(const gslapi::vector&, const gslapi::vector&, 
Note: See TracChangeset for help on using the changeset viewer.