I am trying to create multinomial logistic regression, I have never done this. I am trying to follow the tutorial:
Multinomial Logistic Regression With Python.
I am trying to take the data, and predict gambling (binary) from the alcohol dependence (binary) using sex and age as covariates.
So far I have:
# define dataset
X = data2["SEX"] + data2["AGE"] + data2["alcdep"]+data2["PRS"]
y = data2["Gambling"]
# summarize the dataset
print(X.shape, y.shape)
model.fit(X, y)
But I keep getting errors:
ValueError: Expected 2D array, got 1D array instead:
I also don't know if what I am doing is correct or the steps forward from here.
Here is the dummy data (ignore the yes and zeroes).
data = {
'IID': {0: 'Yale_0001', 1: 'Yale_0004', 2: 'Yale_0006', 3: 'Yale_0007', 4: 'Yale_0008'},
'SEX': {0: 2, 1: 1, 2: 2, 3: 1, 4: 1},
'AGE': {0: 27, 1: 39, 2: 41, 3: 45, 4: 44},
'alcdep': {0: 2, 1: 2, 2: 2, 3: 1, 4: 1},
'Gambling': {0: 1, 1: 1, 2: 2, 3: 1, 4: 2},
'Zero': {0: 0, 1: 0, 2: 0, 3: 1, 4: 0},
'Yes': {0: 'Yes', 1: 'Yes', 2: 'Yes', 3: 'Yes', 4: 'Yes'},
'PRS': {0: 0.053486584299999994, 1: 0.0304387435, 2: 0.00917773968, 3: 0.016352741100000002, 4: 7.433452840000001e-05}
}