Changeset 1087 for trunk/yat/classifier


Ignore:
Timestamp:
Feb 14, 2008, 7:05:37 AM (13 years ago)
Author:
Peter
Message:

fixes #312 and added passing of data in EB constructors

Location:
trunk/yat/classifier
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/EnsembleBuilder.h

    r1079 r1087  
    5252    /// Constructor.
    5353    ///
    54     EnsembleBuilder(const Classifier&, const Sampler&);
     54    EnsembleBuilder(const Classifier&, const Data&, const Sampler&);
    5555
    5656    ///
    5757    /// Constructor.
    5858    ///
    59     EnsembleBuilder(const Classifier&, const Sampler&,
     59    EnsembleBuilder(const Classifier&, const Data&, const Sampler&,
    6060                    FeatureSelector&);
    6161
     
    116116
    117117  template <class C, class D>
    118   EnsembleBuilder<C,D>::EnsembleBuilder(const C& sc,
     118  EnsembleBuilder<C,D>::EnsembleBuilder(const C& sc, const D& data,
    119119                                        const Sampler& sampler)
    120     : mother_(sc),subset_(new SubsetGenerator<D>(sampler,sc.data()))
    121   {
    122   }
    123 
    124 
    125   template <class C, class D>
    126   EnsembleBuilder<C, D>::EnsembleBuilder(const C& sc, const Sampler& sampler,
     120    : mother_(sc),subset_(new SubsetGenerator<D>(sampler,data))
     121  {
     122  }
     123
     124
     125  template <class C, class D>
     126  EnsembleBuilder<C, D>::EnsembleBuilder(const C& sc, const D& data,
     127                                         const Sampler& sampler,
    127128                                         FeatureSelector& fs)
    128129    : mother_(sc),
    129       subset_(new SubsetGenerator<D>(sampler,sc.data(),fs))
     130      subset_(new SubsetGenerator<D>(sampler,data,fs))
    130131  {
    131132  }
  • trunk/yat/classifier/SVM.cc

    r1049 r1087  
    4747
    4848  SVM::SVM(const KernelLookup& kernel, const Target& target)
    49     : SupervisedClassifier(target),
    50       alpha_(target.size(),0),
     49    : alpha_(target.size(),0),
    5150      bias_(0),
    5251      C_inverse_(0),
     
    5756      owner_(false),
    5857      sample_(target.size()),
     58      target_(target),
    5959      trained_(false),
    6060      tolerance_(0.00000001)
     
    114114  }
    115115
    116   SupervisedClassifier* SVM::make_classifier(const DataLookup2D& data,
    117                                              const Target& target) const
     116  SVM* SVM::make_classifier(const DataLookup2D& data,
     117                            const Target& target) const
    118118  {
    119119    SVM* sc=0;
  • trunk/yat/classifier/SVM.h

    r1049 r1087  
    2828
    2929#include "KernelLookup.h"
    30 #include "SupervisedClassifier.h"
    3130#include "SVindex.h"
     31#include "Target.h"
    3232#include "yat/utility/vector.h"
    3333
     
    5252  /// taken care of outside (in the kernel).
    5353  ///   
    54   class SVM : public SupervisedClassifier
     54  class SVM
    5555  {
    5656 
     
    7575    /// If DataLookup2D is not a KernelLookup a bad_cast exception is thrown.
    7676    ///
    77     SupervisedClassifier*
    78     make_classifier(const DataLookup2D&, const Target&) const;
     77    SVM* make_classifier(const DataLookup2D&, const Target&) const;
    7978
    8079    ///
     
    246245    bool owner_;
    247246    SVindex sample_;
     247    Target target_;
    248248    bool trained_;
    249249    double tolerance_;
Note: See TracChangeset for help on using the changeset viewer.