mlr_task_generators_blobs: Gaussian Blobs Cluster Task Generator

mlr_task_generators_blobsR Documentation

Gaussian Blobs Cluster Task Generator

Description

A TaskGenerator for isotropic Gaussian blobs, in the spirit of sklearn.datasets.make_blobs(). k cluster centers are drawn uniformly from the hypercube ⁠[-center_box, center_box]^d⁠, and the n observations are assigned to the centers in a balanced fashion and perturbed with Gaussian noise of standard deviation sd in each of the d dimensions. The generated TaskClust only contains the numeric features x1, ..., xd; the cluster membership is not stored in the task. The parameters are initialized to k = 3, d = 2, sd = 1, and center_box = 10.

Dictionary

This TaskGenerator can be instantiated via the dictionary mlr_task_generators or with the associated sugar function tgen():

mlr_task_generators$get("blobs")
tgen("blobs")

Parameters

Id Type Default Range
k integer - [1, \infty)
d integer - [1, \infty)
sd numeric - [0, \infty)
center_box numeric - [0, \infty)

Super class

mlr3::TaskGenerator -> TaskGeneratorBlobs

Methods

Public methods

Inherited methods

TaskGeneratorBlobs$new()

Creates a new instance of this R6 class.

Usage
TaskGeneratorBlobs$new()

TaskGeneratorBlobs$plot()

Creates a simple plot of the first two features of generated data, colored by cluster membership.

Usage
TaskGeneratorBlobs$plot(n = 200L, pch = 19L, ...)
Arguments
n

(integer(1))
Number of samples to draw for the plot. Default is 200.

pch

(integer(1))
Point char. Passed to graphics::plot().

...

(any)
Additional arguments passed to graphics::plot().


TaskGeneratorBlobs$clone()

The objects of this class are cloneable with this method.

Usage
TaskGeneratorBlobs$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

  • Dictionary of TaskGenerators: mlr3::mlr_task_generators

  • as.data.table(mlr_task_generators) for a table of available TaskGenerators in the running session (depending on the loaded packages).

Other TaskGenerator: mlr_task_generators_moons

Examples

generator = tgen("blobs")
plot(generator, n = 200)

task = generator$generate(200)
str(task$data())

# 4 well separated clusters in 3 dimensions
generator = tgen("blobs", k = 4, d = 3, sd = 0.5)
task = generator$generate(500)
task

mlr3cluster documentation built on Sept. 17, 2026, 5:09 p.m.