Description Usage Arguments Value Author(s) Examples
View source: R/LinearRegression.R
Fast Ridge Regression with Training and Test Data, it will return the prediction result of the data X_test and the RMSE between Y_test and the prediction results.
1  | fastRidgeRegression(X_train, Y_train, X_test, Y_test, training_part = 0.8)
 | 
X_train | 
 The data used for training the linear regression model, with only features.  | 
Y_train | 
 The data used for training the linear regression model, with only target.  | 
X_test | 
 The data used for prediction and computing RMSE, with only features.  | 
Y_test | 
 The data used for prediction and computing RMSE, with only target.  | 
training_part | 
 
  | 
pred | 
 The prediction for the test set the algorithm automatically splitted  | 
RMSE | 
 The RMSE between the prediction and true target result for the test set  | 
Li (Richard) Liu
1 2 3 4 5 6 7 8 9 10 11 12 13 14  | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (X_train, Y_train, X_test, Y_test, training_part = 0.8)
{
    res_svd = svd(X_train)
    tuy = crossprod(res_svd$u, Y_train)
    beta = res_svd$v %*% (tuy * res_svd$d/(res_svd$d^2))
    pred = crossprod(t(X_test), beta)
    RMSE = eval_metrics(Y_test, pred)
    return(list(pred = pred, RMSE = RMSE))
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.