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

Add simple tsfresh unit tests #92

Merged

Conversation

TomBurdge
Copy link
Contributor

@TomBurdge TomBurdge commented Oct 17, 2023

New tests

  • variation_coefficient
  • var_gt_std
  • large_standard_deviation
  • range_count
  • mean_change
  • abs_mean_change

Changes to tsfresh variation_coefficient function

  • Added error handling for division by zero where mean x is zero.
  • This was causing an error for Series and returning NaNs (undesirable) for DataFrames/LazyFrames.
  • Function checks whether x is a Series. Unfortunately, less readable. It needs to, in order to handle the zero division.
  • A series needs to differentiate between an int and float mean, whereas DataFrame/LazyFrame doesn't appear to.

also of note: Polars is limiting the significant figures with this function (I don't recall exactly, but this may be a local setting which can be changed).

Miscellaneous
Added a noqa on the second test_percent_reocurring_value test name - ruff pre-commit hook wasn't happy with it.

This looks like a lot of changes, but most of it is pre-commit reformatting.
Start at green line 58. (I use flake8 lint on save usually, but have turned that off now).

variation_coefficient.
feat: Add unit tests for
- var_gt_std
- large_standard_deviation
- variation_coefficient
- count_range
for not series in variation_coefficient
@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
functime-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2023 8:22am

and abs mean change
@MathieuCayssol
Copy link
Collaborator

MathieuCayssol commented Oct 17, 2023

A series needs to differentiate between an int and float mean, whereas DataFrame/LazyFrame doesn't appear to.

I think it could be related to pola-rs/polars#11736. But 0.0 == 0 returns True anyway

I would push for returning nan for 0/0, and inf/-inf for x != 0, x/0. This is the logic implemented for numpy and expressions in polars. It's either NaN/inf or raising an error. Returning 0 could be misleading.
Also, for this feature, if the mean < 0, it doesn't make sense (you can't really interpret a negative dispersion). but I would let the user the choice and not raise anything even though it makes no sense.

Integrate Mathieu's proposal for handling zero mean in variation_coefficient.

Co-authored-by: Mathieu Cayssol <49449000+MathieuCayssol@users.noreply.github.com>
Integrate Mathieu's proposal to update unit tests for zero mean in variation_coefficient.

Co-authored-by: Mathieu Cayssol <49449000+MathieuCayssol@users.noreply.github.com>
@MathieuCayssol MathieuCayssol merged commit d75b5b9 into functime-org:main Oct 18, 2023
topher-lo pushed a commit that referenced this pull request Dec 19, 2023
Co-authored-by: Mathieu Cayssol <49449000+MathieuCayssol@users.noreply.github.com>
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