Skip to content

fractional differentiation for engineering stationary features from financial time series - #11851

Open
mjvakili wants to merge 5 commits into
TheAlgorithms:masterfrom
mjvakili:feature-fracdiff
Open

mjvakili wants to merge 5 commits into
TheAlgorithms:masterfrom
mjvakili:feature-fracdiff

Conversation

@mjvakili

@mjvakili mjvakili commented Oct 7, 2024

Copy link
Copy Markdown

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@priya-sundaram-dev priya-sundaram-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, well-documented contribution @mjvakili — type hints, doctests and references are all here, which is great. Two small suggestions:

  1. fracdiff_fixedwindow calls calculate_weights(degree=degree, length=len(price_series)) but only ever uses the first window_size weights, so it computes len(price_series) - window_size weights that are thrown away. Using length=window_size keeps it O(window_size) per point.
  2. The fracdiff_fixedwindow docstring Parameters section documents price_series and degree but omits window_size — please add it. A quick ValueError/note for window_size > len(price_series) (currently silently returns all-nan) would also help callers.

Otherwise this looks solid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants