470 lines
18 KiB
Ruby
Generated
470 lines
18 KiB
Ruby
Generated
# typed: true
|
|
|
|
# DO NOT EDIT MANUALLY
|
|
# This is an autogenerated file for types exported from the `rumale-manifold` gem.
|
|
# Please instead update this file by running `bin/tapioca gem rumale-manifold`.
|
|
|
|
|
|
# Rumale is a machine learning library in Ruby.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#8
|
|
module Rumale; end
|
|
|
|
# Module for data embedding algorithms.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#9
|
|
module Rumale::Manifold; end
|
|
|
|
# HessianEigenmaps is a class that implements Hessian Eigenmaps.
|
|
#
|
|
# *Reference*
|
|
# - Donoho, D. L., and Grimes, C., "Hessian eigenmaps: Locally linear embedding techniques for high-dimensional data," Proc. Natl. Acad. Sci. USA, vol. 100, no. 10, pp. 5591--5596, 2003.
|
|
#
|
|
# @example
|
|
# require 'numo/linalg/autoloader'
|
|
# require 'rumale/manifold/hessian_eigenmaps'
|
|
#
|
|
# hem = Rumale::Manifold::HessianEigenmaps.new(n_components: 2, n_neighbors: 15)
|
|
# z = hem.fit_transform(x)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#21
|
|
class Rumale::Manifold::HessianEigenmaps < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with Hessian Eigenmaps.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param n_neighbors [Integer] The number of nearest neighbors for k-nearest neighbor graph construction.
|
|
# @param reg_param [Float] The reguralization parameter for local gram matrix in transform method.
|
|
# @return [HessianEigenmaps] a new instance of HessianEigenmaps
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#33
|
|
def initialize(n_neighbors: T.unsafe(nil), n_components: T.unsafe(nil), reg_param: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#26
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#47
|
|
def fit(x, _y = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#92
|
|
def fit_transform(x, _y = T.unsafe(nil)); end
|
|
|
|
# Transform the given data with the learned model.
|
|
# For out-of-sample data embedding, the same method as Locally Linear Embedding is used.
|
|
#
|
|
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The data to be transformed with the learned model.
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components]) The transformed data.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#107
|
|
def transform(x); end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#130
|
|
def neighbor_ids(distance_mat, n_neighbors, contain_self); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/hessian_eigenmaps.rb#141
|
|
def tangent_coordinates(x); end
|
|
end
|
|
|
|
# LaplacianEigenmaps is a class that implements Laplacian Eigenmaps.
|
|
#
|
|
# *Reference*
|
|
# - Belkin, M., and Niyogi, P., "Laplacian Eigenmaps and Spectral Techniques for Embedding and Clustering," Proc. NIPS'01, pp. 585--591, 2001.
|
|
#
|
|
# @example
|
|
# require 'numo/linalg/autoloader'
|
|
# require 'rumale/manifold/laplacian_eigenmaps'
|
|
#
|
|
# lem = Rumale::Manifold::LaplacianEigenmaps.new(n_components: 2, n_neighbors: 15)
|
|
# z = lem.fit_transform(x)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#21
|
|
class Rumale::Manifold::LaplacianEigenmaps < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with Laplacian Eigenmaps.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param gamma [Nil/Float] The parameter of RBF kernel. If nil is given, the weight of affinity matrix sets to 1.
|
|
# @param n_neighbors [Integer] The number of nearest neighbors for k-nearest neighbor graph construction.
|
|
# @return [LaplacianEigenmaps] a new instance of LaplacianEigenmaps
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#33
|
|
def initialize(n_components: T.unsafe(nil), gamma: T.unsafe(nil), n_neighbors: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#26
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#47
|
|
def fit(x, _y = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#75
|
|
def fit_transform(x, _y = T.unsafe(nil)); end
|
|
|
|
# Transform the given data with the learned model.
|
|
#
|
|
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The data to be transformed with the learned model.
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components]) The transformed data.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#87
|
|
def transform(x); end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/laplacian_eigenmaps.rb#105
|
|
def k_neighbor_graph(distance_mat, n_neighbors, contain_self); end
|
|
end
|
|
|
|
# LocalTangentSpaceAlignment is a class that implements Local Tangent Space Alignment.
|
|
#
|
|
# *Reference*
|
|
# - Zhang, A., and Zha, H., "Principal Manifolds and Nonlinear Diemnsion Reduction via Local Tangent Space Alignment," SIAM Journal on Scientific Computing, vol. 26, iss. 1, pp. 313-338, 2004.
|
|
#
|
|
# @example
|
|
# require 'numo/linalg/autoloader'
|
|
# require 'rumale/manifold/local_tangent_space_alignment'
|
|
#
|
|
# lem = Rumale::Manifold::LocalTangentSpaceAlignment.new(n_components: 2, n_neighbors: 15)
|
|
# z = lem.fit_transform(x)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#21
|
|
class Rumale::Manifold::LocalTangentSpaceAlignment < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with Local Tangent Space Alignment.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param n_neighbors [Integer] The number of nearest neighbors for finding k-nearest neighbors
|
|
# @param reg_param [Float] The reguralization parameter for local gram matrix in transform method.
|
|
# @return [LocalTangentSpaceAlignment] a new instance of LocalTangentSpaceAlignment
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#33
|
|
def initialize(n_components: T.unsafe(nil), n_neighbors: T.unsafe(nil), reg_param: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#26
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#47
|
|
def fit(x, _y = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#86
|
|
def fit_transform(x, _y = T.unsafe(nil)); end
|
|
|
|
# Transform the given data with the learned model.
|
|
# For out-of-sample data embedding, the same method as Locally Linear Embedding is used.
|
|
#
|
|
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The data to be transformed with the learned model.
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components]) The transformed data.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#99
|
|
def transform(x); end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#122
|
|
def neighbor_ids(distance_mat, n_neighbors, contain_self); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/local_tangent_space_alignment.rb#133
|
|
def right_singular_vectors(x_local, n_singulars); end
|
|
end
|
|
|
|
# LocallyLinearEmbedding is a class that implements Locally Linear Embedding.
|
|
#
|
|
# *Reference*
|
|
# - Roweis, S., and Saul, L., "Nonlinear Dimensionality Reduction by Locally Linear Embedding," J. of Science, vol. 290, pp. 2323-2326, 2000.
|
|
#
|
|
# @example
|
|
# require 'numo/linalg/autoloader'
|
|
# require 'rumale/manifold/locally_linear_embedding'
|
|
#
|
|
# lem = Rumale::Manifold::LocallyLinearEmbedding.new(n_components: 2, n_neighbors: 15)
|
|
# z = lem.fit_transform(x)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#21
|
|
class Rumale::Manifold::LocallyLinearEmbedding < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with Locally Linear Embedding.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param n_neighbors [Integer] The number of nearest neighbors for k-nearest neighbor graph construction.
|
|
# @param reg_param [Float] The reguralization parameter for local gram matrix.
|
|
# @return [LocallyLinearEmbedding] a new instance of LocallyLinearEmbedding
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#33
|
|
def initialize(n_components: T.unsafe(nil), n_neighbors: T.unsafe(nil), reg_param: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#26
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#47
|
|
def fit(x, _y = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#81
|
|
def fit_transform(x, _y = T.unsafe(nil)); end
|
|
|
|
# Transform the given data with the learned model.
|
|
#
|
|
# @param x [Numo::DFloat] (shape: [n_samples, n_features]) The data to be transformed with the learned model.
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components]) The transformed data.
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#93
|
|
def transform(x); end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/locally_linear_embedding.rb#116
|
|
def neighbor_ids(distance_mat, n_neighbors, contain_self); end
|
|
end
|
|
|
|
# MDS is a class that implements Metric Multidimensional Scaling (MDS)
|
|
# with Scaling by MAjorizing a COmplicated Function (SMACOF) algorithm.
|
|
#
|
|
# *Reference*
|
|
# - Groenen, P J. F. and van de Velden, M., "Multidimensional Scaling by Majorization: A Review," J. of Statistical Software, Vol. 73 (8), 2016.
|
|
#
|
|
# @example
|
|
# require 'rumale/manifold/mds'
|
|
#
|
|
# mds = Rumale::Manifold::MDS.new(init: 'pca', max_iter: 500, random_seed: 1)
|
|
# representations = mds.fit_transform(samples)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#23
|
|
class Rumale::Manifold::MDS < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with MDS.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param metric [String] The metric to calculate the distances in original space.
|
|
# If metric is 'euclidean', Euclidean distance is calculated for distance in original space.
|
|
# If metric is 'precomputed', the fit and fit_transform methods expect to be given a distance matrix.
|
|
# @param init [String] The init is a method to initialize the representaion space.
|
|
# If init is 'random', the representaion space is initialized with normal random variables.
|
|
# If init is 'pca', the result of principal component analysis as the initial value of the representation space.
|
|
# @param max_iter [Integer] The maximum number of iterations.
|
|
# @param tol [Float] The tolerance of stress value for terminating optimization.
|
|
# If tol is nil, it does not use stress value as a criterion for terminating the optimization.
|
|
# @param verbose [Boolean] The flag indicating whether to output stress value during iteration.
|
|
# @param random_seed [Integer] The seed value using to initialize the random generator.
|
|
# @return [MDS] a new instance of MDS
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#56
|
|
def initialize(n_components: T.unsafe(nil), metric: T.unsafe(nil), init: T.unsafe(nil), max_iter: T.unsafe(nil), tol: T.unsafe(nil), verbose: T.unsafe(nil), random_seed: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#28
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#77
|
|
def fit(x, _not_used = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#120
|
|
def fit_transform(x, _not_used = T.unsafe(nil)); end
|
|
|
|
# Return the number of iterations run for optimization
|
|
#
|
|
# @return [Integer]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#36
|
|
def n_iter; end
|
|
|
|
# Return the random generator.
|
|
#
|
|
# @return [Random]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#40
|
|
def rng; end
|
|
|
|
# Return the stress function value after optimization.
|
|
#
|
|
# @return [Float]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#32
|
|
def stress; end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#147
|
|
def calc_stress(hi_distance_mat, lo_distance_mat); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#129
|
|
def init_embedding(x); end
|
|
|
|
# @return [Boolean]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/mds.rb#140
|
|
def terminate?(old_stress, new_stress); end
|
|
end
|
|
|
|
# TSNE is a class that implements t-Distributed Stochastic Neighbor Embedding (t-SNE)
|
|
# with fixed-point optimization algorithm.
|
|
# Fixed-point algorithm usually converges faster than gradient descent method and
|
|
# do not need the learning parameters such as the learning rate and momentum.
|
|
#
|
|
# *Reference*
|
|
# - van der Maaten, L., and Hinton, G., "Visualizing data using t-SNE," J. of Machine Learning Research, vol. 9, pp. 2579--2605, 2008.
|
|
# - Yang, Z., King, I., Xu, Z., and Oja, E., "Heavy-Tailed Symmetric Stochastic Neighbor Embedding," Proc. NIPS'09, pp. 2169--2177, 2009.
|
|
#
|
|
# @example
|
|
# require 'rumale/manifold/tsne'
|
|
#
|
|
# tsne = Rumale::Manifold::TSNE.new(perplexity: 40.0, init: 'pca', max_iter: 500, random_seed: 1)
|
|
# representations = tsne.fit_transform(samples)
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#26
|
|
class Rumale::Manifold::TSNE < ::Rumale::Base::Estimator
|
|
include ::Rumale::Base::Transformer
|
|
|
|
# Create a new transformer with t-SNE.
|
|
#
|
|
# @param n_components [Integer] The number of dimensions on representation space.
|
|
# @param perplexity [Float] The effective number of neighbors for each point. Perplexity are typically set from 5 to 50.
|
|
# @param metric [String] The metric to calculate the distances in original space.
|
|
# If metric is 'euclidean', Euclidean distance is calculated for distance in original space.
|
|
# If metric is 'precomputed', the fit and fit_transform methods expect to be given a distance matrix.
|
|
# @param init [String] The init is a method to initialize the representaion space.
|
|
# If init is 'random', the representaion space is initialized with normal random variables.
|
|
# If init is 'pca', the result of principal component analysis as the initial value of the representation space.
|
|
# @param max_iter [Integer] The maximum number of iterations.
|
|
# @param tol [Float] The tolerance of KL-divergence for terminating optimization.
|
|
# If tol is nil, it does not use KL divergence as a criterion for terminating the optimization.
|
|
# @param verbose [Boolean] The flag indicating whether to output KL divergence during iteration.
|
|
# @param random_seed [Integer] The seed value using to initialize the random generator.
|
|
# @return [TSNE] a new instance of TSNE
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#60
|
|
def initialize(n_components: T.unsafe(nil), perplexity: T.unsafe(nil), metric: T.unsafe(nil), init: T.unsafe(nil), max_iter: T.unsafe(nil), tol: T.unsafe(nil), verbose: T.unsafe(nil), random_seed: T.unsafe(nil)); end
|
|
|
|
# Return the data in representation space.
|
|
#
|
|
# @return [Numo::DFloat] (shape: [n_samples, n_components])
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#31
|
|
def embedding; end
|
|
|
|
# Fit the model with given training data.
|
|
#
|
|
# @overload fit
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#82
|
|
def fit(x, _not_used = T.unsafe(nil)); end
|
|
|
|
# Fit the model with training data, and then transform them with the learned model.
|
|
#
|
|
# @overload fit_transform
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#120
|
|
def fit_transform(x, _not_used = T.unsafe(nil)); end
|
|
|
|
# Return the Kullback-Leibler divergence after optimization.
|
|
#
|
|
# @return [Float]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#35
|
|
def kl_divergence; end
|
|
|
|
# Return the number of iterations run for optimization
|
|
#
|
|
# @return [Integer]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#39
|
|
def n_iter; end
|
|
|
|
# Return the random generator.
|
|
#
|
|
# @return [Random]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#43
|
|
def rng; end
|
|
|
|
private
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#207
|
|
def cost(p, q); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#140
|
|
def gaussian_distributed_probability_matrix(distance_mat); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#191
|
|
def gaussian_distributed_probability_vector(n, distance_vec, beta); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#129
|
|
def init_embedding(x); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#159
|
|
def optimal_probabilities(sample_id, distance_vec, max_iter = T.unsafe(nil)); end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#200
|
|
def t_distributed_probability_matrix(y); end
|
|
|
|
# @return [Boolean]
|
|
#
|
|
# source://rumale-manifold//lib/rumale/manifold/tsne.rb#211
|
|
def terminate?(p, q); end
|
|
end
|
|
|
|
# source://rumale-manifold//lib/rumale/manifold/version.rb#8
|
|
Rumale::Manifold::VERSION = T.let(T.unsafe(nil), String)
|