guess: Guess

Description Usage Arguments Details Value See Also Examples

Description

Infers the category of a new observation.

Usage

1
  guess(nn, X)

Arguments

nn

A trained and smoothed Probabilistic neural network.

X

A vector describing a new observation.

Details

Given an already trained and smoothed Probabilistic neural network, the function guess gives the category with the highest probability, and the probabilities of each category.

Value

A list of the guessed category and the probabilities of each category.

See Also

pnn-package, learn, smooth, perf, norms

Examples

1
2
3
4
5
6
7
8
9
library(pnn)
data(norms)
pnn <- learn(norms)
pnn <- smooth(pnn, sigma=0.8)
guess(pnn, c(1,1))
guess(pnn, c(1,1))$category
guess(pnn, c(1,1))$probabilities
guess(pnn, c(2,1))
guess(pnn, c(1.5,1))

Example output

Attaching package: 'pnn'

The following object is masked from 'package:stats':

    smooth

$category
[1] "A"

$probabilities
        A         B 
0.5532007 0.4467993 

[1] "A"
        A         B 
0.5532007 0.4467993 
$category
[1] "B"

$probabilities
        A         B 
0.4399107 0.5600893 

$category
[1] "B"

$probabilities
        A         B 
0.4975773 0.5024227 

pnn documentation built on May 2, 2019, 9:30 a.m.