classifly {classifly}  R Documentation 
This is a convenient function to fit a classification function and
then explore the results using GGobi. You can also do this in two
separate steps using the classification function and then
explore
.
classifly(
data,
model,
classifier,
...,
n = 10000,
method = "nonaligned",
type = "range"
)
data 
Data set use for classification 
model 
Classification formula, usually of the form

classifier 
Function to use for the classification, eg.

... 
Other arguments passed to classification function. For
example. if you use 
n 
Number of points to simulate. To maintain the illusion of a filled solid this needs to increase with dimension. 10,000 points seems adequate for up to four of five dimensions, but if you have more predictors than that, you will need to increase this number. 
method 
method to simulate points: grid, random or nonaligned
(default). See 
type 
type of scaling to apply to data. Defaults to commmon range.
See 
By default in GGobi, points that are not on the boundary (ie. that have an advantage greater than the 5 to brush mode and choose include shadowed points from the brush menu on the plot window. You can then brush them yourself to explore how the certainty of classification varies throughout the space
Special notes:
You should make sure the response variable is a factor
For SVM, make sure to include probability = TRUE
in the
arguments to classifly
explore
, http://had.co.nz/classifly
data(kyphosis, package = "rpart")
library(MASS)
classifly(kyphosis, Kyphosis ~ . , lda)
classifly(kyphosis, Kyphosis ~ . , qda)
classifly(kyphosis, Kyphosis ~ . , glm, family="binomial")
classifly(kyphosis, Kyphosis ~ . , knnf, k=3)
library(rpart)
classifly(kyphosis, Kyphosis ~ . , rpart)
if (require("e1071")) {
classifly(kyphosis, Kyphosis ~ . , svm, probability=TRUE)
classifly(kyphosis, Kyphosis ~ . , svm, probability=TRUE, kernel="linear")
classifly(kyphosis, Kyphosis ~ . , best.svm, probability=TRUE,
kernel="linear")
# Also can use explore directorly
bsvm < best.svm(Species~., data = iris, gamma = 2^(1:1),
cost = 2^(2:+ 4), probability=TRUE)
explore(bsvm, iris)
}