Getting an error 'ValueError: bad input shape (1906, 38)' when applying logistics regression model

machine_learning
ipython
logistic_regression
value_error

#1

Hello everyone,
I am trying to fit a logistics regression model in python on a data frame ‘df’. My target variable is categorical. Originally, I had 16 variables. Few of them are categorical. I created dummy variables using those categorical variables. Finally, when I run my model on data set, it popped up an error

ValueError: bad input shape (1906, 38)

can anyone help me fix it?


#2

Python’s logistic regression cannot handle multi-label classification which I suppose is the case here. Convert your problem into a binary classification problem for eg: one vs the rest and you should be good to go.


#3

Could you please define your dependent variable.

Is it binary ?


#4

@NSS Thanks for the answer. It helped.


#5

Any way other than this to handle multi class problem in Python.

I think R can handle Multi Class Problem .