projectLearnerToGrid {MLInterfaces} | R Documentation

## create learned tesselation of feature space after PC transformation

### Description

create learned tesselation of feature space after PC transformation

### Usage

    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

    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)
    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 (requireNamespace("rgl") && interactive()) {
    #    learnerIn3D(nnetp)
    #    ## customising the rgl plot
    #    learnerIn3D(nnetp, size = 10, alpha = 0.1)
    #}

[Package MLInterfaces version 1.64.1 Index]