python-causality-handbook icon indicating copy to clipboard operation
python-causality-handbook copied to clipboard

Issue on page /17-Predictive-Models-101.html

Open TommyBarnes opened this issue 5 years ago • 2 comments

Hi! I love your book, I'm reading it again and I'll probably file a lot of issues.

I think you should use dummy encoding on the region feature instead of transforming it into a region net income proxy. I think this might have crippled the ML model.

If this was shown at least as an alternative, I'd trust the conclusion more.

'To help it, we will take the region feature, which is categorical, and encode it with the lower end of the confidence interval of net income for that region. Remember that we have those stored in the regions_to_net dictionary?'

TommyBarnes avatar Apr 07 '21 18:04 TommyBarnes

Issues are very welcome. Keep them coming. Specially in part II, which is very experimental.

As for the encoding, I think I tried that and it didn't perform (trees don't like dummies/one-hot encoding very much because it increase the number of features they have to split on). But I'll take a look and again.

matheusfacure avatar Apr 08 '21 11:04 matheusfacure

I've added an experiment with dummy encoding in the PR linked above. As you can see, it lowers model performance. The main reason is that tree models don't like dummies very much: https://towardsdatascience.com/one-hot-encoding-is-making-your-tree-based-ensembles-worse-heres-why-d64b282b5769

matheusfacure avatar Apr 14 '21 11:04 matheusfacure