I want to use the same function or method in Python as mvregress in MATLAB.
As an example, we have x1, x2, x3, x4, x5, x6
inputs and y1, y2, y3
outputs. After using this function we should get some estimate regression coefficients.
Does Python have this ability?
Asked
Active
Viewed 1,355 times
2

Paul
- 5,473
- 1
- 30
- 37

A. Innokentiev
- 681
- 2
- 11
- 27
1 Answers
2
sklearn.linear_model.LinearRegression
works fine for multivariate linear regression (where the output is a vector, not a scalar)
>>> from sklearn import linear_model
>>> X = [[1, 2, 3, 4, 5, 6]]
>>> Y = [[1, 2, 3]]
>>> lr = linear_model.LinearRegression()
>>> model = lr.fit(X, Y)
>>> model.predict([[1,2,3,4,5,6]])
array([[ 1., 2., 3.]])

bakkal
- 54,350
- 12
- 131
- 107