knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" ) options(width = 100, digits = 2)
Provides a fast implementation for weighted histogram matching.
devtools::load_all(quiet = TRUE) library(dplyr, warn.conflicts = FALSE) requireNamespace("ggplot2", quietly = TRUE)
histmatch(1:10, 1:10) histmatch(1:10, 2:11) histmatch(1:11, 5:6) histmatch(1:11, c(2, 4, 5))
In the following plot, the black and red elements correspond to the target and source distribution, respectively.
set.seed(20161031) x_source <- runif(10) x_source x_target <- rnorm(30) x_target histmatch_data(x_source, x_target) %>% plot
For random vectors, which are generated using the following function:
r <- function(e) runif(10 ** e)
set.seed(123) microbenchmark::microbenchmark( r(4), histmatch(r(3), r(3)), histmatch(r(3), r(3), r(3)), histmatch(r(3), r(4)), histmatch(r(3), r(4), r(4)), histmatch(r(4), r(4)), histmatch(r(4), r(4), r(4)), histmatch(r(4), r(3)), histmatch(r(4), r(3), r(3)), times = 100 ) %>% group_by(expr) %>% summarize(median_ms = median(time) / 1e6) %>% ungroup
devtools::install_github("krlmlr/histmatch")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.