Ignore:
Timestamp:
Sep 5, 2007, 2:50:49 PM (14 years ago)
Author:
Markus Ringnér
Message:

The SNR score is now ok again and renamed SNRScore. Fixes #235"

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/SNRScore.cc

    r855 r856  
    2323*/
    2424
    25 #include "SNR.h"
     25#include "SNRScore.h"
    2626#include "Averager.h"
    2727#include "AveragerWeighted.h"
     
    3636namespace statistics { 
    3737
    38   SNR::SNR(bool b)
    39     : Score(b), score_(0)
     38  SNRScore::SNRScore(bool b)
     39    : Score(b)
    4040  {
    4141  }
    4242
    43   double SNR::score(const classifier::Target& target,
    44                     const utility::vector& value)
     43  SNRScore::~SNRScore(void)
     44  {
     45  }
     46
     47  double SNRScore::score(const classifier::Target& target,
     48                         const utility::vector& value) const
    4549  {
    4650    statistics::Averager positive;
     
    5458    double diff = positive.mean() - negative.mean();
    5559    double denom=positive.std()+negative.std();
    56     score_=diff/denom;
     60    double snr=diff/denom;
    5761    if(positive.n()==0 || negative.n()==0)
    58       score_=0;
    59     if (score_<0 && absolute_)
    60       score_=-score_;   
    61     return score_;
     62      snr=0;
     63    if (snr<0 && absolute_)
     64      snr=-snr;   
     65    return snr;
    6266  }
    6367
    64   double SNR::score(const classifier::Target& target,
    65                     const classifier::DataLookupWeighted1D& value)
     68  double SNRScore::score(const classifier::Target& target,
     69                         const classifier::DataLookupWeighted1D& value) const
    6670  {
    6771    statistics::AveragerWeighted positive;
     
    7680    double denom=positive.std()+negative.std();
    7781    assert(denom);
    78     score_=diff/denom;
     82    double snr=diff/denom;
    7983    if(positive.sum_w()==0 || negative.sum_w()==0)
    80       score_=0;
    81     if (score_<0 && absolute_)
    82       score_=-score_;   
    83     return score_;
     84      snr=0;
     85    if (snr<0 && absolute_)
     86      snr=-snr;   
     87    return snr;
    8488  }
    8589
    8690
    8791
    88   double SNR::score(const classifier::Target& target,
     92  double SNRScore::score(const classifier::Target& target,
    8993                    const utility::vector& value,
    90                     const utility::vector& weight)
     94                    const utility::vector& weight) const
    9195  {
    9296    statistics::AveragerWeighted positive;
     
    101105    double denom=positive.std()+negative.std();
    102106    assert(denom);
    103     score_=diff/denom;
     107    double snr=diff/denom;
    104108    if(positive.sum_w()==0 || negative.sum_w()==0)
    105       score_=0;
    106     if (score_<0 && absolute_)
    107       score_=-score_;   
    108     return score_;
     109      snr=0;
     110    if (snr<0 && absolute_)
     111      snr=-snr;   
     112    return snr;
    109113  }
    110114
Note: See TracChangeset for help on using the changeset viewer.