Clustering of ICE and d-ICE curves by kmeans.
Clustering if ICE and d-ICE curves by kmeans. All curves are centered to have mean 0 and then kmeans is applied to the curves with the specified number of clusters.
clusterICE(ice_obj, nClusters, plot = TRUE, plot_margin = 0.05, colorvec, plot_pdp = FALSE, x_quantile = FALSE, avg_lwd = 3, centered = FALSE, plot_legend = FALSE, ...)
ice_obj |
Object of class |
nClusters |
Number of clusters to find. |
plot |
If |
plot_margin |
Extra margin to pass to |
colorvec |
Optional vector of colors to use for each cluster. |
plot_pdp |
If |
x_quantile |
If |
avg_lwd |
Average line width to use when plotting the cluster means. Line width is proportional to the cluster's size. |
centered |
If |
plot_legend |
If |
... |
Additional arguments for plotting. |
The ouput of the kmeans
call (a list of class kmeans
).
ice, dice
## Not run: require(ICEbox) require(randomForest) require(MASS) #has Boston Housing data, Pima data(Boston) #Boston Housing data X = Boston y = X$medv X$medv = NULL ## build a RF: bh_rf = randomForest(X, y) ## Create an 'ice' object for the predictor "age": bh.ice = ice(object = bh_rf, X = X, y = y, predictor = "age", frac_to_build = .1) ## cluster the curves into 2 groups. clusterICE(bh.ice, nClusters = 2, plot_legend = TRUE) ## cluster the curves into 3 groups, start all at 0. clusterICE(bh.ice, nClusters = 3, plot_legend = TRUE, center = TRUE) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.