Skip to content

Commit cf974ed

Browse files
committed
modAL.models ABC metaclass fixed, now it is compatible with earlier python versions
1 parent 083f62d commit cf974ed

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modAL/models.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
Core models for active learning algorithms.
33
"""
44

5+
import abc
6+
import sys
57
import numpy as np
6-
from abc import ABC, abstractmethod
8+
79
from sklearn.utils import check_array
810
from sklearn.base import BaseEstimator
911
from modAL.utils.validation import check_class_labels, check_class_proba
1012
from modAL.uncertainty import uncertainty_sampling
1113
from modAL.disagreement import vote_entropy_sampling, max_std_sampling
1214

1315

16+
if sys.version_info >= (3, 4):
17+
ABC = abc.ABC
18+
else:
19+
ABC = abc.ABCMeta('ABC', (), {})
20+
21+
1422
class ActiveLearner(BaseEstimator):
1523
"""
1624
This class is an abstract model of a general active learning algorithm.
@@ -458,11 +466,11 @@ def teach(self, X, y, bootstrap=False, **fit_kwargs):
458466
self._add_training_data(X, y)
459467
self._fit_to_known(bootstrap=bootstrap, **fit_kwargs)
460468

461-
@abstractmethod
469+
@abc.abstractmethod
462470
def predict(self, X):
463471
pass
464472

465-
@abstractmethod
473+
@abc.abstractmethod
466474
def vote(self, X):
467475
pass
468476

0 commit comments

Comments
 (0)