2

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?

0

1 Answer 1

3

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.]])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.