Skip to contents

A mlr3::TaskGenerator calling distr6::distrSimulate(). See distr6::distrSimulate() for an explanation of the hyperparameters. See distr6::listDistributions() for the names of the available distributions.

Dictionary

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

mlr_task_generators$get("simdens")
tgen("simdens")

Parameters

IdTypeDefaultLevels
distributioncharacterNormalArcsine, Arrdist, Bernoulli, Beta, BetaNoncentral, Binomial, Categorical, Cauchy, ChiSquared, ChiSquaredNoncentral, ...
parsuntyped-

See also

Other TaskGenerator: mlr_task_generators_coxed, mlr_task_generators_simsurv

Super class

mlr3::TaskGenerator -> TaskGeneratorSimdens

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method help()

Opens the corresponding help page referenced by field $man.

Usage

TaskGeneratorSimdens$help()


Method clone()

The objects of this class are cloneable with this method.

Usage

TaskGeneratorSimdens$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# generate 20 samples from a standard Normal distribution
dens_gen = tgen("simdens")
dens_gen$param_set
#> <ParamSet(2)>
#>              id    class lower upper nlevels        default  value
#>          <char>   <char> <num> <num>   <num>         <list> <list>
#> 1: distribution ParamFct    NA    NA      47         Normal [NULL]
#> 2:         pars ParamUty    NA    NA     Inf <NoDefault[0]> [NULL]

task = dens_gen$generate(20)
head(task)
#>             x
#>         <num>
#> 1:  1.9231091
#> 2:  0.7656584
#> 3:  0.1113752
#> 4: -2.4873272
#> 5: -0.6934592
#> 6: -2.0700736

# generate 50 samples from a Binomial distribution with specific parameters
dens_gen = tgen("simdens", distribution = "Bernoulli", pars = list(prob = 0.8))
task = dens_gen$generate(50)
task$data()[["x"]]
#>  [1] 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
#> [39] 1 1 1 1 0 1 1 1 0 1 1 1