Learn R Programming

SaturnCoefficient (version 1.3)

trustworthiness_score: 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)

Value

a real value containing the trustworthiness score

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

Examples

Run this code

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="")

Run the code above in your browser using DataLab