scaling-methods: Compute Metric Scaling Co-ordinates

Description Usage Arguments Value Methods References Examples

Description

Compute metric scaling co-ordinates for training examples in a random forest, based on the proximity matrix generated by proximities. Scaling co-ordinates are useful for visualising the data.

Usage

1
2
## S4 method for signature 'bigrfprox'
scaling(prox, nscale=2L, trace=0L)

Arguments

prox

A proximity matrix of class "bigrfprox".

nscale

The number of scaling co-ordinates to compute. Typically, the first two or three scaling co-ordinates are the most useful. Default: 2L.

trace

0 for no verbose output. 1 to print verbose output. 2 to print even more verbose output on the progress of finding scaling coordinates. Default: 0.

Value

A matrix containing the scaling co-ordinates for each example, where the ith column contains the ith scaling co-ordinates.

Methods

signature(prox = "bigrfprox")

Compute metric scaling coordinates for a random forest.

References

Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32.

Breiman, L. & Cutler, A. (n.d.). Random Forests. Retrieved from http://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm.

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
# Classify cars in the Cars93 data set by type (Compact, Large,
# Midsize, Small, Sporty, or Van).

# Load data.
data(Cars93, package="MASS")
x <- Cars93
y <- Cars93$Type

# Select variables with which to train model.
vars <- c(4:22)

# Run model, grow 30 trees.
forest <- bigrfc(x, y, ntree=30L, varselect=vars, cachepath=NULL)

# Calculate proximity matrix.
prox <- proximities(forest, cachepath=NULL)

# Calculate scaling co-ordinates.
scale <- scaling(prox, 3L)

# Plot the 1st vs 2nd scaling co-ordinates.
plot(scale[, 1], scale[, 2], col=as.integer(y), pch=as.integer(y))

# Plot the 1st vs 3rd scaling co-ordinates.
plot(scale[, 1], scale[, 3], col=as.integer(y), pch=as.integer(y))

# Plot the 2nd vs 3rd scaling co-ordinates.
plot(scale[, 2], scale[, 3], col=as.integer(y), pch=as.integer(y))

gboris/bigrf documentation built on May 16, 2019, 10:14 p.m.