### Install HeatGeo Package Source: https://krishnaswamylab.github.io/HeatGeo/index.html Install the HeatGeo package using pip. For development, install with the 'dev' extra. ```bash pip install heatgeo ``` ```bash pip install heatgeo['dev'] ``` -------------------------------- ### GET /utils/time_entropy Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Computes the time entropy for a given heat kernel. ```APIDOC ## GET /utils/time_entropy ### Description Calculates the time entropy based on the provided heat kernel H. ### Parameters #### Request Body - **H** (object) - Required - The heat kernel matrix. ``` -------------------------------- ### Get Scanpy Graph Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Retrieves the Scanpy graph. The 'knn' parameter defaults to 5. ```python get_scanpy_graph (X, knn=5, **kwargs) ``` -------------------------------- ### Get Alpha Decay Graph Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Retrieves the alpha-decay graph. Parameters include 'knn', 'decay', 'anisotropy', and 'n_pca'. ```python get_alpha_decay_graph (X, knn:int=5, decay:float=40.0, anisotropy:float=0, n_pca:int=None, **kwargs) ``` -------------------------------- ### Get kNN Graph Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Retrieves the k-Nearest Neighbors (kNN) graph. The 'knn' parameter defaults to 5. ```python get_knn_graph (X, knn=5, **kwargs) ``` -------------------------------- ### GET /utils/get_optimal_heat Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Calculates the optimal heat kernel for a given embedding operator using Chebyshev approximation. ```APIDOC ## GET /utils/get_optimal_heat ### Description Select the optimal tau for the heat kernel using Chebyshev approximation. ### Parameters #### Request Body - **emb_op** (object) - Required - The embedding operator. - **tau_max** (float) - Optional - Maximum tau value (default: 50). - **n_tau** (int) - Optional - Number of tau steps (default: 20). ### Response #### Success Response (200) - **H** (np.array) - Heat kernel with optimal tau (n_nodes, n_nodes). ``` -------------------------------- ### Get UMAP Graph Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Retrieves the UMAP graph. The 'knn' parameter defaults to 5, which is different from UMAP's default of 15. ```python get_umap_graph (X, knn=5, **kwargs) ``` -------------------------------- ### Initialize HeatFilter Source: https://krishnaswamylab.github.io/HeatGeo/heat_filter.html Wrapper for the approximation of the heat kernel. Supported methods include 'pygsp', 'mar', and 'euler'. ```python HeatFilter (graph:Any, tau:float, order:int, method:str) ``` -------------------------------- ### classic Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Performs classical MDS (CMDS) using random SVD. ```APIDOC ## classic ### Description Performs fast Classical Multidimensional Scaling (CMDS) using random Singular Value Decomposition (SVD). ### Parameters - **D** (array-like, shape=[n_samples, n_samples]) - Pairwise distances. - **n_components** (int, optional) - Number of dimensions to embed into. Defaults to 2. - **random_state** (int, RandomState or None, optional) - Numpy random state. ### Returns - **Y** (array-like, embedded data [n_sample, ndim]) - Embedded data. ``` -------------------------------- ### PhateBasic Wrapper Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html A wrapper for PHATE, providing a simplified interface for dimensionality reduction. Requires additional packages. ```python PhateBasic (knn:int, anisotropy:int=0, decay:int=40, n_pca:int=40, tau:Union[int,str]='auto', emb_dim:int=2) ``` -------------------------------- ### Compute heat kernel approximation with expm_multiply Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Calculates the product of the matrix exponential and a vector using Chebyshev approximation. ```python expm_multiply (L, X, phi, tau, K=None, err=1e-32) ``` -------------------------------- ### PhateBasic Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Wrapper for PHATE embedding. ```APIDOC ## PhateBasic ### Description Wrapper for PHATE. ### Parameters - **knn** (int) - Required - **anisotropy** (int) - Optional - Default: 0 - **decay** (int) - Optional - Default: 40 - **n_pca** (int) - Optional - Default: 40 - **tau** (Union[int, str]) - Optional - Default: 'auto' - **emb_dim** (int) - Optional - Default: 2 ``` -------------------------------- ### RandWalkGeo Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html HeatGeo implementation using a random walk matrix instead of a Heat kernel. ```APIDOC ## RandWalkGeo ### Description HeatGeo with a random walk matrix instead of Heat kernel. ### Parameters - **knn** (int) - Required - **anisotropy** (int) - Optional - Default: 0 - **decay** (int) - Optional - Default: 40 - **n_pca** (int) - Optional - Default: 40 - **tau** (int) - Optional - Default: 10 - **emb_dim** (int) - Optional - Default: 2 - **filter_method** (str) - Optional - Default: 'exact' - **order** (int) - Optional - Default: 32 - **lap_type** (str) - Optional - Default: 'normalized' - **log_normalize** (bool) - Optional - Default: False - **scale_factor** (float) - Optional - Default: 1 - **denoising** (bool) - Optional - Default: False - **n_ref** (int) - Optional - Default: 50 - **n_svd** (int) - Optional - Default: 50 - **graph_type** (str) - Optional - Default: 'alpha' ``` -------------------------------- ### HeatGeo Class Initialization Source: https://krishnaswamylab.github.io/HeatGeo/embedding.html Initializes the HeatGeo embedding class with specific parameters for graph construction and diffusion regularization. ```APIDOC ## HeatGeo ### Description Base class for Heat Geo embedding methods, supporting various graph types and regularization parameters. ### Parameters - **knn** (int) - Required - Number of neighbors considered to build the graph. - **anisotropy** (int) - Optional - Default: 0 - **decay** (int) - Optional - Default: 40 - **n_pca** (int) - Optional - Default: 40 - **tau** (int) - Optional - Default: 10 - **emb_dim** (int) - Optional - Default: 2 - **filter_method** (str) - Optional - Default: 'mar' - **order** (int) - Optional - Default: 32 - **lap_type** (str) - Optional - Default: 'normalized' - **tau_min** (float) - Optional - Default: 0.1 - **tau_max** (float) - Optional - Default: 200 - **n_tau** (int) - Optional - Default: 1 - **log_normalize** (bool) - Optional - Default: False - **scale_factor** (float) - Optional - Default: 1.0 - **denoising** (bool) - Optional - Default: False - **graph_type** (str) - Optional - Default: 'alpha' - **harnack_regul** (float) - Optional - Default: 0 - Harnack regularization parameter, between 0 and 1. - **denoise_regul** (float) - Optional - Default: 0.0 - Corresponds to ρ in the paper. ``` -------------------------------- ### BaseEmb Class Initialization Source: https://krishnaswamylab.github.io/HeatGeo/embedding.html Initializes the BaseEmb class, providing foundational methods for embedding techniques. ```APIDOC ## BaseEmb ### Description Base class for embedding methods providing core configuration for diffusion kernels and MDS solvers. ### Parameters - **knn** (int) - Required - Number of nearest neighbors. - **anisotropy** (int) - Optional - Default: 0 - Anisotropy parameter in the diffusion kernel. - **decay** (int) - Optional - Default: 40 - Decay parameter in the diffusion kernel. - **n_pca** (int) - Optional - Default: 40 - Number of principal components to use for knn estimation. - **tau** (Union[int, str]) - Optional - Default: 'auto' - Diffusion time. - **emb_dim** (int) - Optional - Default: 2 - Embedding dimension. - **order** (int) - Optional - Default: 32 - Order of the Chebyshev approximation, or steps in Euler’s method. - **random_state** (int) - Optional - Default: 42 - Random state for the embedding. - **scale_factor** (float) - Optional - Default: 2.0 - Power when computing the distance matrix. - **solver** (str) - Optional - Default: 'sgd' - Solver to use for MDS. - **lap_type** (str) - Optional - Default: 'normalized' - Type of Laplacian to use for the graph. - **filter_method** (str) - Optional - Default: 'pygsp' - Method to use for Heat approx. - **graph_type** (str) - Optional - Default: 'alpha' - Type of graph to use for the embedding. ``` -------------------------------- ### Graph Construction Methods Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Functions to generate graphs from input data X using different kernel strategies. ```APIDOC ## get_umap_graph ### Description Generates a UMAP graph from input data. ### Method FUNCTION ### Parameters #### Arguments - **X** (array) - Required - Input data - **knn** (int) - Optional - Number of neighbors, defaults to 5 - **kwargs** (dict) - Optional - Additional arguments ## get_scanpy_graph ### Description Generates a graph using Scanpy methods. ### Parameters - **X** (array) - Required - Input data - **knn** (int) - Optional - Number of neighbors, defaults to 5 - **kwargs** (dict) - Optional - Additional arguments ## get_alpha_decay_graph ### Description Generates an alpha-decay kernel graph. ### Parameters - **X** (array) - Required - Input data - **knn** (int) - Optional - Number of neighbors, defaults to 5 - **decay** (float) - Optional - Decay factor, defaults to 40.0 - **anisotropy** (float) - Optional - Anisotropy factor, defaults to 0 - **n_pca** (int) - Optional - Number of PCA components - **kwargs** (dict) - Optional - Additional arguments ## get_knn_graph ### Description Generates a K-Nearest Neighbors graph. ### Parameters - **X** (array) - Required - Input data - **knn** (int) - Optional - Number of neighbors, defaults to 5 - **kwargs** (dict) - Optional - Additional arguments ``` -------------------------------- ### Create HeatGeo Embedding Source: https://krishnaswamylab.github.io/HeatGeo/index.html Instantiate the HeatGeo class and use fit_transform to create an embedding for the given data. The knn parameter controls the number of nearest neighbors. ```python from heatgeo.embedding import HeatGeo emb_op = HeatGeo(knn=5) emb = emb_op.fit_transform(data) ``` -------------------------------- ### Classic MDS Implementation Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Fast Classical MDS (CMDS) using random SVD. Takes pairwise distances as input. ```python classic (D, n_components=2, random_state=None) ``` -------------------------------- ### RandWalkGeo Implementation Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Use RandWalkGeo for embeddings based on a random walk matrix instead of the standard Heat kernel. Requires additional packages. ```python RandWalkGeo (knn:int, anisotropy:int=0, decay:int=40, n_pca:int=40, tau:int=10, emb_dim:int=2, filter_method:str='exact', order:int=32, lap_type:str='normalized', log_normalize:bool=False, scale_factor:float=1, denoising:bool=False, n_ref:int=50, n_svd:int=50, graph_type:str='alpha') ``` -------------------------------- ### ShortestPath Embedding Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Generates shortest path embeddings with various graph construction parameters. Requires additional packages. ```python ShortestPath (knn:int, anisotropy:int=0, decay:int=40, n_pca:int=40, graph_type:str='alpha', **kwargs) ``` -------------------------------- ### Perform HeatEuler Discretization Source: https://krishnaswamylab.github.io/HeatGeo/heat_filter.html Implicit Euler discretization of the heat equation using Cholesky prefactorization. ```python HeatEuler (L, t, K) ``` -------------------------------- ### HeatFilter API Source: https://krishnaswamylab.github.io/HeatGeo/heat_filter.html Wrapper for the approximation of the heat kernel. It supports different methods like Chebyshev polynomials ('pygsp', 'mar') and Backward Euler ('euler'). ```APIDOC ## HeatFilter ### Description Wrapper for the approximation of the heat kernel. ### Method Constructor ### Endpoint N/A (Class constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "graph": "", "tau": 0.1, "order": 32, "method": "pygsp" } ``` ### Response #### Success Response (200) Returns a callable function for applying the heat filter. #### Response Example ```json { "message": "Heat filter function returned" } ``` ``` -------------------------------- ### SGD MDS Implementation Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Metric MDS using stochastic gradient descent. Accepts pairwise distances and optional initialization. ```python sgd (D, w=None, n_components=2, random_state=None, init=None) ``` -------------------------------- ### HeatEuler API Source: https://krishnaswamylab.github.io/HeatGeo/heat_filter.html Implicit Euler discretization of the heat equation using Cholesky prefactorization. ```APIDOC ## HeatEuler ### Description Implicit Euler discretization of the heat equation using Cholesky prefactorization. ### Method Constructor ### Endpoint N/A (Class constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "L": "", "t": 0.1, "K": "" } ``` ### Response #### Success Response (200) Represents the implicit Euler discretization object. #### Response Example ```json { "message": "HeatEuler object created" } ``` ``` -------------------------------- ### Calculate optimal heat kernel Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Computes the heat kernel with an optimal tau value determined by Chebyshev approximation. ```python get_optimal_heat (emb_op, tau_max:float=50, n_tau:int=20) ``` -------------------------------- ### SMACOF MDS Implementation Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Metric and non-metric MDS using the SMACOF algorithm. Requires pairwise distances as input. ```python smacof (D, n_components=2, metric=True, init=None, random_state=None, verbose=0, max_iter=3000, eps=1e-06, n_jobs=1) ``` -------------------------------- ### compute_chebychev_coeff_all Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Computes the K+1 Chebyshev coefficients for the specified functions. ```APIDOC ## compute_chebychev_coeff_all ### Description Compute the K+1 Chebychev coefficients for our functions. ### Parameters - **phi** (float) - Required - Scaling parameter. - **tau** (float) - Required - Time parameter. - **K** (int) - Required - Degree of approximation. ``` -------------------------------- ### sgd Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Performs metric MDS using stochastic gradient descent. ```APIDOC ## sgd ### Description Performs metric Multidimensional Scaling (MDS) using stochastic gradient descent (SGD). ### Parameters - **D** (array-like, shape=[n_samples, n_samples]) - Pairwise distances. - **w** (array-like or None) - Weights for SGD. - **n_components** (int, optional) - Number of dimensions to embed into. Defaults to 2. - **random_state** (int or None, optional) - Numpy random state. - **init** (array-like or None, optional) - Initialization algorithm or state to use for MMDS. ### Returns - **Y** (array-like, embedded data [n_sample, ndim]) - Embedded data. ``` -------------------------------- ### Compute Chebyshev coefficients Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Calculates the K+1 Chebyshev coefficients for the specified functions. ```python compute_chebychev_coeff_all (phi, tau, K) ``` -------------------------------- ### ShortestPath Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Shortest path embedding with different graph construction. ```APIDOC ## ShortestPath ### Description Shortest path embedding with different graph construction. ### Parameters - **knn** (int) - Required - **anisotropy** (int) - Optional - Default: 0 - **decay** (int) - Optional - Default: 40 - **n_pca** (int) - Optional - Default: 40 - **graph_type** (str) - Optional - Default: 'alpha' - **kwargs** (dict) - Optional ``` -------------------------------- ### expm_multiply Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Computes the matrix exponential multiplied by a vector using Chebyshev approximation. ```APIDOC ## expm_multiply ### Description Computes the matrix exponential multiplied by a vector. ### Parameters - **L** (matrix) - Required - The graph Laplacian matrix. - **X** (vector) - Required - The input vector. - **phi** (float) - Required - Scaling parameter. - **tau** (float) - Required - Time parameter. - **K** (int) - Optional - Degree of approximation. - **err** (float) - Optional - Error tolerance. ``` -------------------------------- ### Calculate eta bounds Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Functions to compute specific or generic eta error bounds. ```python get_bound_eta_specific (phi, x, tau, K) ``` ```python get_bound_eta_generic (phi, x, tau, K) ``` -------------------------------- ### DiffusionMap Embedding Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Implements Diffusion Map embedding with flexible graph construction options. Requires additional packages. ```python DiffusionMap (knn:int=0, decay:int=40, n_pca:int=40, tau:float=1, emb_dim:int=2, anisotropy:int=0, graph_type:str='alpha', **kwargs) ``` -------------------------------- ### Compute time entropy Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Calculates the time entropy for a given heat kernel matrix. ```python time_entropy (H) ``` -------------------------------- ### POST /utils/interpolate Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Performs interpolation between two points over a specified number of steps. ```APIDOC ## POST /utils/interpolate ### Description Interpolates between x0 and x1 over n_steps. ### Parameters #### Request Body - **x0** (object) - Required - Starting point. - **x1** (object) - Required - Ending point. - **n_steps** (int) - Required - Number of interpolation steps. ``` -------------------------------- ### Calculate generic epsilon bound Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Computes the generic epsilon error bound. ```python get_bound_eps_generic (phi, x, tau, K) ``` -------------------------------- ### Calculate error bound E Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Computes the error bound E given K and C. ```python E (K, C) ``` -------------------------------- ### Calculate error bound g Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Computes the error bound g given K and C. ```python g (K, C) ``` -------------------------------- ### smacof Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Performs metric and non-metric MDS using the SMACOF algorithm. ```APIDOC ## smacof ### Description Performs metric and non-metric Multidimensional Scaling (MDS) using the SMACOF algorithm. ### Method SMACOF (Scaling by MAking use of COmputational FLuid dynamics) ### Parameters - **D** (array-like, shape=[n_samples, n_samples]) - Pairwise distances. - **n_components** (int, optional) - Number of dimensions to embed into. Defaults to 2. - **metric** (bool, optional) - Use metric MDS. If False, uses non-metric MDS. Defaults to True. - **init** (array-like or None, optional) - Initialization state. - **random_state** (int, RandomState or None, optional) - Numpy random state. - **verbose** (int or bool, optional) - Verbosity level. Defaults to 0. - **max_iter** (int, optional) - Maximum number of iterations. Defaults to 3000. - **eps** (float, optional) - Stopping criterion. Defaults to 1e-6. - **n_jobs** (int, optional) - Number of jobs to run in parallel. Defaults to 1. ### Returns - **Y** (array-like, shape=[n_samples, n_components]) - Embedded data. ``` -------------------------------- ### Determine minimal K for error bound Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Finds the smallest K such that the approximation error is less than or equal to the specified threshold. ```python reverse_bound (f, phi, x, tau, err) ``` -------------------------------- ### reverse_bound Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Determines the minimal degree K required to satisfy an error bound. ```APIDOC ## reverse_bound ### Description Returns the minimal K such that f(phi, x, tau, K) <= err. ### Parameters - **f** (function) - Required - The error function. - **phi** (float) - Required - Scaling parameter. - **x** (float) - Required - Input value. - **tau** (float) - Required - Time parameter. - **err** (float) - Required - Error tolerance. ``` -------------------------------- ### Diffusion Operator Functions Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Functions to compute diffusion metrics on pygsp graphs. ```APIDOC ## diff_aff ### Description Compute the diffusion affinity for a pygsp graph. ### Parameters - **graph** (pygsp.graph) - Required - The input graph ## kernel_degree ### Description Compute the kernel degree for a pygsp graph. ### Parameters - **graph** (pygsp.graph) - Required - The input graph ## diff_op ### Description Compute the diffusion operator for a pygsp graph. ### Parameters - **graph** (pygsp.graph) - Required - The input graph ``` -------------------------------- ### Compute Diffusion Affinity Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Computes the diffusion affinity for a pygsp graph. ```python diff_aff (graph) ``` -------------------------------- ### Interpolate data Source: https://krishnaswamylab.github.io/HeatGeo/utils.html Performs interpolation between two points over a specified number of steps. ```python interpolate (x0, x1, n_steps) ``` -------------------------------- ### Compute Kernel Degree Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Computes the kernel degree for a pygsp graph. ```python kernel_degree (graph) ``` -------------------------------- ### Compute Diffusion Operator Source: https://krishnaswamylab.github.io/HeatGeo/graph.html Computes the diffusion operator for a pygsp graph. ```python diff_op (graph) ``` -------------------------------- ### DiffusionMap Source: https://krishnaswamylab.github.io/HeatGeo/other_emb.html Diffusion Map embedding with different graph construction. ```APIDOC ## DiffusionMap ### Description Diffusion Map embedding with different graph construction. ### Parameters - **knn** (int) - Optional - Default: 0 - **decay** (int) - Optional - Default: 40 - **n_pca** (int) - Optional - Default: 40 - **tau** (float) - Optional - Default: 1 - **emb_dim** (int) - Optional - Default: 2 - **anisotropy** (int) - Optional - Default: 0 - **graph_type** (str) - Optional - Default: 'alpha' - **kwargs** (dict) - Optional ``` -------------------------------- ### Calculate Bergamaschi bounds Source: https://krishnaswamylab.github.io/HeatGeo/cheb.html Functions to compute specific or generic Bergamaschi error bounds. ```python get_bound_bergamaschi_specific (phi, x, tau, K) ``` ```python get_bound_bergamaschi_generic (phi, x, tau, K) ``` -------------------------------- ### embed_MDS Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Embeds data into a lower-dimensional space using MDS. ```APIDOC ## embed_MDS ### Description Embeds data into a lower-dimensional space using Multidimensional Scaling (MDS). ### Parameters - **X** (array-like) - Input data or pairwise distances. - **ndim** (int, optional) - Number of dimensions to embed into. Defaults to 2. - **seed** (int, optional) - Random seed for reproducibility. Defaults to 2. - **solver** (str, optional) - The solver to use for MDS. Defaults to 'sgd'. - **how** (str, optional) - Method for embedding ('metric' or 'non-metric'). Defaults to 'metric'. - **input_is_dist** (bool, optional) - Whether the input X is a distance matrix. Defaults to True. - **distance_metric** (str, optional) - The distance metric to use if input_is_dist is False. Defaults to 'euclidean'. - **mds_weights** (array-like or None, optional) - Weights for MDS. Defaults to None. ``` -------------------------------- ### Embed MDS Function Source: https://krishnaswamylab.github.io/HeatGeo/mds.html Function signature for embedding data using MDS with various solver options. ```python embed_MDS (X, ndim=2, seed=2, solver='sgd', how='metric', input_is_dist=True, distance_metric='euclidean', mds_weights=None) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.