MCPcopy Create free account
hub / github.com/modAL-python/modAL / fit

Method fit

modAL/models/learners.py:136–158  ·  view source on GitHub ↗

Interface for the fit method of the predictor. Fits the predictor to the supplied data, then stores it internally for the active learning loop. Args: X: The samples to be fitted. y: The corresponding labels. bootstrap: If true, trains the

(self, X: modALinput, y: modALinput, bootstrap: bool = False, **fit_kwargs)

Source from the content-addressed store, hash-verified

134 return self
135
136 def fit(self, X: modALinput, y: modALinput, bootstrap: bool = False, **fit_kwargs) -> 'BaseLearner':
137 """
138 Interface for the fit method of the predictor. Fits the predictor to the supplied data, then stores it
139 internally for the active learning loop.
140
141 Args:
142 X: The samples to be fitted.
143 y: The corresponding labels.
144 bootstrap: If true, trains the estimator on a set bootstrapped from X.
145 Useful for building Committee models with bagging.
146 **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor.
147
148 Note:
149 When using scikit-learn estimators, calling this method will make the ActiveLearner forget all training data
150 it has seen!
151
152 Returns:
153 self
154 """
155 check_X_y(X, y, accept_sparse=True, ensure_2d=False, allow_nd=True, multi_output=True, dtype=None,
156 force_all_finite=self.force_all_finite)
157 self.X_training, self.y_training = X, y
158 return self._fit_to_known(bootstrap=bootstrap, **fit_kwargs)
159
160 def teach(self, X: modALinput, y: modALinput, bootstrap: bool = False, only_new: bool = False, **fit_kwargs) -> None:
161 """

Callers 1

test_sklearnMethod · 0.95

Calls 1

_fit_to_knownMethod · 0.95

Tested by 1

test_sklearnMethod · 0.76