0
$\begingroup$

I participated in one of the hackathon. And there the variables were like id, region, gender, age .etc. It was a regression problem. I did scaling on the variables. But I am not sure what to do with the variables like, id and region code, numerical and ordinal variables respectively. Are they relevant and significant for modeling?

$\endgroup$
1
$\begingroup$

These variables might be very significant depending on the problem you are dealing with. Some more info on the problem setting would be nice. But let's assume, for example, you are trying to predict mean income for employees (your sample consists of a bunch of employees of a specific company then), than you might want to transform the region codes into dummy variables. That makes it possible to assess whether a salary is dependent upon the region an employee lives in.

Depending on the format of the id's, there might be some information concealed in them. If the id's are extracted from, let's say, a employee database, they might contain information on the date when the employee started working at the company. Some creativity comes into play here, but when stumbling upon such variables, it's always worth it to look for more details and options.

In sum, don't look at the datatype of the variables too much when you're starting on a new problem. Explore the data and try to make sense of the nature of the variables (nominal, categorical, interval, etc.). Let your creativity flourish and i'm sure you'll have lots of fun :-).

$\endgroup$
  • $\begingroup$ Thanks ,Joshua1990. I have 50000 id with 450 region codes. Any suggestions? $\endgroup$ – Payal Bhatia Jul 25 at 11:09
1
$\begingroup$

That depends on the problem and the data. Usually, at hackathons, there are at least several thousand id's and hundreds of region codes in your data and your task is to train on one dataset and predict on another dataset with new customers in existing regions.

In this case, you can exclude the id-column. Other categorical variables like region, age-group, race, etc, are usually relevant. The region code can be used as a categorical variable, but it depends on the number of regions. If there are hundreds of region codes in your data, map these codes to a larger region. For example, assume your data contains the region codes of all American counties. The easiest way to go is to map each county to its respective federal state and use the state instead of the county.

$\endgroup$
  • $\begingroup$ Thanks, @georg_un. Well, hackathon does not reveal about country or state. Even if I map it to a federal state, then the region codes will be converted to categorical variables. so, does it affect the regression line in any way $\endgroup$ – Payal Bhatia Jul 25 at 11:07
  • $\begingroup$ @PayalBhatia Yes, categorical variables do affect the regression line. In linear regression, the model will find a coefficient for every category of your categorical variable. In your case, it will find a coefficient for every region code. However, to do so, it will first convert your categorical variable into a matrix with a binary column for each category (aka one-hot-encoding). This will create a matrix with 450 columns alone for the region variable. That's the reason why I suggested mapping them to a higher level. $\endgroup$ – georg-un Jul 25 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.