Skip to content
Advertisement

Cache only a single step in sklearn’s Pipeline

I want to use UMAP in my sklearn’s Pipeline, and I would like to cache that step to speed things up. However, since I have custom Transformer, the suggested method doesn’t work.

Example code:

JavaScript

If you run this, you will get a PicklingError, saying it cannot pickle the custom transformer. But I only need to cache the UMAP step. Any suggestions to make it work?

Advertisement

Answer

Not the cleanest, but you could nest pipelines?

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement