0
I am going through a blog post on tidymodels (random forest regression) and for some reason, I keep getting Error: object
should be a 'quant_param' object when I run the code chunk below
grid_tidym <- grid_random(
mtry %>% range_set(c( 1, 14)),
trees %>% range_set(c( 500, 1000)),
min_n %>% range_set(c(2, 10)),
size = 30
)
How do I get out of this? Thanks.
Hi, this is an application of the lazy evaluation
principle that you should keep in mind: the reproducible example, called a reprex .
In this case, what is grid_random()
?
Max
January 18, 2020, 5:49pm
3
As of a version or two ago, dials
changed its parameter objects to be functions instead of pre-compiled objects.
library(dials)
#> Loading required package: scales
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
grid_random(
mtry() %>% range_set(c( 1, 14)),
trees() %>% range_set(c( 500, 1000)),
min_n() %>% range_set(c(2, 10)),
size = 30
)
#> # A tibble: 30 x 3
#> mtry trees min_n
#> <int> <int> <int>
#> 1 1 727 4
#> 2 10 589 7
#> 3 7 538 2
#> 4 1 710 9
#> 5 4 703 4
#> 6 5 917 2
#> 7 8 672 7
#> 8 1 886 5
#> 9 14 725 5
#> 10 13 851 10
#> # … with 20 more rows
Created on 2020-01-18 by the reprex package (v0.3.0)
1 Like
Just what I needed. Thanks very much, Max.
1 Like
Great. Please mark the solution for the benefit of those to follow.
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
system
Closed
January 27, 2020, 4:07am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.