pymc-devs / pymc-devs/pymc-extras

ModelBuilder and _generate_and_preprocess_model_data()

Open
#596 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
143
Forks
91
Avg merge
3d 18h
Merged PRs (30d)
19

Description

I'm writing a non-trival model using ModelBuilder. This model needs to do some data processing, and I've added that code in the _generate_and_preprocess_model_data(), and a call to _generate_and_preprocess_model_data() at the top of build_model() as the documentation and unit tests suggest. I'm having issues with my data processing because _generate_and_preprocess_model_data() is called twice when fitting, once (explicitly) in build_model() and once implicitly as part of fit(). If I remove my explicit call to _generate_and_preprocess_model_data() in build_model(), fitting works, but loading a saved model doesn't, because self.X and self.y aren't valid. Adding the explicit call to _generate_and_preprocess_model_data() fixes loading and saving, but breaks my data processing.

The model used in the ModelBuilder unit tests doesn't do any data transformations. X and y are just cached in _generate_and_preprocess_model_data().

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ModelBuilder documentation and its unit tests, then trace the calls to _generate_and_preprocess_model_data() from build_model(), fit(), and saved-model loading. Done should mean fitting does not trigger the data-processing method twice, while loading a saved model still restores valid self.X and self.y.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.