tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
590 stars 88 forks source link

Doc Fix: `mlp_brulee()` #1122

Closed kscott-1 closed 4 months ago

kscott-1 commented 4 months ago

The default parameter for penalty in the docs is incorrect. This is a comically small PR, but it did trip me up this week thinking the default was 0 when it wasn't.

Here is some quick reprex proof via parsnip:: and via brulee:: itself (see 'weight decay' value):

data <- modeldata::two_class_dat
# - recipe
rec <-
    data |>
        recipes::recipe(Class ~ .)
# - default param brulee_mlp via parsnip
mod <-
    parsnip::mlp() |>
        parsnip::set_engine("brulee") |>
        parsnip::set_mode("classification")
# - workflow
wf <-
    workflows::workflow() |>
        workflows::add_recipe(rec) |>
        workflows::add_model(mod)
# - fit
wf |>
    parsnip::fit(data = data)
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: mlp()
#> 
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 0 Recipe Steps
#> 
#> ── Model ───────────────────────────────────────────────────────────────────────
#> Multilayer perceptron
#> 
#> relu activation
#> 3 hidden units,  17 model parameters
#> 791 samples, 2 features, 2 classes 
#> class weights Class1=1, Class2=1 
#> weight decay: 0.001 
#> dropout proportion: 0 
#> batch size: 712 
#> learn rate: 0.01 
#> validation loss after 4 epochs: 0.5

brulee::brulee_mlp(
    x = rec,
    data = data
)
#> Multilayer perceptron
#> 
#> relu activation
#> 3 hidden units,  17 model parameters
#> 791 samples, 2 features, 2 classes 
#> class weights Class1=1, Class2=1 
#> weight decay: 0.001 
#> dropout proportion: 0 
#> batch size: 712 
#> learn rate: 0.01 
#> validation loss after 30 epochs: 0.379
simonpcouch commented 4 months ago

Thank you! :)

github-actions[bot] commented 3 months ago

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.