0

Initially, I used sklearn to perform logistic regression. When I asked how to get the p-values from the coefficients I got the reply that I should use statsmodels even though I mentioned that it doesn't read it in my data (and I've never used it before).

My training data is a np.array and my labels are a list. I get the following error TypeError: cannot perform reduce with flexible type I've never worked with this module before so I have no clue how to use it and why it doesn't accept my data since sklearn seems to have no problems. How do I make this work and get the p-values?

Lunalight
  • 157
  • 2
  • 15
  • This question has been answered a couple times before. See e.g. here https://stackoverflow.com/questions/27928275/find-p-value-significance-in-scikit-learn-linearregression. Does that help? In any case, try converting your np-array to a dataframe with pandas. Statsmodels reads pandas, as far as I know. – Rachel Jul 03 '17 at 15:29
  • Most likely (given no traceback and no data structure in the question) you need to convert your response variable to a 0-1 int or float. – Josef Jul 04 '17 at 06:47

0 Answers0