All Projects → koheiw → proxyC

koheiw / proxyC

Licence: GPL-3.0 license
R package for large-scale similarity/distance computation

Programming Languages

r
7636 projects
C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to proxyC

dist
🗺️ Python/C API extension module that computes distance between two coordinates on the world map
Stars: ✭ 13 (-31.58%)
Mutual labels:  distance-measures
similarity measures
Quantify the difference between two arbitrary curves in space
Stars: ✭ 140 (+636.84%)
Mutual labels:  similarity-measures
BOSCH-GLM-rangefinder
Python script to remote control a BOSCH GLM 100C rangefinder via its Bluetooth serial interface
Stars: ✭ 41 (+115.79%)
Mutual labels:  distance-measures
spykesim
Extended edit similarity measurement for high dimensional discrete-time series signal (e.g., multi-unit spike-train).
Stars: ✭ 18 (-5.26%)
Mutual labels:  similarity-measures
edits.cr
Edit distance algorithms inc. Jaro, Damerau-Levenshtein, and Optimal Alignment
Stars: ✭ 16 (-15.79%)
Mutual labels:  similarity-measures
SAFNet
[IROS 2021] Implementation of "Similarity-Aware Fusion Network for 3D Semantic Segmentation"
Stars: ✭ 19 (+0%)
Mutual labels:  similarity-measures
theheraldproject.github.io
Herald - Proximity Detection Protocol and research documentation, including the Fair Efficacy Formula
Stars: ✭ 17 (-10.53%)
Mutual labels:  distance-measures
NDD
Drug-Drug Interaction Predicting by Neural Network Using Integrated Similarity
Stars: ✭ 25 (+31.58%)
Mutual labels:  similarity-measures
fuzzymax
Code for the paper: Don't Settle for Average, Go for the Max: Fuzzy Sets and Max-Pooled Word Vectors, ICLR 2019.
Stars: ✭ 43 (+126.32%)
Mutual labels:  similarity-measures
discrete frechet
Compute the Fréchet distance between two polygonal curves in Euclidean space.
Stars: ✭ 68 (+257.89%)
Mutual labels:  distance-measures
dhash-vips
vips-powered ruby gem to measure images similarity, implementing dHash and IDHash algorithms
Stars: ✭ 75 (+294.74%)
Mutual labels:  similarity-measures
mtss-gan
MTSS-GAN: Multivariate Time Series Simulation with Generative Adversarial Networks (by @firmai)
Stars: ✭ 77 (+305.26%)
Mutual labels:  similarity-measures
Trajectory-Analysis-and-Classification-in-Python-Pandas-and-Scikit-Learn
Formed trajectories of sets of points.Experimented on finding similarities between trajectories based on DTW (Dynamic Time Warping) and LCSS (Longest Common SubSequence) algorithms.Modeled trajectories as strings based on a Grid representation.Benchmarked KNN, Random Forest, Logistic Regression classification algorithms to classify efficiently t…
Stars: ✭ 41 (+115.79%)
Mutual labels:  similarity-measures
Java String Similarity
Implementation of various string similarity and distance algorithms: Levenshtein, Jaro-winkler, n-Gram, Q-Gram, Jaccard index, Longest Common Subsequence edit distance, cosine similarity ...
Stars: ✭ 2,403 (+12547.37%)
Mutual labels:  similarity-measures
Algorithms
Free hands-on course with the implementation (in Python) and description of several computational, mathematical and statistical algorithms.
Stars: ✭ 117 (+515.79%)
Mutual labels:  similarity-measures
bhtsne
Parallel Barnes-Hut t-SNE implementation written in Rust.
Stars: ✭ 43 (+126.32%)
Mutual labels:  similarity-measures
WebGL-Distance-Fields
⭐ Realtime Euclidean distance field generation and rendering
Stars: ✭ 50 (+163.16%)
Mutual labels:  distance-measures

proxyC: R package for large-scale similarity/distance computation

CRAN Version Downloads Total Downloads R build status codecov

proxyC computes proximity between rows or columns of large matrices efficiently in C++. It is optimized for large sparse matrices using the Armadillo and Intel TBB libraries. Among several built-in similarity/distance measures, computation of correlation, cosine similarity and Euclidean distance is particularly fast.

This code was originally written for quanteda to compute similarity/distance between documents or features in large corpora, but separated as a stand-alone package to make it available for broader data scientific purposes.

install.packages("proxyC")
require(Matrix)
## Loading required package: Matrix
require(microbenchmark)
## Loading required package: microbenchmark
require(RcppParallel)
## Loading required package: RcppParallel
require(ggplot2)
## Loading required package: ggplot2
require(magrittr)
## Loading required package: magrittr

# Set number of threads
setThreadOptions(8)

# Make a matrix with 99% zeros
sm1k <- rsparsematrix(1000, 1000, 0.01) # 1,000 columns
sm10k <- rsparsematrix(1000, 10000, 0.01) # 10,000 columns

# Convert to dense format
dm1k <- as.matrix(sm1k) 
dm10k <- as.matrix(sm10k)

Cosine similarity between columns

With sparse matrices, proxyC is roughly 10 to 100 times faster than proxy.

bm1 <- microbenchmark(
    "proxy 1k" = proxy::simil(dm1k, method = "cosine"),
    "proxyC 1k" = proxyC::simil(sm1k, margin = 2, method = "cosine"),
    "proxy 10k" = proxy::simil(dm10k, method = "cosine"),
    "proxyC 10k" = proxyC::simil(sm10k, margin = 2, method = "cosine"),
    times = 10
)
autoplot(bm1)
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.

Cosine similarity greater than 0.9

If min_simil is used, proxyC becomes even faster because small similarity scores are floored to zero.

bm2 <- microbenchmark(
    "proxyC all" = proxyC::simil(sm1k, margin = 2, method = "cosine"),
    "proxyC min_simil" = proxyC::simil(sm1k, margin = 2, method = "cosine", min_simil = 0.9),
    times = 10
)
autoplot(bm2)
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.

Flooring by min_simil makes the resulting object much smaller.

proxyC::simil(sm10k, margin = 2, method = "cosine") %>% 
  object.size() %>% 
  print(units = "MB")
## 763 Mb
proxyC::simil(sm10k, margin = 2, method = "cosine", min_simil = 0.9) %>% 
  object.size() %>% 
  print(units = "MB")
## 0.2 Mb

Top-10 correlation

If rank is used, proxyC only returns top-n values.

bm3 <- microbenchmark(
    "proxyC rank" = proxyC::simil(sm1k, margin = 2, method = "correlation", rank = 10),
    "proxyC all" = proxyC::simil(sm1k, margin = 2, method = "correlation"),
    times = 10
)
autoplot(bm3)
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].