# Apply logistic regression to binary data - Need guidance

Good morning.

I am trying to predict the probability of death of people suffering from a disease, based on their age and gender.

Currently from the data (approximately 50,000 people), 43699 survive and 1035 die, here I see the first problem, I think there is an unbalanced distribution and I do not know how to treat it.

Let's continue...

First, graph the people who died and those who did not, in a graph of age, gender (muscle = 1, female = 0). As you can see in the first image, there is too much data for a good visualization.

Even taking out the survivors, you can see that the deceased are distributed in both genders and in almost all ages.

Try to use the sklearn library to apply a logistic regression as I think it is the most suitable for this purpose. If I manage to run it, I get other problems.

First, the frontier of decision, it doesn't give me any information (I think, from my humble knowledge, that this happens because there is a distribution of the deceased in almost all ages and genders).

Second, the accuracy of the model is too bad, I attach the data:

>>> print(classification_report(prueba, predictions))
precision    recall  f1-score   support

0       0.98      1.00      0.99     43699
1       0.34      0.01      0.02      1035

accuracy                           0.98     44734
macro avg       0.66      0.51      0.50     44734
weighted avg       0.96      0.98      0.97     44734


Where: 0 represents survivor, 1 represents death

After this long introduction, I wanted to ask you:

1. Is there any way to correct this model for the present data?
2. If not, is there another model that is more useful to me? Maybe k-Means
3. Is there a way to graph it that will give me a better representation?

Maybe the input data does not contain a direct relation and you can't find any productive model.

Thank you!