Skip to content

Commit 349fe93

Browse files
committed
modAL.models sklearn.utils.check_array removed, performing checks now left to the estimator object
1 parent cf974ed commit 349fe93

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

modAL/models.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import numpy as np
88

9-
from sklearn.utils import check_array
109
from sklearn.base import BaseEstimator
1110
from modAL.utils.validation import check_class_labels, check_class_proba
1211
from modAL.uncertainty import uncertainty_sampling
@@ -109,8 +108,8 @@ def __init__(
109108
self.X_training = None
110109
self.y_training = None
111110
elif type(X_training) != type(None) and type(y_training) != type(None):
112-
self.X_training = check_array(X_training)
113-
self.y_training = check_array(y_training, ensure_2d=False)
111+
self.X_training = X_training
112+
self.y_training = y_training
114113
self._fit_to_known(bootstrap=bootstrap_init, **fit_kwargs)
115114

116115
def _add_training_data(self, X, y):
@@ -133,7 +132,6 @@ def _add_training_data(self, X, y):
133132
have to agree with the training samples which the
134133
classifier has seen.
135134
"""
136-
X, y = check_array(X), check_array(y, ensure_2d=False)
137135
assert len(X) == len(y), 'the number of new data points and number of labels must match'
138136

139137
if type(self.X_training) != type(None):
@@ -265,7 +263,6 @@ def query(self, X, **query_kwargs):
265263
X[query_idx]: numpy.ndarray of shape (n_instances, n_features)
266264
The instances from X_pool chosen to be labelled.
267265
"""
268-
check_array(X, ensure_2d=True)
269266

270267
query_idx, query_instances = self.query_strategy(self.estimator, X, **query_kwargs)
271268
return query_idx, query_instances
@@ -424,8 +421,6 @@ def query(self, X, **query_kwargs):
424421
X[query_idx]: numpy.ndarray of shape (n_instances, n_features)
425422
The instances from X_pool chosen to be labelled.
426423
"""
427-
check_array(X, ensure_2d=True)
428-
429424
query_idx, query_instances = self.query_strategy(self, X, **query_kwargs)
430425
return query_idx, X[query_idx]
431426

@@ -624,7 +619,6 @@ def vote(self, X, **predict_kwargs):
624619
The predicted class for each learner in the Committee
625620
and each sample in X.
626621
"""
627-
check_array(X, ensure_2d=True)
628622
prediction = np.zeros(shape=(X.shape[0], len(self.learner_list)))
629623

630624
for learner_idx, learner in enumerate(self.learner_list):
@@ -651,8 +645,6 @@ def vote_proba(self, X, **predict_proba_kwargs):
651645
652646
"""
653647

654-
check_array(X, ensure_2d=True)
655-
656648
# get dimensions
657649
n_samples = X.shape[0]
658650
n_learners = len(self.learner_list)
@@ -780,7 +772,6 @@ def vote(self, X, **predict_kwargs):
780772
vote: numpy.ndarray of shape (n_samples, n_regressors)
781773
The predicted value for each regressor in the CommitteeRegressor and each sample in X.
782774
"""
783-
check_array(X, ensure_2d=True)
784775
prediction = np.zeros(shape=(len(X), len(self.learner_list)))
785776

786777
for learner_idx, learner in enumerate(self.learner_list):

0 commit comments

Comments
 (0)