Learn R Programming

FastKRR (version 0.1.2)

param.krr: Param method for fitted Kernel Ridge Regression models

Description

Displays (and invisibly returns) the hyperparameters actually used by a fitted object. For krr objects returned by fastkrr, this prints a concise hyperparameter panel (e.g., rho, lambda, m, eps, n_threads, d).

Usage

# S3 method for krr
param(x, ...)

Value

Prints a human-readable panel and returns (invisibly) a named list of hyperparameters.

Arguments

x

An object of class "krr", typically returned by fastkrr.

...

Additional arguments.

Details

Pivoted approximation note: When opt = "pivoted", the effective number of pivots m used during the approximation may be smaller than the user-specified m because the algorithm can stop early based on eps. If you want to confirm the initial m that you set, please see the printed Call (the original function call shows your input arguments).

See Also

fastkrr

Examples

Run this code
# Data setting
set.seed(1)
lambda = 1e-4
d = 1
n = 50
rho = 1
X = matrix(runif(n*d, 0, 1), nrow = n, ncol = d)
y = as.vector(sin(2*pi*rowMeans(X)^3) + rnorm(n, 0, 0.1))

model = fastkrr(X, y, kernel="gaussian", opt="nystrom",
              rho=1, lambda=1e-4, m=200, n_threads=4, fastcv=FALSE)


class(model)
param(model)

Run the code above in your browser using DataLab