klaR: Interfaces for klaR package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to klaR functions that can be used in a pipeline implemented by magrittr.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

Examples

  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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
## Not run: 
library(intubate)
library(magrittr)
library(klaR)

## ntbt_classscatter: Classification scatterplot matrix
data(B3)
library(MASS)

## Original function to interface
classscatter(PHASEN ~ BSP91JW + EWAJW + LSTKJW, data = B3, method = "lda")

## The interface puts data as first parameter
ntbt_classscatter(B3, PHASEN ~ BSP91JW + EWAJW + LSTKJW, method = "lda")

## so it can be used easily in a pipeline.
B3 %>%
  ntbt_classscatter(PHASEN ~ BSP91JW + EWAJW + LSTKJW, method = "lda")


## ntbt_cond.index: Calculation of Condition Indices for Linear Regression
data(Boston)

## Original function to interface
cond.index(medv ~ ., data = Boston)

## The interface puts data as first parameter
ntbt_cond.index(Boston, medv ~ .)

## so it can be used easily in a pipeline.
Boston %>%
  ntbt_cond.index(medv ~ .)


## ntbt_greedy.wilks: Stepwise forward variable selection for classification
data(B3)

## Original function to interface
greedy.wilks(PHASEN ~ ., data = B3, niveau = 0.1)

## The interface puts data as first parameter
ntbt_greedy.wilks(B3, PHASEN ~ ., niveau = 0.1)

## so it can be used easily in a pipeline.
B3 %>%
  ntbt_greedy.wilks(PHASEN ~ ., niveau = 0.1)

## ntbt_loclda: Localized Linear Discriminant Analysis (LocLDA)
## Original function to interface
loclda(PHASEN ~ ., data = B3)

## The interface puts data as first parameter
ntbt_loclda(B3, PHASEN ~ .)

## so it can be used easily in a pipeline.
B3 %>%
  ntbt_loclda(PHASEN ~ .)


## ntbt_meclight: Minimal Error Classification
data(iris)

## Original function to interface
meclight(Species ~ ., data = iris)

## The interface puts data as first parameter
ntbt_meclight(iris, Species ~ .)

## so it can be used easily in a pipeline.
iris %>%
  ntbt_meclight(Species ~ .)


## ntbt_NaiveBayes: Naive Bayes Classifier
data(iris)

## Original function to interface
NaiveBayes(Species ~ ., data = iris)

## The interface puts data as first parameter
ntbt_NaiveBayes(iris, Species ~ .)

## so it can be used easily in a pipeline.
iris %>%
  ntbt_NaiveBayes(Species ~ .)


## ntbt_nm: Nearest Mean Classification
## Original function to interface
nm(PHASEN ~ ., data = B3)

## The interface puts data as first parameter
ntbt_nm(B3, PHASEN ~ .)

## so it can be used easily in a pipeline.
B3 %>%
  ntbt_nm(PHASEN ~ .)


## ntbt_partimat: Plotting the 2-d partitions of classification methods
## Original function to interface
partimat(Species ~ ., data = iris, method = "lda")

## The interface puts data as first parameter
ntbt_partimat(iris, Species ~ ., method = "lda")

## so it can be used easily in a pipeline.
iris %>%
  ntbt_partimat(Species ~ ., method = "lda")


## ntbt_plineplot: Plotting marginal posterior class probabilities
## Original function to interface
plineplot(PHASEN ~ ., data = B3, method = "lda", x = "EWAJW", xlab = "EWAJW")

## The interface puts data as first parameter
ntbt_plineplot(B3, PHASEN ~ ., method = "lda", x = "EWAJW", xlab = "EWAJW")

## so it can be used easily in a pipeline.
B3 %>%
  ntbt_plineplot(PHASEN ~ ., method = "lda", x = "EWAJW", xlab = "EWAJW")


## ntbt_pvs: Pairwise variable selection for classification
library("mlbench")
data("Satellite")

## Original function to interface
pvs(classes ~ ., Satellite[1:3218,], method="qda", vs.method="ks.test")

## The interface puts data as first parameter
ntbt_pvs(Satellite[1:3218,], classes ~ ., method="qda", vs.method="ks.test")

## so it can be used easily in a pipeline.
Satellite[1:3218,] %>%
  ntbt_pvs(classes ~ ., method="qda", vs.method="ks.test")


## ntbt_rda: Regularized Discriminant Analysis (RDA)
## Original function to interface
rda(Species ~ ., data = iris, gamma = 0.05, lambda = 0.2)

## The interface puts data as first parameter
ntbt_rda(iris, Species ~ ., gamma = 0.05, lambda = 0.2)

## so it can be used easily in a pipeline.
iris %>%
  ntbt_rda(Species ~ ., gamma = 0.05, lambda = 0.2)


## ntbt_sknn: Simple k nearest Neighbours
## Original function to interface
sknn(Species ~ ., data = iris)

## The interface puts data as first parameter
ntbt_sknn(iris, Species ~ .)

## so it can be used easily in a pipeline.
iris %>%
  ntbt_sknn(Species ~ .)


## ntbt_stepclass: Stepwise variable selection for classification
## Original function to interface
stepclass(Species ~ ., data = iris, method = "qda", 
          start.vars = "Sepal.Width", criterion = "AS")  # same as above 

## The interface puts data as first parameter
ntbt_stepclass(iris, Species ~ ., method = "qda", 
               start.vars = "Sepal.Width", criterion = "AS")  # same as above 

## so it can be used easily in a pipeline.
iris %>%
  ntbt_stepclass(Species ~ ., method = "qda", 
                 start.vars = "Sepal.Width", criterion = "AS")  # same as above 


## ntbt_woe: Weights of evidence
data("GermanCredit")
set.seed(6)
train <- sample(nrow(GermanCredit), round(0.6*nrow(GermanCredit)))

## Original function to interface
woe(credit_risk ~ ., data = GermanCredit[train,], zeroadj = 0.5, applyontrain = TRUE)

## The interface puts data as first parameter
ntbt_woe(GermanCredit[train,], credit_risk ~ ., zeroadj = 0.5, applyontrain = TRUE)

## so it can be used easily in a pipeline.
GermanCredit[train,] %>%
  ntbt_woe(credit_risk ~ ., zeroadj = 0.5, applyontrain = TRUE)

## End(Not run)

rbertolusso/intubate documentation built on May 27, 2019, 3 a.m.