Description Usage Arguments Value See Also Examples
The function makes predictions using a rarefit
object at optimal
(lambda
, alpha
) chosen by rarefit.cv
.
1 | rarefit.predict(fitObj, cvObj, newx)
|
fitObj |
Output of |
cvObj |
Output of |
newx |
Matrix of new values for x at which predictions are made. |
Returns a sequence of predictions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# See vignette for more details.
set.seed(100)
ts <- sample(1:length(data.rating), 400) # Train set indices
# Fit the model on train set
ourfit <- rarefit(y = data.rating[ts], X = data.dtm[ts, ], hc = data.hc, lam.min.ratio = 1e-6,
nlam = 20, nalpha = 10, rho = 0.01, eps1 = 1e-5, eps2 = 1e-5, maxite = 1e4)
# Cross validation
ourfit.cv <- rarefit.cv(ourfit, y = data.rating[ts], X = data.dtm[ts, ],
rho = 0.01, eps1 = 1e-5, eps2 = 1e-5, maxite = 1e4)
# Prediction on test set
pred <- rarefit.predict(ourfit, ourfit.cv, data.dtm[-ts, ])
pred.error <- mean((pred - data.rating[-ts])^2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.