Changeset 10222:ba0d61857ad7 in orange


Ignore:
Timestamp:
02/15/12 01:17:01 (2 years ago)
Author:
Janez Demšar <janez.demsar@…>
Branch:
default
Parents:
10221:33ba08489c0a (diff), 10217:c9f84f39419c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge

Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/lib_learner.cpp

    r10206 r10222  
    103103 
    104104#include "assoc.hpp" 
    105 C_CALL(AssociationLearner - Orange.classification.rules.AssociationLearner, Learner, "([examples] [, weight=, conf=, supp=, voteWeight=]) -/-> Classifier") 
    106 C_NAMED(AssociationClassifier - Orange.classification.rules.AssociationClassifier, ClassifierFD, "([rules=, voteWeight=])") 
     105C_CALL(AssociationLearner, Learner, "([examples] [, weight=, conf=, supp=, voteWeight=]) -/-> Classifier") 
     106C_NAMED(AssociationClassifier, ClassifierFD, "([rules=, voteWeight=])") 
    107107C_CALL3(AssociationRulesInducer - Orange.associate.AssociationRulesInducer, AssociationRulesInducer, Orange, "([examples[, weightID]], confidence=, support=]) -/-> AssociationRules") 
    108108C_CALL3(AssociationRulesSparseInducer - Orange.associate.AssociationRulesSparseInducer, AssociationRulesSparseInducer, Orange, "([examples[, weightID]], confidence=, support=]) -/-> AssociationRules") 
    109 C_CALL3(ItemsetsSparseInducer - Orange.associate.ItemsSparseInducer, ItemsetsSparseInducer, Orange, "([examples[, weightID]], support=]) -/-> AssociationRules") 
     109C_CALL3(ItemsetsSparseInducer - Orange.associate.ItemsetsSparseInducer, ItemsetsSparseInducer, Orange, "([examples[, weightID]], support=]) -/-> AssociationRules") 
    110110 
    111111BASED_ON(ItemsetNodeProxy - Orange.associate.ItemsetNodeProxy, Orange) 
     
    571571#include "callback.hpp" 
    572572 
    573 C_CALL(TreeLearner - Orange.core.TreeLearner, Learner, "([examples] [, weight=, split=, stop=, nodeLearner=, lookDownOnUnknown=]) -/-> Classifier") 
     573C_CALL(TreeLearner - Orange.classification.tree._TreeLearner, Learner, "([examples] [, weight=, split=, stop=, nodeLearner=, lookDownOnUnknown=]) -/-> Classifier") 
    574574 
    575575C_NAMED(TreeNode - Orange.classification.tree.Node, Orange, "([lookDownOnUnknown=, branchSelector=, nodeClassifier=, branches=, contingency=])") 
    576 C_NAMED(TreeClassifier - Orange.classification.tree.TreeClassifier, ClassifierFD, "([domain=, tree=, descender=])") 
     576C_NAMED(TreeClassifier - Orange.classification.tree._TreeClassifier, ClassifierFD, "([domain=, tree=, descender=])") 
    577577 
    578578C_NAMED(TreeStopCriteria_common - Orange.classification.tree.StopCriteria_common, TreeStopCriteria, "([maxMajority=, minExamples=])") 
     
    582582C_CALL(TreeSplitConstructor_Combined - Orange.classification.tree.SplitConstructor_Combined, TreeSplitConstructor, "([examples, [weight, domainContingency, apriorClass, candidates] [discreteTreeSplitConstructor=, continuousTreeSplitConstructor=]) -/-> (Classifier, descriptions, sizes, quality)") 
    583583 
    584 ABSTRACT(TreeSplitConstructor_Measure - Orange.classification.tree.SplitConstructor_Measure, TreeSplitConstructor) 
    585 C_CALL(TreeSplitConstructor_Attribute - Orange.classification.tree.SplitConstructor_Attribute, TreeSplitConstructor_Measure, "([measure=, worstAcceptable=, minSubset=])") 
     584ABSTRACT(TreeSplitConstructor_Measure - Orange.classification.tree.SplitConstructor_Score, TreeSplitConstructor) 
     585C_CALL(TreeSplitConstructor_Attribute - Orange.classification.tree.SplitConstructor_Feature, TreeSplitConstructor_Measure, "([measure=, worstAcceptable=, minSubset=])") 
    586586C_CALL(TreeSplitConstructor_ExhaustiveBinary - Orange.classification.tree.SplitConstructor_ExhaustiveBinary, TreeSplitConstructor_Measure, "([measure=, worstAcceptable=, minSubset=])") 
    587587C_CALL(TreeSplitConstructor_OneAgainstOthers - Orange.classification.tree.SplitConstructor_OneAgainstOthers, TreeSplitConstructor_Measure, "([measure=, worstAcceptable=, minSubset=])") 
     
    600600C_CALL(TreeExampleSplitter_UnknownsAsSelector - Orange.classification.tree.Splitter_UnknownsAsSelector, TreeExampleSplitter, "([branchIndex, node, examples[, weight]]) -/-> (ExampleGenerator, [list of weight ID's])") 
    601601 
    602 C_CALL(TreeDescender_UnknownToBranch - Orange.classification.tree.Descender_Unknown, TreeDescender, "(node, example) -/-> (node, {distribution | None})") 
     602C_CALL(TreeDescender_UnknownToBranch - Orange.classification.tree.Descender_UnknownToBranch, TreeDescender, "(node, example) -/-> (node, {distribution | None})") 
    603603C_CALL(TreeDescender_UnknownToCommonBranch - Orange.classification.tree.Descender_UnknownToCommonBranch, TreeDescender, "(node, example) -/-> (node, {distribution | None})") 
    604604C_CALL(TreeDescender_UnknownToCommonSelector - Orange.classification.tree.Descender_UnknownToCommonSelector, TreeDescender, "(node, example) -/-> (node, {distribution | None})") 
     
    933933#include "c4.5.hpp" 
    934934 
    935 C_CALL(C45Learner - Orange.classification.tree.C45Learner, Learner, "([examples] [, weight=, gainRatio=, subset=, batch=, probThresh=, minObjs=, window=, increment=, cf=, trials=]) -/-> Classifier") 
    936 C_NAMED(C45Classifier - Orange.classification.tree.C45Classifier, Classifier, "()") 
     935C_CALL(C45Learner - Orange.classification.tree._C45Learner, Learner, "([examples] [, weight=, gainRatio=, subset=, batch=, probThresh=, minObjs=, window=, increment=, cf=, trials=]) -/-> Classifier") 
     936C_NAMED(C45Classifier - Orange.classification.tree._C45Classifier, Classifier, "()") 
    937937 
    938938PyObject *C45Learner_command_line(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "(line) -> None") 
     
    12171217 
    12181218#include "logistic.hpp" 
    1219 C_CALL(LogRegLearner - Orange.classification.logreg.LogRegLearner, Learner, "([examples[, weight=]]) -/-> Classifier") 
     1219C_CALL(LogRegLearner, Learner, "([examples[, weight=]]) -/-> Classifier") 
    12201220C_NAMED(LogRegClassifier - Orange.classification.logreg.LogRegClassifier, ClassifierFD, "([probabilities=])") 
    12211221 
     
    12901290/************ Linear **********/ 
    12911291#include "liblinear_interface.hpp" 
    1292 C_CALL(LinearLearner - Orange.classification.svm.LinearLearner, Learner, "([examples] -/-> Classifier)") 
     1292C_CALL(LinearLearner, Learner, "([examples] -/-> Classifier)") 
    12931293C_NAMED(LinearClassifier - Orange.classification.svm.LinearClassifier, ClassifierFD, " ") 
    12941294 
     
    13301330 
    13311331#include "libsvm_interface.hpp" 
    1332 C_CALL(SVMLearner - Orange.core.SVMLearner, Learner, "([examples] -/-> Classifier)") 
    1333 C_CALL(SVMLearnerSparse - Orange.core.SVMLearnerSparse, SVMLearner, "([examples] -/-> Classifier)") 
     1332C_CALL(SVMLearner - Orange.classification.svm._SVMLearner, Learner, "([examples] -/-> Classifier)") 
     1333C_CALL(SVMLearnerSparse - Orange.classification.svm._SVMLearnerSparse, SVMLearner, "([examples] -/-> Classifier)") 
    13341334C_NAMED(SVMClassifier - Orange.classification.svm.SVMClassifier, ClassifierFD," ") 
    13351335C_NAMED(SVMClassifierSparse - Orange.classification.svm.SVMClassifierSparse, SVMClassifier," ") 
     
    13771377} 
    13781378 
    1379 PyObject *KernelFunc_new(PyTypeObject *type, PyObject *args, PyObject *keywords)  BASED_ON(Orange - Orange.classification.kernels.KernelFunc, "<abstract>") 
     1379PyObject *KernelFunc_new(PyTypeObject *type, PyObject *args, PyObject *keywords)  BASED_ON(Orange - Orange.classification.svm.kernels.KernelFunc, "<abstract>") 
    13801380{ if (type == (PyTypeObject *)&PyOrKernelFunc_Type) 
    13811381    return setCallbackFunction(WrapNewOrange(mlnew TKernelFunc_Python(), type), args); 
     
    15451545#include "earth.hpp" 
    15461546 
    1547 C_CALL(EarthLearner - Orange.core.EarthLearner, Learner, "([examples], [weight=] -/-> Classifier)") 
    1548 C_NAMED(EarthClassifier - Orange.core.EarthClassifier, ClassifierFD, " ") 
     1547C_CALL(EarthLearner, Learner, "([examples], [weight=] -/-> Classifier)") 
     1548C_NAMED(EarthClassifier, ClassifierFD, " ") 
    15491549 
    15501550PyObject *EarthClassifier_formatEarth(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "() -> None") 
     
    15881588 
    15891589#include "bayes.hpp" 
    1590 C_CALL(BayesLearner - Orange.core.BayesLearner, Learner, "([examples], [weight=, estimate=] -/-> Classifier") 
    1591 C_NAMED(BayesClassifier - Orange.core.BayesClassifier, ClassifierFD, "([probabilities=])") 
     1590C_CALL(BayesLearner - Orange.classification.bayes._BayesLearner, Learner, "([examples], [weight=, estimate=] -/-> Classifier") 
     1591C_NAMED(BayesClassifier - Orange.classification.bayes._BayesClassifier, ClassifierFD, "([probabilities=])") 
    15921592 
    15931593PyObject *BayesClassifier_p(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "(class, example) -> float") 
  • source/orange/lib_learner.cpp

    r10220 r10222  
    2323  #pragma warning (disable : 4786 4114 4018 4267 4244) 
    2424#endif 
     25 
     26#include <iostream> 
     27#include <sstream> 
    2528 
    2629#include "vars.hpp" 
     
    5558C_CALL(SimpleTreeLearner - Orange.classification.tree.SimpleTreeLearner, Learner, "([examples], [maxMajority=, minExamples=, maxDepth=])") 
    5659C_NAMED(SimpleTreeClassifier - Orange.classification.tree.SimpleTreeClassifier, Classifier, "()") 
     60 
     61PyObject *SimpleTreeClassifier__reduce__(PyObject *self) 
     62{ 
     63    PyTRY 
     64    ostringstream ss; 
     65 
     66    CAST_TO(TSimpleTreeClassifier, classifier); 
     67    classifier->save_model(ss); 
     68    return Py_BuildValue("O(s)N", getExportedFunction("__pickleLoaderSimpleTreeClassifier"),  
     69        ss.str().c_str(), packOrangeDictionary(self)); 
     70    PyCATCH 
     71} 
     72 
     73PyObject *__pickleLoaderSimpleTreeClassifier(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "(buffer)") 
     74{ 
     75    PyTRY 
     76    char *cbuf; 
     77    istringstream ss; 
     78 
     79    int buffer_size = 0; 
     80    if (!PyArg_ParseTuple(args, "s:__pickleLoaderSimpleTreeClassifier", &cbuf)) 
     81        return NULL; 
     82    ss.str(string(cbuf)); 
     83    PSimpleTreeClassifier classifier = mlnew TSimpleTreeClassifier(); 
     84    classifier->load_model(ss); 
     85    return WrapOrange(classifier); 
     86    PyCATCH 
     87} 
     88 
    5789 
    5890/* ************ MAJORITY AND COST ************ */ 
Note: See TracChangeset for help on using the changeset viewer.