Changeset 543


Ignore:
Timestamp:
Mar 5, 2006, 5:42:38 PM (16 years ago)
Author:
Peter
Message:

moved destruction of ranker to SupervisedClassifier?

Location:
trunk/lib/classifier
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/classifier/NCC.cc

    r527 r543  
    3636  NCC::~NCC()   
    3737  {
    38     if(ranker_)
    39       delete ranker_;
    4038  }
    4139
  • trunk/lib/classifier/SVM.cc

    r542 r543  
    77#include <c++_tools/gslapi/vector.h>
    88#include <c++_tools/statistics/Averager.h>
     9#include <c++_tools/statistics/Score.h>
    910#include <c++_tools/random/random.h>
    1011
     
    2930      output_(target.size(),0),
    3031      sample_(target.size()),
    31       target_(target),
    3232      trained_(false),
    3333      tolerance_(0.00000001)
    3434  {
    3535  }
     36
     37  SVM::SVM(const KernelLookup& kernel, const Target& target,
     38           statistics::Score& score, const size_t nof_inputs)
     39    : SupervisedClassifier(target, &score, nof_inputs),
     40      alpha_(target.size(),0),
     41      bias_(0),
     42      C_inverse_(0),
     43      kernel_(&kernel),
     44      max_epochs_(10000000),
     45      output_(target.size(),0),
     46      sample_(target.size()),
     47      trained_(false),
     48      tolerance_(0.00000001)
     49  {
     50  }
     51
     52 
    3653
    3754  SupervisedClassifier* SVM::make_classifier(const DataLookup2D& data,
  • trunk/lib/classifier/SVM.h

    r542 r543  
    111111    SVM(const KernelLookup& kernel, const Target& target);
    112112
     113    ///
     114    /// Constructor taking the kernel, the target vector, the score
     115    /// used to rank data inputs, and the number of top ranked data
     116    /// inputs to use in the classification.
     117    ///
     118    /// @note if the @a target or @a kernel
     119    /// is destroyed the behaviour is undefined.
     120    ///
     121    /// @note make no effect yet
     122    SVM(const KernelLookup& kernel, const Target& target,
     123        statistics::Score&, const size_t);
     124
    113125    ///
    114126    /// @todo doc
     
    240252    gslapi::vector output_;
    241253    Index sample_;
    242     const Target& target_;
    243254    bool trained_;
    244255    double tolerance_;
  • trunk/lib/classifier/SupervisedClassifier.cc

    r526 r543  
    22
    33#include <c++_tools/classifier/SupervisedClassifier.h>
     4#include <c++_tools/classifier/InputRanker.h>
    45
    56namespace theplu {
     
    1213  }
    1314
    14     SupervisedClassifier::SupervisedClassifier(const Target& target,
     15  SupervisedClassifier::SupervisedClassifier(const Target& target,
    1516                                             statistics::Score* score,
    1617                                             const size_t nof_inputs)
     
    2021  }
    2122
     23  SupervisedClassifier::~SupervisedClassifier()
     24  {
     25    if(ranker_)
     26      delete ranker_;
     27  }
     28
    2229
    2330}}
  • trunk/lib/classifier/SupervisedClassifier.h

    r526 r543  
    4848    /// Destructor
    4949    ///
    50     virtual ~SupervisedClassifier() {};
     50    virtual ~SupervisedClassifier();
    5151
    5252    ///
Note: See TracChangeset for help on using the changeset viewer.