svmModel: Combine Model-based Recursive Partitioning with Support...

Description Usage Arguments Format Details Value References See Also Examples

Description

Combine Model-based Recursive Partitioning with Support Vector Machines.

Usage

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

  ## S3 method for class 'svmModel'
 reweight(object, weights, ...)

  ## S3 method for class 'wsvm'
 deviance(object, ...)

  ## S3 method for class 'wsvm'
 estfun(x, ...)

  ## S3 method for class 'svmModel'
 predict(object,
    out = c("class", "posterior", "decision"), ...)

Arguments

object

An object of class "svmModel" and "wsvm", respectively.

x

An object of class "wsvm".

weights

A vector of observation weights.

out

Should class labels or posterior probabilities be returned?

...

Further arguments.

Format

Formal class 'StatModel' [package "modeltools"] with 5 slots

Details

This page lists all ingredients to combine Support Vector Machines with Model-Based Recursive Partitioning (mob from package party). See the example for how to do that.

svmModel is an object of class StatModel-class implemented in package modeltools that provides an infra-structure for an unfitted wsvm model.

Moreover, methods for wsvm and svmModel objects for the generic functions reweight, deviance, estfun, and predict are provided.

Value

reweight: The re-weighted fitted "svmModel" object.
deviance: The value of the objective function extracted from object.
estfun: The empirical estimating (or score) function, i.e. the derivatives of the objective function with respect to the parameters, evaluated at the training data.
predict: Either a vector of predicted class labels, a matrix of decision values or a matrix of class posterior probabilities.

References

Zeileis, A., Hothorn, T. and Kornik, K. (2008), Model-based recursive partitioning. Journal of Computational and Graphical Statistics, 17(2) 492–514.

See Also

reweight, deviance, estfun, predict.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(locClassData)
library(party)

data <- vData(500)
x <- seq(0,1,0.05)
grid <- expand.grid(x.1 = x, x.2 = x)

fit <- mob(y ~ x.1 + x.2 | x.1 + x.2, data = data, model = svmModel, kernel = "linear",
control = mob_control(objfun = deviance, minsplit = 200))

## predict decision values
dec <- predict(fit, newdata = grid, out = "decision")

image(x, x, matrix(dec, length(x)), xlab = "x.1", ylab = "x.2")
contour(x, x, matrix(dec, length(x)), levels = 0, add = TRUE)
points(data$x, pch = as.character(data$y))

## predict node membership
splits <- predict(fit, newdata = grid, type = "node")
contour(x, x, matrix(splits, length(x)), levels = min(splits):max(splits), add = TRUE, lty = 2)

locClass documentation built on May 2, 2019, 5:21 p.m.

Related to svmModel in locClass...