Changeset 493


Ignore:
Timestamp:
Jan 9, 2006, 3:01:40 PM (16 years ago)
Author:
Peter
Message:

fixed typo in tScore and added make_classifier in SVM

Location:
trunk/lib
Files:
3 edited

Legend:

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

    r491 r493  
    44#include <c++_tools/classifier/SVM.h>
    55
    6 #include <c++_tools/classifier/KernelLookup.h>
     6#include <c++_tools/classifier/DataLookup2D.h>
    77#include <c++_tools/gslapi/matrix.h>
    88#include <c++_tools/gslapi/vector.h>
     
    137137  }
    138138
    139   SVM::SVM(const KernelLookup& kernel, const Target& target)
     139  SVM::SVM(const DataLookup2D& kernel, const Target& target)
    140140    : SupervisedClassifier(kernel,target),
    141141      alpha_(target.size(),0),
     
    150150      tolerance_(0.00000001)
    151151  {
     152  }
     153
     154  SupervisedClassifier* SVM::make_classifier(const DataLookup2D& data,
     155                                             const Target& target) const
     156  {
     157    SVM* sc = new SVM(data,target);
     158    //Copy those variables possible to modify from outside
     159    return sc;
    152160  }
    153161
  • trunk/lib/classifier/SVM.h

    r491 r493  
    108108    /// the SVM is no longer defined.
    109109    ///
    110     SVM(const KernelLookup&, const Target&);
     110    SVM(const DataLookup2D&, const Target&);
     111
     112    ///
     113    /// @todo doc
     114    ///
     115    SupervisedClassifier*
     116    make_classifier(const DataLookup2D&, const Target&) const;
    111117
    112118    ///
     
    152158    { trained_=false; alpha_=gslapi::vector(target_.size(),0); }
    153159
    154     ///
    155     /// Training the SVM following Platt's SMO, with Keerti's
    156     /// modifacation. Minimizing \f$ \frac{1}{2}\sum
    157     /// y_iy_j\alpha_i\alpha_j(K_{ij}+\frac{1}{C_i}\delta_{ij}) \f$,
    158     /// which corresponds to minimizing \f$ \sum w_i^2+\sum C_i\xi_i^2
    159     /// \f$.
     160    ///
     161    /// Training the SVM following Platt's SMO, with Keerti's
     162    /// modifacation. Minimizing \f$ \frac{1}{2}\sum
     163    /// y_iy_j\alpha_i\alpha_j(K_{ij}+\frac{1}{C_i}\delta_{ij}) \f$,
     164    /// which corresponds to minimizing \f$ \sum w_i^2+\sum C_i\xi_i^2
     165    /// \f$.
    160166    ///
    161167    bool train();
     
    169175    SVM(const SVM&);
    170176         
    171     ///
    172     /// Default constructor (not implemented)
    173     ///
    174     SVM(void);
    175 
    176177    ///
    177178    /// Calculates bounds for alpha2
     
    207208    double bias_;
    208209    double C_inverse_;
    209     const KernelLookup& kernel_;
     210    const DataLookup2D& kernel_;
    210211    unsigned long int max_epochs_;
    211212    gslapi::vector output_;
  • trunk/lib/statistics/tScore.cc

    r492 r493  
    5858    double diff = positive.mean() - negative.mean();
    5959    double s2=(positive.sum_xx_centered()+negative.sum_xx_centered())/
    60       (positive.n()+negative.n()-2;
     60      (positive.n()+negative.n()-2);
    6161    t_=diff/sqrt(s2*(1.0/positive.sum_w()+1.0/negative.sum_w()));
    6262    assert(0);
Note: See TracChangeset for help on using the changeset viewer.