0

I am performing regression over the data set.This is my dataset

I am performing-: regr = linear_model.LinearRegression() regr.fit(feat1, label)

Now I am getting the error -:This is the error message

As you can see the error is in 76.76.172.48 which is my SrcAddr column in data set. How can I solve this error? Pardon if the question seems not being clearly explained.

It seems that all the related solutions are converting the field into numeric by method of One Hot Encoding but I want to retain the IP field as it is.

feedMe
  • 3,431
  • 2
  • 36
  • 61
Abhishek Thakur
  • 379
  • 1
  • 3
  • 9
  • What's your question? – Mohamed Thasin ah Dec 07 '18 at 16:54
  • My question is that I am performing -: regr = linear_model.LinearRegression() regr.fit(feat1, label). feat1 contains a column which has IP address like described in the question. So when I run the code it gives me the value error mentioned above. I think it's trying to read that IP address as float. – Abhishek Thakur Dec 07 '18 at 16:55
  • Sorry your question is unclear, please edit your question and clearly explain where you are getting stuck. Provide What you have tried, sample input and expected output. It will be easy to get a solution – Mohamed Thasin ah Dec 07 '18 at 16:57
  • Yeah now got it, it's linear regression accepts only numeric values, but you are passing non numeric characters. So while trying to convert into float it will fail. So it throws invalid litertal error in your case – Mohamed Thasin ah Dec 07 '18 at 16:59
  • Yeah, that's what I was trying to explain to you. – Abhishek Thakur Dec 07 '18 at 17:05

0 Answers0