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
[ENH] Adding ADI/CV Feature Extractor #6336
Conversation
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.
Really nice! This is almost ready, there are small but blocking issues:
- this is a transformer, so it should be in the
transformations
module. I would suggesttransformations.series.adi_cv
as a file to put it - for testing, we need to add tests, since the test suite data currently does not generate expressly data in the four classes. It should not be too difficult to make synthetic data that fits in either of the four categories. For consistency, I would suggest a new file
transformations.series.tests.test_adi_cv
. - I would make
features
the first parameter, as that is probably the most "interesting" for users - does the ADI value in your formula have the fraction the wrong way round?
- the changes to the data loaders seem unrelated but potentially valid - can you kindly make these in a different PR, and describe what these are about?
Just to help concretely with synthetic generation:
|
@fkiraly, I just pushed a new commit that addresses the suggestions! I had some points that I wanted to quickly discuss:
|
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.
Nice, thanks! Great addition!
- the changes to the
datasets
module are stlil present. Ifgit
behaviour is confusing, you can copy the files frommain
over the modified files and commit. PRs are squashed, so the individual commits around those files will not be visible. - your
get_test_params
seems non-compliant. If you add a new estimator, please always check thatcheck_estimator
runs.
Thank you! I've made a new commit that adds in the reverted commit. Also, I believe I have fixed the error originating from the |
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.
Nice!
Some comments:
- please do not delete other people from the "all contributors" file
- you are still making changes to the data loaders file. Kindly move these to a separate PR.
- your test
test_adi_cv
is not runing - I would suggest you try running it locally on your computer before you push - the failure related to
get_params
is genuine. Parameters of the estimator should be written toself
in__init__
and not changed afterwards.
@fkiraly, I have some updates!
EDIT: From the CI, it seems that the tests are sporadic and only work sometimes...I'll look further into this! |
Great! If you have any question about resolving the |
@fkiraly, I believe that my code's working better now! For my test data generation, I increased the variance associated with lumpy / erratic Series to assist with the test cases. I have also made sure not to modify any of the variables from the I'll start work on the final items in the checklists! |
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.
This is very nice!
This could be merged, I am just requesting improved documentation.
- docstring should mention the standard thresholds in the preamble.
- docstring should be clearer on the return of
transform
, e.g., what is in the columns - the paper should be cited with its full reference in a
References
section, see other estimators that do that - the estimator should be added to the API reference,
docs/source/api_reference/transformations.rst
, I would add it in the "Summarization" section of Series-to-Features transformers
Got it! I'll make the changes and push them soon! :) |
…nto primitives_transformer
@fkiraly, I just added in the required changes for the documentation, included the research paper's citation and added the changes to the docstrings like you requested! Update: I understand that there are some failing checks but I am not sure if they are stemming from the |
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.
I understand that there are some failing checks but I am not sure if they are stemming from the
ADICVTransformer
. I am not sure of the reason for these...have you seen them before?
These are probably related to the transformer, what it means is that somewhere in the file you used characters that cannot be parsed by python.
I suspect the apostrophes in the citation you added, and that removing them will fix the issue.
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.
This fixed it
@fkiraly, thanks! Closing the PR now. |
closed by mistake, should get merged |
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.
Approving again.
Also added a full description in the docstring, and fixed an error with the "minus one" in the computation of the ADI.
@fkiraly, I have added a very rough first commit for the compositor discussed in #6279. I have implemented the Could you please let me know if my approach for this problem seems okay? Also, please let me know if you'd like me to work in a new branch. I can try and make a fork from the |
This reverts commit e3b7530.
@shlok191, that's great! Yes, it would be great if you could work on this on a new branch. To make things easier, I have merged the parts with the ADI/CV transformer. If you do not update from the branch, you should be able to continue on it. |
Regarding the approach - this is nice, but I was imagining it more general. That is, I thought it could take any series-to-primitives transformer, including the ADI/CV transformer - the transformer should be also an argument, assume it produces categories out of the time series in a column, first. ADI/CV could be a default though. |
Thank you so much for the merge, I'll make a new branch and copy over any new changes I made 🙂 |
Reference Issues/PRs
Fixes #6286. See also #6279 for more information about the original request!
What does this implement/fix? Explain your changes.
This PR implements a feature extractor that has the capability to process time series data representing
demand over time into one of 4 categories (smooth, intermittent, erratic, lumpy) based on the guidelines
detailed in the paper: "The accuracy of Intermittent Demand Estimates" by J. Boylan, A. Syntetos.
Does your contribution introduce a new dependency? If yes, which one?
The PR only requires
pandas
, which I do not believe will be a new dependency!What should a reviewer concentrate their feedback on?
This is my first time implementing a transformer, so I would really appreciate any feedback on how I specifically am processing my input and output types and if the way I calculate the
class
labels is the way someone with more experience would do it!Did you add any tests for the change?
Yes, I added 3 test parameters with their own
ADI
andCV
threshold values to test how varying thresholdscan impact classification. I also set some thresholds to 0.0 to see how that might impact the labels given!
Requests for next steps
I am really hoping to test out this estimator locally (I am sure I must have some mistakes right now) so I would really appreciate some advice on some test data I could potentially try out the estimator on and if there might be a recommended approach to testing the new feature.
This would also tie to the remaining items in my PR checklist, and will help me complete this issue!
PR checklist
For all contributions
maintainers
tag - do this if you want to become the owner or maintainer of an estimator you added.For new estimators
docs/source/api_reference/taskname.rst
, follow the pattern.Examples
section.python_dependencies
tag and ensureddependency isolation, see the estimator dependencies guide.