divisive_clustering {clustlearn} | R Documentation |

## Divisive Hierarchical Clustering

### Description

Perform a hierarchical Divisive cluster analysis on a set of observations

### Usage

```
divisive_clustering(data, details = FALSE, waiting = TRUE, ...)
```

### Arguments

`data` |
a set of observations, presented as a matrix-like object where every row is a new observation. |

`details` |
a Boolean determining whether intermediate logs explaining how the algorithm works should be printed or not. |

`waiting` |
a Boolean determining whether the intermediate logs should be printed in chunks waiting for user input before printing the next or not. |

`...` |
additional arguments passed to |

### Details

This function performs a hierarchical cluster analysis for the
`n`

objects being clustered. The definition of a set of clusters using
this method follows a `n`

step process, which repeats until `n`

clusters remain:

Initially, each object is assigned to the same cluster. The sum of squares of the distances between objects and their cluster center is computed.

The cluster with the highest sum of squares is split into two using the k-means algorithm. This step is repeated until

`n`

clusters remain.

### Value

An `stats::hclust()`

object which describes the tree produced by the
clustering process.

### Author(s)

Eduardo Ruiz Sabajanes, eduardo.ruizs@edu.uah.es

### Examples

```
### !! This algorithm is very slow, so we'll only test it on some datasets !!
### Helper function
test <- function(db, k) {
print(cl <- clustlearn::divisive_clustering(db, max_iterations = 5))
par(mfrow = c(1, 2))
plot(db, col = cutree(cl, k), asp = 1, pch = 20)
h <- rev(cl$height)[50]
clu <- as.hclust(cut(as.dendrogram(cl), h = h)$upper)
ctr <- unique(cutree(cl, k)[cl$order])
plot(clu, labels = FALSE, hang = -1, xlab = "Cluster", sub = "", main = "")
rect.hclust(clu, k = k, border = ctr)
}
### Example 1
# test(clustlearn::db1, 2)
### Example 2
# test(clustlearn::db2, 2)
### Example 3
# test(clustlearn::db3, 3)
### Example 4
# test(clustlearn::db4, 3)
### Example 5
test(clustlearn::db5, 3)
### Example 6
test(clustlearn::db6, 3)
### Example 7 (with explanations, no plots)
cl <- clustlearn::divisive_clustering(
clustlearn::db5[1:6, ],
details = TRUE,
waiting = FALSE
)
```

*clustlearn*version 1.0.0 Index]