Hello! what do you mean by the output?
You’ll need to use it to predict something to get an output for a model.
Dylan
]]>Thank you for great explanation. I need to ask 1 thing.
I want to check the regression output after fitting the model. How to do that?
Thanks
]]>Hi ChienChi,
poly_model is defined in the for loop!
A normal “fit” method won’t have any output, as it’s not transforming (as seen in the for loop).
a fit_transform is a little different than a fit method.
Dylan
]]> The code is useful and thanks for sharing it.
I put the sample code below and need your help to
confirm one question:
At line 10, the parameter values passed to mean_squared_error()
are “y_value” and “y_pred”.
“y_value” is the result fetched from the Excel file.
“y_pred” is the result returned by line 8.
But at line 4, “poly_model.fit(poly_x_values, y_values)” is executed.
What does this line take effect?
This line doesn’t generate any result.
What is the relation between line 4 and line 10?
Thanks very much.
======================================================
1 poly_model = PolynomialFeatures(degree=degree)
2
3 poly_x_values = poly_model.fit_transform(x_values)
4 poly_model.fit(poly_x_values, y_values)
5
6 regression_model = LinearRegression()
7 regression_model.fit(poly_x_values, y_values)
8 y_pred = regression_model.predict(poly_x_values)
9
10 plt_mean_squared_error.append(mean_squared_error(y_values, y_pred, squared=False))
Sincerely
ChienChi
Hey Dominique,
I’m glad that the code worked!
Sometimes many think they’re after this post but are really after something like a regression spine.
Maybe this article will help (it’s from someone else’s blog)
]]>I have a data set that contains 10 independent variables and 1 dependent variable. Using the code in this article, it computed that my polynomial should be of degree 4.
When I fit my ‘linear’ regression model, is it actually forming polynomial relationships of degree 4, or is it just performing normal linear regression? The accuracy is not very good if I set my degree to 4.
Is this actually multivariate polynomial regression? If not, do you know how I can do this?
Thank you!
]]>