Skip to content

Add a model for bagged neural networks #815

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

Merged
merged 8 commits into from
Sep 26, 2022
Merged

Add a model for bagged neural networks #815

merged 8 commits into from
Sep 26, 2022

Conversation

topepo
Copy link
Member

@topepo topepo commented Sep 22, 2022

@simonpcouch
Copy link
Contributor

The model spec print method will need a new row in this table to describe this model.🙂

parsnip/R/print.R

Lines 39 to 40 in 3c0a0e2

model_descs <- tibble::tribble(
~cls, ~desc,

@topepo topepo requested a review from simonpcouch September 22, 2022 15:49
@topepo topepo marked this pull request as ready for review September 22, 2022 15:49
Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A few small changes in the PR, and 2 questions:

  1. Why is epochs a tunable parameter for mlp but not for bag_mlp?

  2. If I mistakenly try to tune epochs, I get the parsnip error about guarded arguments:

# pak::pak("tidymodels/baguette#64")

library(baguette)
#> Loading required package: parsnip

bm <-
  bag_mlp(epochs = tune()) %>%
  set_engine("nnet") %>%
  set_mode("regression")

bm_tune <-
  tune::tune_grid(
    bm,
    mpg ~ .,
    rsample::bootstraps(mtcars, 2),
    grid = 2
  )
#> ! Bootstrap1: preprocessor 1/1, model 1/2: The following arguments cannot be manually modified and were removed: ma...
#> ! Bootstrap1: preprocessor 1/1, model 2/2: The following arguments cannot be manually modified and were removed: ma...
#> ! Bootstrap2: preprocessor 1/1, model 1/2: The following arguments cannot be manually modified and were removed: ma...
#> ! Bootstrap2: preprocessor 1/1, model 2/2: The following arguments cannot be manually modified and were removed: ma...

tune::show_notes(bm_tune)
#> unique notes:
#> ────────────────────────────────────────────────────────────────────────────
#> The following arguments cannot be manually modified and were removed: maxit.

Created on 2022-09-22 by the reprex package (v2.0.1)

Is this the usual error when tune() is mistakenly supplied to a main model org that isn't tunable?

topepo and others added 2 commits September 26, 2022 09:34
Co-authored-by: Simon P. Couch <simonpatrickcouch@gmail.com>
@topepo
Copy link
Member Author

topepo commented Sep 26, 2022

The epoch issue was hard to track down but fixed in baguette.

Running the tests in 'tests/testthat.R' failed.
111
Last 13 lines of output:
112

113
  * Run `snapshot_accept('boost_tree_xgboost')` to accept the change
114
  * Run `snapshot_review('boost_tree_xgboost')` to interactively review the change
115
  ── Failure (test_boost_tree_xgboost.R:674:3): interface to param arguments ─────
116
  Snapshot of `fit_6 <- spec_6 %>% fit(mpg ~ ., data = mtcars)` has changed:
117
  old vs new
118
  - "! The arguments `watchlist` and `data` are guarded by parsnip and will not be passed to `xgb.train()`."
119
  + "!  The arguments `watchlist` and `data` are guarded by parsnip and will not be passed to `xgb.train()`."
@topepo topepo merged commit e0a238d into main Sep 26, 2022
@topepo topepo deleted the bag-mlp branch September 26, 2022 14:57
@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants