SK Learn Regression Issue
How can I fix this code , it can't regress itself
I've been trying to use reg.get_params() , but it didn't work.
Hi Eric!
Thanks for reaching out!
The error message you're encountering indicates that your data contains non-numeric values, such as strings or bytes, which are not compatible with scikit-learn's LinearRegression model that expects numeric input. To resolve this issue, you need to ensure that your input data is in a numeric format.
Please check if the data is properly preprocessed and doesn't contain categorical variables. Moreover, you can share the previous cells of your code for further assistance.
Hope this helps.
Best,
Ivan
Hi Ivan thanks for your reply , here's my previous cells
The strange thing is the cell is same as the solution , how can it works in the lecture but cannot works now ?
Hi Eric!
Can you please specify which is the course and the lesson you are referring to?
Looking forward to your answer.
Ivan
Hi Ivan !
It's the course
"Complete Data Science Training: Mathematics, Statistics, Python, Advanced Statistics in Python, Machine & Deep Learning"
218.Multiple Linear Regression Exercise
Thanks for your attention !
Hi Eric!
The error you're encountering is due to the fact that you're passing a list of column names ('size' and 'year') as the input feature array x to the LinearRegression model's fit()
function. The model expects numeric data in the x array, but you're providing column names which are strings.
Here's how you can modify your code to fix this issue:x = data[['size', 'year']]
y = data['price']
Hope this helps.
Best,
Ivan