Giter Club home page Giter Club logo

ruby-umappp's Introduction

Umappp - UMAP for Ruby

test Gem Version

πŸ—ΊοΈ Umappp - Uniform Manifold Approximation and Projection - for Ruby

image

Uniform Manifold Approximation and Projection (UMAP) is a dimension reduction technique that can be used for visualisation similarly to t-SNE, but also for general non-linear dimension reduction. (original UMAP documentation)

Installation

gem install umappp
  • OpenMP is required for multithreading.

Usage

This Gem provides the module Umappp and its singular method Umappp.run(). The first argument of Umappp.run() is a two-dimensional Ruby array or a two-dimensional Numo array. Numo is a library for performing N-dimensional array computing like NumPy. The argument is converted to Numo::SFloat. SFloat is a single precision floating point number type of Numo::NArray.

# The embedding is two-dimensional Ruby array or Numo array
# Returns Numo::SFloat
r = Umappp.run(embedding)

# Run with parameters
r = Umappp.run(pixels, num_threads: 8, a: 1.8956, b: 0.8006)

Available parameters and their default values

parameters default value
method :annoy (another option is :vptree)
ndim 2
tick 0 (Not yet implemented)
local_connectivity 1.0
bandwidth 1
mix_ratio 1
spread 1
min_dist 0.01
a 0
b 0
repulsion_strength 1
num_epochs 500
learning_rate 1
negative_sample_rate 5
num_neighbors 15
seed 1234567890
batch false
num_threads 1 (OpenMP required)

Development

git clone https://github.com/kojix2/ruby-umappp
cd umap
bundle exec rake compile
bundle exec rake test

Update LTLA/umappp

Requires cmake to run

cd script
./vendor.sh

Ruby dependencies

  • rice - Ruby Interface for C++ Extensions
  • numo.hpp - C++ header for Numo and Rice

Umappp dependencies

This Gem is a wrapper for Umappp. We store and distribute Umappp and other dependent C++ code in the Vendor directory. Umappp is compiled when the Gem is installed. Umappp's C++ modules have complex dependencies as shown in the figure below. It is not a good idea to manage them manually. Use script/vendor.sh to update them automatically. This actually runs cmake and moves the required directories to the vendor directory.

graph TD;
    id1(eigen)-->CppIrlba;
    aarand-->CppIrlba;
    Annoy-->knncolle;
    hnswlib-->knncolle;
    CppKmeans-->knncolle;
    aarand-->CppKmeans;
    powerit-->CppKmeans;
    aarand-->powerit;
    knncolle-->umappp;
    aarand-->umappp;
    CppIrlba-->umappp;
    style id1 fill:#f9f,stroke:#333

All modules except eigen are the work of Aaron Lun.

Contributing

Welcome!

Do you need commit rights to my repository?
Do you want to get admin rights and take over the project?
If so, please feel free to contact us @kojix2.

License

  • As for the code I wrote, it is BSD 2-Clause (or MIT).
  • The license of Umappp for C++ by Aaron Lun is BSD 2-Clause.
  • For other codes, please check on your own. (There are many dependencies)

ruby-umappp's People

Contributors

bkmgit avatar kojix2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rnaimehaom bkmgit

ruby-umappp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.