what would be the correct representation of categorical variables like sex?
I have a doubt about what will be the right way to use or represent categorical variables with only two values like sex. I have checked it up from different sources, but I was not able to find any solid reference. For example, if I have the variable sex I usually see this in this form:
id sex 1 male 2 female 3 female 4 male
So I found that one can use dummy variables like this:
and also in this way:
(https://stattrek.com/multiple-regression/dummy-variables.aspx)
Therefore, which one would be more adequate way to deal with this variable, for example, in a classification system. I am inclined to go with the dummy variables, but I would like some opinion about it.
Thanks
Topic dummy-variables feature-selection
Category Data Science