Skip to content

Separate legacy 2D rescaling from dimension-generic normalisation #128

Description

@t-uda

Problem

EllipseCloud.rescale() is currently restricted to two-dimensional ellipse clouds. The original proposal attempted to generalise it using the volume-equivalent radius

$$ r_{\mathrm{vol}}(\Sigma) = \det(\Sigma)^{1/(2d)}. $$

However, this does not reduce to the existing two-dimensional implementation.

For aggregated semi-axis lengths (A \ge B), the current implementation uses

$$ s_{\mathrm{legacy}}=\frac{A^2}{B}, $$

whereas the volume-equivalent radius is (\sqrt{AB}). These coincide only in the isotropic case (A=B). Replacing the current formula would therefore silently change all existing two-dimensional results.

Interpretation of the current rule

For an ellipse with semi-axes (a\ge b), the quantity

$$\frac{a^2}{b} $$

is the radius of curvature at a vertex on the minor axis. Thus, the existing implementation should be regarded as a curvature-based two-dimensional calibration, rather than a volume-based normalisation.

This interpretation is particularly relevant when ellipses are estimated from local covariance matrices: the ratio (a^2/b) can remove the leading dependence on neighbourhood width and retain information related to the curvature radius of an underlying sampled curve.

Why there is no automatic arbitrary-dimensional extension

In dimensions greater than two, several inequivalent scalar size measures are available:

  • volume-equivalent radius;
  • maximum or minimum principal curvature radius;
  • a mean-curvature-based radius;
  • a Gauss–Kronecker-curvature radius.

For an ellipsoid with semi-axes

$$ s_1\ge \cdots \ge s_d, $$

the geometric mean of the principal curvature radii at a vertex on the shortest axis is

$$ R_K = \frac{ {( \prod_{j\lt d} s_j )}^{2/(d-1)} }{ s_d }. $$

This reduces to (s_1^2/s_2) when (d=2), but it is naturally associated with a hypersurface interpretation. It is not necessarily appropriate for lower-dimensional manifolds embedded in a higher-dimensional ambient space, such as curves in (\mathbb R^3).

Consequently, ambient dimension alone is insufficient to determine a canonical generalisation.

Proposed API direction

Separate the existing behaviour from genuinely dimension-generic normalisations.

1. Preserve the current two-dimensional behaviour

The existing rule remains available without numerical changes:

cloud.rescale(method="median", measure="legacy")

For two-dimensional data, measure="legacy" computes the current per-axis aggregate followed by

scale = major**2 / minor

The default behaviour for existing two-dimensional calls must remain backward compatible.

2. Add an explicit volume-based measure

Provide a dimension-generic option:

cloud.rescale(method="median", measure="volume")

For each covariance matrix (\Sigma_i), define

$$ r_i=\det(\Sigma_i)^{1/(2d)}, $$

and aggregate the scalar values (r_i) using the requested statistic:

$$ s=\mathrm{median}_i r_i $$

or the corresponding arithmetic mean.

This option represents volume-equivalent radius normalisation and must not be presented as equivalent to the existing two-dimensional rule.

3. Defer curvature-based higher-dimensional generalisation

Do not introduce (R_K), or another curvature-derived scalar, as an automatic default in this issue. Such an option requires a documented geometric assumption, including the intended intrinsic dimension of the sampled structure.

A separate follow-up issue may investigate curvature-based normalisation for hypersurface data.

Diagnostics

RescaleDiagnostics must report enough information to identify the applied convention. At minimum, diagnostics should contain:

  • the scalar scale factor;
  • the aggregation method;
  • the selected measure;
  • the relevant pre- and post-rescaling summaries.

Legacy per-axis summaries remain appropriate for measure="legacy". Volume-based rescaling should instead report summaries of the scalar values (\det(\Sigma_i)^{1/(2d)}).

Positive-definiteness requirements

All implemented measures assume positive-definite covariance matrices. In higher dimensions, local covariance matrices are necessarily singular when the neighbourhood contains too few independent samples.

The implementation must therefore detect non-positive eigenvalues and raise a clear error. Covariance regularisation is outside the scope of this issue and should not be applied silently.

Acceptance criteria

  • Existing two-dimensional calls retain exactly the current numerical behaviour.
  • The formula (A^2/B) is documented explicitly.
  • A dimension-generic volume-based option is available only under an explicit measure name.
  • The implementation does not claim that volume-based scaling generalises the existing rule.
  • Diagnostics distinguish legacy and volume-based measures.
  • Singular or non-positive-definite covariance matrices produce an informative error.
  • Tests cover isotropic and anisotropic 2D cases, at least one 3D volume-based case, and singular covariance input.

Out of scope

  • Choosing a canonical curvature scale for arbitrary intrinsic dimensions.
  • Estimating intrinsic dimension.
  • Regularising singular local covariance matrices.
  • Changing the filtration or tangency solver itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions