A model that is trained in any language are able to integrate with tidypredict, and thus with broom. The requirement is that the model in that language is exported using the parse model spec. The easiest file format would be YAML.

python example

A model that was fitted using sklearn’s linear_model. The model is based on diabetes data. Ten baseline variables, age, sex, body mass index, average blood pressure, and six blood serum measurements were obtained for each of n = 442 diabetes patients, as well as the response of interest, a quantitative measure of disease progression one year after baseline. The model’s results were converted to YAML by the same python script, I copied and pasted the top part here:

  is_glm: 0
  model: lm
  residual: 0
  sigma2: 0
  type: regression
  version: 2.0
- coef: 152.76430691633442
  - col: (Intercept)
    type: ordinary
  is_intercept: 1
  label: (Intercept)


Now that we have a parsed_model object, it is possible to use broom’s tidy() function. This means that we are able to integrate a totally external model, with broom.