predict.kerndwd: predict class labels for new observations

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/predict.kerndwd.R

Description

Predict the binary class labels or the fitted values of an kerndwd object.

Usage

1
2
## S3 method for class 'kerndwd'
predict(object, kern, x, newx, type=c("class", "link"), ...)

Arguments

object

A fitted kerndwd object.

kern

The kernel function used when fitting the kerndwd object.

x

The predictor matrix, i.e., the x matrix used when fitting the kerndwd object.

newx

A matrix of new values for x at which predictions are to be made. We note that newx must be a matrix, predict function does not accept a vector or other formats of newx.

type

"class" or "link"? "class" produces the predicted binary class labels and "link" returns the fitted values. Default is "class".

...

Not used. Other arguments to predict.

Details

If "type" is "class", the function returns the predicted class labels. If "type" is "link", the result is β_0 + x_i'β for the linear case and β_0 + K_i'α for the kernel case.

Value

Returns either the predicted class labels or the fitted values, depending on the choice of type.

Author(s)

Boxiang Wang and Hui Zou
Maintainer: Boxiang Wang [email protected]

References

Wang, B. and Zou, H. (2018) “Another Look at Distance Weighted Discrimination," Journal of Royal Statistical Society, Series B, 80(1), 177–198.
https://rss.onlinelibrary.wiley.com/doi/10.1111/rssb.12244

See Also

kerndwd

Examples

1
2
3
4
5
6
7
data(BUPA)
BUPA$X = scale(BUPA$X, center=TRUE, scale=TRUE)
lambda = 10^(seq(-3, 3, length.out=10))
kern = rbfdot(sigma=sigest(BUPA$X))
m1 = kerndwd(BUPA$X, BUPA$y, kern,
  qval=1, lambda=lambda, eps=1e-5, maxit=1e5)
predict(m1, kern, BUPA$X, tail(BUPA$X))

kerndwd documentation built on April 22, 2018, 1:04 a.m.