Repository navigation
Align feature descriptions with the catch22 C implementation - #4
Merged
Merged
Conversation
Audit of each feature page against the pycatch22/catch22 C source: - centroid_freq: describe it as the median frequency of the power spectrum and explain why "centroid" is a misnomer; give units - low_freq_power: no explicit normalisation (z-scoring makes total ~1); Welch estimate is a single rectangular window (a periodogram) - acf_timescale: crossing is linearly interpolated; examples predate this - acf_first_min, periodicity: state what is computed and returned - ami_timescale: sensitive only to linear autocorrelation; relation to the ACF zero-crossing - outlier_timing: threshold step and the 2% trimming of thresholds - transition_variance: downsample before symbolising; entries are joint pair probabilities - self-affine scaling: least-squares detrending for rs_range, timescale range, output is a proportion, "multifractal" -> crossover - embedding_dist: tau cap, one-step distances, exponential not fitted - typos, fi ligatures and PD_PeriodicityWang_th0_01 name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…v0.6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Update: the code quirks listed under "Not changed here" are now being fixed so the C matches MATLAB/hctsa: DynamicsAndNeuralSystems/catch22#63, with downstream PRs DynamicsAndNeuralSystems/pycatch22#41, hendersontrent/Rcatch22#61 and brendanjohnharris/Catch22.jl#45 (draft). I've pushed one more commit here so that |
…ing_1e_acf_point) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I checked each feature page against the C implementation that pycatch22 wraps (the same code as
catch22/Con main), and ran pycatch22 wherever a page's claim could be tested numerically.Corrections
centroid_freq: the feature returns the median frequency of the power spectrum (the first frequency at which the cumulative power passes half the total), not its centroid. The page now explains why "centroid" is a misnomer. A centroid is the power-weighted mean frequency, which a high-frequency tail pulls upward; the median barely moves. For an AR(1) process with φ = 0.9,centroid_freqreturns 0.107, while the true spectral centroid is 0.27. The page also gives the units: radians per sample, from 0 to π.low_freq_power: the code doesn't divide by the total power. The output reads as a fraction only because z-scoring makes the total power about 1. The "Welch" estimate uses a single rectangular window over the whole series, so it is in effect a periodogram.acf_timescale: the 1/e crossing is linearly interpolated, so outputs aren't integers (uncorrelated noise gives about 0.63, not 1). A note now says that the integer example outputs come from an earlier version. The hctsa equivalent is now given asCO_FirstCrossing(x_z,'ac',1/exp(1),'continuous')(the hctsa featurefirstCrossing_1e_acf_point), linked to its source. It was previously given as the integer-lag'discrete'version,firstCrossing_1e_acf_tau.ami_timescale: removed "(potentially nonlinear)". The feature is a transform of the linear ACF, and its first minimum falls near the ACF's first zero crossing. Added the cap at N/2.acf_first_minandperiodicity: the pages now say what is computed and returned, including the Wang et al. peak conditions and the return value of 0.outlier_timing_*: added the step size of 0.01 SD. Also added the trimming step: thresholds exceeded by 2% or fewer of the points are dropped before the final median.transition_variance: the series is downsampled before it is converted to symbols. Each matrix entry is the joint probability of a pair of successive symbols, not a row-normalised transition probability.rs_range/dfa:rs_rangesubtracts a least-squares line from each window, not the line joining the window's endpoints, and doesn't divide by the SD.embedding_dist: added the cap on τ at N/10. The distances are between embedded points one step apart, and the exponential isn't fitted: its mean is set to the mean distance.high_fluctuation: fixed an inverted sentence and added a note that the 0.04σ threshold is small.ami2: added how the histogram estimate is computed.PD_PeriodicityWang_th0_01.Quirks in the C code: now being fixed
Three of the quirks I found while auditing turned out to be bugs introduced when the code was ported to C. They are being fixed so that the C matches MATLAB (hctsa), in DynamicsAndNeuralSystems/catch22#63, with downstream PRs DynamicsAndNeuralSystems/pycatch22#41, hendersontrent/Rcatch22#61 and brendanjohnharris/Catch22.jl#45 (draft):
periodicityandami_timescalereturned the lag minus one. From v0.6.0 they return the lag itself.stretch_highandstretch_decreasingcounted runs not at the start of the series one too long. From v0.6.0 they count runs exactly, andstretch_decreasingtreats zero differences as non-increases, as MATLAB does. This PR'sstretch_decreasingpage already describes that behaviour.These pages describe what the features compute, which is the corrected behaviour. Once v0.6.0 is released, some example outputs will shift slightly (
periodicityandami_timescaleup by 1, the stretch features usually down by 1), so they should be refreshed then.Still open, and not changed here:
embedding_distmixes two quantities. It compares histogram bin probabilities with exponential density values, so the result depends on the bin width. catch22 inherited this from hctsa as it was in 2018; hctsa itself now uses'pdf'normalisation.featureList.txt. pycatch22 usestransition_matrixwherefeatureList.txtand these docs usetransition_variance.🤖 Generated with Claude Code