-
Notifications
You must be signed in to change notification settings - Fork 239
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
Rename clv_summary
to rfm_summary
and extend functionality
#479
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #479 +/- ##
==========================================
+ Coverage 90.83% 90.87% +0.04%
==========================================
Files 21 21
Lines 1974 1983 +9
==========================================
+ Hits 1793 1802 +9
Misses 181 181 ☔ View full report in Codecov by Sentry. |
rfm_summary
Utility Functionclv_summary
to rfm_summary
and extend functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestion to simplify the docstring.
Should we keep clv_summary
with a deprecation warning so we don't break people's code? Something like:
Also is this not used in any of our public notebooks? Those would need to be updated.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Done and done 👍 Using a different dataset required updating all the charts and results in the notebook. I also used the opportunity to fix #466. |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2024-01-11T14:48:36Z We should put and read the dataset from here: https://github.com/pymc-labs/pymc-marketing/tree/main/datasets
ColtAllen commented on 2024-01-11T15:44:42Z If ricardoV94 commented on 2024-01-11T15:48:44Z Just replace the one that's there with the unformatted one? The dataset is there just for the purpose of being used in examples. |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2024-01-11T14:48:37Z There may be an error in the ColtAllen commented on 2024-01-11T15:45:51Z No error - just a different dataset (or rather, a different subset of CDNOW_MASTER.txt, which is rather large for testing). ricardoV94 commented on 2024-01-11T15:49:13Z Okay. Is this subset fixed or does it change when the NB is rerun?
ricardoV94 commented on 2024-01-11T15:50:59Z I see you have a random_seed, perfect! |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2024-01-11T14:48:38Z Here we can also see large differences compared to before ColtAllen commented on 2024-01-11T15:45:59Z See above |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2024-01-11T14:48:39Z Line break in representin ColtAllen commented on 2024-01-11T15:51:09Z This linebreak does not appear in Jupyter, PyCharm, or even the docs build preview. I'm not sure why ReviewNB isn't displaying properly here. ricardoV94 commented on 2024-01-11T15:52:38Z Must be a glitch then. The docs preview should be enough |
View / edit / reply to this conversation on ReviewNB ricardoV94 commented on 2024-01-11T14:48:40Z Estimates also changed considerably in this model ColtAllen commented on 2024-01-11T15:46:45Z Different dataset; see above. |
@ColtAllen I seem some large differences in the NB results. I suspect there may be a bug in the new function, or in what the model is expecting |
If View entire conversation on ReviewNB |
No error - just a different dataset (or rather, a different subset of CDNOW_MASTER.txt, which is rather large for testing). View entire conversation on ReviewNB |
See above View entire conversation on ReviewNB |
Different dataset; see above. View entire conversation on ReviewNB |
Just replace the one that's there with the unformatted one? The dataset is there just for the purpose of being used in examples. View entire conversation on ReviewNB |
Okay. Is this subset fixed or does it change when the NB is rerun?
View entire conversation on ReviewNB |
I see you have a random_seed, perfect! View entire conversation on ReviewNB |
This linebreak does not appear in Jupyter, PyCharm, or even the docs build preview. I'm not sure why ReviewNB isn't displaying properly here. View entire conversation on ReviewNB |
Must be a glitch then. The docs preview should be enough View entire conversation on ReviewNB |
Pre-commit is also complaining. Otherwise besides adding the dataset to a more user-facing location, everything looks on spot! |
Dataset has been moved to https://github.com/pymc-labs/pymc-marketing/tree/main/datasets |
Did |
No idea, but all looks green now! |
Did you change the import in the NB? |
It's fixed now. |
* current status as method * format * Update version.txt * Implement different convolution modes (#454) * Add PR template * Update pull_request_template.md * Fix issues in index example * Update .pre-commit-config.yaml * Update .pre-commit-config.yaml * move from other PR * put legend on side * Optimisation in customer_lifetime_value when discount_rate == 0 (#468) * Optimisation in customer_lifetime_value when discount_rate == 0 cf #467 * Update utils.py * Update README.md * add support for pre-commit-ci * add isort * modify autosummary templates * Rename `clv_summary` to `rfm_summary` and extend functionality (#479) * clv_summary adapted into rfm_summary * added clv_summary with warning * moved dataset from testing folder * Update version.txt * improve ruff * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.11 → v0.1.14](astral-sh/ruff-pre-commit@v0.1.11...v0.1.14) - [github.com/pre-commit/pre-commit-hooks: v3.2.0 → v4.5.0](pre-commit/pre-commit-hooks@v3.2.0...v4.5.0) * resolve conflict * Add baselined saturation (#498) * add baselined saturation with test and plots * refactor docs * add the reparam * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * verify parametrization is equivalent under change of baseline * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add a note for setting x0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * make it clear how r_ref is calculated * fix typo * fix docstrings * improve test by making sure transform is gives identical saturation and cac0 * add comment in the docstring * add blank line in the code-block --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Swap Before and After convolution modes as per #489 (#501) * Add support for string mode args * Swap before and after and make mode explicit * Use Union due Python 3.9 * Style * resolve conflict * add dim_name arg * add seed to tests and test methods * add slice as type hint * use slice in docstring * defaults to mean for each channel * add non-negative check * ax as last arg * change weeks -> time * parameterize quantiles * separate out and add to docs * rerun the baseline images * mock the prior * add new images from latest env * migrate to toml instead of ci/cd * test only is axes * remove the images --------- Co-authored-by: Juan Orduz <juan.orduz@wolt.com> Co-authored-by: Abdalaziz Rashid <abdalaziz.rashid@outlook.com> Co-authored-by: Ricardo Vieira <ricardo.vieira1994@gmail.com> Co-authored-by: Ricardo Vieira <28983449+ricardoV94@users.noreply.github.com> Co-authored-by: vincent-grosbois <vincent.grosbois@gmail.com> Co-authored-by: juanitorduz <juanitorduz@gmail.com> Co-authored-by: Oriol (ProDesk) <oriol.abril.pla@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: Maxim Kochurov <max.kochurov@pymc-labs.com>
* current status as method * format * Update version.txt * Implement different convolution modes (#454) * Add PR template * Update pull_request_template.md * Fix issues in index example * Update .pre-commit-config.yaml * Update .pre-commit-config.yaml * move from other PR * put legend on side * Optimisation in customer_lifetime_value when discount_rate == 0 (#468) * Optimisation in customer_lifetime_value when discount_rate == 0 cf #467 * Update utils.py * Update README.md * add support for pre-commit-ci * add isort * modify autosummary templates * Rename `clv_summary` to `rfm_summary` and extend functionality (#479) * clv_summary adapted into rfm_summary * added clv_summary with warning * moved dataset from testing folder * Update version.txt * improve ruff * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.11 → v0.1.14](astral-sh/ruff-pre-commit@v0.1.11...v0.1.14) - [github.com/pre-commit/pre-commit-hooks: v3.2.0 → v4.5.0](pre-commit/pre-commit-hooks@v3.2.0...v4.5.0) * resolve conflict * Add baselined saturation (#498) * add baselined saturation with test and plots * refactor docs * add the reparam * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * verify parametrization is equivalent under change of baseline * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add a note for setting x0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * make it clear how r_ref is calculated * fix typo * fix docstrings * improve test by making sure transform is gives identical saturation and cac0 * add comment in the docstring * add blank line in the code-block --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Swap Before and After convolution modes as per #489 (#501) * Add support for string mode args * Swap before and after and make mode explicit * Use Union due Python 3.9 * Style * resolve conflict * add dim_name arg * add seed to tests and test methods * add slice as type hint * use slice in docstring * defaults to mean for each channel * add non-negative check * ax as last arg * change weeks -> time * parameterize quantiles * separate out and add to docs * rerun the baseline images * mock the prior * add new images from latest env * migrate to toml instead of ci/cd * test only is axes * remove the images --------- Co-authored-by: Juan Orduz <juan.orduz@wolt.com> Co-authored-by: Abdalaziz Rashid <abdalaziz.rashid@outlook.com> Co-authored-by: Ricardo Vieira <ricardo.vieira1994@gmail.com> Co-authored-by: Ricardo Vieira <28983449+ricardoV94@users.noreply.github.com> Co-authored-by: vincent-grosbois <vincent.grosbois@gmail.com> Co-authored-by: juanitorduz <juanitorduz@gmail.com> Co-authored-by: Oriol (ProDesk) <oriol.abril.pla@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: Maxim Kochurov <max.kochurov@pymc-labs.com>
Description
This PR adds some enhancements to the existing
clv_summary
function and renames it torfm_summary
, which is a better descriptor for what this function does. Specific changes are described in #469.The RFM Analysis interpretation of
recency
was not added in this PR. Instead of creating an additional column unnecessary for predictive modeling, it would make more sense to create that column (which is simplyT-recency
within a future model for Bayesian RFM segmentation.Related Issue
clv_summary
Enhancements #469Checklist
(https://wiki.openstack.org/wiki/GitCommitMessages#Structural_split_of_changes)
Modules affected
Type of change
📚 Documentation preview 📚: https://pymc-marketing--479.org.readthedocs.build/en/479/