A
A
AnastasiaVO952021-08-13 13:32:19
Python
AnastasiaVO95, 2021-08-13 13:32:19

How to build a polynomial regression model with multiple independent variables using Python?

How to build a polynomial regression model of the second degree with several independent variables (from 2x to 4x) in such a way that you can see the equation itself and the data to assess the adequacy of the model? The data array includes 50 dependent variables and 4 independent variables for each of them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2021-08-13
@AnastasiaVO95

There are many options.
sklearn.preprocessing.PolynomialFeatures is the time.
You can manually convert a multivariate polynomial model to a multivariate linear one, and then run
sklearn.LinearRegression()
You can use the more general variant
scipy.optimize.curve_fit() , and since regression is essentially a minimization problem, any function can be fitted here. Moreover, scipy.optimize has many different numerical optimization methods that can be used to obtain a regression model, including.
In TensorFlow, you can use the
GradientDescentOptimizer
. But I recommend that you first understand the task and terminology. Your phrase
"50 dependent variables" - at first plunged me into a stupor.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question