Answers.Body: <p>It's definitely wrong to threat categorical data as continuous. It is also wrong to encode the variable occupation with increasing numerical values before feed them to the models you listed.</p>
  <p>Reason being that those numbers have no meaning in relation to those categorical values, for example 3 is bigger than 2 but it has no sense at all to say that the class unemployed is bigger than the class working.</p>
  <p>One hot encoding is definitely the way to go to encode categorical variables like occupation.</p>
  <p>Filling in missing values with mean of course will not work cause you don't have a mean, and usually that's a very bad way to fill in missing values, even for continuous variables. If you have lot of instances with missing values that you can't discard you can add a new value called &quot;Unknown&quot; and fill in the missing data with that class. Conceptually is the most reasonable thing to do since you have no information.</p>
  <p>SMOTE is a whole different story, not related to continuous or categorical variables, and you should consider it only if you have classes (i.e. variables values) heavily underrepresented. It is though a risky move that might lead to over fitting and misinterpretation or your models performances, so if you don't understand it conceptually I would skip it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-22T07:08:13.110Z
Answers.LastActivityDate: 2022-07-22T07:08:13.110Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>In my dataset, I have some data that is continuous - eg. Age and BMI. I also have some data that is discrete- for example, occupation is labelled as 1 =&quot;Homemaker&quot;
  2=&quot;Working&quot;
  3=&quot;Unemployed&quot;
  4=&quot;Retired&quot;
  5=&quot;Extended Sick Leave&quot;
  6=&quot;Disabled&quot;
  7=&quot;Other&quot;.</p>
  <p>My question is- is it correct to pre-process this data the same (0-1 scale, fill in missing values with mean, SMOTE etc) to then put into my model (SVM, KNN, LR, RF). Or do I need to perform different preprocessing with the categorical data? I have looked into One Hot Encoding however concluded it is not appropriate since the data is not string like, but I am unsure.</p>
  
Tags: <machine-learning><data-preprocessing>
Title: Can I use discrete data in the same model as continuous data?
UserDisplayName: helpwithkeras
ThreadText: # Can I use discrete data in the same model as continuous data?
  
  (Asked by: username_0 on 2022-07-21)
  
  In my dataset, I have some data that is continuous - eg. Age and BMI. I also have some data that is discrete- for example, occupation is labelled as 1 ="Homemaker"
  2="Working"
  3="Unemployed"
  4="Retired"
  5="Extended Sick Leave"
  6="Disabled"
  7="Other".
  
  My question is- is it correct to pre-process this data the same (0-1 scale, fill in missing values with mean, SMOTE etc) to then put into my model (SVM, KNN, LR, RF). Or do I need to perform different preprocessing with the categorical data? I have looked into One Hot Encoding however concluded it is not appropriate since the data is not string like, but I am unsure.
  
  **Tags:** machine-learning, data-preprocessing
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-22. Score: 1 | Accepted answer
  
  It's definitely wrong to threat categorical data as continuous. It is also wrong to encode the variable occupation with increasing numerical values before feed them to the models you listed.
  
  Reason being that those numbers have no meaning in relation to those categorical values, for example 3 is bigger than 2 but it has no sense at all to say that the class unemployed is bigger than the class working.
  
  One hot encoding is definitely the way to go to encode categorical variables like occupation.
  
  Filling in missing values with mean of course will not work cause you don't have a mean, and usually that's a very bad way to fill in missing values, even for continuous variables. If you have lot of instances with missing values that you can't discard you can add a new value called "Unknown" and fill in the missing data with that class. Conceptually is the most reasonable thing to do since you have no information.
  
  SMOTE is a whole different story, not related to continuous or categorical variables, and you should consider it only if you have classes (i.e. variables values) heavily underrepresented. It is though a risky move that might lead to over fitting and misinterpretation or your models performances, so if you don't understand it conceptually I would skip it.
  
  
  ---
  
  