0
$\begingroup$

One simple and straightforward question, which is confusing me because poor results that I'm getting. I'm using MATLAB's built in ridge function to get weights for my model, on my training dataset. When I make vector multiplication with my feature matrix and weights from ridge function, results are extremely poor.

model = ridge(y_train,X_train,labdavalue)
y_predicted = X_test * model

X's dimensions [286x12], X_Train [200x12], X_test[86x12]

How can I improve my results?

$\endgroup$

1 Answer 1

0
$\begingroup$

The output coefficients from ridge are based on a centered and scaled X matrix. Try the syntax

b = ridge(y,x,lambda,0)

This will return coefficients that can multiply the unscaled x values. Note that there is an additional coefficient, the intercept, in the first element. So you may need to do something like

y_predicted = b(1) + X_test*b(2:end)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.