@@ -32,7 +32,38 @@ def makeFigure():
3232
3333
3434def calculateFMS (A : anndata .AnnData , B : anndata .AnnData ):
35- """Calculates FMS between 2 factors"""
35+ """Calculate Factor Match Score (FMS) between two RISE decompositions.
36+
37+ Factor Match Score measures the similarity between two tensor decompositions
38+ by comparing their factor matrices. Values range from 0 (no similarity) to 1
39+ (identical factors). Used to assess decomposition stability across different
40+ initializations or data subsamples.
41+
42+ Parameters
43+ ----------
44+ A : anndata.AnnData
45+ First AnnData object with RISE decomposition results. Must contain:
46+ - A.uns["Pf2_weights"]: Component weights
47+ - A.uns["Pf2_A"]: Condition factors
48+ - A.uns["Pf2_B"]: Eigen-state factors
49+ - A.varm["Pf2_C"]: Gene factors
50+ B : anndata.AnnData
51+ Second AnnData object with RISE decomposition results. Must have the
52+ same rank as A and contain the same decomposition attributes.
53+
54+ Returns
55+ -------
56+ float
57+ Factor Match Score between 0 and 1. Higher values indicate more similar
58+ decompositions. Typically: >0.9 = highly stable, >0.6 = acceptable,
59+ <0.6 = unstable decomposition.
60+
61+ Notes
62+ -----
63+ This function uses tlviz.factor_tools.factor_match_score with weights
64+ consideration disabled (consider_weights=False) and skipping the condition
65+ mode (skip_mode=1) for stability assessment across replicate decompositions.
66+ """
3667 factors = [A .uns ["Pf2_A" ], A .uns ["Pf2_B" ], A .varm ["Pf2_C" ]]
3768 A_CP = CPTensor (
3869 (
0 commit comments