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

Method teach

modAL/models/learners.py:407–429  ·  view source on GitHub ↗

Adds X and y to the known training data and retrains the predictor with the augmented dataset. This method also keeps track of the maximum value encountered in the training data. Args: X: The new samples for which the values are supplied. y: Values c

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

Source from the content-addressed store, hash-verified

405 return self.X_max, self.y_max
406
407 def teach(self, X: modALinput, y: modALinput, bootstrap: bool = False, only_new: bool = False, **fit_kwargs) -> None:
408 """
409 Adds X and y to the known training data and retrains the predictor with the augmented dataset. This method also
410 keeps track of the maximum value encountered in the training data.
411
412 Args:
413 X: The new samples for which the values are supplied.
414 y: Values corresponding to the new instances in X.
415 bootstrap: If True, training is done on a bootstrapped dataset. Useful for building Committee models with
416 bagging. (Default value = False)
417 only_new: If True, the model is retrained using only X and y, ignoring the previously provided examples.
418 Useful when working with models where the .fit() method doesn't retrain the model from scratch (for
419 example, in tensorflow or keras).
420 **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor.
421 """
422 self._add_training_data(X, y)
423
424 if not only_new:
425 self._fit_to_known(bootstrap=bootstrap, **fit_kwargs)
426 else:
427 self._fit_on_new(X, y, bootstrap=bootstrap, **fit_kwargs)
428
429 self._set_max(X, y)
430
431
432"""

Callers 2

test_teachMethod · 0.95
test_on_transformedMethod · 0.95

Calls 4

_set_maxMethod · 0.95
_add_training_dataMethod · 0.45
_fit_to_knownMethod · 0.45
_fit_on_newMethod · 0.45

Tested by 2

test_teachMethod · 0.76
test_on_transformedMethod · 0.76