DailyML 41 – Answer


Answer DailyML 41:
pd.get_dummies(data, drop_first=True)
In some situations this code can help avoid:

• Dummy variable trap
• Multicollinearity
• High Variance Inflation Factor
• All of the above

All of the above can be helped by dropping one of the dummy variables.

Let’s say you are working with variables that are multicollinear, for example, a day of the week, in the form of dummy variables (similar to one-hot encoding, transforming categorical data to numeric). If you know the truth values (1 for True and 0 for False) for all days of the week except Sunday, you will be able to determine if Sunday is 1 (all of the others would be 0). These are correlated. We drop the first, which is Sunday in this case, because is it not necessary. Not only that, but keeping Sunday would make regression difficult due to the multicollinearity, also known as the Dummy variable trap.

Variance Inflation Factor is a measure of multicollinearity. High Variance Inflation Factor is often an indication of high multicollinearity.

Leave a Reply


Discover more from DailyQZ

Subscribe now to keep reading and get access to the full archive.

Continue reading