-1

I am working on titanic data set but when I try to test my logistic regression model it gives this error.

Input contains NaN, infinity or a value too large for dtype('float64')

I have tried these code snippets to check whether my data has NaN/Inf or not. np.any(np.isnan(test_df)) This return True np.all(np.isfinite(test_df)) This returns False Please tell me what do these returned values mean that whether my test data has NaN or Infinity value or not

DYZ
  • 55,249
  • 10
  • 64
  • 93
MFA
  • 1
  • 5

1 Answers1

0

You can easily find your answer in the numpy docs.

Numpy isnan() documentation

Numpy isfinite() documentation

So yes, there are NaNs and Infs in your dataset.

There may be divisions by zero or under/overflows occurring during your logistic regression. You could look into the docs of the particular functions you use to find out more about why this occurs, or whether perhaps there are better fitting/minimization algorithms to choose from under the hood.

Joost
  • 21
  • 2