projectLearnerToGrid: create learned tesselation of feature space after PC...

Description Usage Arguments Value Author(s) References Examples

Description

create learned tesselation of feature space after PC transformation

Usage

1
2
3
4
5
6
projectLearnerToGrid(formula, data, learnerSchema, 
   trainInds, ..., 
   dropIntercept = TRUE, 
   ngpts = 20, 
   predExtras = list(), 
   predWrapper = force)

Arguments

formula

standard formula, typically of the form "y~." where y denotes the class label variable to be predicted by all remaining features in the input data frame

data

a data.frame instance

learnerSchema

an instance of learnerSchema-class

trainInds

integer vector of rows of data to use for training

...

additional parameters for use with learnerSchema

dropIntercept

logical indicating whether to include column of 1s among feature column-vectors

ngpts

number of equispaced points along the range of each input feature to use in forming a grid in feature space

predExtras

a list with named elements giving binding to extra parameters needed to predict labels for the learner in use. For example, with ldaI, set predExtras=list(type="class")

predWrapper

Sometimes a function call is needed to extract the predicted labels from the RObject applied to the fittedLearner slot of the output object; this parameter defines that call.

Value

instance of projectedLearner-class

Author(s)

VJ Carey <stvjc@channing.harvard.edu>

References

none.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(mlbench)
# demostrate with 3 dimensional hypercube problem
kk = mlbench.hypercube()
colnames(kk$x) = c("f1", "f2", "f3")
hcu = data.frame(cl=kk$classes, kk$x)
library(MLInterfaces)
set.seed(1234)
sam = sample(1:nrow(kk$x), size=nrow(kk$x)/2)
ldap = projectLearnerToGrid(cl~., data=hcu, ldaI, 
   sam, predWrapper=function(x)x$class)
plot(ldap)
confuMat(ldap@fittedLearner)
nnetp = projectLearnerToGrid(cl~., data=hcu, nnetI, sam, size=2,
   decay=.01, predExtras=list(type="class"))
plot(nnetp)
confuMat(nnetp@fittedLearner)
if (require(rgl) && interactive()) {
    learnerIn3D(nnetp)
    ## customising the rgl plot
    learnerIn3D(nnetp, size = 10, alpha = 0.1)
}

lgatto/MLInterfaces documentation built on May 21, 2019, 5:12 a.m.