spnn.learn: spnn.learn

Description Usage Arguments Details Value See Also Examples

View source: R/spnn.learn.R

Description

Create or update a Scale Invariant Probabilistic Neural Network.

Usage

1
spnn.learn(set, nn, sigma, category.column = 1)

Arguments

set

data.frame or matrix representing the training set. The first column (default category.column = 1) is used to define the category or class of each observation.

nn

(optional) A Scale Invariant Probabilistic Neural Network object. If provided, the training data set input is concatenated to the current training data set of the neural network. If not provided, a new SPNN object is created.

sigma

An n by n square matrix of smoothing parameters where n is the number of input factors. Defaults to using the covariance matrix of the training data set excluding the category.column.

category.column

The column number of category data. Default is 1.

Details

The function spnn.learn creates a new Scale Invariant Probabilistic Neural Network with a given training data set or updates the training data of an existing SPNN. It sets the parameters: model, set, category.column, categories, sigma, sigmaInverse, k, and n for the SPNN.

Value

A trained Scale Invariant Probabilistic Neural Network (SPNN)

See Also

spnn-package, spnn.predict, 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.