# Why create unnecessary variables in modeling (Lab-2)

**URL:** <https://community.deeplearning.ai/t/why-create-unnecessary-variables-in-modeling-lab-2/299839>\
**Category:** Advanced Learning Algorithms\
**Tags:** week-module-4\
**Created:** [March 30, 2023, 5:58pm UTC](https://community.deeplearning.ai/t/why-create-unnecessary-variables-in-modeling-lab-2/299839 "2023-03-30T17:58:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkranjan](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@rkranjan](https://community.deeplearning.ai/u/rkranjan)\
**Post date:** [March 30, 2023, 5:58pm UTC](https://community.deeplearning.ai/t/why-create-unnecessary-variables-in-modeling-lab-2/299839/1 "2023-03-30T17:58:05Z")

</div>

For Lab-2 –

Why is there a need to create 2 variables for Sex and Exercise Angina?

For instance, for Sex - 0 could have been Male and 1 could have been female.

```
Age: age of the patient [years]
Sex: sex of the patient [M: Male, F: Female]
ChestPainType: chest pain type [TA: Typical Angina, ATA: Atypical Angina, NAP: Non-Anginal Pain, ASY: Asymptomatic]
RestingBP: resting blood pressure [mm Hg]
Cholesterol: serum cholesterol [mm/dl]
FastingBS: fasting blood sugar [1: if FastingBS > 120 mg/dl, 0: otherwise]
RestingECG: resting electrocardiogram results [Normal: Normal, ST: having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV), LVH: showing probable or definite left ventricular hypertrophy by Estes' criteria]
MaxHR: maximum heart rate achieved [Numeric value between 60 and 202]
ExerciseAngina: exercise-induced angina [Y: Yes, N: No]
Oldpeak: oldpeak = ST [Numeric value measured in depression]
ST_Slope: the slope of the peak exercise ST segment [Up: upsloping, Flat: flat, Down: downsloping]
HeartDisease: output class [1: heart disease, 0: Normal]

```

---

<div class="post-metadata">

**Author:** ![Kic](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/kic/32/76339_2.png) [@Kic](https://community.deeplearning.ai/u/Kic)\
**Post date:** [March 30, 2023, 8:00pm UTC](https://community.deeplearning.ai/t/why-create-unnecessary-variables-in-modeling-lab-2/299839/2 "2023-03-30T20:00:24Z")

</div>

Hi @rkranjan

I can not find this lab in MLS Course2 week4. Could you please check and post to the correct discussion forum.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [March 31, 2023, 1:20am UTC](https://community.deeplearning.ai/t/why-create-unnecessary-variables-in-modeling-lab-2/299839/3 "2023-03-31T01:20:32Z")

</div>

I agree with mentor Kic.

In general, categories are converted to one-hot encoding. If there are only two categories, this step could be skipped.
