plot.L0LearnCV: Plot Cross-validation Errors

View source: R/plot.R

plot.L0LearnCVR Documentation

Plot Cross-validation Errors

Description

Plots cross-validation errors for a given gamma.

Usage

## S3 method for class 'L0LearnCV'
plot(x, gamma = 0, ...)

Arguments

x

The output of L0Learn.cvfit

gamma

The value of gamma at which to plot.

...

ignore

Value

A ggplot object.

Examples

# Generate synthetic data for this example
data <- GenSynthetic(n=100,p=20,k=10,seed=1)
X = data$X
y = data$y

# Perform 3-fold cross-validation on an L0L2 Model with 3 values of
# Gamma ranging from 0.0001 to 10
fit <- L0Learn.cvfit(X, y, nFolds=3, seed=1, penalty="L0L2",
maxSuppSize=20, nGamma=3, gammaMin=0.0001, gammaMax = 10)
# Plot the graph of cross-validation error versus lambda for gamma = 0.0001
plot(fit, gamma=0.0001)


L0Learn documentation built on March 7, 2023, 8:18 p.m.