Answers for "Multiple Regression in Python"

3

multiple linear regression in python

from sklearn import linear_model
clf = linear_model.LinearRegression()
clf.fit([[getattr(t, 'x%d' % i) for i in range(1, 8)] for t in texts],
        [t.y for t in texts])
#clf.coef_ will have the regression coefficients.
Posted by: Guest on April-17-2021
0

Multiple Regression in Python

from sklearn import linear_model
x = [[5, 7], [6, 6], [7, 4], [8, 5], [9, 6]]
y = [10, 20, 60, 40, 50]
lm = linear_model.LinearRegression()
lm.fit(x, y)
a = lm.intercept_
b = lm.coef_
print a, b[0], b[1]
Posted by: Guest on January-20-2022

Code answers related to "Multiple Regression in Python"

Python Answers by Framework

Browse Popular Code Answers by Language