Fits self.estimator to the given data and labels. 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 True, the method trains the model on a set bootstrapped f
(self, X: modALinput, y: modALinput, bootstrap: bool = False, **fit_kwargs)
| 100 | return data_hstack(Xt) |
| 101 | |
| 102 | def _fit_on_new(self, X: modALinput, y: modALinput, bootstrap: bool = False, **fit_kwargs) -> 'BaseLearner': |
| 103 | """ |
| 104 | Fits self.estimator to the given data and labels. |
| 105 | |
| 106 | Args: |
| 107 | X: The new samples for which the labels are supplied by the expert. |
| 108 | y: Labels corresponding to the new instances in X. |
| 109 | bootstrap: If True, the method trains the model on a set bootstrapped from X. |
| 110 | **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor. |
| 111 | |
| 112 | Returns: |
| 113 | self |
| 114 | """ |
| 115 | |
| 116 | if not bootstrap: |
| 117 | self.estimator.fit(X, y, **fit_kwargs) |
| 118 | else: |
| 119 | bootstrap_idx = np.random.choice( |
| 120 | range(X.shape[0]), X.shape[0], replace=True) |
| 121 | self.estimator.fit(X[bootstrap_idx], y[bootstrap_idx]) |
| 122 | |
| 123 | return self |
| 124 | |
| 125 | @abc.abstractmethod |
| 126 | def fit(self, *args, **kwargs) -> None: |