Learn R Programming

yap (version 0.1.1)

pnn.search_logl: Search for the optimal value of PNN smoothing parameter based on the cross entropy

Description

The function pnn.search_logl searches for the optimal value of PNN smoothing parameter by cross-validation.

Usage

pnn.search_logl(net, sigmas, nfolds = 4, seed = 1)

Arguments

net

A PNN object generated by pnn.fit()

sigmas

A numeric vector to search for the best smoothing parameter

nfolds

A scalar for the number of n-fold, 4 by default

seed

The seed value for the n-fold cross-validation, 1 by default

Value

The list of all searching outcomes and the best outcome

Examples

Run this code
# NOT RUN {
data(iris, package = "datasets")
Y <- iris[, 5]
X <- scale(iris[, 1:4])
pnet <- pnn.fit(x = X, y = Y)
pnn.search_logl(pnet, c(0.5, 1), nfolds = 2)
# }

Run the code above in your browser using DataLab