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

Method _add_training_data

modAL/models/learners.py:88–112  ·  view source on GitHub ↗

Adds the new data and label to the known data, but does not retrain the model. Args: X: The new samples for which the labels are supplied by the expert. y: Labels corresponding to the new instances in X. Note: If the classifier has been

(self, X: modALinput, y: modALinput)

Source from the content-addressed store, hash-verified

86 self._fit_to_known(bootstrap=bootstrap_init, **fit_kwargs)
87
88 def _add_training_data(self, X: modALinput, y: modALinput) -> None:
89 """
90 Adds the new data and label to the known data, but does not retrain the model.
91
92 Args:
93 X: The new samples for which the labels are supplied by the expert.
94 y: Labels corresponding to the new instances in X.
95
96 Note:
97 If the classifier has been fitted, the features in X have to agree with the training samples which the
98 classifier has seen.
99 """
100 check_X_y(X, y, accept_sparse=True, ensure_2d=False, allow_nd=True, multi_output=True, dtype=None,
101 force_all_finite=self.force_all_finite)
102
103 if self.X_training is None:
104 self.X_training = X
105 self.y_training = y
106 else:
107 try:
108 self.X_training = data_vstack((self.X_training, X))
109 self.y_training = data_vstack((self.y_training, y))
110 except ValueError:
111 raise ValueError('the dimensions of the new training data and label must'
112 'agree with the training data and labels provided so far')
113
114 def _fit_to_known(self, bootstrap: bool = False, **fit_kwargs) -> 'BaseLearner':
115 """

Callers 2

teachMethod · 0.95

Calls 1

data_vstackFunction · 0.90

Tested by 1