ageron / handson-ml

⛔️ DEPRECATED – See https://github.com/ageron/handson-ml3 instead.
Apache License 2.0
25.18k stars 12.92k forks source link

using column indices in the Custom Transformer #615

Open julienvos opened 3 years ago

julienvos commented 3 years ago

In command line 68 and 69 of the projectcode of Chapter 2, the column indices of rooms_ix, bedrooms_ix, population_ix, household_ix are calculated using the whole 'housing' df. These column indices are later used in the custom Transformer.

Shouldn't this be the indices of the subset of the housing df that is used in the Columntransformer?

(For the current project it does't matter because indices are the same, but just for the conveniece and clearity)

Kind regards

ageron commented 3 years ago

That's a great point, thanks @julienvos . The ColumnTransformer didn't exist when I wrote the book, so things were a bit ugly back then. You are right that we could just use a ColumnTransformer for this: it would be more elegant and more robust. Would you like to submit a PR?