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

Update 14-iterative-search.Rmd #367

Merged
merged 2 commits into from Aug 28, 2023

Conversation

matanhakim
Copy link
Contributor

Fix typo

@juliasilge
Copy link
Member

Thanks for this fix @matanhakim! I'll need to go in and see what needs to be updated for DALEX separately.

@topepo
Copy link
Member

topepo commented Aug 25, 2023

The issue is related to creating the natural spline terms for a single observation.

bake_step_ns() correctly makes the new terms from the single data

Browse[2]> new_values
           1            2            3            4            5            6 
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
           7            8            9           10           11           12 
0.000000e+00 3.390881e-05 3.057544e-01 6.496525e-01 4.455920e-02 0.000000e+00 
          13           14           15           16           17           18 
0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
          19           20 
0.000000e+00 0.000000e+00 
attr(,"class")
[1] "ns"     "basis"  "matrix"
attr(,"degree")
[1] 3
attr(,"knots")
 [1] 41.99479 42.01414 42.01775 42.01956 42.02209 42.02518 42.02822 42.03110
 [9] 42.03250 42.03461 42.03593 42.03842 42.04288 42.04646 42.04991 42.05229
[17] 42.05518 42.05889 42.06127
attr(,"Boundary.knots")
[1] 41.98650 42.06339
attr(,"intercept")
[1] FALSE

The next line renames the columns using names0(num, prefix) but fails because, for some reason, the new value doesn't have column dimensions:

Browse[2]> is.matrix(new_values)
[1] FALSE
Browse[2]> # but.... 
Browse[2]> class(new_values)
[1] "ns"     "basis"  "matrix"
Browse[2]> ncol(new_values)
NULL
Browse[2]> length(new_values)
[1] 20

¯_(ツ)_/¯

I'll make an issue in recipes to fix this.

We should transition the code here to use step_spline_natural(), but it has the same issue.

@topepo
Copy link
Member

topepo commented Aug 26, 2023

There is a new recipes version on CRAN that fixes this issue.

Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

Thanks again for this PR @matanhakim!

@juliasilge juliasilge merged commit 244672f into tidymodels:main Aug 28, 2023
1 check passed
@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 Sep 12, 2023
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.

None yet

3 participants