1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
from Orange.data import Table
from Orange.modelling.constant import ConstantLearner
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner
from Orange.widgets.utils.widgetpreview import WidgetPreview
class OWConstant(OWBaseLearner):
name = "Constant"
description = "Predict the most frequent class or mean value " \
"from the training set."
icon = "icons/Constant.svg"
replaces = [
"Orange.widgets.classify.owmajority.OWMajority",
"Orange.widgets.regression.owmean.OWMean",
]
priority = 10
keywords = "constant, majority, mean"
LEARNER = ConstantLearner
if __name__ == "__main__": # pragma: no cover
WidgetPreview(OWConstant).run(Table("iris"))
|