Skip to content

bmuchmore/PreciseDist

Repository files navigation

PreciseDist

For package details please see https://bmuchmore.github.io/PreciseDist/

PreciseDist is an instrument for epistemic hygiene in unsupervised analysis. The distance or similarity metric you choose is not a throwaway preprocessing detail — it is the structure you are about to analyse. So don’t assume your metric: build many, test how much they agree, fuse the ones worth trusting, project the result to a graph, and see the structure before you believe it.

Two packages, one workflow

PreciseDist owns the four computational tiers. PreciseViz consumes their open typed-matrix output without importing PreciseDist:

library(PreciseDist)
library(PreciseViz)

idx <- c(1:5, 61:65, 121:125)
x <- as.matrix(data_cell_cycle[idx, -1])[, 1:50]
storage.mode(x) <- "double"
rownames(x) <- paste0("obs_", seq_len(nrow(x)))

d <- precise_dist(x, dists = c("euclidean", "manhattan", "canberra"),
                  verbose = FALSE)
d <- precise_transform(d, to = "distance")
f <- precise_fusion(d, methods = "mean", verbose = FALSE)
g <- precise_graph(f, methods = "knn", verbose = FALSE)
v <- precise_viz(g, views = "graph_layout", verbose = FALSE)

Every matrix carries an explicit type (distance or similarity); PreciseDist never infers type from values and never silently converts one to the other. precise_correlations() measures how much your metrics agree, precise_diagnostics() summarizes each matrix quantitatively, precise_stability() asks whether a fused consensus is sensitive to which candidate matrices you selected, precise_graphml() exports a graph for Gephi, and precise_trellis() browses the view panels with trelliscope.

Installation

Both packages require R >= 4.1.0. They are not yet on CRAN; install the development versions from the same GitHub repository:

# install.packages("devtools")
devtools::install_github("bmuchmore/PreciseDist")
devtools::install_github("bmuchmore/PreciseDist", subdir = "PreciseViz")

Optional extensions are installed only when you need them. PreciseViz imports uwot for its default UMAP embedding; optional interactive renderers use suggested packages such as plotly, threejs, trelliscopejs, and visNetwork. Optional method backends use analogue, SNFtool, DistatisR, and KODAMA, and user-managed parallel execution can use future / doFuture.

Citation

Hopefully, coming soon.

About

An R package for optimal distance or similarity matrix creation. https://bmuchmore.github.io/PreciseDist/

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages