---
name: "mlpack_kmeans_RandomPartition"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_kmeans_RandomPartition"
---

# mlpack\_kmeans\_RandomPartition(3)

A very simple partitioner which partitions the data randomly into the number of desired clusters.

## NAME

mlpack::kmeans::RandomPartition -

A very simple partitioner which partitions the data randomly into the number of desired clusters.

## SYNOPSIS

### Public Member Functions

**RandomPartition** ()\
 *Empty constructor, required by the InitialPartitionPolicy policy.*

### Static Public Member Functions

template\<typename MatType \> static void **Cluster** (const MatType &data, const size\_t clusters, arma::Col\< size\_t \> &assignments)\
 *Partition the given dataset into the given number of clusters.*

## Detailed Description

A very simple partitioner which partitions the data randomly into the number of desired clusters.

It has no parameters, and so an instance of the class is not even necessary.

Definition at line 36 of file random\_partition.hpp.

## Constructor & Destructor Documentation

### mlpack::kmeans::RandomPartition::RandomPartition ()` [inline]`

Empty constructor, required by the InitialPartitionPolicy policy.

Definition at line 40 of file random\_partition.hpp.

## Member Function Documentation

### template\<typename MatType \> static void mlpack::kmeans::RandomPartition::Cluster (const MatType &data, const size\_tclusters, arma::Col\< size\_t \> &assignments)` [inline]`, ` [static]`

Partition the given dataset into the given number of clusters. Assignments are random, and the number of points in each cluster should be equal (or approximately equal).

**Template Parameters:**

*MatType* Type of data (arma::mat or arma::sp\_mat).

**Parameters:**

*data* Dataset to partition. \
 *clusters* Number of clusters to split dataset into. \
 *assignments* Vector to store cluster assignments into. Values will be between 0 and (clusters - 1).

Definition at line 54 of file random\_partition.hpp.

## Author

Generated automatically by Doxygen for MLPACK from the source code.
