Predict multi-output variable using model for each target variable. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The input data. Returns ------- y : {array-like, sparse matrix} of shape (n_samples
(self, X)
| 286 | return self |
| 287 | |
| 288 | def predict(self, X): |
| 289 | """Predict multi-output variable using model for each target variable. |
| 290 | |
| 291 | Parameters |
| 292 | ---------- |
| 293 | X : {array-like, sparse matrix} of shape (n_samples, n_features) |
| 294 | The input data. |
| 295 | |
| 296 | Returns |
| 297 | ------- |
| 298 | y : {array-like, sparse matrix} of shape (n_samples, n_outputs) |
| 299 | Multi-output targets predicted across multiple predictors. |
| 300 | Note: Separate models are generated for each predictor. |
| 301 | """ |
| 302 | check_is_fitted(self) |
| 303 | if not hasattr(self.estimators_[0], "predict"): |
| 304 | raise ValueError("The base estimator should implement a predict method") |
| 305 | |
| 306 | y = Parallel(n_jobs=self.n_jobs)( |
| 307 | delayed(e.predict)(X) for e in self.estimators_ |
| 308 | ) |
| 309 | |
| 310 | return np.asarray(y).T |
| 311 | |
| 312 | def __sklearn_tags__(self): |
| 313 | tags = super().__sklearn_tags__() |
nothing calls this directly
no test coverage detected