Ticket #1007 (closed wish: fixed)

Opened 3 years ago

Last modified 3 years ago

Enable orange learners to return subclass of classifier.

Reported by: anze Owned by: janez
Milestone: 3.0 Component: other
Severity: minor Keywords:
Cc: Blocking:
Blocked By:

Description (last modified by anze) (diff)

Each orange learner returns its corresponding classifier. If you want to subclass both, to provide some additional functionality (__str__, __repr__), there is currently no clean, easy way to do it.

A possible solution would be, to have a field on learner (i.e. __classifier__) that would specify, which classifier class to construct. There could also bo a check, to make sure that the specified classifier is a subclass of the default one.

Change History

comment:1 Changed 3 years ago by janez

Just to make sure: __classifier__ is supposed to be a field of the class, not an instance, e.g.

class MyBayesLearner(BayesLearner):
    __classifier__ = MyBayesClassifier
    (...)

You are not going to provide (or override) the __classifier__ in, for instance, MyBayesLearner.__init__, right? I would one against instance-specific __classifier__ for reasons of conceptual clarity and simplicity, although implementation is basically the same.

Checking that the __classifier__ is a subtype of the correct class is indeed necessary, and it's not a problem, I'll do it.

Last edited 3 years ago by janez (previous) (diff)

comment:2 Changed 3 years ago by anze

  • Description modified (diff)

I agree, classifier should only be specified as a field and not in __init__.

comment:3 Changed 3 years ago by janez

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.