Multiclass #654
-
Hi, I am trying to determine which classifiers support multiclass and following the FAQ it says to do the following:
However, I am getting this error:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @jmrichardson 👋 Thanks for your interest in the library and reporting this error. Unfortunately the documentation is outdated here, the Nevertheless, python isinstance(tree.HoeffdingAdaptiveTreeClassifier(), base.Classifier) If your goal is to list all the import importlib
import inspect
import river
def is_multiclassifier(obj):
if hasattr(obj, '_multiclass'):
try:
if isinstance(obj(), river.base.Classifier):
return obj._multiclass
else:
return False
except:
return False
else:
return False
for module in importlib.import_module('river').__all__:
if module in ['datasets', 'synth']:
continue
for name, obj in inspect.getmembers(importlib.import_module(f'river.{module}'), is_multiclassifier):
print(name)
>>> NoChangeClassifier
>>> PriorClassifier
>>> AdaptiveRandomForestClassifier
>>> SRPClassifier
>>> FFMClassifier
>>> FMClassifier
>>> FwFMClassifier
>>> HOFMClassifier
>>> ALMAClassifier
>>> LogisticRegression
>>> PAClassifier
>>> Perceptron
>>> SoftmaxRegression
>>> BernoulliNB
>>> ComplementNB
>>> GaussianNB
>>> MultinomialNB
>>> KNNADWINClassifier
>>> KNNClassifier
>>> SAMKNNClassifier
>>> ExtremelyFastDecisionTreeClassifier
>>> HoeffdingAdaptiveTreeClassifier
>>> HoeffdingTreeClassifier
>>> LabelCombinationHoeffdingTreeClassifier Let us know if you have any other questions :) |
Beta Was this translation helpful? Give feedback.
Hi @jmrichardson 👋 Thanks for your interest in the library and reporting this error.
Unfortunately the documentation is outdated here, the
base.BinaryClassifier
andbase.MultiClassifier
have been deprecated in favor of abase.Classifier
with a_multiclass
property instead. Sorry for the inconvenience.Nevertheless, python
isinstance
built-in method compares an object instance with a class so you can't pass thetree.hoeffding_adaptive_tree_classifier
module toisinstance
. Instead you want to pass an instantiated object:If your goal is to list all the
river
mutliclass classifiers, the following snippet should do the trick:i…