Changeset 11805:8c7bac69fbb4 in orange


Ignore:
Timestamp:
12/12/13 13:50:08 (4 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added a new constructor for CostWrapperClassifier.

It was not possible to construct an instance of CostWrapperClassifier through
the default constructor..

Location:
source/orange
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/orange/costwrapper.cpp

    r11703 r11805  
    1717 
    1818TCostWrapperClassifier::TCostWrapperClassifier(PCostMatrix cm, PClassifier bc) 
    19 : TClassifier(bc->classVar, false), 
     19: TClassifier((bc? bc->classVar: PVariable()), false), 
    2020  classifier(bc), 
    2121  costMatrix(cm) 
  • source/orange/costwrapper.hpp

    r11703 r11805  
    1111  __REGISTER_CLASS 
    1212 
    13   PLearner basicLearner; //P basic learner 
     13  PLearner basicLearner; //P(+base_learner) basic learner 
    1414  PCostMatrix costMatrix; //P cost matrix 
    1515 
  • source/orange/lib_learner.cpp

    r11703 r11805  
    110110 
    111111#include "costwrapper.hpp" 
    112 C_CALL(CostWrapperLearner - Orange.wrappers.CostWrapperLearner, Learner, "([examples] [, weight=, costs=]) -/-> Classifier") 
    113 C_NAMED(CostWrapperClassifier - Orange.wrappers.CostWrapperClassifier, Classifier, "([classifier=, costs=])") 
    114  
     112C_CALL(CostWrapperLearner - Orange.wrappers.CostWrapperLearner, Learner, "([examples] [, weight=, cost_matrix=]) -/-> Classifier") 
     113C_NAMED(CostWrapperClassifier - Orange.wrappers.CostWrapperClassifier, Classifier, "(classifier, cost_matrix)") 
     114 
     115 
     116PyObject *CostWrapperClassifier_new(PyTypeObject *type, PyObject *args) 
     117{ 
     118  PyTRY 
     119    PClassifier classifier; 
     120    PCostMatrix costMatrix; 
     121    if (!PyArg_ParseTuple(args, "O&O&:CostWrapperClassifier.__new__", cc_Classifier, &classifier, cc_CostMatrix, &costMatrix)) { 
     122        raiseError("A Classifier and CostMatrix expected."); 
     123    } 
     124    return WrapNewOrange(mlnew TCostWrapperClassifier(costMatrix, classifier), type); 
     125  PyCATCH 
     126} 
    115127 
    116128/************* ASSOCIATION RULES ************/ 
Note: See TracChangeset for help on using the changeset viewer.