17 Feature Histogram
Feature histograms give an instant readout of each group’s center, spread, skew and any multi-peaked shape that raw tables hide. FLIM Playground plots a histogram for each group based on the selected numerical feature. Additionally, the Gaussian Mixture Model mode can help find subcomponents of each histogram in an unsupervised way. To quantify the distribution heterogeneity, normalized H-index is calculated for each group.
17.2 Histogram Mode
Select Apply Gaussian Mixture Model to switch from histogram mode to GMM mode. Clear it to return to the histogram.
A Log X checkbox next to the mode switch transforms the selected feature with \(\log_{10}(x + 10^{-6})\) before computing either analysis. Histogram bins and skewness then describe transformed values; the GMM components, model selection, classification thresholds, and H-index are also computed in log space. The small offset allows zero values. If negative values are present, the app reports an error and keeps the original scale.
Histogram mode plots observation counts for each group. Use Bin Width to adjust the shared bins. The default uses NumPy’s automatic choice between the Sturges and Freedman–Diaconis estimators (see NumPy’s bin estimators). Widths are capped at one-third of the data range and adjusted in steps of \(1/50\) of the range. The app keeps separate width choices for each feature’s raw and logarithmic scales. A constant or very small dataset may have a single bin and no width control.
The legend reports each group’s bias-corrected skewness. It displays undefined for fewer than three observations or a constant group. Enable Show group counts (n) in legend under Plot Styling to include the number of observations in each group.
As a rule of thumb, interpret skewness as follows:
- Strongly left-skewed: < -1
- Moderately left-skewed: -1 to -0.5
- Approximately symmetric: -0.5 to -0.25 and 0.25 to 0.5
- Almost symmetric: -0.25 to 0.25
- Moderately right-skewed: 0.5 to 1
- Strongly right-skewed: > 1
Skewness alone cannot describe every distribution shape: a symmetric distribution can still have several peaks. When these peaks might represent subpopulations, such as cell types, states, or cell-cycle phases, use Gaussian Mixture Model mode to explore possible components.
17.3 Separate by
Choose one categorical column in Separate by to stack one full-width histogram or GMM panel per category. The same color represents the same Color by group in every panel. The separation column is removed from the available Color by choices.
For the inhibitor dataset, select a1 under Lifetime fit_nadh, set Separate by → cell_line, and set Color by → treatment. Keep the categorical filters at All and Apply Gaussian Mixture Model cleared. The result is exactly two stacked histograms: Panc1 above MCF7.
All panels share axis ranges and, in histogram mode, bin edges. Histogram legends report local skewness; both modes can display local counts. GMMs are fitted separately within each category and color group. Their component tables and fitting notices appear below the plots, with table titles in category × color group form.
Changing Separate by changes the populations being modeled. This method always uses individual observations; averaging by category is available in Feature Comparison and 2D Feature Distribution.
17.4 Gaussian Mixture Model Mode
A Gaussian Mixture Model (GMM) represents a distribution as a weighted sum of Gaussian (normal) components, each with its own mean (\(\mu\)) and variance (\(\sigma^2\)). The fit estimates these parameters and the component weights, commonly using the Expectation-Maximization (EM) algorithm, to capture multiple peaks that a single Gaussian cannot.
17.4.1 Fit Gaussian Mixture Models
- Fits candidate GMMs directly to the selected numerical values, starting with one component and continuing up to
Max Components. The maximum can be set from 2 to 5; its default is 3. Each component has a weight (\(w_i\)), mean (\(\mu_i\)), and variance (\(\sigma_i^2\)). - Retains only valid models in which every component has weight at least
Min Weight Threshold(default 0.1, or 10%; the weights of all components add to 1). - Chooses the valid model with the lowest BIC score, which penalizes complexity to discourage overfitting.
The plot shows the fitted mixture density and, for a model with multiple components, its component curves. Tables below the plot report Mean ± SD, Weight, and the group’s H-index. These are fitted component parameters based on soft membership probabilities; the mean, SD, and fraction of rows assigned to a component by a hard rule can differ. A group needs at least two distinct observations for fitting. Groups with insufficient data or no valid model receive a notice without preventing the other groups from being analyzed.
17.4.2 Heterogeneity index
The H-index summarizes subpopulation structure in each group’s fitted mixture. Each component contributes its weight’s entropy term, \(-w_i \log w_i\)1, multiplied by the distance from its mean \(\mu_i\) to the mixture mean \(\bar\mu = \sum_{i=1}^k w_i\,\mu_i\). That distance is normalized by the standard deviation of the component means. \[ H =\sum_{i=1}^{k}\bigl(-w_i \log w_i\bigr)\,d_i, \qquad d_i \;=\; \frac{\lvert\mu_i - \bar{\mu}\rvert}{\sigma} \]
17.4.3 Classification
For fits with more than one component, the app assigns each observation to one subpopulation using hard assignment by default. Select Use intersection as threshold to use intersection thresholding instead. Components are numbered in ascending order of their fitted means under either rule. A one-component fit has H-index 0 and leaves its rows unassigned, as do groups with insufficient data or no valid fit.
Export labeled data
Double-click a subpopulation’s Name in its component table to set the label used in the download. Exported column name defaults to GMM_group; if that column already exists, the app uses an available name such as GMM_group_2. Click Download GMM Grouped Data to save gmm_grouped_data.csv.
Default values look like 0.5hr_group1 and 0.5hr_group2. With Separate by, labels include the category, for example {category}::{color_group}_group1; without a color group they use {category}_group1. You can give multiple components the same exported name to combine their labels. Names must be nonempty, and the exported column name cannot overwrite another column. Naming changes affect the exported copy and script, while the fitted curves and parameters stay the same.
The CSV contains the analyzed observations after filtering and removal of missing values in the selected feature. It retains their available columns, including the analyzed values when Log X is enabled, plus the new label column. Unassigned rows have an empty label. The download is available when at least one group has generated labels.
On reupload, the label column follows the normal column-role review; its name has no special reserved role. Assign it Categorical to use its labels in filters and grouping. The exported Python script retains the naming choices; set SAVE_DERIVED_DATA = True in the script to also save the labeled CSV.
Intersection thresholding
- Once the GMM is estimated, thresholds can be obtained by locating the intersection points of adjacent component densities: \[ w_1\,\mathcal{N}(x;\mu_1,\sigma_1^2) \;=\; w_2\,\mathcal{N}(x;\mu_2,\sigma_2^2) \] where \(w_1, \mu_1, \sigma_1\) are the mixture weight, mean, and standard deviation of the first Gaussian component, respectively, and \(w_2, \mu_2, \sigma_2\) those of the second component.
- The app searches between adjacent component means with Brent’s root-finding method. When valid, increasing intersection thresholds are found, data points are assigned to the intervals they define. Weighted Gaussian components need not intersect between their means, so this rule is not always available.
If valid, increasing intersection thresholds cannot be found for a group, the app reports this and uses hard assignment for that group.
Hard assignment
- The app assigns each data point to the component with the highest posterior probability (responsibility).
\[\text{label}(x) = \arg\max_{i} \gamma_i(x)\]
\[\text{where} \quad \gamma_i(x) = \frac{w_i \; \mathcal{N}\bigl(x \mid \mu_i, \sigma_i^2\bigr)}{\sum_{j=1}^K w_j \; \mathcal{N}\bigl(x \mid \mu_j, \sigma_j^2\bigr)}\]
17.4.4 Example
Pham et al.2 used GMM with intersection thresholding to create gates using NAD(P)H \(a_1\) and optical redox ratio. These gates were used to define metabolically stressed and fit cells in their study of the impact of cryopreservation on T cell metabolism.
They compared the GMM-derived gate with cell viability by Trypan blue staining:
It suggests that optical metabolic imaging (OMI) could serve as an early, non-destructive indicator of T cell viability post-thaw.





