File: similarity_measures_classification.Rd

package info (click to toggle)
r-cran-stablelearner 0.1-5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: makefile: 2
file content (103 lines) | stat: -rw-r--r-- 2,424 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
\name{similarity_measures_classification}

\alias{similarity_measures}
\alias{similarity_measures_classification}
\alias{clagree}
\alias{ckappa}
\alias{bdist}
\alias{tvdist}
\alias{hdist}
\alias{jsdiv}

\title{Similarity Measure Infrastructure for Stability Assessment with Ordinal Responses}

\description{
  Functions that provide objects with functionality used by 
  \code{\link{stability}} to measure the similarity between the predictions
  of two results in classification problems.
}

\usage{
  clagree()
  ckappa()

  bdist()
  tvdist()
  hdist()
  jsdiv(base = 2)
}

\arguments{
  \item{base}{A positive or complex number: the base with respect to which 
  logarithms are computed. Defaults to 2.}
}

\details{

  The similarity measure functions provide objects that include functionality 
  used by \code{\link{stability}} to measure the similarity between the 
  probability predictions of two results in classification problems.

  The \code{clagree} and \code{ckappa} functions provide an object that can be 
  used to assess the similarity based on the predicted classes of two results.
  The predicted classes are selected by the class with the highest probability.

  The \code{bdist} (Bhattacharayya distance), \code{tvdist} (Total variation 
  distance), \code{hdist} (Hellinger distance) and \code{jsdist} 
  (Jenson-Shannon divergence) functions provide an object that can be 
  used to assess the similarity based on the predicted class probabilities of 
  two results.
  
}

\seealso{\code{\link{stability}}}

\examples{

\donttest{

set.seed(0)

## build trees
library("partykit")
m1 <- ctree(Species ~ ., data = iris[sample(1:nrow(iris), replace = TRUE),])
m2 <- ctree(Species ~ ., data = iris[sample(1:nrow(iris), replace = TRUE),])

p1 <- predict(m1, type = "prob")
p2 <- predict(m2, type = "prob")

## class agreement
m <- clagree()
m$measure(p1, p2)

## cohen's kappa
m <- ckappa()
m$measure(p1, p2)

## bhattacharayya distance
m <- bdist()
m$measure(p1, p2)

## total variation distance
m <- tvdist()
m$measure(p1, p2)

## hellinger distance
m <- hdist()
m$measure(p1, p2)

## jenson-shannon divergence
m <- jsdiv()
m$measure(p1, p2)

## jenson-shannon divergence (base = exp(1))
m <- jsdiv(base = exp(1))
m$measure(p1, p2)

}

}

\keyword{stability}
\keyword{similariy}
\keyword{measures}