All Projects → mlr-org → paradox

mlr-org / paradox

Licence: LGPL-3.0 license
ParamHelpers Next Generation

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to paradox

mlr3spatiotempcv
Spatiotemporal resampling methods for mlr3
Stars: ✭ 43 (+86.96%)
Mutual labels:  r-package, mlr3
mlr3tuning
Hyperparameter optimization package of the mlr3 ecosystem
Stars: ✭ 44 (+91.3%)
Mutual labels:  r-package, mlr3
NetBID
Data-driven Network-based Bayesian Inference of Drivers
Stars: ✭ 21 (-8.7%)
Mutual labels:  r-package
mikropml
User-Friendly R Package for Supervised Machine Learning Pipelines
Stars: ✭ 34 (+47.83%)
Mutual labels:  r-package
gendercoder
Creating R package to code free text gender responses
Stars: ✭ 48 (+108.7%)
Mutual labels:  r-package
mlr3-learndrake
Template for using mlr3 with drake
Stars: ✭ 18 (-21.74%)
Mutual labels:  mlr3
pkgkitten
Create simple packages which pass R CMD check
Stars: ✭ 31 (+34.78%)
Mutual labels:  r-package
WeightedTreemaps
Create Voronoi and Sunburst Treemaps from Hierarchical data
Stars: ✭ 33 (+43.48%)
Mutual labels:  r-package
cranlogs
Download Logs from the RStudio CRAN Mirror
Stars: ✭ 70 (+204.35%)
Mutual labels:  r-package
rtweet.download
{rtweet} helpers for automating large or time-consuming downloads
Stars: ✭ 24 (+4.35%)
Mutual labels:  r-package
aRt
R package to create generative art.
Stars: ✭ 37 (+60.87%)
Mutual labels:  r-package
GAlogger
Log R Events and R Usage to Google Analytics
Stars: ✭ 23 (+0%)
Mutual labels:  r-package
polyglot
🎓Use the R Console as an interactive learning environment
Stars: ✭ 26 (+13.04%)
Mutual labels:  r-package
cablecuttr
An R wrapper for CanIStream.It API
Stars: ✭ 17 (-26.09%)
Mutual labels:  r-package
sl3
💪 🤔 Modern Super Learning with Machine Learning Pipelines
Stars: ✭ 93 (+304.35%)
Mutual labels:  r-package
nasapower
API Client for NASA POWER Global Meteorology, Surface Solar Energy and Climatology in R
Stars: ✭ 79 (+243.48%)
Mutual labels:  r-package
bittrex
A R Client for the Bittrex Crypto-Currency Exchange
Stars: ✭ 26 (+13.04%)
Mutual labels:  r-package
dataspice
🌶️ Create lightweight schema.org descriptions of your datasets
Stars: ✭ 151 (+556.52%)
Mutual labels:  r-package
travis
⛔ ARCHIVED ⛔ Set Up 'Travis' for Testing and Deployment
Stars: ✭ 61 (+165.22%)
Mutual labels:  r-package
cusumcharter
Easier CUSUM control charts. Returns simple CUSUM statistics, CUSUMs with control limit calculations, and function to generate faceted CUSUM Control Charts
Stars: ✭ 17 (-26.09%)
Mutual labels:  r-package

paradox

Package website: release | dev

Universal Parameter Space Description and Tools.

tic CRAN Status StackOverflow Mattermost

Installation

remotes::install_github("mlr-org/paradox")

Usage

Create a simple ParamSet using all supported Parameter Types:

  • integer numbers ("int")
  • real-valued numbers ("dbl")
  • truth values TRUE or FALSE ("lgl")
  • categorical values from a set of possible strings ("fct")
  • further types are only possible by using transformations.
ps = ParamSet$new(
  params = list(
    ParamInt$new(id = "z", lower = 1, upper = 3),
    ParamDbl$new(id = "x", lower = -10, upper = 10),
    ParamLgl$new(id = "flag"),
    ParamFct$new(id = "methods", levels = c("a","b","c"))
  )
)

Draw random samples / create random design:

generate_design_random(ps, 3)
#> <Design> with 3 rows:
#>    z         x  flag methods
#> 1: 1  7.660348 FALSE       b
#> 2: 3  8.809346 FALSE       c
#> 3: 2 -9.088870 FALSE       b

Generate LHS Design:

requireNamespace("lhs")
#> Loading required namespace: lhs
generate_design_lhs(ps, 3)
#> <Design> with 3 rows:
#>    z         x  flag methods
#> 1: 1 -3.984673  TRUE       b
#> 2: 2  7.938035 FALSE       a
#> 3: 3  1.969783  TRUE       c

Generate Grid Design:

generate_design_grid(ps, resolution = 2)
#> <Design> with 24 rows:
#>     z   x  flag methods
#>  1: 1 -10  TRUE       a
#>  2: 1 -10  TRUE       b
#>  3: 1 -10  TRUE       c
#>  4: 1 -10 FALSE       a
#>  5: 1 -10 FALSE       b
#>  6: 1 -10 FALSE       c
#>  7: 1  10  TRUE       a
#>  [ reached getOption("max.print") -- omitted 18 rows ]

Properties of the parameters within the ParamSet:

ps$ids()
#> [1] "z"       "x"       "flag"    "methods"
ps$levels
#> $z
#> NULL
#> 
#> $x
#> NULL
#> 
#> $flag
#> [1]  TRUE FALSE
#> 
#> $methods
#> [1] "a" "b" "c"
ps$nlevels
#>       z       x    flag methods 
#>       3     Inf       2       3
ps$is_number
#>       z       x    flag methods 
#>    TRUE    TRUE   FALSE   FALSE
ps$lower
#>       z       x    flag methods 
#>       1     -10      NA      NA
ps$upper
#>       z       x    flag methods 
#>       3      10      NA      NA

Parameter Checks

Check that a parameter satisfies all conditions of a ParamSet, using $test() (returns FALSE on mismatch), $check() (returns error description on mismatch), and $assert() (throws error on mismatch):

ps$test(list(z = 1, x = 1))
#> [1] TRUE
ps$test(list(z = -1, x = 1))
#> [1] FALSE
ps$check(list(z = -1, x = 1))
#> [1] "z: Element 1 is not >= 1"
ps$assert(list(z = -1, x = 1))
#> Error in ps$assert(list(z = -1, x = 1)): Assertion on 'list(z = -1, x = 1)' failed: z: Element 1 is not >= 1.

Transformations

Transformations are functions with a fixed signature.

  • x A named list of parameter values
  • param_set the ParamSet used to create the design

Transformations can be used to change the distributions of sampled parameters. For example, to sample values between (2^-3) and (2^3) in a (log_2)-uniform distribution, one can sample uniformly between -3 and 3 and exponentiate the random value inside the transformation.

ps = ParamSet$new(
  params = list(
    ParamInt$new(id = "z", lower = -3, upper = 3),
    ParamDbl$new(id = "x", lower = 0, upper = 1)
  )
)
ps$trafo = function(x, param_set) {
  x$z = 2^x$z
  return(x)
}
ps_smplr = SamplerUnif$new(ps)
x = ps_smplr$sample(2)
xst = x$transpose()
xst
#> [[1]]
#> [[1]]$z
#> [1] 0.125
#> 
#> [[1]]$x
#> [1] 0.4137243
#> 
#> 
#> [[2]]
#> [[2]]$z
#> [1] 0.5
#> 
#> [[2]]$x
#> [1] 0.3688455

Further documentation can be found in the mlr3book.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].