Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better printing of internal tuned values for logging #487

Closed
sebffischer opened this issue Jan 21, 2025 · 1 comment
Closed

Better printing of internal tuned values for logging #487

sebffischer opened this issue Jan 21, 2025 · 1 comment

Comments

@sebffischer
Copy link
Member

Because the internal_tuned_values are a list column, one cannot see their values by looking at the logging output, see the example below:

  library(mlr3verse)
#> Loading required package: mlr3
  learner = lrn("classif.debug",
    iter = to_tune(upper = 1000L, internal = TRUE),
    x = to_tune(0.2, 0.3),
    validate = 0.3,
    early_stopping = TRUE
  )
  ti = tune(
    tuner = tnr("grid_search", batch_size = 2),
    learner = learner,
    task = tsk("iris"),
    resampling = rsmp("holdout"),
    term_evals = 4
  )
#> INFO  [12:38:00.562] [bbotk] Starting to optimize 1 parameter(s) with '<OptimizerBatchGridSearch>' and '<TerminatorEvals> [n_evals=4, k=0]'
#> INFO  [12:38:00.579] [bbotk] Evaluating 2 configuration(s)
#> INFO  [12:38:00.587] [mlr3] Running benchmark with 2 resampling iterations
#> INFO  [12:38:00.607] [mlr3] Applying learner 'classif.debug' on task 'iris' (iter 1/1)
#> INFO  [12:38:00.621] [mlr3] Applying learner 'classif.debug' on task 'iris' (iter 1/1)
#> INFO  [12:38:00.637] [mlr3] Finished benchmark
#> INFO  [12:38:00.658] [bbotk] Result of batch 1:
#> INFO  [12:38:00.660] [bbotk]          x classif.ce warnings errors runtime_learners internal_tuned_values
#> INFO  [12:38:00.660] [bbotk]  0.2000000       0.74        0      0            0.004             <list[1]>
#> INFO  [12:38:00.660] [bbotk]  0.2555556       0.56        0      0            0.003             <list[1]>
#> INFO  [12:38:00.660] [bbotk]                                 uhash
#> INFO  [12:38:00.660] [bbotk]  1036ef04-e06a-4c15-adc4-fe58e53c8c9f
#> INFO  [12:38:00.660] [bbotk]  a8e95113-68ac-41e6-9eb5-0abdc282dbd3
#> INFO  [12:38:00.661] [bbotk] Evaluating 2 configuration(s)
#> INFO  [12:38:00.665] [mlr3] Running benchmark with 2 resampling iterations
#> INFO  [12:38:00.667] [mlr3] Applying learner 'classif.debug' on task 'iris' (iter 1/1)
#> INFO  [12:38:00.678] [mlr3] Applying learner 'classif.debug' on task 'iris' (iter 1/1)
#> INFO  [12:38:00.687] [mlr3] Finished benchmark
#> INFO  [12:38:00.709] [bbotk] Result of batch 2:
#> INFO  [12:38:00.710] [bbotk]          x classif.ce warnings errors runtime_learners internal_tuned_values
#> INFO  [12:38:00.710] [bbotk]  0.2333333       0.70        0      0            0.001             <list[1]>
#> INFO  [12:38:00.710] [bbotk]  0.2666667       0.74        0      0            0.001             <list[1]>
#> INFO  [12:38:00.710] [bbotk]                                 uhash
#> INFO  [12:38:00.710] [bbotk]  c2a54ca1-8684-441b-9349-297090141638
#> INFO  [12:38:00.710] [bbotk]  2ed86023-845e-4922-bdd7-4d3f52b68973
#> INFO  [12:38:00.719] [bbotk] Finished optimizing after 4 evaluation(s)
#> INFO  [12:38:00.719] [bbotk] Result:
#> INFO  [12:38:00.720] [bbotk]          x internal_tuned_values learner_param_vals  x_domain classif.ce
#> INFO  [12:38:00.720] [bbotk]      <num>                <list>             <list>    <list>      <num>
#> INFO  [12:38:00.720] [bbotk]  0.2555556             <list[1]>          <list[3]> <list[1]>       0.56

Created on 2025-01-21 with reprex v2.1.1

It would be nice if the internal_tuned_values column hat a custom printer that actually prints the values and list <list[1]>

@be-marc
Copy link
Member

be-marc commented Jan 31, 2025

Thanks. Done via custom printer #489

@be-marc be-marc closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants