predict class labels for new observations
predict.lhsc.RdPredict the binary class labels or the fitted values of an lhsc object.
Arguments
- object
- A fitted - lhscobject.
- kern
- The kernel function used when fitting the - lhscobject.
- x
- The predictor matrix, i.e., the - xmatrix used when fitting the- lhscobject.
- newx
- A matrix of new values for - xat which predictions are to be made. We note that- newxmust be a matrix,- predictfunction 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 \(\beta_0 + x_i'\beta\) for the linear case and \(\beta_0 + K_i'\alpha\) for the kernel case.
Value
Returns either the predicted class labels or the fitted values, depending on the choice of type.
Author
Oh-Ran Kwon and Hui Zou
Maintainer: Oh-Ran Kwon  kwon0085@umn.edu
Examples
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 = lhsc(BUPA$X, BUPA$y, kern,
  lambda=lambda, eps=1e-5, maxit=1e5)
predict(m1, kern, BUPA$X, tail(BUPA$X))
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#> [1,]    1    1    1    1    1    1    1    1    1     1
#> [2,]    1    1    1    1    1    1    1    1    1    -1
#> [3,]    1    1    1    1    1    1    1    1    1     1
#> [4,]    1    1    1    1    1    1    1    1    1    -1
#> [5,]    1    1    1    1    1    1    1    1    1    -1
#> [6,]    1    1    1    1    1    1    1    1    1    -1