spnn.predict: spnn.predict

Description Usage Arguments Details Value See Also Examples

View source: R/spnn.predict.R

Description

Estimates the category probabilities of new observations using a fitted SPNN.

Usage

1
spnn.predict(nn, newData)

Arguments

nn

A trained Scaled Invariant Probabilistic Neural Network.

newData

A matrix of new observations where each row represents a single observation vector.

Details

Given a trained Scale Invariant Probabilistic Neural Network and new data, the function spnn.predict returns the category with the highest probability and the probability estimates for each category.

Value

A list of the guessed categories and the probability estimates of each category.

See Also

spnn-package, spnn.learn, iris

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(spnn)
library(datasets)

data(iris)

# shuffle the iris data set
indexRandom <- sample(1:nrow(iris), size = nrow(iris), replace = FALSE)

# use 100 observations for training set
trainData <- iris[indexRandom[1:100],]

# use remaining observations for testing
testData <- iris[indexRandom[101:length(indexRandom)],]

# fit spnn
spnn <- spnn.learn(set = trainData, category.column = 5)

# estimate probabilities
predictions <- spnn.predict(nn = spnn, newData = testData[,1:4])

spnn documentation built on Jan. 9, 2020, 1:06 a.m.