Return the deviance for an object of class "sgdnet", typically from a fit with sgdnet(). deviance.cv_sgdnet() is a simple wrapper that calls deviance.sgdnet() on the fit to full data from cv_sgdnet().

# S3 method for sgdnet
deviance(object, ...)

# S3 method for cv_sgdnet
deviance(object, ...)

Arguments

object

an object of class 'sgdnet'

...

ignored

Value

The deviance of object at each value along the regularization path. For family = "gaussian" in sgdnet(), this is the residual sum of squares.

Details

This functions returns the deviance of the model along the regularization path. It is computed from the slots dev.ratio and nulldev from the "sgdnet" object using the formula

$$ (1 - \mathtt{dev.ratio}) \times \mathtt{nulldev} $$

where nulldev is the deviance of the intercept-only model.

See also

Examples

fit <- sgdnet(wine$x, wine$y, family = "multinomial") deviance(fit)
#> [1] 386.629686 366.259816 334.666443 301.934272 273.866962 249.014502 #> [7] 226.876325 207.612079 190.715887 175.774111 162.386053 150.519557 #> [13] 139.619936 129.740056 120.807055 112.695624 104.875697 97.604269 #> [19] 90.971614 84.816273 78.802453 73.116104 67.913593 63.135287 #> [25] 58.612609 54.437532 50.605316 47.085120 43.839830 40.841395 #> [31] 38.079450 35.529642 33.158471 30.973266 28.962744 27.065673 #> [37] 25.263511 23.598993 22.067803 20.636764 19.165075 17.841334 #> [43] 16.624277 15.473455 14.401470 13.375898 12.431927 11.545031 #> [49] 10.700009 9.939195 9.252987 8.631202 8.018645 7.424548 #> [55] 6.906177 6.468464 6.004134 5.613422 5.224772 4.898010 #> [61] 4.581992 4.267622 3.993388 3.709858 3.494350 3.274016 #> [67] 3.068117 2.900982 2.740452 2.598604 2.451513 2.324323 #> [73] 2.223543 2.114775 2.012058 1.914734 1.848818 1.775088 #> [79] 1.696043 1.637099 1.579970 1.517315 1.464910 1.414560 #> [85] 1.379693 1.338768 1.311988 1.266447 1.260030 1.228038 #> [91] 1.202976 1.178547 1.160482 1.148500 1.124857 1.113205 #> [97] 1.101608 1.078737 1.073103 1.067489