ProCreations's picture
Publish validated PolyILR reproduction logbook
db39dbc verified
Raw
History Blame Contribute Delete
18.2 kB
\section{Additional Experiments and Details}\label{appdx:exp}
\begin{figure}[t]
\centering
\resizebox{\textwidth}{!}{\input{figure/tree-inference}}
\caption{\emph{Orthogonal subspace partitions.} The coordinates of $V$ can be grouped into orthogonal subspaces indexed by tree structure: by individual node, by depth level, or by subtree (one example). Each grouping enables inference at a different resolution.}
\label{fig:tree-inference}
\end{figure}
\subsection{Microbiome Dataset and Taxonomy Construction Details}\label{appdx:micro-data}
\paragraph{Datasets.}
We use two microbiome datasets. \texttt{HMP} (Human Microbiome Project; 4,743 samples, 402 taxa) provides samples from 18 body sites with a curated NCBI-derived taxonomy. \texttt{cMD3} (curatedMetagenomicData v3; 20,238 samples from 86 studies, 2,047 taxa) aggregates shotgun metagenomic data across diverse cohorts. Disease labels denote any non-healthy diagnosis, pooled across conditions and body sites. Note that 748 \texttt{HMP} samples also appear in \texttt{cMD3}; we do not deduplicate, as our focus is methodological comparison. The \texttt{HMP} data were obtained from the \texttt{HMP16SData} package in R. Operational taxonomic unit (OTU) abundances and sample metadata were extracted, and samples were filtered to those with complete body site annotations. The taxonomic tree was constructed from the NCBI-derived lineage strings provided with each OTU, parsed from Kingdom through Genus, and converted to Newick format using the \texttt{ape} package. The \texttt{cMD3} metagenomic data were obtained from the \texttt{curatedMetagenomicData} package (v3.0) in R. We retrieved relative abundance data for all available studies, excluding \texttt{IaniroG\_2022}. Taxonomic abundance matrices and sample metadata were extracted from \texttt{TreeSummarizedExperiment} objects and merged using \texttt{mergeData}. Only samples present in both the abundance matrix and metadata were retained. Taxonomic lineages were parsed from strings of the form \texttt{k\_\_Kingdom|p\_\_Phylum|c\_\_Class|o\_\_Order|f\_\_Family|g\_\_Genus|s\_\_Species}, with rank prefixes removed. Taxon identifiers were generated via MD5 hashing (first 8 characters, prefixed \texttt{taxon\_}) for reproducibility.
\paragraph{Taxonomic Trees.}
For \texttt{HMP}, we use the NCBI-derived taxonomy provided with the dataset. For \texttt{cMD3}, the taxonomic tree was constructed from lineage strings using the \texttt{data.tree} package with a common root, converted to Newick format via \texttt{ape}, and assigned ultrametric branch lengths using Grafen's method. Tip labels were replaced with hash-based identifiers to match the abundance matrix. Because \texttt{cMD3} aggregates studies with heterogeneous taxonomic resolution, some internal nodes have children spanning multiple taxonomic ranks; we label such nodes by their lowest common rank (e.g., \emph{Bacteria (Kingdom)} or \emph{Mixed}).
\subsection{Single-Cell Dataset and Ontology Construction Details}\label{appdx:cell-data}
\paragraph{Single-Cell Dataset.}
We use \texttt{DISCO} (Database of Immune Single-Cell Omics), a curated atlas of human immune single-cell transcriptomes. Data were extracted via the \texttt{DISCOtoolkit} R package. We selected samples with $\geq$500 cells and randomly sampled up to 200 samples per condition. We extracted blood tissue (healthy, COVID-19, leukemia) and liver tissue (healthy, hepatocellular carcinoma). Cell type proportions were computed by counting cells per annotated type and normalizing to sum to one, following standard practice in single-cell compositional analysis~\citep{phipson2022propeller,buettner2021sccoda}. After processing: blood (199 healthy, 200 COVID-19, 199 leukemia; 62 cell types) and liver (200 healthy, 153 HCC; 99 cell types). For the main experiments, we use the leukemia and HCC tasks.
\paragraph{Cell Ontology Tree.}
The cell type hierarchy was obtained from DISCO's cell ontology API \citep{li2022disco}. For each tissue, we constructed a subtree by: (1) identifying cell types present in the data, (2) filtering to true leaves (types with no children in the data), and (3) tracing ancestor paths to the root. Unit branch lengths were assigned. The cell ontology contains extensive polytomies: blood has 14 nodes with $>$2 children (``T cell'' has 9 children); liver has similar structure with 99 leaves and 72 internal nodes.
\subsection{Software and Hyperparameters}\label{appdx:software}
Classification models were tuned via 5-fold cross-validation on training data. Grid search ranges and selected values are summarized in Table~\ref{tab:hyperparams}. Feature importance was computed via mean decrease in impurity (random forest), coefficient magnitude (logistic regression), or permutation importance (SVM).
\begin{table}[h]
\centering
\caption{Hyperparameter search grid and selected values.}
\label{tab:hyperparams}
\small
\begin{tabular}{llll}
\toprule
\textbf{Model} & \textbf{Parameter} & \textbf{Search Range} & \textbf{Used} \\
\midrule
Random Forest & \texttt{n\_estimators} & $\{100, 300, 500\}$ & 500 \\
& \texttt{max\_depth} & $\{10, 20, \texttt{None}\}$ & 20 \\
& \texttt{max\_features} & $\{\texttt{sqrt}, \texttt{log2}\}$ & \texttt{sqrt} \\
\midrule
Logistic Reg. & $C$ (inverse reg.) & $\{0.01, 0.1, 1, 10\}$ & 1 \\
& penalty & $\{\ell_1, \ell_2\}$ & $\ell_2$ \\
\midrule
SVM (RBF) & $C$ & $\{0.1, 1, 10\}$ & 1 \\
& $\gamma$ & $\{\texttt{scale}, 0.01, 0.1\}$ & \texttt{scale} \\
\bottomrule
\end{tabular}
\end{table}
We compare PolyILR against: (i) \textbf{CLR} (centered log-ratio), which ignores tree structure; and (ii) \textbf{PhILR}~\citep{silverman2017phylogenetic}, which requires arbitrary binary refinement of polytomies. Both use identical zero handling.
{\color{black}
\subsection{Handling Zeros in PolyILR} \label{appdx:zeros}
The raw compositional data (e.g., microbiome counts, single-cell type counts) typically exhibit high sparsity, with zeros comprising 70\% or more of entries. Since log-ratio transformations are undefined at zero, zero replacement is required as preprocessing. There is no consensus on the optimal choice; common choices include 0.5, 1, or smaller values, depending on whether the raw data are counts or proportions~\citep{kaul2017analysis,hu2022locom}. Because our focus is on comparing representations rather than zero-handling strategies, we adopt simple per-dataset choices appropriate to each data scale as follows. \texttt{HMP} and \texttt{cMD3} are count data: \texttt{HMP} provides raw 16S counts, and \texttt{cMD3} (curatedMetagenomicData v3) is retrieved with \texttt{counts=TRUE}, which multiplies relative abundances by read depth. For both, we add a pseudocount of 1 prior to normalization, i.e., $\tilde{x}_i = (x_i + 1) / \sum_j (x_j + 1)$, which is commonly done at count scale. For \texttt{cMD3}, one study (\texttt{IaniroG\_2022}) was excluded because read depth metadata was unavailable. \emph{DISCO} provides cell-type proportions rather than counts, so we instead use $\epsilon = 10^{-10}$ applied additively before renormalization. We note that PolyILR partially mitigates the effect of zero replacement, because each coordinate is a contrast between \emph{geometric means over clades} rather than between individual taxa (Section~\ref{sec:construction}), but a rigorous study is for future work.
}
% A pseudocount of 1 was added to all entries prior to normalization, i.e., $\tilde{x}_i = (x_i + 1) / \sum_j (x_j + 1)$. This is standard practice in compositional data analysis; common choices include 0.5, 1, or smaller values, with no consensus on optimal selection~\citep{kaul2017analysis,hu2022locom}. Our focus is on comparing representations rather than zero-handling strategies.
{\color{black}
\subsection{PolyILR's Robustness under Topological Noise}\label{appdx:nni}
As discussed in Section~\ref{sec:conclusion}, PolyILR assumes a fixed input tree $\mathcal{T}$, and its coordinates are defined relative to $\mathcal{T}$. This is reasonable because PolyILR is designed for \emph{curated scientific hierarchies} provided by domain experts (e.g., phylogenies, taxonomies, or ontologies) which can largely be trusted. In practice, however, some tree noise or error is unavoidable. One common form is \emph{topological noise}, e.g., small misestimations of branching order or leaf placement. Therefore, we provide a preliminary analysis of how the PolyILR basis and resulting representations respond to such local perturbations in the input tree, both empirically (as semantic stability of selected features) and structurally (as how much of the basis $V$ is preserved).
We introduce topological noise via random \emph{nearest-neighbor interchange} (NNI) operations on the NCBI taxonomy of the \texttt{HMP} dataset. Each NNI swaps two subtrees across an internal edge, locally rearranging the tree without changing leaf labels. We report perturbation strength as the absolute number of NNI applied randomly. We use the \texttt{HMP} body-subsite task (18 classes, $d=402$ taxa), matching the setting of Table~\ref{tab:repr-stability} (bottom).
\begin{table}[h]
\centering
\small
\begin{tabular}{cc}
\toprule
\#NNIs & PolyILR semantic top-10 stability \\
\midrule
0 & 0.73 $\pm$ 0.10 \\
1 & 0.71 $\pm$ 0.11 \\
2 & 0.68 $\pm$ 0.09 \\
3 & 0.65 $\pm$ 0.08 \\
\bottomrule
\end{tabular}
\vspace{3pt}
\caption{Semantic Jaccard similarity of top-10 PolyILR features under NNI perturbations on the \texttt{HMP} taxonomy (18 body subsites, 402 taxa). Mean $\pm$ std over 10 perturbed trees $\times$ 10 seeds.}
\vspace{-15pt}
\label{tab:nni-semantic}
\end{table}
\textbf{Semantic stability under NNI.}
For each NNI count, we perturb the original tree, recompute the PolyILR basis $V$, retrain the downstream RF model, and re-extract the top-10 important features. We then measure semantic Jaccard similarity of the top-10 features against the unperturbed baseline, averaged over 10 perturbed trees and 10 random seeds (Table~\ref{tab:nni-semantic}). Other setups mirror those used for Table~\ref{tab:repr-stability}. At 0 NNIs (no noise), the result matches Table~\ref{tab:repr-stability} (bottom). As we introduce more NNIs, PolyILR degrades smoothly but \emph{remains substantially more stable than PhILR} even at 3 NNIs: PolyILR at 3 NNIs (0.65) is still well above PhILR at 0 NNIs (0.13, from Table~\ref{tab:repr-stability} bottom), which suffers from binarization-induced instability on top of any tree noise. This shows that PolyILR remains effective even at moderate noise levels.
\textbf{Locality of NNI effects on the basis $V$.}
The robustness above has a structural explanation: the PolyILR basis factors node by node. For each internal node $u$ with children $c_1, \ldots, c_{k_u}$, $V$ contains exactly $k_u - 1$ local basis vectors associated with $u$. Once child ordering is fixed, this local block depends only on the partition of descendant leaves induced by the children of $u$ and their subtree sizes $\{n_r\}$ (Section~\ref{sec:construction}). After spreading, each basis is supported only on the leaves descending from $u$, and no node's construction references any other node's local structure. Therefore, a local topological change has only a local effect on $V$.
Consider an NNI at an internal edge $(p, c)$, where $p$ is the parent of $c$. At $p$ and $c$, the child partitions directly change, so the local coordinate blocks of $p$ and $c$ in $V$ also change; above $p$, the swap happens entirely within $p$'s subtree, so the descendant leaf sets under each ancestor's children, and their subtree sizes, are unchanged, so their local blocks in $V$ are \emph{exactly preserved}; below $c$, the internal structure of each subtree is untouched, so again their local blocks in $V$ are \emph{exactly preserved}. This way, an NNI perturbation modifies only the coordinate blocks attached to a small set of affected nodes; all others remain preserved.
\begin{table}[h]
\centering
\small
\begin{tabular}{cccc}
\toprule
\#NNIs & Cols at perturbed nodes & Cols changed & Cols preserved (\%) \\
\midrule
1 & 18.8 & 8.4 & 392.6 / 401 (97.9\%) \\
2 & 26.6 & 13.2 & 387.8 / 401 (96.7\%) \\
3 & 36.6 & 18.6 & 382.4 / 401 (95.4\%) \\
\bottomrule
\end{tabular}
\vspace{3pt}
\caption{NNI effects on $V$ (\texttt{HMP}, 402 taxa, 401 coords; mean over 5 seeds). We report the number of cumulative NNIs, the numbers of columns at perturbed nodes, of columns that changed, and of columns that are preserved.}
\vspace{-15pt}
\label{tab:nni-locality}
\end{table}
We verify this empirically on the \texttt{HMP} taxonomy (402 taxa, 401 PolyILR coordinates) above. For each NNI count, we apply $\{1, 2, 3\}$ cumulative random NNI moves and compare $V$ before and after, averaged over 5 seeds. In Table~\ref{tab:nni-locality}, we observe that the number of changed columns never exceeds the number of columns at perturbed nodes, and most of $V$ remains exactly preserved. This empirically supports the structural argument and helps explain the mild degradation seen in Table~\ref{tab:nni-semantic}.
}
\subsection{Extended Classification Results}\label{appdx:ml}
We provide a preliminary empirical illustration of the geometric connection described in Section~\ref{sec:ml}. Using \texttt{CIFAR-100} with its known 20-superclass hierarchy and a ResNet-34 trained to 80.4\% test accuracy, we ask two questions: (i) Does the true semantic hierarchy capture structure in the model's error distribution that arbitrary hierarchies do not? (ii) If so, how does this structure develop during training?
\paragraph{Setup and discussion.} The \texttt{CIFAR-100} hierarchy has 100 fine classes grouped into 20 superclasses, yielding a two-level tree with 19 depth-0 coordinates (superclass contrasts) and 80 depth-1 coordinates (within-superclass contrasts). For each test sample, we compute the gradient $\nabla_{\mathbf{a}} \ell = \mathbf{V}^\top (\mathbf{p} - \mathbf{e}_y)$ in PolyILR coordinates and measure how gradient norm distributes across depths. We summarize this via \emph{gradient entropy}: $H = -\sum_d p_d \log p_d$, where $p_d$ is the fraction of total gradient norm at depth $d$. Lower entropy indicates concentration at specific depths, which we view as \emph{some structure} emerging.
\emph{(i) Known tree vs.\ shuffled trees.} We compare the true hierarchy against 1000 random trees constructed by permuting leaf assignments while preserving structure. For the trained model, the true tree yields significantly lower entropy (0.576 vs.\ $0.632 \pm 0.001$; $p < 0.001$), indicating that errors concentrate at specific depths under the true hierarchy but not under arbitrary ones. For a randomly initialized model, no difference exists ($p = 0.73$). This confirms that this structure emerges from learning rather than architectural bias. This aligns with recent work showing that flat classifiers implicitly encode semantic hierarchies recoverable from logits alone~\citep{palumbo2025from}.
\emph{(ii): Learning dynamics.} We track gradient distribution across 200 training epochs. The fraction at depth 1 (within-superclass) increases from 0.68 to 0.74 over training, consistent with the model progressively resolving coarse superclass distinctions before fine-grained class boundaries. This coarse-to-fine pattern---recently termed \emph{hypernym bias}~\citep{malashin2025hypernym}---reflects curriculum-like learning where easier (coarser) distinctions are learned first.
\paragraph{Implication.} These results suggest that PolyILR coordinates may provide a meaningful lens for analyzing softmax classifiers and steering model training when class hierarchies are available. The gradient decomposition partly reveals where in the hierarchy a model's errors concentrate and how this evolves during training. We view this as opening a research direction rather than a complete empirical study, which we leave to future work.
\input{figure/cifar100-appdx}
\subsection{Full Experimental Results}\label{appdx:exp-results}
This appendix provides complete experimental results; biological interpretation is in Section~\ref{sec:main-exp}. The patterns are consistent with those discussed in the main text: PolyILR recovers interpretable taxonomic and ontological contrasts across all tasks. Deeper biological validation—including wet-lab experiments and large-scale cohort studies—is beyond the scope of this methodological work. {\color{black}Throughout these tables, we report point estimates alongside variability (e.g., 95\% confidence intervals for accuracy and AUROC, std for importance, and rank range across CV folds), which are small in our observations and demonstrate robustness of the reported numbers.}
Table~\ref{tab:app-representation-all} reports classification accuracy {\color{black}and AUROC with 95\% CIs} across all tasks: body sites/subsites (\texttt{HMP}), westernization/age/health/body site (\texttt{cMD3}), and COVID-19(blood)/leukemia(blood)/HCC(liver) (\texttt{DISCO}). {\color{black}SVM and LR are identical across CLR, PhILR, and PolyILR within each task, as expected from isometry; RF varies modestly.} Table~\ref{tab:app-stability-all} reports feature stability (Jaccard similarity of top-$K$ features across CV folds); PolyILR remains stable while PhILR suffers from arbitrary binarization for both index and semantic stabilities. Tables~\ref{tab:app-contrasts-hmp}--\ref{tab:app-contrasts-disco} list the top-10 PolyILR contrasts by RF importance for \texttt{HMP} (microbiome, body sites), \texttt{cMD3} (microbiome, health/lifestyle), and \texttt{DISCO} (single-cell, disease){\color{black}, with mean importance, std, and rank range across 5-fold CV}. Each contrast is a log-ratio of geometric means between two groups at a tree node. Tables~\ref{tab:app-tree-hmp}--\ref{tab:app-tree-disco} report tree-level aggregation results, with importance aggregated by depth (cumulative), subtree, node, and taxon/cell-type levels. Accuracy columns show predictive performance using only features at that level.
% \input{table/appdx_all}
\input{table/appdx_all_updated}