Update interface to match assesspy 2.0#13
Open
jeancochrane wants to merge 8 commits into1.0.0from
Open
Conversation
jeancochrane
commented
Dec 12, 2024
Comment on lines
+40
to
+44
| if (method == "quantile") { | ||
| out <- quantile_outlier(x, probs = probs) | ||
| } else { | ||
| out <- iqr_outlier(x, mult = mult) | ||
| } |
Member
Author
There was a problem hiding this comment.
No ifelse here since we're returning a vector, in which case ifelse coerces the return value to the same shape as the test.
Comment on lines
+63
to
+73
| is.vector(x) | ||
| is.numeric(x) | ||
| !is.nan(x) | ||
| length(x) > 2 | ||
| all(is.finite(x) | is.na(x)) # All values are finite OR are NA | ||
| is.numeric(gap) | ||
| gap > 0 | ||
| gap < 1 | ||
| is.vector(bounds) | ||
| is.numeric(bounds) | ||
| bounds[2] > bounds[1] |
Member
Author
There was a problem hiding this comment.
Moving all of the input checks up here from the sub-functions.
Comment on lines
-87
to
-98
| #' @describeIn detect_chasing CDF gap method for detecting sales chasing. | ||
| #' @param bounds Ratio boundaries to use for detection. The CDF method will | ||
| #' return TRUE if the CDF gap exceeding the threshold is found within these | ||
| #' bounds. The distribution method will calculate the percentage of ratios | ||
| #' within these bounds for the actual data and an ideal normal distribution. | ||
| #' Expanding these bounds increases likelihood of detection. | ||
| #' @param cdf_gap Ratios that have bunched up around a particular value | ||
| #' (typically 1) will appear as a flat spot on the CDF. The longer this flat | ||
| #' spot, the worse the potential sales chasing. This variable indicates the | ||
| #' length of that flat spot and can be thought of as the proportion of ratios | ||
| #' that have the same value. For example, 0.03 means that 3% of ratios share | ||
| #' the same value. |
Member
Author
There was a problem hiding this comment.
I dropped the docs for these functions, since they're no longer public.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.0.0 #13 +/- ##
=========================================
Coverage ? 100.00%
=========================================
Files ? 5
Lines ? 195
Branches ? 0
=========================================
Hits ? 195
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the companion to ccao-data/assesspy#24, updating the interface to match the latest version of the Python package.
Warning
This is a breaking refactor. It significantly changes the API of some functions and deprecates others. As such, this PR is intended to target a new major version release (1.0.0).
Breaking changes
estimate,sale_price) and return the same output (a single number). Previously, some metrics had one input (COD) or different outputs (PRD)detect_chasingandis_outlierare no longer exported to the user. Instead they can be selected via an argument in their respective functionsdetect_chasingis renamed tois_sales_chasedfor consistency withis_outlier