Multi-feature matrix regression?

조회 수: 2 (최근 30일)
ML
ML 2015년 10월 4일
편집: Ahmet Cecen 2016년 5월 17일
Hi, can anyone help to get the following regression done?
X is the input multi-dimension matrix (e.g. 90 rows * 20 columns). Y is the target one dimension vector (e.g. 90 rows * 1 column).
How the polynomial regression e.g. polytool can be applied for inputs with more than one feature (I need to test the model by different poly degrees)? What about the K-fold cross validation? how it can be formulated?
Thanks.

채택된 답변

Ahmet Cecen
Ahmet Cecen 2016년 5월 17일
편집: Ahmet Cecen 2016년 5월 17일
Use the function I created expressly for this purpose. And you are in luck, a lightning fast Leave One Out Cross Validation is already embedded in to the core functionality: http://www.mathworks.com/matlabcentral/fileexchange/34918-multivariate-polynomial-regression
All you have to do is MultiPolyRegress(X(:,selectcolumnvectors),Y,POWEROFPOLYNOMIAL,'figure').
Keep in mind the number of polynomial terms follow a pascal triangle, so don't create billion term polynomials. The code wasn't written with memory in mind. Below is a start (blue is number of feature vectors/columns, red is power of polynomial).

추가 답변 (2개)

Walter Roberson
Walter Roberson 2015년 10월 4일
It does not sound to me as if you are trying for a polynomial: it sounds to me as if you need a multinomial.
Construct a matrix of all of the various combinations you want, such as
A = [x(:,1), x(:,1).^2, x(:,1).^3, x(:,2), x(:,2).^2, x(:,1).*x(:,2), x(:,3), x(:,4), x(:,5).*x(:,6).*x(:,7) ..]
meaning (for example) c1*x1 + c2*x1^2 + c3*x1^3 + c4*x2 + c5*x2^2 + c5*x1*x2 + c6*x3 + c7*x4 + c8*x5*x6*x7 + ...
Then,
A\Y
will give the coefficients c1, c2, c3, ...
To use different degrees or a different mix of the various features, construct a different A matrix.

Walter Roberson
Walter Roberson 2016년 5월 17일
You have indicated that you accepted the answer by mistake. Please explain further why the above did not work for you.

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by