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

Method teach

modAL/models/base.py:344–358  ·  view source on GitHub ↗

Adds X and y to the known training data for each learner and retrains learners with the augmented dataset. Args: X: The new samples for which the labels are supplied by the expert. y: Labels corresponding to the new instances in X. bootstrap: If T

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

Source from the content-addressed store, hash-verified

342 self._fit_to_known(bootstrap=True, **fit_kwargs)
343
344 def teach(self, X: modALinput, y: modALinput, bootstrap: bool = False, only_new: bool = False, **fit_kwargs) -> None:
345 """
346 Adds X and y to the known training data for each learner and retrains learners with the augmented dataset.
347 Args:
348 X: The new samples for which the labels are supplied by the expert.
349 y: Labels corresponding to the new instances in X.
350 bootstrap: If True, trains each learner on a bootstrapped set. Useful when building the ensemble by bagging.
351 only_new: If True, the model is retrained using only X and y, ignoring the previously provided examples.
352 **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor.
353 """
354 self._add_training_data(X, y)
355 if not only_new:
356 self._fit_to_known(bootstrap=bootstrap, **fit_kwargs)
357 else:
358 self._fit_on_new(X, y, bootstrap=bootstrap, **fit_kwargs)
359
360 @abc.abstractmethod
361 def predict(self, X: modALinput) -> Any:

Callers

nothing calls this directly

Calls 3

_add_training_dataMethod · 0.95
_fit_to_knownMethod · 0.95
_fit_on_newMethod · 0.95

Tested by

no test coverage detected