Adding isolation forest to parsnip - argument "formula" is missing

I'm trying to add an isolation forest model to parsnip following the guidance at

I think I've defined the model adm_isolation_forest and engine.

adm_isolation_forest(ntrees = 100) %>%
  translate(engine = "isotree")
Model Specification (anomaly_score)

Main Arguments:
  ntrees = 100

Computational engine: isotree 

Model fit template:
isotree::isolation.forest(data = missing_arg(), ntrees = 100)

However, when I attempt to fit the model...

model_fit <- adm_isolation_forest(ntrees = 100)  %>%
  set_engine("isotree") %>% 
  fit(data = train)

I get...

Error in fit.model_spec(., data = train) : 
  argument "formula" is missing, with no default

I'm not understanding why the function expects a formula. Isolation forest is unsupervised right? Any suggestions for either a suitable formula to provide, or how to change my parsnip model definition so that it no longer requires one?


parsnip is for supervised models models so this model doesn't really fit with that. The GitHub version of applicable has isolations forests in it (and should be on CRAN soon) so that might work for you.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.