this post was submitted on 26 Nov 2023
1 points (100.0% liked)

Machine Learning

1 readers
1 users here now

Community Rules:

founded 11 months ago
MODERATORS
 

Hey guys, begginers doubt:

I am preparing a dataframe for a machine learning model. The purpose of the model is to predict whether people infected with COVID will die or not.

To do this, I am looking for some conditions and symptoms, such as sore throat, cough, comorbidities, gender, and others, and binarizing them into "yes" or "no" or "male" and "female".

I have a problem. One of the variables is "pregnant", but only individuals of the female sex can be pregnant. How can I deal with this variable?

Can I keep it in the dataframe and assign the value "not pregnant" to all male individuals? Or could this harm the model?

you are viewing a single comment's thread
view the rest of the comments
[–] mathbbR@alien.top 1 points 9 months ago

As others have said, pregnant men, while uncommon, might appear in your dataset. However, for preliminary results, it could make sense to exclude the possibility. Depending on the prevalence and impact of pregnancy in your data, you may be free to drop the column entirely. Some exploratory data analysis should help. Pregnancy should be relatively frequent (>5% of rows, at the very least). Pregnant women should also have noticably different target statistics than non-pregnant women. If pregnancy is rare or doesn't seem to have much of an impact, feel free to drop it altogether for now.

Alternatively, I would default to basic indicator columns for both sex and pregnancy. Just be sure your model doesn't require feature independence, as some do.