Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native server does not work with Jupyter Notebook without configuration #546

Closed
Xiao-Chenguang opened this issue Jul 21, 2024 · 16 comments
Closed
Assignees
Labels
notebook Related to (Jupyter) notebooks

Comments

@Xiao-Chenguang
Copy link

Xiao-Chenguang commented Jul 21, 2024

Ruff not function in jupyter notebooks when set ruff.nativeServer to auto or on. It seems there are some communication problem between the nativeserver and notebook. When use ruff-lsp by setting ruff.nativeServer to off, all ruff functions works as expected.

According to the server log, the nativeserver started normally but receive nothing while I type format command.

2024-07-21 16:44:25.149 [info] Name: Ruff
2024-07-21 16:44:25.149 [info] Module: ruff
2024-07-21 16:44:25.149 [info] Python extension loading
2024-07-21 16:44:25.149 [info] Waiting for interpreter from python extension.
2024-07-21 16:44:25.149 [info] Python extension loaded
2024-07-21 16:44:25.242 [info] Falling back to bundled executable: /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff
2024-07-21 16:44:25.265 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-07-21 16:44:25.266 [info] Found Ruff 0.5.3 at /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff
2024-07-21 16:44:25.266 [info] Server run command: /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff server
2024-07-21 16:44:25.266 [info] Server: Start requested.

The behaviour of setting nativeServer off is:

2024-07-21 16:48:31.470 [info] Name: Ruff
2024-07-21 16:48:31.470 [info] Module: ruff
2024-07-21 16:48:31.470 [info] Python extension loading
2024-07-21 16:48:31.470 [info] Waiting for interpreter from python extension.
2024-07-21 16:48:31.470 [info] Python extension loaded
2024-07-21 16:48:31.470 [info] Server run command: /Users/cg/miniconda3/envs/fl/bin/python /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/tool/server.py
2024-07-21 16:48:31.470 [info] Server: Start requested.
2024-07-21 16:48:31.934 [info] 2024-07-21 16:48:31,934 INFO Starting IO server

2024-07-21 16:48:31.975 [info] Workspace settings: []
2024-07-21 16:48:31.975 [info] Global settings: {
    "nativeServer": "off",
    "cwd": "/",
    "workspace": "/",
    "path": [],
    "ignoreStandardLibrary": true,
    "interpreter": [],
    "configuration": null,
    "importStrategy": "fromEnvironment",
    "codeAction": {
        "fixViolation": {
            "enable": true
        },
        "disableRuleComment": {
            "enable": true
        }
    },
    "lint": {
        "enable": true,
        "run": "onType",
        "args": []
    },
    "format": {
        "args": []
    },
    "enable": true,
    "organizeImports": true,
    "fixAll": true,
    "showNotifications": "off",
    "configurationPreference": "editorFirst",
    "showSyntaxErrors": true
}
2024-07-21 16:48:31.990 [info] Interpreter executable (/Users/cg/miniconda3/envs/fl/bin/ruff) not found
2024-07-21 16:48:31.990 [info] Falling back to bundled executable: /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff
2024-07-21 16:48:32.025 [info] Inferred version 0.5.3 for: /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff
2024-07-21 16:48:32.025 [info] Found ruff 0.5.3 at /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff
2024-07-21 16:48:32.025 [info] Running Ruff with: /Users/cg/.vscode/extensions/charliermarsh.ruff-2024.34.0-darwin-arm64/bundled/libs/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/Users/cg/Desktop/test.ipynb']

other ruff setting: all default
ruff version: v2024.34.0
OS: Mac
Python version: 3.10

Mininal example:

# test.ipynb
a = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]
@charliermarsh
Copy link
Member

\cc @dhruvmanila

@dhruvmanila
Copy link
Member

Can you provide the contents of the Ruff config in pyproject.toml / ruff.toml / .ruff.toml file? After astral-sh/ruff#12252, Ruff would only include the notebook files if it's included via either include or extend-include.

The reason it works for ruff-lsp is because it uses the ruff CLI directly via stdin and it would always provide diagnostics / formatting for a file which is passed directly:

2024-07-22 10:08:25.812 [info] Running Ruff with: /Users/dhruv/work/astral/ruff/target/debug/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--stdin-filename', '/Users/dhruv/playground/ruff/notebooks/test.ipynb']

This doesn't consider the include / extend-include config because the --force-exclude flag doesn't consider those settings.

@dhruvmanila
Copy link
Member

You can also enabled debug logs for the native server using:

{
  "ruff.trace.server": "messages",
  "ruff.logLevel": "debug"
}

which outputs:

2024-07-22 10:03:54.657 [info] Using 'path' setting: /Users/dhruv/work/astral/ruff/target/debug/ruff
2024-07-22 10:03:55.471 [info] Found Ruff 0.5.2 at /Users/dhruv/work/astral/ruff/target/debug/ruff
2024-07-22 10:03:55.471 [info] Server run command: /Users/dhruv/work/astral/ruff/target/debug/ruff server --preview
2024-07-22 10:03:55.472 [info] Server: Start requested.
2024-07-22 10:03:55.476 [info] [Trace - 10:03:55 AM] Sending request 'initialize - (0)'.
2024-07-22 10:03:55.488 [info] [Trace - 10:03:55 AM] Received response 'initialize - (0)' in 12ms.
2024-07-22 10:03:55.489 [info] [Trace - 10:03:55 AM] Sending notification 'initialized'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending notification 'textDocument/didOpen'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/diagnostic - (1)'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending notification 'notebookDocument/didOpen'.
2024-07-22 10:03:55.492 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (2)'.
2024-07-22 10:03:55.493 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (3)'.
2024-07-22 10:03:55.494 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (4)'.
2024-07-22 10:03:55.510 [info]    0.019833583s DEBUG ThreadId(13) ruff_server::session::index::ruff_settings: Ignored path via `exclude`: /Users/dhruv/playground/ruff/.vscode

2024-07-22 10:03:55.519 [info] [Trace - 10:03:55 AM] Received request 'client/registerCapability - (1)'.
2024-07-22 10:03:55.519 [info] [Trace - 10:03:55 AM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
2024-07-22 10:03:55.519 [info]    0.028470583s DEBUG ruff:worker:0 ruff_server::resolve: Included path via `include`: /Users/dhruv/playground/ruff/src/play.py

2024-07-22 10:03:55.520 [info]    0.029595292s  INFO     ruff:main ruff_server::server: Configuration file watcher successfully registered

2024-07-22 10:03:55.520 [info] [Trace - 10:03:55 AM] Received response 'textDocument/codeAction - (4)' in 26ms.

You can see that it only included the Python file (search for "Included path via") and not the notebook file.

But, once you include it in the config:

[tool.ruff]
extend-include = ["*.ipynb"]

It'll start including the notebook files as well.

@Xiao-Chenguang
Copy link
Author

You can also enabled debug logs for the native server using:

{
  "ruff.trace.server": "messages",
  "ruff.logLevel": "debug"
}

which outputs:

2024-07-22 10:03:54.657 [info] Using 'path' setting: /Users/dhruv/work/astral/ruff/target/debug/ruff
2024-07-22 10:03:55.471 [info] Found Ruff 0.5.2 at /Users/dhruv/work/astral/ruff/target/debug/ruff
2024-07-22 10:03:55.471 [info] Server run command: /Users/dhruv/work/astral/ruff/target/debug/ruff server --preview
2024-07-22 10:03:55.472 [info] Server: Start requested.
2024-07-22 10:03:55.476 [info] [Trace - 10:03:55 AM] Sending request 'initialize - (0)'.
2024-07-22 10:03:55.488 [info] [Trace - 10:03:55 AM] Received response 'initialize - (0)' in 12ms.
2024-07-22 10:03:55.489 [info] [Trace - 10:03:55 AM] Sending notification 'initialized'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending notification 'textDocument/didOpen'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/diagnostic - (1)'.
2024-07-22 10:03:55.490 [info] [Trace - 10:03:55 AM] Sending notification 'notebookDocument/didOpen'.
2024-07-22 10:03:55.492 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (2)'.
2024-07-22 10:03:55.493 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (3)'.
2024-07-22 10:03:55.494 [info] [Trace - 10:03:55 AM] Sending request 'textDocument/codeAction - (4)'.
2024-07-22 10:03:55.510 [info]    0.019833583s DEBUG ThreadId(13) ruff_server::session::index::ruff_settings: Ignored path via `exclude`: /Users/dhruv/playground/ruff/.vscode

2024-07-22 10:03:55.519 [info] [Trace - 10:03:55 AM] Received request 'client/registerCapability - (1)'.
2024-07-22 10:03:55.519 [info] [Trace - 10:03:55 AM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
2024-07-22 10:03:55.519 [info]    0.028470583s DEBUG ruff:worker:0 ruff_server::resolve: Included path via `include`: /Users/dhruv/playground/ruff/src/play.py

2024-07-22 10:03:55.520 [info]    0.029595292s  INFO     ruff:main ruff_server::server: Configuration file watcher successfully registered

2024-07-22 10:03:55.520 [info] [Trace - 10:03:55 AM] Received response 'textDocument/codeAction - (4)' in 26ms.

You can see that it only included the Python file (search for "Included path via") and not the notebook file.

But, once you include it in the config:

[tool.ruff]
extend-include = ["*.ipynb"]

It'll start including the notebook files as well.

Thank you @dhruvmanila , setting extend-include = ["*.ipynb"] in a ruff.toml file works for me. I didn't use ruff config file before and I would suggest you put this as a notice at some place obvious.

@juanitorduz
Copy link

Thanks for the tip! I was having the same problem and

[tool.ruff]
extend-include = ["*.ipynb"]

solved it for me as well!

@dhruvmanila
Copy link
Member

No worries. It makes sense for this change to be documented. I'm thinking of adding it to:

  1. https://github.com/astral-sh/ruff-vscode#jupyter-notebook-support
  2. https://docs.astral.sh/ruff/editors/features/#jupyter-notebook

Do you have any other places in mind which will be more visible?

juanitorduz added a commit to pymc-labs/pymc-marketing that referenced this issue Jul 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
wd60622 pushed a commit to pymc-labs/pymc-marketing that referenced this issue Jul 22, 2024
* make nb ruff astral-sh/ruff-vscode#546

* fix docs

* fix quickstart

* add types
@Xiao-Chenguang
Copy link
Author

That's really helpful. Use it as an extension, I would first check the extension readme as you mentioned and then the extension setting. It may benefit users by adding this into extension setting and the notebook feature can be enabled global without need of toml file per project.

@dhruvmanila
Copy link
Member

It may benefit users by adding this into extension setting and the notebook feature can be enabled global without need of toml file per project.

Yeah, I had a similar thought earlier but that would mean that running Ruff from the command-line would give different results compared to the editor. I'm not sure if there are any opinions on this but as the notebook files were always included for linting and formatting via ruff-lsp and there haven't been any user report, I guess that should be fine (?).

@Xiao-Chenguang
Copy link
Author

I'm not sure if there are any opinions on this but as the notebook files were always included for linting and formatting via ruff-lsp and there haven't been any user report, I guess that should be fine (?).

Totally agree. Just keep the notebook behaviour similar to ruff-lsp before there is a better solution.

dhruvmanila added a commit to astral-sh/ruff that referenced this issue Jul 22, 2024
## Summary

Similar to astral-sh/ruff-vscode#547 but for the
online docs.

Refer to astral-sh/ruff-vscode#546

## Preview

<img width="1728" alt="Screenshot 2024-07-22 at 14 51 40"
src="https://github.com/user-attachments/assets/39014278-c868-45b0-9058-42858a060fd8">
dhruvmanila added a commit that referenced this issue Jul 22, 2024
## Summary

This PR adds a new section in the README to guide users to opt-in for
Jupyter Notebook support for the native server. This is required
because, unlike `ruff-lsp`, the native server looks at the `include` /
`extend-include` setting.

Refer #546
@dhruvmanila
Copy link
Member

We might just include Jupyter Notebooks in Ruff's inclusion by default (astral-sh/ruff#12456).

@dhruvmanila dhruvmanila added the notebook Related to (Jupyter) notebooks label Jul 23, 2024
@dhruvmanila dhruvmanila changed the title nativeServer not work with jupyter notebook Native server does not work with Jupyter Notebook without configuration Jul 23, 2024
@rnckp
Copy link

rnckp commented Jul 26, 2024

@dhruvmanila

I still have difficulties making it work, even when I add extend-include = ["*.ipynb"] in ~.vscode/extensions/charliermarsh.ruff-2024.36.0-darwin-arm64/pyproject.toml.

.py files in VS Code are being formatted and linted properly. However, jupyer notebooks are not.

Tried to restart, reinstall from clean state (VS Code, settings and extensions) to no avail. Any recommendations to make it work again? I noticed that I stopped working a couple of days ago.

I use all latest versions of VS Code and extensions. Besides Ruff I have installed Python, Pylance, Python Debugger (all MS), Jupyter, Jupyter Keymap and Jupyter Notebook Renderers.

@dhruvmanila
Copy link
Member

I still have difficulties making it work, even when I add extend-include = ["*.ipynb"] in ~.vscode/extensions/charliermarsh.ruff-2024.36.0-darwin-arm64/pyproject.toml.

I think you'd need to add that in the pyproject.toml file within the current project you're in. That directory is where the extension resides. For example, if you opened VS Code in ~/projects/ruff, then the root config file would be ~/projects/ruff/pyproject.toml.

@rnckp
Copy link

rnckp commented Jul 26, 2024

That did the trick! Thanks so much! You saved my day... 🙏☀️

A detail: In my case it was sufficient to create pyproject.toml just in the root folder of my project (aka the top code folder that I opened in my VS Code workspace). Subfolder /ruff/ didn't seem to be necessary.

@dhruvmanila
Copy link
Member

~/projects/ruff is the root folder of the "ruff" project ;)

@rnckp
Copy link

rnckp commented Jul 26, 2024

Got it! Thanks! 😊

@DGrady
Copy link

DGrady commented Jul 31, 2024

We might just include Jupyter Notebooks in Ruff's inclusion by default (astral-sh/ruff#12456).

Upvoting this! Speaking as someone who mainly uses Ruff from within Jupyter notebooks running in VSCode, my experience here was: a few months ago, very happy that I got to replace two slow extensions with one fast one; then recent frustration when the fast one stopped working with no obvious errors.

AlexWaygood added a commit to astral-sh/ruff that referenced this issue Aug 14, 2024
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Closes: #12456
Closes: astral-sh/ruff-vscode#546
MichaReiser pushed a commit to astral-sh/ruff that referenced this issue Aug 14, 2024
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Closes: #12456
Closes: astral-sh/ruff-vscode#546
MichaReiser pushed a commit to astral-sh/ruff that referenced this issue Aug 14, 2024
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Closes: #12456
Closes: astral-sh/ruff-vscode#546
twiecki pushed a commit to pymc-labs/pymc-marketing that referenced this issue Sep 10, 2024
* make nb ruff astral-sh/ruff-vscode#546

* fix docs

* fix quickstart

* add types
twiecki pushed a commit to pymc-labs/pymc-marketing that referenced this issue Sep 10, 2024
* make nb ruff astral-sh/ruff-vscode#546

* fix docs

* fix quickstart

* add types
juanitorduz added a commit to pymc-labs/pymc-marketing that referenced this issue Dec 28, 2024
* Update version.txt (#640)

* [pre-commit.ci] pre-commit autoupdate (#642)

* Fix build badge (#645)

* Add downloads stats to README

* Pareto/NBD Example Notebook (#646)

* notebook opening and imports

* model definition markdown

* Data Load Notebook section

* WIP model fitting section

* added notebook to docs directory

* notebook edits and graph code

* ppc section and nb cleanup

* demz sampling and WIP plotting

* WIP predictive plots

* WIP heatmap plots

* predictive plots

* WIP covariates and nbqa-ruff edits

* covariate section

* plot additions

* fig sizes

* remove model file

* add spaces, increase indentation, and fix number order to Pareto notebook (#651)

* add spaces, increase indentation, and fix number order

* explicit with 6

* Add link to new Pareto notebook (#649)

* Plot Waterfall Components Decomposition (#631)

* Creating plot waterfall

Co-Authored-By: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>

* requested changes

* pre-commit

---------

Co-authored-by: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>

* Update resources.md (#652)

Databricks should have a lower-case b.

* fix ylabel (#654)

* [pre-commit.ci] pre-commit autoupdate (#655)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.2](astral-sh/ruff-pre-commit@v0.4.1...v0.4.2)
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](pre-commit/mirrors-mypy@v1.9.0...v1.10.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Lift test fixes (#656)

* support for negative values and dates (if used)

* fix terrible spelling

* test dates in coords

* cover numpy objects

* consolidate the tests

* add to docstrings tanh saturation (#657)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Add quickstart to readme (#653)

* add quickstartt to readme

* add pymc labs logo

* typos

* add community links

* fixes

* Add contributors to README (#659)

* Add contributors to README

* small code style improvements

* Time varying intercept (#628)

* Add time-varying prior functionality to DelayedSaturatedMMM

* resolve wd's comments

* resolve failing pre-commits

* add tvp_kwargs to model_config

* fix typo

* replace softplus

* resolve minor review comments

* Add option to supply `ax` to `plot_posterior_predictive`

* bugfix: time_index was not set correctly for OOS

If provided `X` to `_data_setter` was *not* the immediate sequence following the training set, the time_index would we wrong. With this fix, the `date["time_index"]` which gets set upon providing a new `X`, is inferred from the `self.date_column` column of provided `X` (by comparing it to same date column in the training data `self.X`).

* Clean up example notebook

* Make utility function `transform_1d_array`

* 'tvp_kwargs' -> 'intercept_tvp_kwargs'

* move `infer_time_index` into utils

* add tests for new utils

* small fixes (found in tests)

* add tests to cover all added cases

* fix ruff check

* update typehints

* resolve review comments

* refactor model logic for tv intercept

* address review comment for util test

* .

* fix documentation link

* change variable name

* fix hsgp_dims

* update time_varying_prior to be centered on 1

* review fixes

* fix broken test

* add final tests

* fix coverage issues

* Update tests/mmm/test_tvp.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update pymc_marketing/mmm/tvp.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update tests/mmm/test_tvp.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update tests/mmm/test_tvp.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* significant improvements to notebook

* fix heading

* update notebook to make it EVEN better

* update legend, add watermark

* fix intro

* fix broken test

* copy sweep with grammarly

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update README.md (#660)

* Add tv intrecept to readme (#661)

* add tv intrecept to readme

* add to comparison table

* fix title level (#663)

* Remove unnecessary NonImplemented errors from abstract methods (#662)

* ignore non-implemented

* remove not implemented error from abstract classes

* simplify docstrings

* Pass conv mode to adstock functions (#665)

* [Try] Fix compressed images in docs. (#667)

* Update pyproject.toml (#671)

* add license (#673)

* use grep and sed in the env line (#675)

* add sample_kwargs (#676)

* MMM NB Improvements (waterfall & error plots) (#664)

* Update version.txt (#677)

* [pre-commit.ci] pre-commit autoupdate (#683)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](astral-sh/ruff-pre-commit@v0.4.3...v0.4.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* v0 Streamlit MMM Explainer App (#614)

* feat(streamlit_explainer): Pushing files for Streamlit explainer app, to illustrate saturation, adstock and prior concepts in an intuitive, visual way to stakeholders and new MMMers

* chore(readme): Adding a readme for the app

* fix(env): Updating dependencies to include those needed for the Streamlit app

* Drop python 3.9 support (#615)

* drop python 3.9

* try python 3.12

* undo try python 3.12

* add lift tests check

* Add more content to the Gamma-Gamma Notebook  (#573)

* improve nb

* rm warnings and add link to lifetimes quickstart

* address comments

* feedback part 3

* remove warnings manually

* Add more content to the BG/NBD Notebook (#571)

* add more info to the notebook

* hide plots code

* fix plot y labels

* fix plot outputs and remove model build

* improve final note probability plots

* address comments

* use quickstart dataset

* feedback part 3

* remowe warnings manually

* feedback part 4

* Improve MMM Docs (#612)

* improve mmm docs init

* add more code examples to docstrings

* minor improvemeents

* typo

* better phrasing

* add thomas suggestion

* Fix `clv` plotting bugs and edits to Quickstart (#601)

* move fixtures to conftest

* docstrings and moved set_model_fit to conftest

* fixed pandas quickstart warnings

* revert to MockModel and add ParetoNBD support

* quickstart edit for issue 609

* notebook edit

* [pre-commit.ci] pre-commit autoupdate (#616)

* improve coords matching (#623)

* python 3.12 attempt (#618)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(saturation): Using pymc-marketing saturation functions rather than coding my own: Removing tanh, logistic and michaelis menten

* refactor(saturation): Remove Hill and Root saturations, as they aren't supported by pymc-marketing currently

* refactor(geometric_adstock): Removing custom adstock and using pymc-marketing adstock function to demo decay. Also updating latex to align with pymc-marketing, where decay factor is represented by alpha rather than beta

* refactor(delayed_adstock): Using pymc-marketing delayed geometric function rather than custom one

* fix(requirements): Adding pymc-marketing to Streamlit requirements for deployment

* Added Dev Container Folder

* refactor(weibull_cdf): Using pymc-marketing function for Weibull CDF

* fix(weibull_cdf): Fixing incorrect dataframe var name for CDF plotting df

* refactor(weibull_pdf): Using pymc-marketing function for WeibullPDF

* refactor(custom_functions): Removing adstock_saturation_functions.py file now that it is no longer required

* chore: Removing devcontainer created by Streamlit

* fix(requirements): Adding preliz to requirements

* refactor(prior_viz): Reworking the prior visualisation to use Preliz instead of custom function, as well as remove the tab-design. Prior distributions can now be specified programmatically.

* refactor(prior_functions.py): Deleting the draw_samples function and replacing it with a programmatic PreliZ function, such that the distribution object is returned when the user passes in the name of a distribution

* fix(requirements): Delete obsolete pymc requirement, which should fix deployment dependency conflicts

* chore(readme): Updating with guidelines on how to add additional distributions or transformation functions to the app

* refactor(plot_config): Moving height and width specifications into constants at top of Adstock and Saturation files, so the plot sizes are set programmatically

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>
Co-authored-by: Colt Allen <10178857+ColtAllen@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>

* Correct BetaGeo docstring example (#693)

* fix example in docstring

* change docstring

* Add `BetaGeoBetaBinom` Distribution Block (#431)

* init commit

* removed scan

* Fix logp

* Remove print statement

* Add test for logp notimplemented errors

* docstrings

* dev notebook added

* updated to vectorize_graph

* import order

* update oldest pymc_version

* Update ci.yml pymc version

* Update pyproject.toml pymc version

* WIP sample prior testing

* sample prior compared against lifetimes

* increase rtol

* remove commented code, add logp reference

* fix latex docstring

* notebook testing and misc edits

* revert latex in docstring

* add ruff ignore comment

---------

Co-authored-by: Ricardo Vieira <ricardo.vieira1994@gmail.com>

* [pre-commit.ci] pre-commit autoupdate (#705)

* Fix related to column renaming after aggregating test frequency (#698)

Co-authored-by: Colt Allen <10178857+ColtAllen@users.noreply.github.com>

* RFM Segmentation (#680)

* init rfm_segments func

* TODOs

* docstrings and for loop

* docstrings and for loop

* WIP dev notebook debugging

* checkpoint commit for remote pull

* code testing in dev notebook

* unit tests added

* dev notebook cleanup

* clean up type hints

* comments and code cleanup

* docstrings

* move formatting to rfm_summary and quickstart edits

* fix rfm_train_test_split bug

* added test for rfm_quartile_labels

* added rfm score warning

* create bgbb_donations.csv (#710)

* closes #678 (#716)

* use URL for README image (#715)

* use URL for image

* additional links that are relative

* remove forward slashes in URL

* closes #264 (#714)

* [pre-commit.ci] pre-commit autoupdate (#719)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](astral-sh/ruff-pre-commit@v0.4.5...v0.4.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Update `BetaGeoModel` API (#709)

* _extract_predictive_variables util

* deprecation warnings

* expected_purchases_new_customer

* TestBetaGeoModel.setup_class

* test cleanup and test_expected_purchases_new_customer

* expected_probability_alive

* expected_purchases

* TODOs and docstrings

* update runslow tests rtol for new test dataset

* prob_alive_matrix plot fix and notebook testing

* alive loop in bgnbd nb

* quickstart nb fix

* docstring and TODO revisions

* docstring syntax

* docstring edits

* more docstring fixes

* docstrings indent

* docstring indent, clear codecov bug

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* User-defined media transformations and custom ordering (#632)

* Allowing Custom Saturation & Lagging functions

Co-Authored-By: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>

* Small adding

Co-Authored-By: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>

* test commit to carlos branch

* hook up saturation class to lift method

* pull out last saturation function into method

* migrate the logic for tests

* reduce what is needed for a new class

* remove the noqa

* model docstring for inheritance

* rewrite of the components

* rewrite of the components

* change name to logistic

* map names for model_config

* switch out order

* Changes

* solving issues

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* solving errors

* New class name

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pymc_marketing/mmm/transformers.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* pre-commit change

* Update pymc_marketing/mmm/models/components/base.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update pymc_marketing/mmm/models/components/saturation.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update pymc_marketing/mmm/models/components/lagging.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Requested changes

* pre-commit changes

* Requested changes

* more changes

* use reserved parameter name

* Returning name and adding deprecation warning

* Re-structuring the budget optimizer

* Update pymc_marketing/mmm/components/adstock.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Will recommendations

* Temporal comment

* test more assumed behavior

* more budget optimizer changes

* docstrings for classes

* small changes about l_max on adstock

* small addition

* Update pymc_marketing/mmm/delayed_saturated_mmm.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* temporal notebook copy

* update

* docstring

* adding missing

* Update pymc_marketing/mmm/components/adstock.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Update pymc_marketing/mmm/components/adstock.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Making mypy happy part 1

* Small example

* finally?

* small change

* docstrings

* removing mokeytype

* more docstrings

* Update pymc_marketing/mmm/transformers.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* tests for out of box saturation and adstocks

* test the passthrough

* Update pymc_marketing/mmm/components/adstock.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Changes on hints

* modifications

Must be plt, ax

* notebooks addition

* Update notebook

* Saving model

* mock the fit and move tests around

* fix get_distribution tests

* Correct error

* Deprecation warning and new MMM class

Co-Authored-By: Will Dean <57733339+wd60622@users.noreply.github.com>

* Small changes

* updates

* add a lookup for model saving

* fix tests based on recent changes

* Deleting decimals

* test suite

* Update tests/mmm/test_budget_optimizer.py

Juan's test suggestion

* Update tests/mmm/test_budget_optimizer.py

abs and not rel

* running notebooks

* adding hint

* initial docstring check

* update docstrings 1

* Modifying notebook

* use explicit adstock and saturation in MMM

* remove reference to DelayedSaturatedMMM

* request changes

* missing total

* modify docstring

* modify eval

* Small changes

* change

* changes

* import saturation in docstring

* pre-commit

---------

Co-authored-by: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>
Co-authored-by: Will Dean <wd60622@gmail.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* CLV Plotting API (#728)

* plot_probability_alive_matrix

* docstrings

* plot_frequency_recency_matrix

* delete dead code

* docstring quick fix

* [pre-commit.ci] pre-commit autoupdate (#730)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](astral-sh/ruff-pre-commit@v0.4.7...v0.4.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Fix some ParetoNBDModel docstring typos (#731)

* Removed the comma after Schmittlein

* Added missing reference

* Removed extra colon

* pass kwargs to minimizer (#737)

* Minor improvements [MMM] (#735)

* Set upper bound pymc 5.16 (#725)

* changes init

* try fix regex

* Media transformation sampling & plotting methods (#734)

* add plotting methods

* add tests for new methods

* saturation support for additional variable dims

* consolidate the logic of sampling

* change warning

* workflow from a fitted model

* change order of tests

* suggestion to use names

* because of new data

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* improve tests mmm utils (#738)

* improve tests

* empty commit

* remove reduntant function

* `model.fit` doesn't remove prior samples (#741)

* type hint only

* more informative errors

* check for attr

* remove type ignore

* check for attr

* check for attr

* reduce indentation

* new error names

* Hierarchical Model Configuration (#743)

* some base logic and tests

* lookup function once

* add error handling

* implement for mmm and media transformations

* add examples

* add to documentation

* add to docstring

* tests for likelihood

* use deepcopy since keys are added

* set default dims and warn

* fix output_var

* migrate failing tests to model_config

* remove the moved test

* use deepcopy since keys are added

* add to docstrings from feedback

* fix handlers at initialize

* [pre-commit.ci] pre-commit autoupdate (#756)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.8 → v0.4.9](astral-sh/ruff-pre-commit@v0.4.8...v0.4.9)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* MMM Component Notebook (#748)

* initial notebook

* add to example

* push up some feedback

* change the number of channels

* updates

* final message

* add more feedback

* remove since wasnt working the way I wanted

* start addressing sphinx warnings and rendering issues (#750)

* start addressing sphinx warnings and rendering issues

* forgot formatting comment

* Add numpydoc as dependency

* fix dataset type

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Allowing Hierarchical Non Centered Parametrization (#747)

* Allowing non center parametrization

* update notebook

* Adding example in docstring

* change

* Push code changes.

* A painful and ugly change!

The things one does for democracy!

* Missing parts!

* adding missing test 2D

* Missing raise

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* fix np typing (#763)

* fix typing

* empty

* empty

* empty

* dummy

* undo dummy

* empty

* add it back (#764)

* remove noqa from plots (#761)

* remove noqa

* fix escape

* empty

* empty

* Creating Time Base component for Media Contribution (#752)

* Run Ruff Notebooks (#773)

* [pre-commit.ci] pre-commit autoupdate (#779)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.9 → v0.4.10](astral-sh/ruff-pre-commit@v0.4.9...v0.4.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* `GammaGammaModel` API Improvements (#758)

* utils.customer_lifetime_value

* expected_customer_lifetime_value

* WIP clv.models.gamma_gamma.py

* gamma_gamma API

* fixed circular import

* gamma_gamma tests

* delete tests/datasets/test_summary.csv

* clv test_utils.py

* remove expected_purchases(future_t=0)

* remove monetary_value arg

* WIP docstrings

* notebooks

* docstrings

* Revert "notebooks"

This reverts commit a3154d9.

* gamma-gamma notebook

* docstrings

* Deepcopy of posterior to allow second `fit` call (#790)

* Add prior predictive example notebook (#787)

* CLV Modeling Domains and Docstrings (#785)

* quickstart

* pareto_nbd fit warning

* pareto_nbd docstrings

* clv.utils docstrings

* gamma_gamma docstrings

* beta_geo docstrings

* CLV sections in README and index

* fix nb (#793)

* Run example notebooks CI (#791)

* run notebooks init

* change kernel name

* change kernel name

* change kernel name

* rm docs

* add nb

* fix nb

* fig dpi

* update model object

* no output

* test mmm notebooks

* fix path

* graphviz

* sudo

* paralelize and Path

* reqs

* undo

* comments

* try budget allocation

* add quickstart

* ignore budget allocation

* add make command

* use make

* docs: Update model_builder.py to resolve warning in documentation build (#797)

* Time Varying Media Contribution Notebook (#778)

* Time Varaying notebook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* requested changes

* quick change

* Adding to index md

* remove change mmm_budget_allocation_example.ipynb

* quick correction

* Small changes

* Small title change

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* prepare release (#799)

* `Prior` class to represent distributions (#759)

* reimplement hierarchical parameters with wrapper class

* write tests for prior class

* explicit with dependencies

* missing test dependency

* raise KeyError early and test dims

* add prior module to docs

* support for media transformations

* add some documentation

* migrate the delayed_saturated model to Prior class

* migrate the delayed_saturated model to Prior class

* add an example image

* add the example image

* push up some more documentation

* support for student-t

* add configuration notebook

* catch all the errrors

* add more to notebook

* use a sigma which has transform

* add parsing error catches

* add watermark

* test the parsing warnings and error handling

* have a default to dict

* default handles Prior class

* passing plotting tests

* support for lift tests

* fix two failing tests

* update notebook

* change order of pre-commit back

* migrate to Prior and parse_model_config

* migrate the clv tests

* test for warning

* run pre-commit on all files

* switch to Prior in components

* test for the components

* remove the previous dictionary function

* migrate to Prior class in mmm

* remove the unused key,value

* migrate to Prior class in clv tests

* back to dict for warning test

* isort and work out example indentation

* change the example name

* use juans suggestions

* change graph to to_graph

* rerun the time varying media

* rerun the clv notebooks I could get to work

* [pre-commit.ci] pre-commit autoupdate (#801)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](astral-sh/ruff-pre-commit@v0.4.10...v0.5.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](pre-commit/mirrors-mypy@v1.10.0...v1.10.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* initial stab at some docs

* register new module in a few places

* initial stab at how-to example notebook + code + API docs

* Pull out seasonality as `YearlyFourier` and `MonthlyFourier` (#802)

* Separate Weibull adstock into CDF & PDF (#810)

* separate out weibull

* add to test suite

* Add typing and package classifiers (#811)

* add pytyped

* add the py.typed file

* add imports to mmm module (#812)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Friday progress on notebook example

* Save & load support for time varying parameters (#815)

* add missing init for save and load

* get rid of warnings from JSON parsing

* new error message without line break

* migrate to Data and non-mutable coords (#816)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* improve introduction page

* updates to model priors, plotting market shares, and more

* Add in model maths for MV-ITS, saturated market assumption

* [pre-commit.ci] pre-commit autoupdate (#817)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.5.1](astral-sh/ruff-pre-commit@v0.5.0...v0.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix up / improve the model maths and description

* PoC: Use Pydantic as data validator (#809)

* prior with pydantic

* dependencies

* validate adstock

* make mypy happy

* add validation sample curve

* make the prior type tighter

* add test type

* add validation init mmm

* mmm

* start with Fourier

* fix type

* fix test and imprtove docstrings

* docstrings

* types

* self type

* init validator

* types model builder

* improve docstrings

* more input validations mmm init

* validation budget optimizer

* fix dummy example types

* hsgp kwargs class

* add kwargs

* undo type hint in dict

* fix fourier names

* better docs

* fix tests

* add type hint

* undo

* fix type error

* feedback2

* restrict signature

* serialize fourier

* docs and tests

* fix docs

* work on parsing

* add hsgp to parsing config

* add tests

* uncomment

* undo changes

* undo model config parser

* handle hsgp_kwargs

* add hsgp flag

* docs

* undo type hint

* improve hints

* add more sections to docs

* Update pymc_marketing/mmm/tvp.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* feedback 4

* fix test

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* fixes + describe covariance matrix + add section on unsaturated market model

* update title of intro docs page

* add admonition box

* initial stab at modeling products individually

* fix scenario 3 sampling & commentary + allow user to supply sampler_kwargs

* Date Validation and MMM Model Hamonization (Pydantic) (#824)

* validate base mmm init class

* validate dateformat

* add comment about date

* remove ()

* close to done on docs + code?

* add tests

* enlightenment in terms of unsaturated markets

* extract data generation functions into module code

* remove old generate_data

* constrained -> saturated. parameterize a test

* turn generate_saturated_data into a test fixture

* split plot_causal_impact into plot_causal_impact_sales and plot_causal_impact_market_share

* execute notebook

* revert an accidental change from a global find & replace

* Remove warnings during tests (#823)

* address save and load tests

* catch warning on load

* remove warnings in budget optimizer

* remove plotting warnings

* remove validating warnings

* consolidate the loading function

* remove warnings in tests

* incorporate the docstring feedback

* only one deprecation warnings on DelayedSaturatedMMM

* dont have deprecation on test

* Future-proof `prior_linearized` method call (#806)

* modified: pymc_marketing/mmm/tvp.py

* Update tvp.py

Changed Xs to X in prior_linearized( as per the change in pymc)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: sangeedutta <sangeedutta@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Create inverse_scaled_logistic_saturation and the corresponding class (#827)

* fix (#842)

* use labs theme as external (#830)

* use labs theme as external

* Update docs/source/index.md

Co-authored-by: Thomas Wiecki <thomas.wiecki@gmail.com>

* install theme from pypi

---------

Co-authored-by: Thomas Wiecki <thomas.wiecki@gmail.com>
Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* specify 0.9.0 as deprecation version (#849)

* add intercept and target variable to example (#850)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Various MMM small documentation fixes (#854)

* make nb ruff astral-sh/ruff-vscode#546

* fix docs

* fix quickstart

* add types

* Update UML diagrams (#856)

* update uml diagrams

* add uml command to Makefile

* Fixing ruff commands in Makefile #825 (#859)

* updated the ruff lint command, added ruff code formating command in Makefile, updated contributing.md

* fixing the issue with the new line at the end of makefile

* updated the PHONY list in makefile

---------

Co-authored-by: Murad Khalilov <murad.khalilov@proton.me>

* [pre-commit.ci] pre-commit autoupdate (#855)

updates:
- [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](pre-commit/mirrors-mypy@v1.10.1...v1.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Fix model_builder docstrings (#861)

* Fix model_builder docstrings

* Fix whitespace error

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* add GH discussions link to README (#866)

* add GH discussions link to README

* add link to MMM hub slack

* Update README.md

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Skip coords with scalar value (#868)

* Fix Visual for hill_saturation function (Issue #851 ) (#857)

* Fix plotting by evaluating tensors.

* Add space after sphinx directive.

* Remove indentation from blank line.

* Add shared y axis for subplots.

---------

Co-authored-by: Patrick Robotham <pat@conundrm.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Allow plot MMM components in the original scale (#870)

* add original scale implementation

* add plot nb

* change location

* undo

* make mypy happy

* test plot

* add test

* update plot readme

* fix test

* improve variable description

* Inference changed to dataset (#873)

* infernece changed to dataset

* inference changed dataset for plot_allocated_contribution_by_channel

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Add root saturation function (issue #702) (#858)

* feat: adding root_saturation to transformers.py

* feat: adding RootSaturation class to saturation.py

* chore: adding missing RootSaturation to SATURATION_TRANSFORMATIONS

* feat: adding root_saturation to transformers.py

* feat: adding RootSaturation class to saturation.py

* chore: adding missing RootSaturation to SATURATION_TRANSFORMATIONS

* chore: linting edits

* chore: adding coefficient to function

* chore: linting corrections

* chore: removed empty References section of docstring

* chore: produce visual examples of root saturation

* chore: adding root to test_saturation.py

* chore: adding RootSaturation to init file

---------

Co-authored-by: ruari.walker <ruari.walker@qonto.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Check for missing attrs after `sample_prior_predictive` and `fit` (#867)

* separate the attr creation from attachment and perform check

* remove data for CLV

* fix model_builder tests

* fix clv tests

* more specific model builder checks

* rework with no args and kwargs

* rework common load method

* Update pymc_marketing/model_builder.py

* `json.loads` with python types bug (#881)

* loads doesnt support boolean

* defaults for the media transformation

* test for the time_varyign

* [pre-commit.ci] pre-commit autoupdate (#883)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.4 → v0.5.5](astral-sh/ruff-pre-commit@v0.5.4...v0.5.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Fix default `ConvMode` in docstring (#864)

* Update docs in transformers.py

docs: Fix the docstring

* Update docs in transformers.py

docs: fix other docstrings

* change the plot default

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
Co-authored-by: Will Dean <wd60622@gmail.com>

* Save off media transformations (#882)

* to_dict via lookup_name

* parse to and from dict for attrs

* improve the codecov

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change test with change in default behavior

* increase the MMM model version

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Update deployment docs (#887)

* update the notebook

* update the runner

* address feedback. add watermark

* Automate UML creation (#886)

* attempt to automate uml

* install graphviz binaries

* use sudo

* Update UML Diagrams

* remove the git configuration

* use the identity of the previous commit

* dont push with no change

* same triggers as others

* restrict to running with repo_changes

---------

Co-authored-by: GitHub Actions <github-actions@github.com>
Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* prepare release (#888)

* Update README.md (#893)

* Add url health job from streamlit app (#902)

* add url health job

* lint

* small improvements model config nb (#906)

* small improvements

* trim

* Add link model deployment to example notebook (#904)

* add link model deployment

* add pymc-marketing to watermark

* Add pymc-marketing version to some MMM notebooks (#907)

* nb part 1

* add mmm example nb

* rm example nb

* Move adstock and saturation method imports to mmm.__all__ (#908)

* Resolves #892: Move adstock and saturation method imports to mmm.__all__

* fix: patch uml GHA

* Update .github/workflows/uml.yml

* Update .github/workflows/uml.yml

* Add permissions: write-all to .github/workflows/uml.yml

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* chore(Makefile): Adding a self-documenting command and light command documentation (#910)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Fix uml permissions (#913)

* [pre-commit.ci] pre-commit autoupdate (#914)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.5 → v0.5.6](astral-sh/ruff-pre-commit@v0.5.5...v0.5.6)
- [github.com/pre-commit/mirrors-mypy: v1.11.0 → v1.11.1](pre-commit/mirrors-mypy@v1.11.0...v1.11.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Don't run tests for non-code changes (#898)

* test running budget allocator nb (#919)

* make hill pass through the origin (#920)

* Add MMM ROAS Priors Case Study (#916)

* model and data init

* make it work

* add intro

* add nb to index and references

* first complete iteration

* improve formatting

* split paragraph

* pyprojroot

* typos

* add conclusion section

* improve intro

* typos and feedback

* typo (#923)

* [pre-commit.ci] pre-commit autoupdate (#926)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.5.7](astral-sh/ruff-pre-commit@v0.5.6...v0.5.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Original hill function definition (#925)

* MLflow autologging (#921)

* Adding BLAS to the env generation.

* Solving optimizer issues & typos (#933)

* Correcting typo num_days by horizon

* Correcting typo num_days by horizon and scaler

* Running notebooks

* Update UML Diagrams

* Rename horizon by periods

* Adding test requested to check budget outputs

* Running notebooks

* Update UML Diagrams

* Small notebook missing change.

* Correction in tests

* Change on name

* running notebook modifying function

* Update UML Diagrams

* Log number of posterior & tuning samples (#943)

* helper command to view the artifacts from test

* pass tune from kwargs

* test for support of all samplers

* add mlflow as a mock import

* actual import as autolog is missing from docs

* point to GH discussions (#944)

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* [pre-commit.ci] pre-commit autoupdate (#946)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](astral-sh/ruff-pre-commit@v0.5.7...v0.6.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix typo

* fix admonition block + markdown heading level

* collect results of plot funcs in tests

* add no cover comments

* explicit module level scope for fixture

* consistent use of product_incrementality for folder names

* background_sales -> existing_sales

* innovation_sales -> treatment_sales

* Fallback to defaults in `adstock|saturation_from_dict` (#955)

* Default saturation_from_dict to default_priors

* Default to AdstockTransformation.default priors in adstock_from_dict

* Add PyDocStyle Support (#951)

* change to normal likelihood truncated at zero

* use empirical estimate for HalfNormal sigma for observation noise std

* remove commented out lines

* use just one idata instance - removes idata_counterfactual

* make pre-commit checks pass

* break up code in __init__ into smaller methods

* remove @Property and deal with some consequences of that

* deprecate WeibullAdstock in favor of WeibullCDFAdstock and WeibullPDFAdstock (#957)

* deprecate in favor of WeibullCDFAdstock and WeibullPDFAdstock

* Update UML Diagrams

* Update UML Diagrams

* Raise informative error when including target in `X` (#962)

* add error when target is in X_df

* add test

* rename test

* format

* Ensure `fit` reproducibility (#963)

* use get instead of assign to default to sampler_config if exists

* default to what is given

* write tests based on the issue

* have defaults while not overriding

* Enforce `check_parameters` for `alpha` in `geometric_adstock` (#960)

* Enforce check_parameters in geometric_adstock

* Remove check_parameters on l_max. Revert to original test

* Add test_geometric_adstock_bad_alpha

* use ge, le instead of gt,lt

* Update tests/mmm/test_transformers.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* Simplify test parameters

* Update tests/mmm/test_transformers.py

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* scaling should be done before hdi computation (#970)

* Fix UML permissions from forks / Run only on merge to main (#967)

* change repo and python file change to kick off

* comment to check for failure

* using the repo

* delete to trigger

* the previous trigger

* push up again

* check for the owner being pymc-labs

* remove unused

* only run after merge to main

* `DelayedSaturatedMMM` deprecations and moving files (#965)

* deprecations and moving files

* Update UML Diagrams

* change the imports in notebooks

* push up the code / test changes. need to run

* remove _get_\w*_function tests

* rerun the tvp notebook

* remove stale test

* move away from string initialization

* change the tvp media example

* Register and allow custom transform for `Prior` class (#972)

* allow register and use custom transform

* add to the example block

* Update pypi.yml (#975)

* [pre-commit.ci] pre-commit autoupdate (#977)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](astral-sh/ruff-pre-commit@v0.6.1...v0.6.2)
- [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](pre-commit/mirrors-mypy@v1.11.1...v1.11.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Added deprecation warning for method keyword (#974)

Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
Co-authored-by: Juan Orduz <juanitorduz@gmail.com>

* Improve and sync the README and landing page. (#978)

* add table

* sync index

* empty

* improvements

* Time slice cross validation MMM Notebook (#971)

* nb init

* add param stability

* crps init

* add crps to package

* make mypy happy

* clean

* relax req

* update path

* add crps test

* first iteration

* improvements

* improve tests

* improve tests

* improve references

* feedback 1

* add examples

* fix the wrong trigger (#983)

* Media transformation class and different transformations based on subsets of channels (#968)

* Changed pt=pt to pt_lib = None to avoid showing full module path in docs (#992)

* Changed pt=pt to pt_lib = None to avoid showing full module path in docs

* Changed pt to pt_lib inside calculate_lift_measurements_from_curve

* Linear trend (#991)

* push up some linear-trend work I had

* image for the documentation

* start the slopes at t=0

* additional checks at init

* import at mmm module

* update the image

* Move to reference section

* Move coords to single line

* Add hierarchical trend example

* add image for the example

* migrate to pydantic

* update images after seed

* Correct the latex

* fix check from tests

* revert link

* add item for new module

* Use ModelBuilder for incrementality model (#1101)

* use the modelbuilder mixin

* use Prior class for the background_distribution

* modify the tests

* test for mismatch

* add informed prior method

* begin to modify the existing notebooks

* add y to the mix

* changes to saturated notebook

* run with the accept kwargs

* rename product_incrementality module to cc

* fix typo

* add a placeholder quickstart docs page

* rename a folder (previously missed) product_incrementality -> cc

* more instances of product incrementality -> customer choice

* market_saturated -> saturated_market

* add quickstart/cc/index to the getting_started page

* avoid reusing `result` for multiple different scenarios

* notation change: rename "background" to "existing"

* add kwarg plot_total_sales to plot functions

* rename module cc -> customer_choice

* remove type hint on plot_total_sales to make tests pass

* get docs to build / pass tests

* finish the customer_choice getting started page

* fix typo

* remove manual tight_layout commands

* fix typo

* grammatical fix

* fix typo

* surpress a plot output

* fix typo

* update imports + split data generation code into different .py file

* fix imports in tests

* add docstrings to synthetic data module

* switch rng parameter to random_seed

* import from the customer_choice over submodule

* add docstrings to the model and plot function and mypy

* add file autolabeling

* allow for ax argument

* fix the test seed name

* change import

* increase tests / find some holes

* use random_seed instead of rng

* fix conflicts

* lint

---------

Co-authored-by: Juan Orduz <juanitorduz@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Colt Allen <10178857+ColtAllen@users.noreply.github.com>
Co-authored-by: Will Dean <57733339+wd60622@users.noreply.github.com>
Co-authored-by: Carlos Trujillo <156134600+cetagostini-wise@users.noreply.github.com>
Co-authored-by: Carlos Trujillo <59846724+cetagostini@users.noreply.github.com>
Co-authored-by: Corey Abshire <108366077+coreyabs-db@users.noreply.github.com>
Co-authored-by: Ulf Aslak <ulfjensen@gmail.com>
Co-authored-by: nialloulton <124098021+nialloulton@users.noreply.github.com>
Co-authored-by: Louis Magowan <59659198+louismagowan@users.noreply.github.com>
Co-authored-by: Ricardo Vieira <ricardo.vieira1994@gmail.com>
Co-authored-by: Ivan Ugrin <ivan.ugrin@gmail.com>
Co-authored-by: Will Dean <wd60622@gmail.com>
Co-authored-by: Mews <60406199+Mews@users.noreply.github.com>
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Co-authored-by: c0d33ngr <106184818+c0d33ngr@users.noreply.github.com>
Co-authored-by: Shuvayan Das <shuvayan.das@gmail.com>
Co-authored-by: sangeedutta <sangeedutta@gmail.com>
Co-authored-by: Arthur Mello <32939525+arthurmello@users.noreply.github.com>
Co-authored-by: Thomas Wiecki <thomas.wiecki@gmail.com>
Co-authored-by: Murad Khalil <murat.khalilov@gmail.com>
Co-authored-by: Murad Khalilov <murad.khalilov@proton.me>
Co-authored-by: Giannis_apost <79788413+GiannisApost@users.noreply.github.com>
Co-authored-by: Christian Luhmann <39170995+cluhmann@users.noreply.github.com>
Co-authored-by: Patrick Robotham <patrick.robotham2@gmail.com>
Co-authored-by: Patrick Robotham <pat@conundrm.com>
Co-authored-by: Ishaan Jolly <71589295+Ishaanjolly@users.noreply.github.com>
Co-authored-by: Ruari Walker <46534166+iraur@users.noreply.github.com>
Co-authored-by: ruari.walker <ruari.walker@qonto.com>
Co-authored-by: Maxim Kochurov <max.kochurov@pymc-labs.com>
Co-authored-by: GitHub Actions <github-actions@github.com>
Co-authored-by: Pablo de Roque <pablom.roque@gmail.com>
Co-authored-by: Dan Dean <58938832+dandeandean@users.noreply.github.com>
Co-authored-by: Pablo de Roque <pablo.deroque@glovoapp.com>
Co-authored-by: radiokosmos <stasdp@mail.ru>
Co-authored-by: Juan Orduz <juan.orduz@wolt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebook Related to (Jupyter) notebooks
Projects
None yet
Development

No branches or pull requests

7 participants