Changeset 820


Ignore:
Timestamp:
Mar 17, 2007, 10:54:52 PM (17 years ago)
Author:
Peter
Message:

Changed name again. ROCScore is now called AUC. Also fixed several bugs and added test for these.

Location:
trunk
Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/test/consensus_inputranker_test.cc

    r781 r820  
    2323
    2424#include "yat/classifier/ConsensusInputRanker.h"
    25 #include "yat/statistics/ROCScore.h"
     25#include "yat/statistics/AUC.h"
    2626#include "yat/utility/matrix.h"
    2727#include "yat/classifier/MatrixLookup.h"
     
    5959
    6060 
    61   theplu::yat::statistics::ROCScore roc;
     61  theplu::yat::statistics::AUC roc;
    6262  theplu::yat::classifier::CrossValidationSampler sampler(target,30,3);
    6363  *error << "Building Consensus_Inputranker" << std::endl;
  • trunk/test/data_lookup_1d_test.cc

    r680 r820  
    2525#include "yat/classifier/DataLookup1D.h"
    2626#include "yat/classifier/MatrixLookup.h"
     27#include "yat/classifier/utility.h"
    2728
    2829
     
    5455  *error << "Testing Lookup Classes" << std::endl;
    5556  bool ok = true;
     57
     58 
    5659
    5760  if(!std::numeric_limits<double>::has_quiet_NaN) {
     
    166169  }
    167170  std::remove("data/tmp_test_datalookup1D.txt");
    168    
     171  *error << "\n";
     172
     173  DataLookup1D dl(v5);
     174  utility::vector v8;
     175  classifier::convert(dl, v8);
     176  if (!v5.equal(v8,0.0)) {
     177    ok = false;
     178    *error << "Error: Creating a DataLookup1D(utility::vector)\n"
     179           << "and classifier::convert(DataLookup, utility::vector)\n"
     180           << "does not give back original vector\n"
     181           << "orginal:      " << v5 << "\n"
     182           << "DataLookup1D: " << dl << "\n"
     183           << "final result: " << v8 << "\n"
     184           << std::endl;
     185  }
     186
    169187  return end_test(error,ok);
    170188}
  • trunk/test/distance_test.cc

    r816 r820  
    5858  b(2) = 1;
    5959
     60  *error << "testing PearsonDistance" << std::endl;
    6061  statistics::Distance* distance = new statistics::PearsonDistance;
    6162  ok = ok && test(a, b, distance, 1.5, error);
    6263  delete distance;
    6364 
     65  *error << "testing Euclidean" << std::endl;
    6466  distance = new statistics::Euclidean;
    6567  ok = ok && test(a, b, distance, 5, error);
     
    7981          std::ostream* error)
    8082{
     83  // distance between a and a is always zero
    8184  if (a!=b && !test(a, a, distance, 0, error))
    8285    return false;
     86  else
     87    *error << "Testing that distance between x and x is zero"
     88           << std::endl;
    8389  if ((*distance)(a,b) != facit) {
    8490    *error << "Error: calculating distance with utility::vector\n"
  • trunk/test/feature_selection_test.cc

    r781 r820  
    2424#include "yat/classifier/FeatureSelectorIR.h"
    2525#include "yat/classifier/FeatureSelectorRandom.h"
    26 #include "yat/statistics/ROCScore.h"
     26#include "yat/statistics/AUC.h"
    2727
    2828#include <fstream>
     
    4545  bool ok = true;
    4646
    47   statistics::ROCScore roc;
     47  statistics::AUC roc;
    4848  classifier::FeatureSelectorIR f(roc, 12);
    4949  classifier::FeatureSelectorRandom f2(12);
  • trunk/test/inputranker_test.cc

    r781 r820  
    2323
    2424#include "yat/classifier/InputRanker.h"
    25 #include "yat/statistics/ROCScore.h"
     25#include "yat/statistics/AUC.h"
    2626#include "yat/utility/matrix.h"
    2727#include "yat/classifier/MatrixLookup.h"
     
    5757  is.close();
    5858
    59   statistics::ROCScore roc;
     59  statistics::AUC roc;
    6060  classifier::InputRanker ir(data,target,roc);
    6161  if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){
  • trunk/test/score_test.cc

    r781 r820  
    2525#include "yat/statistics/FoldChange.h"
    2626#include "yat/statistics/Pearson.h"
    27 #include "yat/statistics/ROCScore.h"
     27#include "yat/statistics/AUC.h"
    2828#include "yat/statistics/SAMScore.h"
    2929#include "yat/statistics/tScore.h"
     
    5252  bool ok = true;
    5353
    54   *error << "testing ROCScore" << std::endl;
     54  *error << "testing AUC" << std::endl;
    5555  utility::vector value(31);
    5656  std::vector<std::string> label(31,"negative");
     
    6060  for (size_t i=0; i<value.size(); i++)
    6161    value(i)=i;
    62   statistics::ROCScore roc;
    63   double area = roc.score(target, value);
     62  statistics::AUC auc;
     63  double area = auc.score(target, value);
    6464  if (area!=1.0){
    65     *error << "test_roc: area is " << area << " should be 1.0"
     65    *error << "test_auc: area is " << area << " should be 1.0"
    6666           << std::endl;
    6767    ok = false;
     
    6969  target.set_binary(0,false);
    7070  target.set_binary(1,true);
    71   area = roc.score(target, value);
     71  area = auc.score(target, value);
    7272  if (area!=1.0){
    73     *error << "test_roc: area is " << area << " should be 1.0"
     73    *error << "test_auc: area is " << area << " should be 1.0"
    7474           << std::endl;
    7575    ok = false;
     
    9797      ok=false;
    9898    }
    99     area = roc.score(target2,vec);
     99    area = auc.score(target2,vec);
    100100    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
    101101      *error << "test_roc: area is " << area << " should be "
     
    108108  for (size_t i=0; i<data.rows(); i++){
    109109    utility::vector vec(data,i);
    110     area = roc.score(target2, vec, weight);
     110    area = auc.score(target2, vec, weight);
    111111    if (area<correct_area(i)-tol || area>correct_area(i)+tol){
    112112      *error << "test_roc: weighted area is " << area << " should be "
  • trunk/test/subset_generator_test.cc

    r781 r820  
    3232#include "yat/classifier/SVM.h"
    3333#include "yat/classifier/NCC.h"
    34 #include "yat/statistics/ROCScore.h"
     34#include "yat/statistics/AUC.h"
    3535#include "yat/statistics/PearsonDistance.h"
    3636#include "yat/utility/matrix.h"
     
    7979  classifier::CrossValidationSampler sampler(target, 30, 3);
    8080
    81   statistics::ROCScore score;
     81  statistics::AUC score;
    8282  classifier::FeatureSelectorIR fs(score, 96, 0);
    8383  *error << "building SubsetGenerator" << std::endl;
     
    9797  for (size_t i = 0; i<out.size(); ++i)
    9898    out(i)=ensemble_svm.validate()[0][i].mean();
    99   statistics::ROCScore roc;
     99  statistics::AUC roc;
    100100  *error << roc.score(target,out) << std::endl;
    101101
  • trunk/yat/classifier/DataLookup1D.cc

    r815 r820  
    7474
    7575  DataLookup1D::DataLookup1D(const utility::vector& v)
    76     : column_vector_(true), index_(0), owner_(true)
     76    : column_vector_(false), index_(0), owner_(true)
    7777  {
    7878    utility::matrix* m = new utility::matrix(1,v.size());
  • trunk/yat/random/random.h

    r818 r820  
    2525*/
    2626
     27#include "yat/statistics/Histogram.h"
     28
    2729#include <gsl/gsl_rng.h>
    2830#include <gsl/gsl_randist.h>
     
    3234namespace theplu {
    3335namespace yat {
    34 namespace statistics {
    35   class Histogram;
    36 }
    3736namespace random {
    3837
  • trunk/yat/statistics/AUC.cc

    r810 r820  
    2222*/
    2323
    24 #include "ROCScore.h"
     24#include "AUC.h"
    2525#include "yat/classifier/DataLookupWeighted1D.h"
    2626#include "yat/classifier/Target.h"
     
    3737namespace statistics { 
    3838
    39   ROCScore::ROCScore(bool absolute)
     39  AUC::AUC(bool absolute)
    4040    : Score(absolute)
    4141  {
    4242  }
    4343
    44   double ROCScore::score(const classifier::Target& target,
    45                          const utility::vector& value) const
     44  double AUC::score(const classifier::Target& target,
     45                    const utility::vector& value) const
    4646  {
    4747    assert(target.size()==value.size());
     
    5757
    5858
    59   double ROCScore::score(const classifier::Target& target,
    60                          const classifier::DataLookupWeighted1D& value) const
     59  double AUC::score(const classifier::Target& target,
     60                    const classifier::DataLookupWeighted1D& value) const
    6161  {
    6262    assert(target.size()==value.size());
     
    7373
    7474
    75   double ROCScore::score(const classifier::Target& target,
    76                          const utility::vector& value,
    77                          const utility::vector& weight) const
     75  double AUC::score(const classifier::Target& target,
     76                    const utility::vector& value,
     77                    const utility::vector& weight) const
    7878  {
    7979    assert(target.size()==value.size());
     
    9090
    9191
    92   double
    93   ROCScore::score(const MultiMap& m) const
     92  double AUC::score(const MultiMap& m) const
    9493  {
    9594    double area=0;
  • trunk/yat/statistics/AUC.h

    r810 r820  
    1 #ifndef _theplu_yat_statistics_roc_score_
    2 #define _theplu_yat_statistics_roc_score_
     1#ifndef _theplu_yat_statistics_auc_
     2#define _theplu_yat_statistics_auc_
    33
    44// $Id$
     
    4242
    4343  ///
    44   /// @brief Class for Reciever Operating Characteristic.
     44  /// @brief Class calculating Area Under ROC Curve
    4545  ///   
    46   class ROCScore : public Score
     46  class AUC : public Score
    4747  {
    4848 
     
    5151    ///
    5252    ///
    53     ROCScore(bool absolute=true);
     53    AUC(bool absolute=true);
    5454
    5555    /// Function taking \a value, \a target (+1 or -1) and vector
  • trunk/yat/statistics/Makefile.am

    r781 r820  
    2424
    2525noinst_LTLIBRARIES = libstatistics.la
    26 libstatistics_la_SOURCES = Averager.cc AveragerPair.cc      \
     26libstatistics_la_SOURCES = AUC.cc Averager.cc AveragerPair.cc     \
    2727  AveragerWeighted.cc AveragerPairWeighted.cc Distance.cc   \
    2828  Euclidean.cc Fisher.cc FoldChange.cc Histogram.cc Pearson.cc      \
    29   PearsonCorrelation.cc PearsonDistance.cc ROC.cc ROCScore.cc \
     29  PearsonCorrelation.cc PearsonDistance.cc ROC.cc \
    3030  SAMScore.cc Score.cc SNR.cc tScore.cc tTest.cc \
    3131  utility.cc WilcoxonFoldChange.cc
     
    3333include_statisticsdir = $(includedir)/yat/statistics
    3434
    35 include_statistics_HEADERS = Averager.h AveragerPair.h      \
     35include_statistics_HEADERS = AUC.h Averager.h AveragerPair.h      \
    3636  AveragerWeighted.h AveragerPairWeighted.h Distance.h Euclidean.h \
    3737  Fisher.h  \
    3838  FoldChange.h Histogram.h Pearson.h PearsonCorrelation.h \
    39   PearsonDistance.h ROC.h ROCScore.h \
     39  PearsonDistance.h ROC.h \
    4040  SAMScore.h Score.h SNR.h tScore.h tTest.h \
    4141  utility.h WilcoxonFoldChange.h
Note: See TracChangeset for help on using the changeset viewer.