How to identify the coefficients of the dependent variables in Multinomial logistic regression

Viewed 31

In python, I use from sklearn.linear_model import LogisticRegression and dataset looks like:

| sepal length | sepal width | petal length | petal width | species| | -------- | -------------- |--------------| ----------- | -------| | 5 | 3 |2 | 2 | setosa| | 4 | 3 |5 | 7 | versicolor| | 4 | 5 |5 | 8 | virginica| | 2 | 6 |5 | 5 | setosa| | 5 | 3 |5 | 3 | setosa| | 4 | 2 |5 | 5 | virginica| ..... (In case of display errors, you can also click on this to see the table)

And I try to implement multinomial logistic regression to predict their species by characteristics. So the probability equations should be: equations

After

LogisticRegression(random_state=0).fit(X_train, y_train)
clf.coef_

the result is

array([[-0.45372332,  0.91746178, -2.43353375, -1.05051338],
       [ 0.63563613, -0.43787842, -0.19664149, -1.01769015],
       [-0.18191282, -0.47958336,  2.63017524,  2.06820352]])

But it does not identify which equation the coefficients belong to.

For instance, I do not know whether I should use the first list of coefficients to predict the probability of the 'setosa' or 'versicolor'. Is there any code to see this? Or what is the default order? Thank you.

0 Answers
Related