predict.cv_sgdnet: Make Predcitions Based on Fit From 'cv_sgdnet()'

Description Usage Arguments Value Examples

Description

This function is mostly for convenience, since it makes it easy to take an object from a call to cv_sgdnet() and make predictions based on a lambda chosen from cross-validation results.

Usage

1
2
3
## S3 method for class 'cv_sgdnet'
predict(object, newx, s = c("lambda_1se",
  "lambda_min"), ...)

Arguments

object

a fit from cv_sgdnet()

newx

new data to base predictions on

s

'lambda.1se' chooses predictions based on the model fit to the largest lambda with an error at most one standard deviation away from the fit with the least error; predictions are based on the latter fit if 'lambda.min' is chosen

...

arguments passed on to predict.sgdnet()

Value

Predictions for object given data in newx.

Examples

1
2
3
4
5
6
7
set.seed(1)
train_ind <- sample(150, 100)
fit <- cv_sgdnet(iris[train_ind, 1:4],
                 iris[train_ind, 5],
                 family = "multinomial",
                 nfolds = 5)
predict(fit, iris[-train_ind, 1:4], s = "lambda_min", type = "class")

jolars/sgdnet documentation built on May 22, 2019, 11:52 p.m.