mlr-org / mlr3misc

Miscellaneous helper functions for mlr3
https://mlr3misc.mlr-org.com
GNU Lesser General Public License v3.0
11 stars 2 forks source link

feature: convenient id incrementation #80

Closed sebffischer closed 1 year ago

sebffischer commented 1 year ago

These sugar functions allow do append _<n> to the ids of the dictionary to coveniently increment ids. When retrieving the object "pca_1" this retrieves the object "pca" and sets its id to "pca_1"

Instead of having to write

po("nn_linear", id = "nn_linear_1") %>>%
  po("nn_relu") %>>% 
  po("nn_linear", id = "nn_linear_2") 

it is then possible do write

po("nn_linear_1") %>>%
  po("nn_relu") %>>% 
  po("nn_linear_2") 

Note that one wants to use this in a dictionary, one has to ensure that no key satisfies the regex _\d+$ because then this mechanism is flawed.

sebffischer commented 1 year ago

Martin already reviewed this here: https://github.com/mlr-org/mlr3pipelines/pull/702

codecov-commenter commented 1 year ago

Codecov Report

Merging #80 (742b402) into main (3fe73d1) will decrease coverage by 0.36%. The diff coverage is 72.22%.

@@            Coverage Diff             @@
##             main      #80      +/-   ##
==========================================
- Coverage   80.48%   80.11%   -0.37%     
==========================================
  Files          71       71              
  Lines         999     1016      +17     
==========================================
+ Hits          804      814      +10     
- Misses        195      202       +7     
Impacted Files Coverage Δ
R/dictionary_sugar.R 68.11% <72.22%> (+3.41%) :arrow_up:
R/get_seed.R 60.00% <0.00%> (-40.00%) :arrow_down:
src/keep_in_bounds.c 94.73% <0.00%> (-5.27%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.