I have a dataset that looks like
A B C D sex weight
0.955136 0.802256 0.317182 -0.708615 female normal
0.463615 -0.860053 -0.136408 -0.892888 male obese
-0.855532 -0.181905 -1.175605 1.396793 female overweight
-1.236216 -1.329982 0.531241 2.064822 male underweight
-0.970420 -0.481791 -0.995313 0.672131 male obese
I would like, given the features X= [A,B,C,D], and the labels y=[sex, weight] , to train a machine learning model that could be able to predict both the sex and the weight of a person given the features A,B,C and D. How can this be achieved? Could you please suggest any library or reading materials that would help me to achieve this?
For easier testing, the dataset can be artificially generated using the following code:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
df['sex'] = [np.random.choice(['male', 'female']) for x in range(len(df))]
df['weight'] = [np.random.choice(['underweight',
'normal', 'overweight', 'obese']) for x in range(len(df)) ]
y(one model for sex, other for weight, as the answer below does) or use classifiers which support this type of task. See "Support multiclass-multioutput" here. - Vivek Kumar