-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Update Katz_FD #36
Update Katz_FD #36
Conversation
Thank you @PiethonProgram — I'll aim to review the PR later this week. In the meantime, please make sure that the CI tests and lint tests are all passing. |
Applied formatting changes and should pass lint cases. Changed self.assertEqual(np.round(katz_fd(x_k), 3), VALUE) from VALUE = 5.783 to 1.503 to reflect formula change |
Should I be concerned with the unsuccessful checks : It seems the issue is related to GitHub versions, and not the code itself. |
Yeah don't worry about the CI failures, I need to make some upgrade to the GitHub Actions workflow. Thanks! |
Reformatted and "simplified" code. Note : Black formatting caused line 208 in fractal.py to expand into 7 lines (likely due to nested parenthesis restrictions) <= No impact on functions, just aesthetics. |
Hey, Thanks again for the implementation and the PR.
import stochastic.processes.noise as sn
rng = np.random.default_rng(seed=42)
X = np.vstack([
np.arange(1000),
np.sin(2 * np.pi * 1 * np.arange(1000) / 100),
sn.FractionalGaussianNoise(hurst=0.1, rng=rng).sample(1000),
sn.FractionalGaussianNoise(hurst=0.9, rng=rng).sample(1000),
rng.random(1000),
rng.random(1000)]
)
katz_new(X)
![]()
def katz(x):
# Define total length of curve
dists = np.abs(np.diff(x, axis=axis))
length = np.sum(dists, axis=axis)
# Average distance between successive points
a = np.mean(dists, axis=axis)
# Compute farthest distance between starting point and any other point
d = np.max(np.abs(x.T - x[..., 0]).T, axis=axis)
return np.log10(length / a) / (np.log10(d / a)) |
Hi @raphaelvallat , thanks for the catch.
|
Hi @raphaelvallat ,
Please let me know your thoughts. |
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.
Thank you for looking into this! Two very minor comments but otherwise I think we are good to merge.
To clarify for others: this PR is just a simplification of the existing implementation. It does not update the distance calculation to use Euclidean distance, as originally discussed in #34
Hi, the changes have been made. Please let me know if there is anything else, and thank you for your cooperation as well. |
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.
Approved and merging now. Thanks!
Fixed Katz_FD implementation by utilizing Euclidean distances. Also modified test cases to include tests for new method.