Python : How to use Multinomial Logistic Regression using SKlearn

后端 未结 2 1137
北荒
北荒 2021-02-19 07:26

I have a test dataset and train dataset as below. I have provided a sample data with min records, but my data has than 1000\'s of records. Here E is my target variable which I n

相关标签:
2条回答
  • 2021-02-19 07:56

    You could try

    LogisticRegression(multi_class='multinomial',solver ='newton-cg').fit(X_train,y_train)
    
    0 讨论(0)
  • 2021-02-19 08:08

    LogisticRegression can handle multiple classes out-of-the-box.

    X = df[['A', 'B', 'C', 'D']]
    y = df['E']
    lr = LogisticRegression()
    lr.fit(X, y)
    preds = lr.predict(X)  # will output array with integer values.
    
    0 讨论(0)
提交回复
热议问题