Port GeneralizedKSineSkewedWrappedCauchyDistribution (GSSC) from libDirectional#1608
Port GeneralizedKSineSkewedWrappedCauchyDistribution (GSSC) from libDirectional#1608
Conversation
…irectional Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/1a576fc8-b791-47bf-9779-8d2eb91dd477 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
❌MegaLinter analysis: Error
Detailed Issues❌ PYTHON / pylint - 4 errorsSee detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
|
@copilot Can use the "skipif" decorator to skip the tests that are not supporrted for other backends? There are similar cases in the code base that you can use as reference. FAILED pyrecest/tests/distributions/test_sine_skewed_distributions.py::TestGeneralizedKSineSkewedWrappedCauchyDistribution::test_pdf_m1_normalizes - AssertionError: Only supported for numpy backend |
…ot supported) Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/01f9d409-2888-4f39-9e33-1425a0bc08ae Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Done in commit 7a752fa. Added |

Summary
Ports the Generalized K Sine-Skewed Wrapped Cauchy Distribution (GSSC) from libDirectional to PyRecEst.
Changes
pyrecest/distributions/circle/sine_skewed_distributions.pycos,cosh,sinhto the backend importsGeneralizedKSineSkewedWrappedCauchyDistribution— the Generalized K Sine-Skewed Wrapped Cauchy distribution, analogous to the existingGeneralizedKSineSkewedVonMisesDistributionbut using the Wrapped Cauchy as the base distributionThe PDF is:
where
wcis the wrapped Cauchy density andZis the closed-form normalization constant derived from the wrapped Cauchy trigonometric momentsE[cos(n(x−μ))] = exp(−nkγ). Supportsm = 1, 2, 3, 4with:Note: The pdf uses the WC formula directly rather than calling the existing
WrappedCauchyDistribution.pdf, which has a known centering bug for non-zeromu(it computes WC centered at2μrather thanμ).pyrecest/distributions/__init__.pyGeneralizedKSineSkewedWrappedCauchyDistributionto both the import and__all__pyrecest/tests/distributions/test_sine_skewed_distributions.pyimport numpy.testing as nptto the top of the fileTestGeneralizedKSineSkewedWrappedCauchyDistributiontest class covering:test_initialization— valid params work, invalidlambda_,m, andgammaraiseAssertionErrortest_pdf_m1_normalizes— m=1 integrates to 1test_pdf_m2_normalizes— m=2 integrates to 1test_pdf_m3_normalizes— m=3 integrates to 1test_pdf_m4_normalizes— m=4 integrates to 1test_pdf_nonnegative— PDF values are ≥ 0 for all mtest_shift—shift()updatesmucorrectlyReference
Bekker, A., Nakhaei Rad, N., Arashi, M., Ley, C. (2020). Generalized Skew-Symmetric Circular and Toroidal Distributions, Florence Nightingale Directional Statistics volume, Springer.