Use available_decomposition() to get a listing of available decomposition / dimensionality reduction algorithms:
available_decomposition ()
ICA : Independent Component Analysis
Isomap : Isomap
NMF : Non-negative Matrix Factorization
PCA : Principal Component Analysis
tSNE : t-distributed Stochastic Neighbor Embedding
UMAP : Uniform Manifold Approximation and Projection
We can further divide decomposition algorithms into linear (e.g. PCA, ICA, etc.) and nonlinear dimensionality reduction, (also called manifold learning, like tSNE and UMAP).
The rtemis decomposition function is called decomp() to avoid clashing with the stats::decompose() built-in function.
For the examples below, let’s set the default theme to “darkgraygrid”. See the Theme section for more information on available themes.
options (rtemis_theme = "darkgraygrid" )
Linear Dimensionality Reduction
As a simple example, let’s look the famous iris dataset. Note that we use this to demonstrate usage and is not a good example to assess the effectiveness of decomposition algorithms as the iris dataset consists of only 4 variables.
First, we select all variables from the iris dataset, excluding the group names, i.e. the labels. Since the iris dataset includes one duplicate observation, we can remove using preprocess(). This is required for t-SNE to work.
x <- preprocess (
iris,
setup_Preprocessor (remove_duplicates = TRUE )
)["preprocessed" ]
2026-02-11 19:24:43 Removing 1 duplicate case... [preprocess]
2026-02-11 19:24:43 Preprocessing done. [preprocess]
Now, let’s try a few different algorithms, projecting to three dimensions and visualizing using draw_3Dscatter .
Principal Component Analysic (PCA)
iris_PCA <- decomp (
x[, 1 : 4 ],
algorithm = "PCA" ,
config = setup_PCA (k = 3 L)
)
2026-02-11 19:24:43 ▶ [decomp]
2026-02-11 19:24:43 Input: 149 cases x 4 features. [summarize_unsupervised]
2026-02-11 19:24:43 Decomposing with PCA... [decomp]
2026-02-11 19:24:43 Checking unsupervised data... ✓ [check_unsupervised_data]
2026-02-11 19:24:43 Decomposing with PCA ... [decom_PCA]
2026-02-11 19:24:43 ✔ Done in 3e-03 seconds. [decomp]
draw_3Dscatter (
iris_PCA$ transformed,
group = x$ Species,
main = "PCA on iris" ,
xlab = "1st PCA component" ,
ylab = "2nd PCA component" ,
zlab = "3rd PCA component"
)
Independent Component Analysis (ICA)
iris_ICA <- decomp (
x[, 1 : 4 ],
algorithm = "ICA" ,
config = setup_ICA (k = 3 L)
)
2026-02-11 19:24:44 ▶ [decomp]
2026-02-11 19:24:44 Input: 149 cases x 4 features. [summarize_unsupervised]
2026-02-11 19:24:44 Decomposing with ICA... [decomp]
2026-02-11 19:24:44 Checking unsupervised data... ✓ [check_unsupervised_data]
2026-02-11 19:24:44 Decomposing with ICA ... [decom_ICA]
Centering
colstandard
Whitening
Symmetric FastICA using logcosh approx. to neg-entropy function
Iteration 1 tol=0.234782
Iteration 2 tol=0.011670
Iteration 3 tol=0.010078
Iteration 4 tol=0.007116
Iteration 5 tol=0.001950
Iteration 6 tol=0.000446
Iteration 7 tol=0.000118
Iteration 8 tol=0.000034
2026-02-11 19:24:44 ✔ Done in 0.01 seconds. [decomp]
draw_3Dscatter (
iris_ICA$ transformed,
group = x$ Species,
main = "ICA on iris" ,
xlab = "1st ICA component" ,
ylab = "2nd ICA component" ,
zlab = "3rd ICA component"
)
Non-negative Matrix Factorization (NMF)
iris_NMF <- decomp (
x[, 1 : 4 ],
algorithm = "NMF" ,
config = setup_NMF (k = 3 L)
)
2026-02-11 19:24:44 ▶ [decomp]
2026-02-11 19:24:44 Input: 149 cases x 4 features. [summarize_unsupervised]
2026-02-11 19:24:44 Decomposing with NMF... [decomp]
2026-02-11 19:24:44 Checking unsupervised data... ✓ [check_unsupervised_data]
2026-02-11 19:24:44 Decomposing with NMF ... [decom_NMF]
2026-02-11 19:24:45 ✔ Done in 1.17 seconds. [decomp]
draw_3Dscatter (
iris_NMF$ transformed,
group = x$ Species,
main = "NMF on iris" ,
xlab = "1st NMF component" ,
ylab = "2nd NMF component" ,
zlab = "3rd NMF component"
)
Non-linear dimensionality reduction
t-distributed Stochastic Neighbor Embedding (t-SNE)
iris_tSNE <- decomp (
x[, 1 : 4 ],
algorithm = "tSNE" ,
config = setup_tSNE (k = 3 L)
)
2026-02-11 19:24:45 ▶ [decomp]
2026-02-11 19:24:45 Input: 149 cases x 4 features. [summarize_unsupervised]
2026-02-11 19:24:45 Decomposing with tSNE... [decomp]
2026-02-11 19:24:45 Checking unsupervised data... ✓ [check_unsupervised_data]
2026-02-11 19:24:45 Decomposing with tSNE ... [decom_tSNE]
2026-02-11 19:24:45 ✔ Done in 0.27 seconds. [decomp]
draw_3Dscatter (
iris_tSNE$ transformed,
group = x$ Species,
main = "tSNE on iris" ,
xlab = "1st tSNE component" ,
ylab = "2nd tSNE component" ,
zlab = "3rd tSNE component"
)