Ignore:
Timestamp:
07/01/13 16:25:11 (10 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Changed (simplified) SVMClassifier constructors (and pickling).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/libsvm_interface.hpp

    r11606 r11607  
    6767WRAPPER(KernelFunc) 
    6868 
    69 //#include "callback.hpp" 
    7069 
    7170class ORANGE_API TSVMLearner : public TLearner{ 
     
    108107    virtual int getNumOfElements(PExampleGenerator examples); 
    109108    virtual TSVMClassifier* createClassifier( 
    110             PVariable var, PExampleTable examples, PExampleTable supportVectors, svm_model* model); 
     109                PDomain domain, svm_model* model, PExampleTable supportVectors, PExampleTable examples); 
    111110}; 
    112111 
     
    119118    virtual int getNumOfElements(PExampleGenerator examples); 
    120119    virtual TSVMClassifier* createClassifier( 
    121             PVariable classVar, PExampleTable examples, PExampleTable supportVectors, svm_model* model); 
     120            PDomain domain, svm_model* model, PExampleTable supportVectors, PExampleTable examples); 
    122121}; 
    123122 
    124123 
    125 class ORANGE_API TSVMClassifier : public TClassifierFD{ 
     124class ORANGE_API TSVMClassifier : public TClassifierFD { 
    126125public: 
    127126    __REGISTER_CLASS 
    128     TSVMClassifier(){ 
     127    TSVMClassifier() { 
    129128        this->model = NULL; 
    130129    }; 
    131130 
    132     TSVMClassifier(const PVariable & , PExampleTable examples, PExampleTable supportVectors, 
    133             svm_model* model, PKernelFunc kernelFunc); 
     131    TSVMClassifier(PDomain, svm_model * model, PExampleTable supportVectors, 
     132            PKernelFunc kernelFunc=NULL, PExampleTable examples=NULL); 
    134133 
    135134    ~TSVMClassifier(); 
     
    146145    PFloatList probB; //P probB - pairwise probability information 
    147146    PExampleTable supportVectors; //P support vectors 
    148     PExampleTable examples; //P (training instances when svm_type == Custom) 
    149     PKernelFunc kernelFunc; //P custom kernel function 
     147 
     148    PExampleTable examples; //P training instances when svm_type == Custom 
     149    PKernelFunc kernelFunc; //P custom kernel function used when svm_type == Custom 
    150150 
    151151    int svm_type; //P(&SVMLearner_SVMType)  SVM type (C_SVC=0, NU_SVC, ONE_CLASS, EPSILON_SVR=3, NU_SVR=4) 
     
    162162}; 
    163163 
    164 class ORANGE_API TSVMClassifierSparse : public TSVMClassifier{ 
     164class ORANGE_API TSVMClassifierSparse : public TSVMClassifier { 
    165165public: 
    166166    __REGISTER_CLASS 
    167     TSVMClassifierSparse(){}; 
    168     TSVMClassifierSparse(PVariable var, PExampleTable examples,  PExampleTable supportVectors, 
    169             svm_model* model, bool useNonMeta, PKernelFunc kernelFunc 
    170             ) :TSVMClassifier(var, examples, supportVectors, model, kernelFunc){ 
     167    TSVMClassifierSparse() {}; 
     168 
     169    TSVMClassifierSparse( 
     170            PDomain domain, svm_model * model, bool useNonMeta, 
     171            PExampleTable supportVectors, 
     172            PKernelFunc kernelFunc=NULL, 
     173            PExampleTable examples=NULL 
     174            ) : TSVMClassifier(domain, model, supportVectors, kernelFunc, examples) { 
    171175        this->useNonMeta = useNonMeta; 
    172176    } 
    173177 
    174     bool useNonMeta; //P include non meta attributes 
     178    bool useNonMeta; //PR include non meta attributes 
    175179 
    176180protected: 
Note: See TracChangeset for help on using the changeset viewer.