Python : How to use Multinomial Logistic Regression using SKlearn

后端 未结 2 1142
北荒
北荒 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 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.
    

提交回复
热议问题