Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Multiclass classification using logistic regression in python

$
0
0

@syed.danish wrote:

Hi,
I am trying to apply logistic regression on the human activity regression data. It consists of 6 levels of outcome describing different activities, After applying PCA on train and test combined data(continuous variables only) I ended up with 150 principal components from 562 variables. Now I am trying to apply logistic regression for classification using :

from sklearn import linear_model
clf=linear_model.LogisticRegression(C=1e5)
clf.fit(train_x,train.activity)

In the above code train_x consists of the 150 proncipal components and train.activity is the outcome. After predicting it on test data set using :

clf.predict(test_x)

I am getting an array with minimum value of 1 and max value of 6. If there were two outcomes, I would have tried to find a suitable threshold to classify, But here there are 6 outcomes. Please suggest a way to apply logistic regression to classify on 6 possible outcomes.
Thanks in advance
Danish

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles