\section{Methods}

This section describes the proposed Statistically Coherent Network (SCN,  Fig.~\ref{fig:architecture}), a deep learning framework designed to integrate heterogeneous clinical data for disease classification. SCN incorporates three key data modalities; DICOM images, radiomic features, and structured patient attributes, and aligns them within a unified latent representation through multi-space encoding and statistical constraints. The following subsections detail the overall architecture and the mechanisms used to enforce group-level coherence in the learned representations.

\subsection{Statistical Similarity Network}


\subsubsection{Overall Architecture}

The SCN framework is designed to integrate three heterogeneous data modalities: (1) DICOM images $\mathbf{X}_{\text{img}} \in \mathbb{R}^{H \times W \times C}$, (2) radiomic features $\mathbf{X}_{\text{rad}} \in \mathbb{R}^{d_r}$, and (3) structured patient attributes $\mathbf{X}_{\text{meta}} \in \mathbb{R}^{d_m}$. These modalities are processed independently before being merged into a unified latent representation. The image and radiomic inputs are passed through separate convolutional encoders:
\begin{align}
    \mathbf{Z}_{\text{img}} &= f_{\text{img}}(\mathbf{X}_{\text{img}}) \in \mathbb{R}^{k \times d}, \\
    \mathbf{Z}_{\text{rad}} &= f_{\text{rad}}(\mathbf{X}_{\text{rad}}) \in \mathbb{R}^{k \times d},
\end{align}
where $f_{\text{img}}$ and $f_{\text{rad}}$ are CNN-based feature extractors, and $k$ denotes the number of latent subspaces.

In parallel, patient attributes are encoded via a feed-forward embedding network:
\begin{align}
    \mathbf{Z}_{\text{meta}} = f_{\text{meta}}(\mathbf{X}_{\text{meta}}) \in \mathbb{R}^{k \times d},
\end{align}
which projects both categorical and numerical metadata into the shared latent space. All three modality-specific embeddings are fused using a latent integration function:
\begin{align}
    \mathbf{Z}_{\text{fused}} = \phi(\mathbf{Z}_{\text{img}}, \mathbf{Z}_{\text{rad}}, \mathbf{Z}_{\text{meta}}) \in \mathbb{R}^{k \times d},
\end{align}
where $\phi(\cdot)$ denotes the fusion operator that combines subspace-wise embeddings. The integrated representation is then passed to a classification head $\psi(\cdot)$ to produce the predicted class distribution:
\begin{align}
    \hat{\mathbf{y}} = \psi(\mathbf{Z}_{\text{fused}}) \in \mathbb{R}^{C},
\end{align}
where $C$ is the number of output classes. The model is trained end-to-end using a composite loss:
\begin{align}
    \mathcal{L}_{\text{total}} = \mathcal{L}_{\text{sup}} + \lambda_1 \mathcal{L}_{\text{stat}} + \lambda_2 \mathcal{L}_{\text{triplet}},
\end{align}
where $\mathcal{L}_{\text{sup}}$ is the supervised cross-entropy loss, and the additional terms enforce distributional alignment across patient groups. Detailed formulations of $\mathcal{L}_{\text{stat}}$ and $\mathcal{L}_{\text{triplet}}$ are described in subsequent subsections.


\subsubsection{Latent Representation}

\begin{figure}
    \centering
    \includegraphics[width=1.0\linewidth]{figures/figure-05-LM-repr.png}
    \caption{
    Illustration of the multi-space latent representation in SCN. Each row corresponds to a patient subgroup, and each column represents a distinct latent subspace $\mathbf{z}_i$. The distribution of feature activations across subspaces reflects the statistical structure learned from both image and metadata. SCN encourages samples within the same subgroup to exhibit similar distributions across all subspaces, while enforcing distributional divergence across different subgroups.
    }
    \label{fig:eg-representation}
\end{figure}




SCN introduces a multi-space latent representation to overcome the limitations of single-vector embeddings, which often collapse nuanced variation in heterogeneous clinical datasets. Conventional models typically encode modality-specific features into a single latent vector $\mathbf{z} \in \mathbb{R}^d$, which may entangle group-specific patterns and reduce representational flexibility. Instead, SCN constructs a multi-subspace embedding defined as
\begin{equation}
    \mathbf{Z} = [\mathbf{z}_1, \mathbf{z}_2, \ldots, \mathbf{z}_k] \in \mathbb{R}^{k \times d},
\end{equation}
where each sub-vector $\mathbf{z}_i \in \mathbb{R}^{d}$ encodes complementary semantics from the fused image, radiomic, and metadata streams. This design enables the model to distribute the latent capacity across $k$ interpretable subspaces, each potentially aligned with different factors such as anatomical regions, radiomic texture, or demographic variations. The multi-space formulation allows the model to preserve intra-group consistency while maintaining inter-group discrimination, which is not achievable with a monolithic latent vector. To motivate this distinction, we consider the statistical separability between subpopulations: let $\mathcal{P}_g(\mathbf{z})$ be the embedding distribution for patient group $g$. In single-vector setups, inter-group overlap may result in
\[
\mathcal{D}_{\mathrm{KL}} \big( \mathcal{P}_{g_1}(\mathbf{z}) \,\|\, \mathcal{P}_{g_2}(\mathbf{z}) \big) \approx 0,
\]
whereas SCN encourages distinctiveness across subspaces such that
\[
\sum_{i=1}^{k} \mathcal{D}_{\mathrm{KL}} \big( \mathcal{P}_{g_1}(\mathbf{z}_i) \,\|\, \mathcal{P}_{g_2}(\mathbf{z}_i) \big) \gg 0.
\]
This formulation ensures that each subspace contributes to group-level representation disentanglement, enabling the downstream classifier to capture richer and more structured decision boundaries. As illustrated in Figure~\ref{fig:eg-representation}, the proposed representation leads to compact intra-group clusters and better-separated inter-group regions in latent space.


\subsubsection{Radiomics Feature Integration from DICOM}
Radiomics is a computational approach for extracting a large number of quantitative features from medical images that reflect tissue heterogeneity, texture, shape, and intensity statistics~\cite{hunter2013radiomics}. In the context of SCN, we leverage radiomic descriptors derived from DICOM images as an intermediate representation that complements raw pixel-level encoding with high-level semantic and morphological information.

Given a DICOM image $\mathbf{X}_{\text{img}} \in \mathbb{R}^{H \times W \times C}$, a radiomics extraction function $f_{\text{rad}}^{\text{ext}}(\cdot)$ is applied to compute a feature vector:
\begin{equation}
    \mathbf{X}_{\text{rad}} = f_{\text{rad}}^{\text{ext}}(\mathbf{X}_{\text{img}}) \in \mathbb{R}^{d_r},
\end{equation}
where $d_r$ is the number of handcrafted features such as first-order statistics (e.g., mean, skewness), texture matrices (e.g., GLCM, GLSZM), and shape descriptors. These features are standardized and passed through a dedicated CNN encoder:
\begin{equation}
    \mathbf{Z}_{\text{rad}} = f_{\text{rad}}(\mathbf{X}_{\text{rad}}) \in \mathbb{R}^{k \times d},
\end{equation}
aligning them structurally with image and metadata representations in the multi-space latent domain.

Radiomics provides two key advantages within SCN. First, it encapsulates interpretable, handcrafted image statistics that can enhance model transparency and enable hypothesis-driven analysis. Second, radiomic features often capture disease-specific patterns that may not be fully captured by deep convolutional filters, especially in cases of limited training data or subtle pathology. Moreover, because radiomics is inherently voxel- or region-level in nature, it can be linked with localized pathophysiology, offering complementary information to global CNN features. In SCN, we treat radiomics as a modality parallel to the image encoder and metadata stream, ensuring equal participation in latent feature fusion and subgroup-specific representation learning. By combining data-driven and expert-engineered features, the model benefits from both statistical robustness and clinical relevance.



\subsection{Training Pipeline}
\subsubsection{T-stochastic Loss: Statistical Interpretation}


\begin{figure}[hbp!]
    \centering
    \includegraphics[width=1.0\linewidth]{figures/figure-02-train.png}
    \caption{
    Visualization of the training pipeline and T-stochastic loss mechanism in SCN. Anchor-positive pairs (top) are drawn from the same clinical subgroup and are encouraged to exhibit similar distributions across latent subspaces. Anchor-negative pairs (bottom), sampled from different subgroups, are penalized unless their latent representations remain statistically distinct. Each histogram illustrates a subspace embedding distribution, and the loss enforces alignment via a t-statistic-based constraint.
    }
    \label{fig:lossfunction}
\end{figure}

To enforce statistical coherence among latent representations of clinically similar patient groups, SCN introduces a T-stochastic loss grounded in classical two-sample hypothesis testing. The model assumes that patients within the same group (e.g., similar age, BMI) should yield statistically similar latent distributions, while those from distinct groups should diverge. Let $\mathbf{Z}(\mathbf{x}) \in \mathbb{R}^{k \times d}$ denote the multi-space latent representation for sample $\mathbf{x}$, where $k$ is the number of subspaces and $d$ the dimensionality of each subspace. The mean and variance across subspaces are defined as:
\begin{equation}
\label{eq:distributions}
    \mu(\mathbf{x}) = \frac{1}{k} \sum_{i=1}^{k} \mathbf{z}_i, 
    \quad
    V(\mathbf{x}) = \frac{1}{k} \sum_{i=1}^{k} \left\| \mathbf{z}_i - \mu(\mathbf{x}) \right\|^2.
\end{equation}
To measure distributional similarity, we define a pooled $t$-statistic to quantify the normalized difference between two samples $\mathbf{x}$ and $\mathbf{x}'$:
\begin{equation}
\label{eq:lstoch}
    t(\mathbf{x}, \mathbf{x}') = \frac{ \left\| \mu(\mathbf{x}) - \mu(\mathbf{x}') \right\|_2 }
    { \sqrt{ \frac{ V(\mathbf{x}) + V(\mathbf{x}') }{k} } }.
\end{equation}
This expression is inspired by the classical two-sample t-test. When $\mathbf{x}$ and $\mathbf{x}'$ come from the same distribution, their means are close and the pooled variance dominates, resulting in a small $t$-value. When they originate from different distributions, the mean difference becomes large, leading to a higher $t$-value. In the training phase, for each anchor $\mathbf{x}$, we sample a positive $\mathbf{x}^p$ from the same group and a negative $\mathbf{x}^n$ from a different group. To enforce desirable group behavior, we formulate the T-stochastic loss as
\begin{align}
\mathcal{L}_{\text{T-stochastic}} 
= & \; \max\left(0,\, t(\mathbf{x}, \mathbf{x}^p) - t_{\text{c.v.}} \right) \nonumber \\
  & + \max\left(0,\, t_{\text{c.v.}} - t(\mathbf{x}, \mathbf{x}^n) \right) \label{eq:t_loss}
\end{align}
where $t_{\mathrm{c.v.}}$ is a critical value from the $t$-distribution. This loss penalizes intra-group pairs whose distributions deviate too much, and inter-group pairs that are too similar. Figure~\ref{fig:lossfunction} illustrates how the model enforces statistical similarity among samples in the same group.

This formulation is equivalent to enforcing asymmetric hypothesis constraints: accepting the null hypothesis $H_0^{\text{pos}}$ that $\mathbf{x}$ and $\mathbf{x}^p$ come from the same distribution when $t(\cdot)<t_{\mathrm{c.v.}}$, and rejecting $H_0^{\text{neg}}$ for $\mathbf{x}$ and $\mathbf{x}^n$ when $t(\cdot)>t_{\mathrm{c.v.}}$. Compared to classical contrastive or triplet loss, this formulation provides a statistically testable mechanism for distributional alignment across patient subgroups. Moreover, the use of $k$ independent subspaces improves the reliability of the statistical estimate. Under the central limit theorem, the aggregated mean $\mu(\mathbf{x})$ approximates a normal distribution even when each $\mathbf{z}_i$ is not, ensuring that $t(\mathbf{x}, \mathbf{x}')$ is a reliable test statistic. This loss function therefore promotes interpretability, robustness, and generalization by enforcing statistical consistency across multi-modal representations.


% \subsubsection{Loss Functions and Optimized Components}

% The SCN framework is trained end-to-end using a composite loss function that supervises both the prediction task and the structural properties of the latent space. Let $f_{\text{img}}(\cdot)$, $f_{\text{rad}}(\cdot)$, and $f_{\text{meta}}(\cdot)$ denote the encoders for DICOM images, radiomics features, and patient metadata, respectively. The outputs are fused via a latent integration module $\phi(\cdot)$, producing a multi-space latent representation $\mathbf{Z}(\mathbf{x}) = \phi(f_{\text{img}}(\mathbf{x}_{\text{img}}), f_{\text{rad}}(\mathbf{x}_{\text{rad}}), f_{\text{meta}}(\mathbf{x}_{\text{meta}}))$. A classifier $\psi(\cdot)$ maps this representation to prediction scores.

% The primary task is supervised disease classification, optimized via cross-entropy:
% \begin{equation}
%     \mathcal{L}_{\text{sup}} = -\sum_{c=1}^{C} y_c \log \hat{y}_c,
% \end{equation}
% where $C$ is the number of classes, $y_c \in \{0,1\}$ is the one-hot ground truth label, and $\hat{y}_c = \psi(\mathbf{Z}(\mathbf{x}))_c$ is the predicted probability for class $c$. This loss directly updates all encoder networks ($f_{\text{img}}$, $f_{\text{rad}}$, $f_{\text{meta}}$), the fusion module $\phi(\cdot)$, and the classification head $\psi(\cdot)$. To promote distributional coherence across clinically similar samples, we incorporate the T-stochastic loss (eq. 12) with equations (10) and (11). This term influences only the encoders and fusion module ($f_{\text{img}}, f_{\text{rad}}, f_{\text{meta}}, \phi$), and shapes the latent space to align distributions across anchor-positive pairs and separate those across anchor-negative pairs, based on group membership.

% Additionally, a triplet loss is applied to enforce geometric consistency:
% \begin{align}
% \mathcal{L}_{\text{triplet}} 
% &= \max\Big(0,\, \| \mu(\mathbf{x}) - \mu(\mathbf{x}^p) \|_2^2 \notag \\
% &\quad - \| \mu(\mathbf{x}) - \mu(\mathbf{x}^n) \|_2^2 + \alpha \Big)
% \end{align}
% where $\alpha$ is a margin hyperparameter and $\mu(\cdot)$ is the average of latent subspace vectors. This loss further refines the geometry of $\mathbf{Z}(\mathbf{x})$ by pulling similar patients closer and pushing dissimilar ones apart.

% The final training objective is the weighted combination:
% \begin{equation}
%     \mathcal{L}_{\text{total}} = 
%     \mathcal{L}_{\text{sup}} 
%     + \lambda_1 \mathcal{L}_{\text{T-stochastic}} 
%     + \lambda_2 \mathcal{L}_{\text{triplet}},
% \end{equation}
% where $\lambda_1$ and $\lambda_2$ are tunable coefficients with inital values of 1.0. The total loss guides SCN to jointly optimize classification accuracy, intra-group distributional coherence, and inter-group separability. As a result, the model learns latent representations that are predictive, statistically interpretable, and robust to clinical heterogeneity.

\subsubsection{Loss Functions and Optimized Components}

The SCN framework is trained end-to-end using a composite objective that supervises disease classification accuracy, statistical alignment across clinically similar groups, and geometric consistency in the latent space. Let $f_{\text{img}}(\cdot)$, $f_{\text{rad}}(\cdot)$, and $f_{\text{meta}}(\cdot)$ be modality-specific encoders for DICOM images, radiomic features, and structured metadata, respectively. Their outputs are fused by a shared integration module $\phi(\cdot)$ to produce multi-space latent representation:
\begin{equation}
    \mathbf{Z}(\mathbf{x}) = \phi\big(f_{\text{img}}(\mathbf{x}_{\text{img}}),\ f_{\text{rad}}(\mathbf{x}_{\text{rad}}),\ f_{\text{meta}}(\mathbf{x}_{\text{meta}})\big) \in \mathbb{R}^{k \times d},
\end{equation}
where $k$ denotes the number of subspaces. A classification head $\psi(\cdot)$ maps this representation to class probabilities $\hat{\mathbf{y}} = \psi(\mathbf{Z}(\mathbf{x}))$.

The primary classification objective is the cross-entropy loss ($\mathcal{L}_{\text{sup}} = -\sum_{c=1}^{C} y_c \log \hat{y}_c$), where $y_c \in \{0,1\}$ is the one-hot label and $\hat{y}_c = \psi(\mathbf{Z}(\mathbf{x}))_c$ is the predicted class score. This loss contributes gradients to all modules, i.e.,
\[
\frac{\partial \mathcal{L}_{\text{sup}}}{\partial \theta_{\text{img}}},\quad 
\frac{\partial \mathcal{L}_{\text{sup}}}{\partial \theta_{\text{rad}}},\quad 
\frac{\partial \mathcal{L}_{\text{sup}}}{\partial \theta_{\text{meta}}},\quad 
\frac{\partial \mathcal{L}_{\text{sup}}}{\partial \theta_\phi},\quad 
\frac{\partial \mathcal{L}_{\text{sup}}}{\partial \theta_\psi},
\]
thus updating all parameters including the classifier $\psi$. To promote distributional coherence among latent representations of similar cohorts, the T-stochastic loss $\mathcal{L}_{\text{T-stochastic}}$ is introduced (see Eq.~\eqref{eq:lstoch}). It minimizes the pooled $t$-statistic between anchor-positive pairs and maximizes it for anchor-negative pairs. Let $\mu(\mathbf{x}) = \frac{1}{k} \sum_{i=1}^k \mathbf{z}_i$ and $V(\mathbf{x}) = \frac{1}{k} \sum_{i=1}^k \|\mathbf{z}_i - \mu(\mathbf{x})\|^2$, then the loss influences:
\[
\frac{\partial \mathcal{L}_{\text{T-stochastic}}}{\partial \theta_{\text{img}}},\quad 
\frac{\partial \mathcal{L}_{\text{T-stochastic}}}{\partial \theta_{\text{rad}}},\quad 
\frac{\partial \mathcal{L}_{\text{T-stochastic}}}{\partial \theta_{\text{meta}}},\quad 
\frac{\partial \mathcal{L}_{\text{T-stochastic}}}{\partial \theta_\phi},
\]
and does not affect the classifier $\psi$, as it exclusively targets the latent structure $\mathbf{Z}(\mathbf{x})$. A triplet loss $\mathcal{L}_{\text{triplet}}$ complements by enforcing pairwise separation in embedding space:
\begin{align}
\mathcal{L}_{\text{triplet}} 
&= \max\left(0,\, \|\mu(\mathbf{x}) - \mu(\mathbf{x}^p)\|_2^2 \right. \notag \\
&\quad \left. - \|\mu(\mathbf{x}) - \mu(\mathbf{x}^n)\|_2^2 + \alpha \right),
\end{align}
where $\alpha$ is a fixed margin and $\mu(\cdot)$ is the subspace-wise mean. This loss pulls positive examples closer and pushes negatives farther in latent geometry, yielding gradients with respect to encoder and fusion parameters only:
\[
\frac{\partial \mathcal{L}_{\text{triplet}}}{\partial \theta_{\text{img}}},\quad 
\frac{\partial \mathcal{L}_{\text{triplet}}}{\partial \theta_{\text{rad}}},\quad 
\frac{\partial \mathcal{L}_{\text{triplet}}}{\partial \theta_{\text{meta}}},\quad 
\frac{\partial \mathcal{L}_{\text{triplet}}}{\partial \theta_\phi}.
\]
The total loss is defined as:
\begin{equation}
    \mathcal{L}_{\text{total}} = 
    \mathcal{L}_{\text{sup}} 
    + \lambda_1 \mathcal{L}_{\text{T-stochastic}} 
    + \lambda_2 \mathcal{L}_{\text{triplet}},
\end{equation}
with $\lambda_1 = \lambda_2 = 1.0$ by default and empirically tuned in $\{0.1, 0.5, 1.0, 2.0\}$. Each component is optimized via backpropagation based on its respective gradient flow.

Unlike conventional architectures that compress all variability into a single latent vector $\mathbf{z} \in \mathbb{R}^d$, SCN disentangles latent structure into $k$ independent subspaces $\mathbf{Z} \in \mathbb{R}^{k \times d}$. By the central limit theorem, this reduces the variance of estimated means via $\mathrm{Var}[\mu(\mathbf{x})] \sim \sigma^2/k$, stabilizing t-statistic estimation across groups. As a result, the model yields statistically coherent, geometrically structured, and diagnostically robust representations suitable for heterogeneous clinical environments.
