| 494 | return self.fit(X, y).transform(X) |
| 495 | |
| 496 | def _validate_params(self, X): |
| 497 | if self.model is not None: |
| 498 | model = self.model |
| 499 | if isinstance(model, MetaEstimatorMixin): |
| 500 | model = model.estimator |
| 501 | is_predictor = is_regressor(model) or is_classifier(model) |
| 502 | if not is_predictor: |
| 503 | raise ValueError( |
| 504 | "Linear model should be a supervised predictor " |
| 505 | "(classifier or regressor)" |
| 506 | ) |
| 507 | |
| 508 | # For sklearn < 1.6 |
| 509 | try: |
| 510 | self._check_n_features(X, reset=True) |
| 511 | except AttributeError: |
| 512 | pass |
| 513 | |
| 514 | def fit(self, X, y, **fit_params): |
| 515 | """Estimate the coefficients of the linear model. |