Skip to content

Namespacing issue with MARS models #251

@alexpghayes

Description

@alexpghayes

I shouldn't need to explicitly load earth but I do.

library(parsnip)

mars(
  mode = "classification",
  num_terms = 1,
  prod_degree = 1,
  prune_method = "backward"
) %>% 
  set_engine("earth") %>% 
  fit(Species ~ ., iris)
#> Error in get(ctr, mode = "function", envir = parent.frame()): object 'contr.earth.response' of mode 'function' was not found
#> Timing stopped at: 0 0 0

library(earth)
#> Loading required package: Formula
#> Loading required package: plotmo
#> Loading required package: plotrix
#> Loading required package: TeachingDemos

mars(
  mode = "classification",
  num_terms = 1,
  prod_degree = 1,
  prune_method = "backward"
) %>% 
  set_engine("earth") %>% 
  fit(Species ~ ., iris)
#> parsnip model object
#> 
#> Fit time:  50ms 
#> GLM (family binomial, link logit):
#>            nulldev  df       dev  df   devratio     AIC iters converged
#> setosa     190.954 149   190.954 149          0     193     4         1
#> versicolor 190.954 149   190.954 149          0     193     4         1
#> virginica  190.954 149   190.954 149          0     193     4         1
#> 
#> Earth selected 1 of 15 terms, and 0 of 4 predictors
#> Termination condition: Reached nk 21
#> Importance: Sepal.Length-unused, Sepal.Width-unused, Petal.Length-unused, ...
#> Number of terms at each degree of interaction: 1 (intercept only model)
#> 
#> Earth
#>                  GCV       RSS GRSq RSq
#> setosa     0.2252151  33.33333    0   0
#> versicolor 0.2252151  33.33333    0   0
#> virginica  0.2252151  33.33333    0   0
#> All        0.6756452 100.00000    0   0

Created on 2020-01-05 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions