Skip to content

clusizes

Determine cluster sizes, i.e., the number of points in each cluster, using the normal distribution (μ=num_points/num_clusters, σ=μ/3), and then assuring that the final cluster sizes add up to num_points via the fix_num_points() function.

 clu_num_points = clusizes(num_clusters, num_points, allow_empty)

Arguments

  • num_clusters: Number of clusters.
  • num_points: Total number of points.
  • allow_empty: Allow empty clusters?

Return values

  • clu_num_points: Number of points in each cluster (num_clusters x 1 vector).

Note

This function is stochastic. For reproducibility set the PRNG seed with cluseed() as discussed in the Reference.

Examples

cluseed(123);
sizes = clusizes(4, 1000, true)
% sizes =
%    268
%    330
%    128
%    274
sum(sizes)
% ans = 1000