8 - tidymodels and LLMs

Practical Machine Learning with tidymodels

LLMs

In many cases, the accuracy of LLMs to write code is proportional to how much of that code is online and/or scrapable.


Generally speaking, we can enhance the AI’s ability to write good code by providing resources.


Without help, LLMs are meh at writing tidymodels code and only slightly better at Scikit-learn.


Let’s discuss some resources to improve your experience.

Skills

https://skills.tidymodels.org/ contains LLM skill files for:

  • Writing tidymodels code that will be used for data analysis
  • Developer activities such as creating a new parsnip extension, recipes steps, etc.


The Getting Started has instructions for loading these skills. You can also just point your favorite LLM to the basic URL and ask it to install the skills.

Model Context Protocol (MCP) Server

There is also a tidymodels MCP server that you can download and use.


This provides AI real-time access to package documentation, function signatures, and code templates.

Posit Assistant

With RStudio, Positron, or a terminal, you can invoke Posit Assistant.


You can use any framework for modeling activities (e.g., caret, mlr3, etc.). Posit Assistant tends to default to tidymodels.


PA also has a fair amount of wisdom related to ML modeling, such as not constantly evaluating the test set.