Density Task Generator for Package 'distr6'
Source:R/TaskGeneratorSimdens.R
mlr_task_generators_simdens.Rd
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()
:
Parameters
Id | Type | Default | Levels |
distribution | character | Normal | Arcsine, Arrdist, Bernoulli, Beta, BetaNoncentral, Binomial, Categorical, Cauchy, ChiSquared, ChiSquaredNoncentral, ... |
pars | untyped | - |
See also
as.data.table(mlr_task_generators)
for a table of available TaskGenerators in the running session
Other TaskGenerator:
mlr_task_generators_coxed
,
mlr_task_generators_simsurv
Super class
mlr3::TaskGenerator
-> TaskGeneratorSimdens
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.6460799
#> 2: -0.3076342
#> 3: 0.5160393
#> 4: 1.2509043
#> 5: 0.2014329
#> 6: 2.7219002
# 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 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1
#> [39] 1 1 1 1 1 1 1 1 1 1 0 1