Package 'SaturnCoefficient'

Title: Statistical Evaluation of UMAP Dimensionality Reductions
Description: A metric expressing the quality of a UMAP layout. This is a package that contains the Saturn_coefficient() function that reads an input matrix, its dimensionality reduction produced by UMAP, and evaluates the quality of this dimensionality reduction by producing a real value in the [0; 1] interval. We call this real value Saturn coefficient. A higher value means better dimensionality reduction; a lower value means worse dimensionality reduction. Reference: Davide Chicco et al. (February 2026), "The advantages of our proposed Saturn coefficient over continuity and trustworthiness for UMAP dimensionality reduction evaluation", PeerJ Computer Science 12:e3424 (pp. 1-30), <doi:10.7717/peerj-cs.3424>.
Authors: Davide Chicco [aut, cre] (ORCID: <https://orcid.org/0000-0001-9655-7142>)
Maintainer: Davide Chicco <[email protected]>
License: GPL-3
Version: 1.6
Built: 2026-10-10 08:20:55 UTC
Source: https://github.com/davidechicco/saturncoefficient_r_package

Help Index


Function that calculates the Saturn coefficient, trustworthiness score, and the continuity score of a UMAP dimensionality reduction

Description

Function that calculates the Saturn coefficient, trustworthiness score, and the continuity score of a UMAP dimensionality reduction

Usage

calculatesSaturnContinuityTrustworthiness(
  original_matrix,
  umap_output_layout,
  VERBOSE
)

Arguments

original_matrix

input matrix

umap_output_layout

output matrix of UMAP applied to original_matrix

VERBOSE

prints some intermediate message to standard output or not

Value

a dataframe containing the Saturn coefficient, the trustworthiness score, and the continuity score

Examples

this_nrows <- 200
this_ncols <- 100
this_min <- 0
this_max <- 10000
noise_random_matrix <- matrix(runif(n = this_nrows * this_ncols,
     min = this_min, max = this_max), nrow = this_nrows)
input_matrix <- as.matrix(noise_random_matrix)
these_nearest_neighbors <- 15
this_min_dist <- 0.05

library("umap")
custom.settings <- umap::umap.defaults
custom.settings$"n_neighbors" <- these_nearest_neighbors
custom.settings$"min_dist" <- this_min_dist

x_umap <- umap::umap(input_matrix, config=custom.settings)

this_verbose <- FALSE
theseThreeMetrics <- calculatesSaturnContinuityTrustworthiness(input_matrix,
     x_umap$"layout",  this_verbose)
print(theseThreeMetrics)

Function that calculates the continuity score of a UMAP dimensionality reduction

Description

Function that calculates the continuity score of a UMAP dimensionality reduction

Usage

continuity_score(original_matrix, umap_output_layout, VERBOSE)

Arguments

original_matrix

input matrix

umap_output_layout

output matrix of UMAP applied to original_matrix

VERBOSE

prints some intermediate message to standard output or not

Value

a real value containing the continuity score

Examples

this_nrows <- 200
this_ncols <- 100
this_min <- 0
this_max <- 10000
noise_random_matrix <- matrix(runif(n = this_nrows * this_ncols,
     min = this_min, max = this_max), nrow = this_nrows)
input_matrix <- as.matrix(noise_random_matrix)
these_nearest_neighbors <- 15
this_min_dist <- 0.05

library("umap")
custom.settings <- umap::umap.defaults
custom.settings$"n_neighbors" <- these_nearest_neighbors
custom.settings$"min_dist" <- this_min_dist

x_umap <- umap::umap(input_matrix, config=custom.settings)

this_verbose <- FALSE
thisCon <- continuity_score(input_matrix, x_umap$"layout",  this_verbose)
cat("continuity = ", thisCon, "\n", sep="")

Function that calculates the Saturn coefficient to quantify the quality of a UMAP dimensionality reduction

Description

Function that calculates the Saturn coefficient to quantify the quality of a UMAP dimensionality reduction

Usage

Saturn_coefficient(original_matrix, umap_output_layout, VERBOSE)

Arguments

original_matrix

input matrix

umap_output_layout

output matrix of UMAP applied to original_matrix

VERBOSE

prints some intermediate message to standard output or not

Value

a real value containing the Saturn coefficient

Examples

this_nrows <- 200
this_ncols <- 100
this_min <- 0
this_max <- 10000
noise_random_matrix <- matrix(runif(n = this_nrows * this_ncols,
     min = this_min, max = this_max), nrow = this_nrows)
input_matrix <- as.matrix(noise_random_matrix)
these_nearest_neighbors <- 15
this_min_dist <- 0.05

library("umap")
custom.settings <- umap::umap.defaults
custom.settings$"n_neighbors" <- these_nearest_neighbors
custom.settings$"min_dist" <- this_min_dist

x_umap <- umap::umap(input_matrix, config=custom.settings)

this_verbose <- FALSE
thisSaturn <- Saturn_coefficient(input_matrix, x_umap$"layout",  this_verbose)
cat("Saturn coefficient = ", thisSaturn, "\n", sep="")

Function that calculates the trustworthiness score of a UMAP dimensionality reduction

Description

Function that calculates the trustworthiness score of a UMAP dimensionality reduction

Usage

trustworthiness_score(original_matrix, umap_output_layout, VERBOSE)

Arguments

original_matrix

input matrix

umap_output_layout

output matrix of UMAP applied to original_matrix

VERBOSE

prints some intermediate message to standard output or not

Value

a real value containing the trustworthiness score

Examples

this_nrows <- 200
this_ncols <- 100
this_min <- 0
this_max <- 10000
noise_random_matrix <- matrix(runif(n = this_nrows * this_ncols,
     min = this_min, max = this_max), nrow = this_nrows)
input_matrix <- as.matrix(noise_random_matrix)
these_nearest_neighbors <- 15
this_min_dist <- 0.05

library("umap")
custom.settings <- umap::umap.defaults
custom.settings$"n_neighbors" <- these_nearest_neighbors
custom.settings$"min_dist" <- this_min_dist

x_umap <- umap(input_matrix, config=custom.settings)

this_verbose <- FALSE
thisTW <- trustworthiness_score(input_matrix, x_umap$"layout",  this_verbose)
cat("trustworthiness = ", thisTW, "\n", sep="")