From c97ead6f24801fc9485e3b69dd2a1926c6ee91c9 Mon Sep 17 00:00:00 2001 From: Amir Alavi Date: Tue, 29 Aug 2023 14:07:43 -0700 Subject: [PATCH] Use isinstance instead of obj.__bases__ This is a small change but will enable much easier extending of auto-sklearn algorithms, since without this change, all classes are expected to directly inherit from AutoSklearn base calsses, and do not allow additional layers of inheritance. --- autosklearn/pipeline/components/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autosklearn/pipeline/components/base.py b/autosklearn/pipeline/components/base.py index 7b496842b2..04d7259a81 100644 --- a/autosklearn/pipeline/components/base.py +++ b/autosklearn/pipeline/components/base.py @@ -43,7 +43,7 @@ def __init__(self, base_class): self.components = OrderedDict() def add_component(self, obj): - if inspect.isclass(obj) and self.base_class in obj.__bases__: + if inspect.isclass(obj) and isinstance(obj, self.base_class): name = obj.__name__ classifier = obj else: