KLR: Kernel Logistic Regression

Description Usage Arguments Details Value See Also

View source: R/KLR.R

Description

This function fit a kernel logistic regression model to the data (y, x) using some pre-specified kernel. The return list contains the estimated kernel weights as well as the original data to perform predictions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
KLR(
  y,
  x,
  kernel = c("gaussian", "polynomial")[1],
  lambda = 0.01,
  sigma2 = 1,
  d = 3,
  threshold = 1e-06,
  max_iter = 1e+05
)

Arguments

y

A n x 1 column vector containing the responses (0-1).

x

A n x p matrix containing the covariates.

kernel

The kernel to use. Either gaussian (default) or polynomial.

lambda

The regularization parameter.

sigma2

The scale in the gaussian and polynomial kernel. See details.

d

The degree in the polynomial kernel.

threshold

The convergence threshold.

max_iter

The maximum number of iterations.

Details

The gaussian kernel has the following form:

exp(-||x-y||^2/sigma2).

The polynomial kernel has the following form:

(1+x'y/sigma2)^d.

Value

A list containing:

x

The original x.

alpha

The vector of fitted weights.

kernel

The kernel.

sigma2

The scale parameter.

d

The polynomial degree.

See Also

predict.KLR, cv.KLR, contours.KLR


fontaine618/KLR documentation built on March 29, 2021, 1:46 a.m.