{"id":18174453,"url":"https://github.com/mlr-org/paradox","last_synced_at":"2025-04-05T19:10:57.272Z","repository":{"id":39543511,"uuid":"106089478","full_name":"mlr-org/paradox","owner":"mlr-org","description":"ParamHelpers Next Generation","archived":false,"fork":false,"pushed_at":"2025-02-01T19:10:56.000Z","size":11819,"stargazers_count":29,"open_issues_count":46,"forks_count":7,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-03-29T18:06:26.294Z","etag":null,"topics":["experimental-design","hyperparameters","mlr3","r","r-package","transformations"],"latest_commit_sha":null,"homepage":"https://paradox.mlr-org.com","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlr-org.png","metadata":{"funding":{"github":"mlr-org"},"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-07T10:29:04.000Z","updated_at":"2025-02-01T18:56:05.000Z","dependencies_parsed_at":"2024-01-13T20:43:22.916Z","dependency_job_id":"9a25e888-f89e-46c9-b6c7-145494e1d4ba","html_url":"https://github.com/mlr-org/paradox","commit_stats":{"total_commits":802,"total_committers":19,"mean_commits":42.21052631578947,"dds":0.7369077306733167,"last_synced_commit":"9738e56277b32a67060a27821c46ac78ff29c036"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlr-org%2Fparadox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlr-org%2Fparadox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlr-org%2Fparadox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlr-org%2Fparadox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlr-org","download_url":"https://codeload.github.com/mlr-org/paradox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386262,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["experimental-design","hyperparameters","mlr3","r","r-package","transformations"],"created_at":"2024-11-02T16:03:07.324Z","updated_at":"2025-04-05T19:10:57.244Z","avatar_url":"https://github.com/mlr-org.png","language":"R","readme":"---\noutput: github_document\n---\n\n# paradox\n\nPackage website: [release](https://paradox.mlr-org.com/) | [dev](https://paradox.mlr-org.com/dev/)\n\nUniversal Parameter Space Description and Tools.\n\n\u003c!-- badges: start --\u003e\n[![r-cmd-check](https://github.com/mlr-org/paradox/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/mlr-org/paradox/actions/workflows/r-cmd-check.yml)\n[![CRAN Status](https://www.r-pkg.org/badges/version/paradox)](https://CRAN.R-project.org/package=paradox)\n[![StackOverflow](https://img.shields.io/badge/stackoverflow-mlr3-orange.svg)](https://stackoverflow.com/questions/tagged/mlr3)\n[![Mattermost](https://img.shields.io/badge/chat-mattermost-orange.svg)](https://lmmisld-lmu-stats-slds.srv.mwn.de/mlr_invite/)\n\u003c!-- badges: end --\u003e\n\n```{r setup, include=FALSE}\nset.seed(123)\nknitr::opts_chunk$set(cache = FALSE, collapse = TRUE, comment = \"#\u003e\")\noptions(datatable.print.class = FALSE, datatable.print.keys = FALSE)\nlibrary(paradox)\n```\n\n## Installation\n\n```{r inst, eval=FALSE}\nremotes::install_github(\"mlr-org/paradox\")\n```\n\n## Usage\n\nCreate a simple ParamSet using all supported Parameter Types:\n\n* integer numbers (`\"int\"`)\n* real-valued numbers (`\"dbl\"`)\n* truth values `TRUE` or `FALSE` (`\"lgl\"`)\n* categorical values from a set of possible strings (`\"fct\"`)\n* further types are only possible by using transformations.\n\n```{r ps}\npset = ps(\n  z = p_int(lower = 1, upper = 3),\n  x = p_dbl(lower = -10, upper = 10),\n  flag = p_lgl(),\n  methods = p_fct(c(\"a\",\"b\",\"c\"))\n)\n```\n\nDraw random samples / create random design:\n\n```{r pssample}\ngenerate_design_random(pset, 3)\n```\n\nGenerate LHS Design:\n\n```{r pslhs}\nrequireNamespace(\"lhs\")\ngenerate_design_lhs(pset, 3)\n```\n\nGenerate Grid Design:\n\n```{r psgrid, R.options=list(max.print=30)}\ngenerate_design_grid(pset, resolution = 2)\n```\n\nProperties of the parameters within the `ParamSet`:\n\n```{r psprobs}\npset$ids()\npset$levels\npset$nlevels\npset$is_number\npset$lower\npset$upper\n```\n\n### Parameter Checks\n\nCheck 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):\n\n```{r, error = TRUE}\npset$test(list(z = 1, x = 1))\npset$test(list(z = -1, x = 1))\npset$check(list(z = -1, x = 1))\npset$assert(list(z = -1, x = 1))\n```\n\n### Transformations\n\nTransformations are functions with a fixed signature.\n\n* `x` A named list of parameter values\n* `param_set` the `ParamSet` used to create the design\n\nTransformations can be used to change the distributions of sampled parameters.\nFor 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.\nAlternatively, `logscale = TRUE` can be set; in this case, `lower` and `upper` represent the values *after* the transformation.\n\n```{r pstransscale}\npset = ps(\n  z = p_int(lower = -3, upper = 3),\n  x = p_dbl(lower = 2^-3, upper = 2^3, logscale = TRUE)\n)\npset$extra_trafo = function(x, param_set) {\n  x$z = 2^x$z\n  return(x)\n}\npset_smplr = SamplerUnif$new(pset)\nx = pset_smplr$sample(2)\nxst = x$transpose()\nxst\n```\n\nFurther documentation can be found in the [in-depth tutorial](https://paradox.mlr-org.com/dev/articles/indepth.html)\n\n","funding_links":["https://github.com/sponsors/mlr-org"],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlr-org%2Fparadox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlr-org%2Fparadox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlr-org%2Fparadox/lists"}