Wrap-up quiz M4 Q2

Hi everyone,

I have this erro while doing the Question 2, that is to repeat the model of the Q1 but add a Ridge().
I don’t understand how can I solve this, if anyone know, please help me.

THE ERRO: All intermediate steps should be transformers and implement fit and transform or be the string ‘passthrough’ ‘LinearRegression()’ (type <class ‘sklearn.linear_model._base.LinearRegression’>) doesn’t

Thanks

Could you provide the definition of your pipeline. Without the code it is rather difficult to give you the right answer :slight_smile: You can post python code using the 3 backticks delimiters as:

```python
# Some python code
```

I assume that you wrote LinearRegression instead of LinearRegression() in make_pipeline but this is just a guess.

Hi, thanks for your reply

‘’‘model = make_pipeline(SimpleImputer(), StandardScaler(), LinearRegression(), Ridge())’’’

I write this to define my model and got the erro that I posted previously. I remove the LinearRegression() from the cod and use ‘’’ model = make_pipeline(SimpleImputer(), StandardScaler(), Ridge())’’’ and its worked , but I don’t know if this is correct.

You cannot have two regressor in a pipeline. You need to decide which regressor to use (either LinearRegression or Ridge) but not both.

Thank you!