pub struct EmbeddingGeometry {
pub n_rows: usize,
pub h: usize,
pub common_mode_cos: f32,
pub mean_pairwise_cos: f32,
pub eff_rank_raw: f32,
pub eff_rank_centered: f32,
pub eff_rank_double_centered: f32,
pub max_abs_corr: f32,
pub max_vif: f32,
}Expand description
Geometry of an embedding table, measured once and handed to the caller to report. A struct of measured scalars; nothing here decides anything.
Fields§
§n_rows: usizeRows measured (units: cells, genes, modules).
h: usizeColumns (the embedding dimension h).
common_mode_cos: f32Mean |cos| between a row and the mean direction over rows. → 1
means every row is essentially the same direction plus a small residual;
→ 0 means the rows are spread about the origin.
mean_pairwise_cos: f32SIGNED mean cosine over distinct row pairs, zero-norm rows excluded.
Computed in closed form from the sum of unit rows, so it is one O(n·h)
pass rather than n² pairs. A balanced cloud reads −1/(n−1), not 0.
eff_rank_raw: f32Participation ratio (Σλ)² / Σλ² of the uncentered Gram EᵀE/n,
in [1, h].
READ THIS AS VARIANCE CONCENTRATION, NOT USEFUL DIMENSIONALITY. A low value says the variance is carried by few directions; it does not say the remaining dims are noise. On real fits this has read under 3 of 16 while the dims beyond the first few still recovered cell type well above a null. Low-variance directions can carry ample signal, and reading this field as a capacity estimate is a mistake that has already been made once.
eff_rank_centered: f32Same, for the column-centered Gram. Much larger than
Self::eff_rank_raw ⇒ the apparent low rank is a mean offset (a common
mode), not a genuine collapse.
eff_rank_double_centered: f32Same, after DOUBLE centering: each row’s mean across its h columns
removed, then each column’s mean. A log-simplex dictionary is
log β_gk = (per-gene share) + (module/topic content) − (per-topic partition), and the two offsets dominate its variance: column
centering leaves the per-gene share, row centering leaves the
per-topic constant, and either alone reads near 1 with a huge
Self::max_vif. Removing both leaves the topic-specific content,
which is what “how many directions do the topics use” means for such
a table. For an embedding it removes a per-unit depth-like offset the
same way. Row centering projects out the all-ones direction, so a
genuinely full-rank table reads h − 1 here, not h. No VIF is
reported for it: the row-centered columns sum to zero, so their
correlation matrix is singular by construction.
max_abs_corr: f32Largest |correlation| between two distinct dims.
max_vif: f32Largest variance-inflation factor diag(C⁻¹) over dims (1 =
orthogonal). Above ~5, per-dim readouts stop being trustworthy on their
own.
Trait Implementations§
Source§impl Clone for EmbeddingGeometry
impl Clone for EmbeddingGeometry
impl Copy for EmbeddingGeometry
Source§impl Debug for EmbeddingGeometry
impl Debug for EmbeddingGeometry
Source§impl Default for EmbeddingGeometry
impl Default for EmbeddingGeometry
Source§impl PartialEq for EmbeddingGeometry
impl PartialEq for EmbeddingGeometry
impl StructuralPartialEq for EmbeddingGeometry
Auto Trait Implementations§
impl Freeze for EmbeddingGeometry
impl RefUnwindSafe for EmbeddingGeometry
impl Send for EmbeddingGeometry
impl Sync for EmbeddingGeometry
impl Unpin for EmbeddingGeometry
impl UnsafeUnpin for EmbeddingGeometry
impl UnwindSafe for EmbeddingGeometry
Blanket Implementations§
impl<T> Allocation for T
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.