Module: Umappp
- Defined in:
- lib/umappp.rb,
lib/umappp/version.rb
Overview
Uniform Manifold Approximation and Projection
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.default_parameters ⇒ Object
View the default parameters defined within the Umappp C++ library structure.
-
.run(embedding, method: :annoy, ndim: 2, **params) ⇒ Numo::SFloat
Runs the Uniform Manifold Approximation and Projection (UMAP) dimensional reduction technique.
Class Method Details
.default_parameters ⇒ Object
View the default parameters defined within the Umappp C++ library structure.
14 15 16 17 |
# File 'lib/umappp.rb', line 14 def self.default_parameters # {method: :annoy, ndim: 2}.merge umappp_default_parameters end |
.run(embedding, method: :annoy, ndim: 2, **params) ⇒ Numo::SFloat
Runs the Uniform Manifold Approximation and Projection (UMAP) dimensional reduction technique.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/umappp.rb', line 43 def self.run(, method: :annoy, ndim: 2, **params) unless (u = (params.keys - default_parameters.keys)).empty? raise ArgumentError, "[umappp.rb] unknown option : #{u.inspect}" end nnmethod = %i[annoy vptree].index(method.to_sym) raise ArgumentError, "method must be :annoy or :vptree" if nnmethod.nil? = Numo::SFloat.cast() raise ArgumentError, "embedding must be a 2D array" if .ndim <= 1 umappp_run(params, , ndim, nnmethod) end |