geomfum package#
Subpackages#
- geomfum.dataset package
- Submodules
- geomfum.dataset.notebook module
- geomfum.dataset.torch module
DatasetMeshDatasetPairsDatasetPointCloudPointCloudDatasetScipyGraphShortestPathMetricShapeDatasetTriangleMeshTriangleMesh.dist_matrixTriangleMesh.edge_tangent_vectorsTriangleMesh.edgesTriangleMesh.equip_with_metric()TriangleMesh.face_area_vectorsTriangleMesh.face_areasTriangleMesh.face_normalsTriangleMesh.face_vertex_coordsTriangleMesh.from_file()TriangleMesh.n_facesTriangleMesh.n_verticesTriangleMesh.vertex_areasTriangleMesh.vertex_normalsTriangleMesh.vertex_tangent_frames
VertexEuclideanMetric
- Module contents
- geomfum.descriptor package
- Submodules
- geomfum.descriptor.learned module
- geomfum.descriptor.pipeline module
- geomfum.descriptor.spectral module
HeatKernelFilterHeatKernelSignatureHeatKernelSignatureRegistryLandmarkHeatKernelSignatureLandmarkHeatKernelSignatureRegistryLandmarkWaveKernelSignatureLandmarkWaveKernelSignatureRegistrySpectralDescriptorSpectralFilterWaveKernelFilterWaveKernelSignatureWaveKernelSignatureRegistryWhichRegistryMixinsWksDefaultDomainhks_default_domain()
- Module contents
- geomfum.metric package
- geomfum.numerics package
- geomfum.shape package
- Subpackages
- Submodules
- geomfum.shape.hierarchical module
- geomfum.shape.mesh module
FaceDivergenceOperatorFaceOrientationOperatorFaceValuedGradientHeatDistanceMetricShapeTriangleMeshTriangleMesh.dist_matrixTriangleMesh.edge_tangent_vectorsTriangleMesh.edgesTriangleMesh.equip_with_metric()TriangleMesh.face_area_vectorsTriangleMesh.face_areasTriangleMesh.face_normalsTriangleMesh.face_vertex_coordsTriangleMesh.from_file()TriangleMesh.n_facesTriangleMesh.n_verticesTriangleMesh.vertex_areasTriangleMesh.vertex_normalsTriangleMesh.vertex_tangent_frames
compute_edge_tangent_vectors()compute_tangent_frames()load_mesh()
- geomfum.shape.point_cloud module
- geomfum.shape.shape_utils module
- Module contents
PointCloudShapeTriangleMeshTriangleMesh.dist_matrixTriangleMesh.edge_tangent_vectorsTriangleMesh.edgesTriangleMesh.equip_with_metric()TriangleMesh.face_area_vectorsTriangleMesh.face_areasTriangleMesh.face_normalsTriangleMesh.face_vertex_coordsTriangleMesh.from_file()TriangleMesh.n_facesTriangleMesh.n_verticesTriangleMesh.vertex_areasTriangleMesh.vertex_normalsTriangleMesh.vertex_tangent_frames
- geomfum.wrap package
- Submodules
- geomfum.wrap.diffusionnet module
BaseFeatureExtractorDiffusionNetDiffusionNetBlockDiffusionnetFeatureExtractorLearnedTimeDiffusionMiniMLPSpatialGradientFeaturesTriangleMeshTriangleMesh.dist_matrixTriangleMesh.edge_tangent_vectorsTriangleMesh.edgesTriangleMesh.equip_with_metric()TriangleMesh.face_area_vectorsTriangleMesh.face_areasTriangleMesh.face_normalsTriangleMesh.face_vertex_coordsTriangleMesh.from_file()TriangleMesh.n_facesTriangleMesh.n_verticesTriangleMesh.vertex_areasTriangleMesh.vertex_normalsTriangleMesh.vertex_tangent_frames
- geomfum.wrap.igl module
- geomfum.wrap.plotly module
- geomfum.wrap.pointnet module
- geomfum.wrap.polyscope module
- geomfum.wrap.pot module
- geomfum.wrap.pp3d module
- geomfum.wrap.pyfm module
BaseLaplacianFinderBaseSamplerFunctionalOperatorPyFmFaceOrientationOperatorPyfmEuclideanFarthestVertexSamplerPyfmFaceDivergenceOperatorPyfmFaceValuedGradientPyfmHeatKernelSignaturePyfmLandmarkHeatKernelSignaturePyfmLandmarkWaveKernelSignaturePyfmMeshLaplacianFinderPyfmWaveKernelSignatureSpectralDescriptorVectorFieldOperatorWksDefaultDomainget_orientation_op()hks_default_domain()
- geomfum.wrap.pymeshlab module
- geomfum.wrap.pyrmt module
HierarchicalShapePyrmtHierarchicalMeshRMTMeshTriangleMeshTriangleMesh.dist_matrixTriangleMesh.edge_tangent_vectorsTriangleMesh.edgesTriangleMesh.equip_with_metric()TriangleMesh.face_area_vectorsTriangleMesh.face_areasTriangleMesh.face_normalsTriangleMesh.face_vertex_coordsTriangleMesh.from_file()TriangleMesh.n_facesTriangleMesh.n_verticesTriangleMesh.vertex_areasTriangleMesh.vertex_normalsTriangleMesh.vertex_tangent_frames
- geomfum.wrap.pyvista module
- geomfum.wrap.robust module
- geomfum.wrap.transformer module
- Module contents
has_package()register_face_divergence_operator()register_face_orientation_operator()register_face_valued_gradient()register_feature_extractor()register_heat_distance_metric()register_heat_kernel_signature()register_hierarchical_mesh()register_landmark_heat_kernel_signature()register_landmark_wave_kernel_signature()register_laplacian_finder()register_mesh_plotter()register_neighbor_finder()register_point_cloud_plotter()register_poisson_sampler()register_wave_kernel_signature()
Submodules#
geomfum.basis module#
Basis implementations. This module defines various function space bases used in GeomFum. A basis is a set of functionsdefined on a shape that can be used to represent other functions on that shape.
- class geomfum.basis.EigenBasis(vals, vecs, use_k=None)[source]#
Bases:
BasisBasis formed by eigenvectors with dynamic truncation support.
- Parameters:
vals (array-like, shape=[full_spectrum_size]) – Eigenvalues.
vecs (array-like, shape=[dim, full_spectrum_size]) – Eigenvectors.
use_k (int) – Number of values to use on computations.
- property full_spectrum_size#
Total number of stored eigenvalues/eigenvectors.
- Returns:
spectrum_size (int) – Spectrum size.
- property nonzero_vals#
Nonzero eigenvalues.
- Returns:
vals (array-like, shape=[spectrum_size - n_zeros]) – Eigenvalues.
- property nonzero_vecs#
Eigenvectors corresponding to nonzero eigenvalues.
- Returns:
vecs (array-like, shape=[dim, spectrum_size - n_zeros]) – Eigenvectors.
- property spectrum_size#
Number of eigenvalues/eigenvectors currently in use.
- Returns:
spectrum_size (int) – Spectrum size.
- truncate(spectrum_size)[source]#
Create new basis with reduced spectrum size.
- Parameters:
spectrum_size (int) – Spectrum size.
- Returns:
basis (Eigenbasis) – Truncated eigenbasis.
- property vals#
Currently used eigenvalues (truncated to use_k).
- Returns:
vals (array-like, shape=[spectrum_size]) – Eigenvalues.
- property vecs#
Currently used eigenvectors (truncated to use_k).
- Returns:
vecs (array-like, shape=[dim, spectrum_size]) – Eigenvectors.
- class geomfum.basis.LaplaceEigenBasis(shape, vals, vecs, use_k=None)[source]#
Bases:
EigenBasisEigenbasis of the Laplace-Beltrami operator with mass matrix projection.
- Parameters:
shape (Shape) – Shape.
vals (array-like, shape=[spectrum_size]) – Eigenvalues.
vecs (array-like, shape=[dim, spectrum_size]) – Eigenvectors.
use_k (int) – Number of values to use on computations.
- property pinv#
L2 pseudo-inverse for projecting functions onto the basis.
- Returns:
pinv (array-like, shape=[spectrum_size, n_vertices]) – Inverse of the eigenvectors matrix.
- project(array)[source]#
Project function onto the eigenbasis using L2 inner product.
- Parameters:
array (array-like, shape=[…, n_vertices]) – Function values to project.
- Returns:
projected_array (array-like, shape=[…, spectrum_size]) – Spectral coefficients.
- truncate(spectrum_size)[source]#
Create new basis with reduced spectrum size.
- Parameters:
spectrum_size (int) – Spectrum size.
- Returns:
basis (LaplaceEigenBasis) – Truncated eigenbasis.
- property use_k#
Number of basis functions actively used in computations.
- Returns:
use_k (int) – Number of values to use on computations.
geomfum.convert module#
Conversion between pointwise and functional maps. In this module we define various converters to go from pointwise maps to functional maps and viceversa.
- class geomfum.convert.BaseNeighborFinder(n_neighbors=1)[source]#
Bases:
ABCBase class for a Neighbor finder.
- Parameters:
n_neighbors (int) – Number of neighbors to find.
- class geomfum.convert.FmFromP2pBijectiveConverter(pseudo_inverse=False)[source]#
Bases:
BaseFmFromP2pConverterBijective functional map from pointwise map method.
References
[VM2024]Giulio Viganò Simone Melzi. Bijective upsampling and learned embedding for point clouds correspondences. Computers and Graphics, 2024. https://doi.org/10.1016/j.cag.2024.103985.
- class geomfum.convert.FmFromP2pConverter(pseudo_inverse=False)[source]#
Bases:
BaseFmFromP2pConverterFunctional map from pointwise map.
- Parameters:
pseudo_inverse (bool) – Whether to solve using pseudo-inverse.
- class geomfum.convert.NamFromP2pConverter(iter_max=200, patience=10, min_delta=0.0001, device='cpu')[source]#
Bases:
BaseFmFromP2pConverterNeural Adjoint Map from pointwise map using Neural Adjoint Maps (NAMs).
- class geomfum.convert.NearestNeighbors(*, n_neighbors=5, radius=1.0, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, n_jobs=None)[source]#
Bases:
KNeighborsMixin,RadiusNeighborsMixin,NeighborsBaseUnsupervised learner for implementing neighbor searches.
Read more in the User Guide.
Added in version 0.9.
- Parameters:
n_neighbors (int, default=5) – Number of neighbors to use by default for
kneighbors()queries.radius (float, default=1.0) – Range of parameter space to use by default for
radius_neighbors()queries.algorithm ({‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute’}, default=’auto’) – Algorithm used to compute the nearest neighbors:
‘ball_tree’ will use
BallTree‘kd_tree’ will use
KDTree‘brute’ will use a brute-force search.
‘auto’ will attempt to decide the most appropriate algorithm based on the values passed to
fit()method.
Note: fitting on sparse input will override the setting of this parameter, using brute force.
leaf_size (int, default=30) – Leaf size passed to BallTree or KDTree. This can affect the speed of the construction and query, as well as the memory required to store the tree. The optimal value depends on the nature of the problem.
metric (str or callable, default=’minkowski’) – Metric to use for distance computation. Default is “minkowski”, which results in the standard Euclidean distance when p = 2. See the documentation of scipy.spatial.distance and the metrics listed in
distance_metricsfor valid metric values.If metric is “precomputed”, X is assumed to be a distance matrix and must be square during fit. X may be a sparse graph, in which case only “nonzero” elements may be considered neighbors.
If metric is a callable function, it takes two arrays representing 1D vectors as inputs and must return one value indicating the distance between those vectors. This works for Scipy’s metrics, but is less efficient than passing the metric name as a string.
p (float (positive), default=2) – Parameter for the Minkowski metric from sklearn.metrics.pairwise.pairwise_distances. When p = 1, this is equivalent to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used.
metric_params (dict, default=None) – Additional keyword arguments for the metric function.
n_jobs (int, default=None) – The number of parallel jobs to run for neighbors search.
Nonemeans 1 unless in ajoblib.parallel_backendcontext.-1means using all processors. See Glossary for more details.
- effective_metric_params_#
Parameters for the metric used to compute distances to neighbors.
- Type:
- feature_names_in_#
Names of features seen during fit. Defined only when X has feature names that are all strings.
Added in version 1.0.
- Type:
ndarray of shape (n_features_in_,)
See also
KNeighborsClassifierClassifier implementing the k-nearest neighbors vote.
RadiusNeighborsClassifierClassifier implementing a vote among neighbors within a given radius.
KNeighborsRegressorRegression based on k-nearest neighbors.
RadiusNeighborsRegressorRegression based on neighbors within a fixed radius.
BallTreeSpace partitioning data structure for organizing points in a multi-dimensional space, used for nearest neighbor search.
Notes
See Nearest Neighbors in the online documentation for a discussion of the choice of
algorithmandleaf_size.https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm
Examples
>>> import numpy as np >>> from sklearn.neighbors import NearestNeighbors >>> samples = [[0, 0, 2], [1, 0, 0], [0, 0, 1]] >>> neigh = NearestNeighbors(n_neighbors=2, radius=0.4) >>> neigh.fit(samples) NearestNeighbors(...) >>> neigh.kneighbors([[0, 0, 1.3]], 2, return_distance=False) array([[2, 0]]...) >>> nbrs = neigh.radius_neighbors( ... [[0, 0, 1.3]], 0.4, return_distance=False ... ) >>> np.asarray(nbrs[0][0]) array(2)
- fit(X, y=None)[source]#
Fit the nearest neighbors estimator from the training dataset.
- Parameters:
X ({array-like, sparse matrix} of shape (n_samples, n_features) or (n_samples, n_samples) if metric=’precomputed’) – Training data.
y (Ignored) – Not used, present for API consistency by convention.
- Returns:
self (NearestNeighbors) – The fitted nearest neighbors estimator.
- class geomfum.convert.NeighborFinder(n_neighbors=1)[source]#
Bases:
WhichRegistryMixins,BaseNeighborFinderBase class for a Neighbor finder.
A simplified blueprint of
sklearn.NearestNeighborsimplementation.- Parameters:
n_neighbors (int) – Number of neighbors.
- class geomfum.convert.NeighborFinderRegistry[source]#
Bases:
Registry- MAP = {'pot': ('PotSinkhornNeighborFinder', None)}#
- default = 'pot'#
- has_internal = True#
- class geomfum.convert.NeuralAdjointMap(input_dim, output_dim, linear_module=None, non_linear_module=None, device='cpu')[source]#
Bases:
ModuleNeural Adjoint Map (NAM) composed by a linear branch and a non-linear MLP branch.
- Parameters:
input_dim (int) – The dimension of the input data.
output_dim (int) – The dimension of the output data. If None, it defaults to input_dim.
depth (int) – The number of layers in the MLP.
width (int) – The width of each layer in the MLP.
act (torch.nn.Module) – The activation function to be used in the MLP.
References
- class geomfum.convert.P2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#
Bases:
BaseP2pFromFmConverterPointwise map from functional map.
- Parameters:
neighbor_finder (NeighborFinder) – Nearest neighbor finder.
adjoint (bool) – Whether to use adjoint method.
References
[OCSBG2012]Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.
[VM2023]Giulio Viganò Simone Melzi. “Adjoint Bijective ZoomOut: Efficient Upsampling for Learned Linearly-Invariant Embedding.” The Eurographics Association, 2023. https://doi.org/10.2312/stag.20231293.
- class geomfum.convert.P2pFromNamConverter(neighbor_finder=None)[source]#
Bases:
BaseP2pFromFmConverterPointwise map from Neural Adjoint Map (NAM).
- Parameters:
neighbor_finder (NeighborFinder) – Nearest neighbor finder.
- class geomfum.convert.SinkhornP2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#
Bases:
P2pFromFmConverterPointwise map from functional map using Sinkhorn filters.
- Parameters:
neighbor_finder (SinkhornKNeighborsFinder) – Nearest neighbor finder.
adjoint (bool) – Whether to use adjoint method.
bijective (bool) – Whether to use bijective method. Check [VM2023].
References
[PRMWO2021]Gautam Pai, Jing Ren, Simone Melzi, Peter Wonka, and Maks Ovsjanikov. “Fast Sinkhorn Filters: Using Matrix Scaling for Non-Rigid Shape Correspondence with Functional Maps.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 11956-11965. https://hal.science/hal-03184936/document
- class geomfum.convert.SoftmaxNeighborFinder(n_neighbors=1, tau=0.07)[source]#
Bases:
BaseNeighborFinder,ModuleSoftmax neighbor finder.
Finds neighbors using softmax regularization.
- Parameters:
n_neighbors (int) – Number of neighbors.
tau (float) – Temperature parameter for softmax regularization.
- forward(X, Y)[source]#
Find k nearest neighbors using softmax regularization.
- Parameters:
X (array-like, shape=[n_points_x, n_features]) – Reference points.
Y (array-like, shape=[n_points_y, n_features]) – Query points.
- Returns:
neigs (array-like, shape=[n_points_x, n_neighbors]) – Indices of the nearest neighbors in Y for each point in X.
- softmax_matrix(X, Y)[source]#
Compute the permutation matrix P as a softmax of the similarity.
- Parameters:
X (array-like, shape=[n_points_x, n_features]) – Reference points.
Y (array-like, shape=[n_points_y, n_features]) – Query points.
- Returns:
P (array-like, shape=[n_points_x, n_points_y]) – Permutation matrix, where each row sums to 1.
geomfum.forward_functional_map module#
Optimization of the functional map with a forward pass.
- class geomfum.forward_functional_map.ForwardFunctionalMap(lmbda=1000.0, resolvent_gamma=1, bijective=True, fmap_shape=None)[source]#
-
Class for the forward pass of the functional map.
- Parameters:
lmbda (float) – Weight of the mask (default: 1e3).
resolvent_gamma (float) – Resolvant of the regularized functional map (default: 1).
bijective (bool) – Whether we compute the map in both the directions (default: True).
fmap_shape (tuple, optional) – Shape of fmap12, i.e (spectrum_size_b, spectrum_size_a). If None, the shape is inferred from the input shapes.
geomfum.functional_map module#
Factors to build functional map objective function.
- class geomfum.functional_map.FactorSum(factors, weight=1.0)[source]#
Bases:
WeightedFactorFactor sum.
- Parameters:
factors (list[WeightedFactor]) – Factors.
- gradient(fmap_matrix)[source]#
Compute energy gradient wrt functional map matrix.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
- Returns:
energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.
- class geomfum.functional_map.LBCommutativityEnforcing(vals_sqdiff, weight=1.0)[source]#
Bases:
WeightedFactorLaplace-Beltrami commutativity constraint.
- Parameters:
ev_sqdiff (array-like, shape=[spectrum_size_b, spectrum_size_a]) – (Normalized) matrix of squared eigenvalue differences.
weight (float) – Weight of the factor.
- gradient(fmap_matrix)[source]#
Compute energy gradient wrt functional map matrix.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
- Returns:
energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.
- class geomfum.functional_map.OperatorCommutativityEnforcing(oper_a, oper_b, weight=1.0)[source]#
Bases:
WeightedFactorOperator commutativity constraint.
- Parameters:
oper_a (array-like, shape=[spectrum_size_a, spectrum_size_a]) – Operator on first basis.
oper_b (array-like, shape=[spectrum_size_b, spectrum_size_b]) – Operator on second basis.
weight (float) – Weight of the factor.
- static compute_multiplication_operator(basis, descr)[source]#
Compute the multiplication operators associated with the descriptors.
- Parameters:
descr (array-like, shape=[…, n_vertices])
- Returns:
operators (array-like, shape=[…, spectrum_size, spectrum_size])
- static compute_orientation_operator(shape, descr, reversing=False, normalize=False)[source]#
Compute orientation preserving or reversing operators associated to each descriptor.
- Parameters:
reversing (bool) –
- whether to return operators associated to orientation inversion instead
of orientation preservation (return the opposite of the second operator)
normalize (bool) –
- whether to normalize the gradient on each face. Might improve results
according to the authors
- Returns:
list_op (list) – (n_descr,) where term i contains (D1,D2) respectively of size (k1,k1) and (k2,k2) which represent operators supposed to commute.
- classmethod from_multiplication(basis_a, descr_a, basis_b, descr_b, weight=1.0)[source]#
- Parameters:
descr_a (array-like, shape=[…, n_vertices])
descr_b (array-like, shape=[…, n_vertices])
- classmethod from_orientation(shape_a, descr_a, shape_b, descr_b, reversing_a=False, reversing_b=False, normalize=False, weight=1.0)[source]#
- Parameters:
descr_a (array-like, shape=[…, n_vertices])
descr_b (array-like, shape=[…, n_vertices])
- gradient(fmap_matrix)[source]#
Compute energy gradient wrt functional map matrix.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
- Returns:
energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.
- class geomfum.functional_map.SpectralDescriptorPreservation(sdescr_a, sdescr_b, weight=1.0)[source]#
Bases:
WeightedFactorSpectral descriptor energy preservation.
- Parameters:
sdescr_a (array-like, shape=[…, spectrum_size_a]) – Spectral descriptors on first basis.
sdescr_a (array-like, shape=[…, spectrum_size_b]) – Spectral descriptors on second basis.
weight (float) – Weight of the factor.
- gradient(fmap_matrix)[source]#
Compute energy gradient wrt functional map matrix.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
- Returns:
energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.
- class geomfum.functional_map.WeightedFactor(weight)[source]#
Bases:
ABCWeighted factor.
- Parameters:
weight (float) – Weight of the factor.
- abstractmethod gradient(fmap_matrix)[source]#
Compute energy gradient wrt functional map matrix.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
- Returns:
energy_gradient (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Weighted energy gradient wrt functional map matrix.
geomfum.io module#
geomfum.laplacian module#
Laplacian-related algorithms.
- class geomfum.laplacian.LaplaceEigenBasis(shape, vals, vecs, use_k=None)[source]#
Bases:
EigenBasisEigenbasis of the Laplace-Beltrami operator with mass matrix projection.
- Parameters:
shape (Shape) – Shape.
vals (array-like, shape=[spectrum_size]) – Eigenvalues.
vecs (array-like, shape=[dim, spectrum_size]) – Eigenvectors.
use_k (int) – Number of values to use on computations.
- property pinv#
L2 pseudo-inverse for projecting functions onto the basis.
- Returns:
pinv (array-like, shape=[spectrum_size, n_vertices]) – Inverse of the eigenvectors matrix.
- project(array)[source]#
Project function onto the eigenbasis using L2 inner product.
- Parameters:
array (array-like, shape=[…, n_vertices]) – Function values to project.
- Returns:
projected_array (array-like, shape=[…, spectrum_size]) – Spectral coefficients.
- truncate(spectrum_size)[source]#
Create new basis with reduced spectrum size.
- Parameters:
spectrum_size (int) – Spectrum size.
- Returns:
basis (LaplaceEigenBasis) – Truncated eigenbasis.
- property use_k#
Number of basis functions actively used in computations.
- Returns:
use_k (int) – Number of values to use on computations.
- class geomfum.laplacian.LaplacianFinder(*args, **kwargs)[source]#
Bases:
MeshWhichRegistryMixins,BaseLaplacianFinderAlgorithm to find the Laplacian.
- class geomfum.laplacian.LaplacianFinderRegistry[source]#
Bases:
NestedRegistry- Registries = {False: <class 'geomfum._registry._PointSetLaplacianFinderRegistry'>, True: <class 'geomfum._registry._MeshLaplacianFinderRegistry'>}#
- class geomfum.laplacian.LaplacianSpectrumFinder(spectrum_size=100, nonzero=False, fix_sign=False, laplacian_finder=None, eig_solver=None)[source]#
Bases:
objectAlgorithm to find Laplacian spectrum.
- Parameters:
spectrum_size (int) – Spectrum size. Ignored if
eig_solveris not None.nonzero (bool) – Remove zero zero eigenvalue.
fix_sign (bool) – Wheather to have all the first components with positive sign.
laplacian_finder (BaseLaplacianFinder) – Algorithm to find the Laplacian. Ignored if Laplace and mass matrices were already computed.
eig_solver (EigSolver) – Eigen solver.
- property spectrum_size#
Spectrum size.
- Returns:
spectrum_size (int) – Spectrum size.
- class geomfum.laplacian.MeshWhichRegistryMixins(*args, **kwargs)[source]#
Bases:
objectMixin for registry-based instantiation with mesh/point cloud distinction.
- class geomfum.laplacian.ScipyEigsh(spectrum_size=6, sigma=None, which='LM')[source]#
Bases:
objectSparse eigenvalue solver using SciPy’s ARPACK wrapper.
- Parameters:
spectrum_size (int, optional) – Number of eigenvalues and eigenvectors to compute (default: 6).
sigma (float, optional) – Shift for shift-invert mode. If None, standard mode is used.
which (str, optional) – Which eigenvalues to find: ‘LM’ (largest magnitude), ‘SM’ (smallest magnitude), ‘LA’ (largest algebraic), ‘SA’ (smallest algebraic), etc. (default: ‘LM’).
geomfum.linalg module#
Linear algebra utils.
- geomfum.linalg.columnwise_scaling(vec, mat)[source]#
Columnwise scaling.
- Parameters:
vec (array-like, shape=[…, k]) – Vector of scalings.
mat (array-like, shape=[…, n, k]) – Matrix.
- Returns:
scaled_mat (array-like, shape=[…, n, k])
- geomfum.linalg.matvecmul(mat, vec)[source]#
Matrix vector multiplication.
- Parameters:
mat (array-like, shape=[…, m, n]) – Matrix.
vec (array-like, shape=[…, n]) – Vector.
- Returns:
matvec (array-like, shape=[…, m]) – Matrix vector multiplication.
- geomfum.linalg.normalize(array, axis=-1)[source]#
Normalize array along axis.
- Parameters:
array (array-like, shape=[…, n, …]) – Array to normalize.
axis (int) – Axis to use for normalization.
- Returns:
array (array-like, shape=[…, n, …]) – Normalized array.
- geomfum.linalg.rowwise_scaling(vec, mat)[source]#
Columnwise scaling.
- Parameters:
vec (array-like, shape=[…, n]) – Vector of scalings.
mat (array-like, shape=[…, n, k]) – Matrix.
- Returns:
scaled_mat (array-like, shape=[…, n, k])
geomfum.neural_adjoint_map module#
Neural Adjoint Maps (NAMs) for functional maps.
- class geomfum.neural_adjoint_map.MLP(input_dim, output_dim, depth=4, width=128, act=LeakyReLU(negative_slope=0.01), bias=True)[source]#
Bases:
ModuleA simple MLP (Multi-Layer Perceptron) module.
- Parameters:
input_dim (int) – The dimension of the input data.
output_dim (int) – The dimension of the output data.
depth (int) – The number of layers in the MLP.
width (int) – The width of each layer in the MLP.
act (torch.nn.Module) – The activation function to be used in the MLP.
- class geomfum.neural_adjoint_map.NeuralAdjointMap(input_dim, output_dim, linear_module=None, non_linear_module=None, device='cpu')[source]#
Bases:
ModuleNeural Adjoint Map (NAM) composed by a linear branch and a non-linear MLP branch.
- Parameters:
input_dim (int) – The dimension of the input data.
output_dim (int) – The dimension of the output data. If None, it defaults to input_dim.
depth (int) – The number of layers in the MLP.
width (int) – The width of each layer in the MLP.
act (torch.nn.Module) – The activation function to be used in the MLP.
References
geomfum.operator module#
Functional operators. This module defines various class to support implementation of functional operators, like Gradient and Laplacian.
- class geomfum.operator.FaceDivergenceOperator(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins,VectorFieldOperatorDivergence of a function on a mesh.
- class geomfum.operator.FaceDivergenceOperatorRegistry[source]#
Bases:
Registry- MAP = {'pyfm': ('PyfmFaceDivergenceOperator', None)}#
- default = 'pyfm'#
- class geomfum.operator.FaceOrientationOperator(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins,VectorFieldOperatorOrientation operator associated to a gradient field.
For a given function \(g\) on the vertices, this operator linearly computes \(< \grad(f) x \grad(g)\), n> for each vertex by averaging along the adjacent faces. In practice, we compute \(< n x \grad(f), \grad(g) >\) for simpler computation.
- class geomfum.operator.FaceOrientationOperatorRegistry[source]#
Bases:
Registry- MAP = {'pyfm': ('PyFmFaceOrientationOperator', None)}#
- default = 'pyfm'#
- class geomfum.operator.FaceValuedGradient(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins,FunctionalOperatorGradient of a function on a mesh.
Computes the gradient of a function on f using linear interpolation between vertices.
- class geomfum.operator.FaceValuedGradientRegistry[source]#
Bases:
Registry- MAP = {'pyfm': ('PyfmFaceValuedGradient', None)}#
- default = 'pyfm'#
- class geomfum.operator.FunctionalOperator(shape)[source]#
Bases:
ABCAbstract class fot Functional operator.
- class geomfum.operator.Gradient(shape, gradient_matrix=None)[source]#
Bases:
FunctionalOperatorGradient of a function f on a shape defined on the points.
- Parameters:
gradient_matrix (array-like, shape=[n_vertices, n_vertices]) – Gradient matrix.
- property gradient_matrix#
Compute the gradient operator as a complex sparse matrix.
This code locally fits a linear function to the scalar values at each vertex and its neighbors, extracts the gradient in the tangent plane, and assembles the global sparse matrix that acts as the discrete gradient operator on the mesh.
- Returns:
grad_op (complex gs.sparse.csc_matrix, shape=[n_vertices, n_vertices]) – Complex sparse matrix representing the gradient operator. The real part corresponds to the X component in the local tangent frame, and the imaginary part corresponds to the Y component.
- class geomfum.operator.Laplacian(shape, stiffness_matrix=None, mass_matrix=None)[source]#
Bases:
FunctionalOperatorLaplacian operator on a shape.
Check [P2016] for representation choice.
- Parameters:
stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.
mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Diagonal lumped mass matrix.
References
[P2016]Giuseppe Patané. “STAR - Laplacian Spectral Kernels and Distances for Geometry Processing and Shape Analysis.” Computer Graphics Forum 35, no. 2 (2016): 599–624. https://doi.org/10.1111/cgf.12866.
- property basis#
Laplace eigenbasis.
- Returns:
basis (LaplaceEigenBasis) – Laplace eigenbasis.
- find(laplacian_finder=None, recompute=False)[source]#
Compute the laplacian matrices using an indicated algorithm.
- Parameters:
laplacian_finder (BaseLaplacianFinder) – Algorithm to find the Laplacian.
recompute (bool) – Whether to recompute Laplacian if information is cached.
- Returns:
stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.
mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Diagonal lumped mass matrix.
- find_spectrum(spectrum_size=100, laplacian_spectrum_finder=None, set_as_basis=True, recompute=False)[source]#
Compute the spectrum of the Laplacian operator.
- Parameters:
spectrum_size (int) – Spectrum size. Ignored if
laplacian_spectrum_finderis not None.laplacian_spectrum_finder (LaplacianSpectrumFinder) – Algorithm to find Laplacian spectrum.
set_as_basis (bool) – Whether to set spectrum as basis.
recompute (bool) – Whether to recompute spectrum if information is cached in basis.
- Returns:
eigenvals (array-like, shape=[spectrum_size]) – Eigenvalues.
eigenvecs (array-like, shape=[n_vertices, spectrum_size]) – Eigenvectors.
- property mass_matrix#
Mass matrix.
- Returns:
mass_matrix (array-like, shape=[n_vertices, n_vertices]) – Mass matrix.
- property stiffness_matrix#
Stiffness matrix.
- Returns:
stiffness_matrix (array-like, shape=[n_vertices, n_vertices]) – Stiffness matrix.
- class geomfum.operator.LaplacianFinder(*args, **kwargs)[source]#
Bases:
MeshWhichRegistryMixins,BaseLaplacianFinderAlgorithm to find the Laplacian.
- class geomfum.operator.LaplacianSpectrumFinder(spectrum_size=100, nonzero=False, fix_sign=False, laplacian_finder=None, eig_solver=None)[source]#
Bases:
objectAlgorithm to find Laplacian spectrum.
- Parameters:
spectrum_size (int) – Spectrum size. Ignored if
eig_solveris not None.nonzero (bool) – Remove zero zero eigenvalue.
fix_sign (bool) – Wheather to have all the first components with positive sign.
laplacian_finder (BaseLaplacianFinder) – Algorithm to find the Laplacian. Ignored if Laplace and mass matrices were already computed.
eig_solver (EigSolver) – Eigen solver.
- property spectrum_size#
Spectrum size.
- Returns:
spectrum_size (int) – Spectrum size.
geomfum.plot module#
Plotting functions.
In this file we define the plotting logic. Since each plotting library has its own method of plotting, we define general functions that works with any library implemented
- class geomfum.plot.MeshPlotter(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins,ShapePlotterPlotting object to display meshes.
- class geomfum.plot.MeshPlotterRegistry[source]#
Bases:
Registry- MAP = {'plotly': ('PlotlyMeshPlotter', None), 'polyscope': ('PsMeshPlotter', None), 'pyvista': ('PvMeshPlotter', None)}#
- default = 'plotly'#
- class geomfum.plot.PointCloudPlotter(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins,ShapePlotterPlotting object to display point clouds.
- class geomfum.plot.PointCloudPlotterRegistry[source]#
Bases:
Registry- MAP = {'plotly': ('PlotlyPointCloudPlotter', None), 'polyscope': ('PsPointCloudPlotter', None), 'pyvista': ('PvPointCloudPlotter', None)}#
- default = 'plotly'#
- class geomfum.plot.ShapePlotter[source]#
Bases:
ABCPlotting object.
Primitive clas to plot meshes, pointclouds or specific useful informations (scalar functions, landmarks, etc..)
geomfum.refine module#
Functional map refinement machinery.
- class geomfum.refine.AdjointBijectiveZoomOut(nit=10, step=1)[source]#
Bases:
ZoomOutAdjoint bijective zoomout algorithm.
- Parameters:
nit (int) – Number of iterations.
step (int or tuple[2, int]) – How much to increase each basis per iteration.
References
[]
- class geomfum.refine.FastSinkhornFilters(nit=10, step=1, neighbor_finder=None)[source]#
Bases:
ZoomOutFast Sinkhorn filters.
- Parameters:
nit (int) – Number of iterations.
step (int or tuple[2, int]) – How much to increase each basis per iteration.
neighbor_finder (SinkhornKNeighborsFinder) – Nearest neighbor finder.
References
[PRMWO2021]Gautam Pai, Jing Ren, Simone Melzi, Peter Wonka, and Maks Ovsjanikov. “Fast Sinkhorn Filters: Using Matrix Scaling for Non-Rigid Shape Correspondence with Functional Maps.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 11956-11965. https://hal.science/hal-03184936/document
- class geomfum.refine.FmFromP2pBijectiveConverter(pseudo_inverse=False)[source]#
Bases:
BaseFmFromP2pConverterBijective functional map from pointwise map method.
References
[VM2024]Giulio Viganò Simone Melzi. Bijective upsampling and learned embedding for point clouds correspondences. Computers and Graphics, 2024. https://doi.org/10.1016/j.cag.2024.103985.
- class geomfum.refine.FmFromP2pConverter(pseudo_inverse=False)[source]#
Bases:
BaseFmFromP2pConverterFunctional map from pointwise map.
- Parameters:
pseudo_inverse (bool) – Whether to solve using pseudo-inverse.
- class geomfum.refine.IcpRefiner(nit=10, atol=0.0001, p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#
Bases:
IterativeRefinerIterative refinement of functional map using SVD.
- Parameters:
nit (int) – Number of iterations.
atol (float) – Convergence tolerance.
p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.
fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.
References
[OCSBG2012]Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.
- class geomfum.refine.IterativeRefiner(nit=10, step=0, atol=None, p2p_from_fm_converter=None, fm_from_p2p_converter=None, iter_refiner=None)[source]#
Bases:
RefinerIterative refinement of functional map.
At each iteration, it computes a pointwise map, converts it back to a functional map, and (optionally) furthers refines it.
- Parameters:
nit (int) – Number of iterations.
step (int or tuple[2, int]) – How much to increase each basis per iteration.
atol (float) – Convergence tolerance. Ignored if step different than 1.
p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.
fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.
iter_refiner (Refiner) – Refinement algorithm that runs within each iteration.
- iter(fmap_matrix, basis_a, basis_b)[source]#
Refiner iteration.
- Parameters:
fmap_matrix (array-like, shape=[spectrum_size_b, spectrum_size_a]) – Functional map matrix.
basis_a (Eigenbasis.) – Basis.
basis_b (Eigenbasis.) – Basis.
- Returns:
fmap_matrix (array-like, shape=[spectrum_size_b + step_b, spectrum_size_a + step_a]) – Refined functional map matrix.
- property step#
How much to increase each basis per iteration.
- Returns:
step (tuple[2, int]) – Step.
- class geomfum.refine.NamFromP2pConverter(iter_max=200, patience=10, min_delta=0.0001, device='cpu')[source]#
Bases:
BaseFmFromP2pConverterNeural Adjoint Map from pointwise map using Neural Adjoint Maps (NAMs).
- class geomfum.refine.NeuralZoomOut(nit=10, step=1, device='cpu')[source]#
Bases:
ZoomOutNeural zoomout algorithm.
- Parameters:
nit (int) – Number of iterations.
step (int or tuple[2, int]) – How much to increase each basis per iteration.
References
[VOM2025]Giulio Viganò, Maks Ovsjanikov, Simone Melzi. “NAM: Neural Adjoint Maps for refining shape correspondences”.
- class geomfum.refine.OrthogonalRefiner(flip_neg_det=True)[source]#
Bases:
RefinerRefinement using singular value decomposition.
- Parameters:
flip_neg_det (bool) – Whether to flip negative determinant for square matrices.
References
[OCSBG2012]Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.
- class geomfum.refine.P2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#
Bases:
BaseP2pFromFmConverterPointwise map from functional map.
- Parameters:
neighbor_finder (NeighborFinder) – Nearest neighbor finder.
adjoint (bool) – Whether to use adjoint method.
References
[OCSBG2012]Maks Ovsjanikov, Mirela Ben-Chen, Justin Solomon, Adrian Butscher, and Leonidas Guibas. “Functional Maps: A Flexible Representation of Maps between Shapes.” ACM Transactions on Graphics 31, no. 4 (2012): 30:1-30:11. https://doi.org/10.1145/2185520.2185526.
[VM2023]Giulio Viganò Simone Melzi. “Adjoint Bijective ZoomOut: Efficient Upsampling for Learned Linearly-Invariant Embedding.” The Eurographics Association, 2023. https://doi.org/10.2312/stag.20231293.
- class geomfum.refine.P2pFromNamConverter(neighbor_finder=None)[source]#
Bases:
BaseP2pFromFmConverterPointwise map from Neural Adjoint Map (NAM).
- Parameters:
neighbor_finder (NeighborFinder) – Nearest neighbor finder.
- class geomfum.refine.ProperRefiner(p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#
Bases:
RefinerRefinement projecting the functional map to the proper functional map space.
- Parameters:
p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.
fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.
- class geomfum.refine.SinkhornP2pFromFmConverter(neighbor_finder=None, adjoint=False, bijective=False)[source]#
Bases:
P2pFromFmConverterPointwise map from functional map using Sinkhorn filters.
- Parameters:
neighbor_finder (SinkhornKNeighborsFinder) – Nearest neighbor finder.
adjoint (bool) – Whether to use adjoint method.
bijective (bool) – Whether to use bijective method. Check [VM2023].
References
[PRMWO2021]Gautam Pai, Jing Ren, Simone Melzi, Peter Wonka, and Maks Ovsjanikov. “Fast Sinkhorn Filters: Using Matrix Scaling for Non-Rigid Shape Correspondence with Functional Maps.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 11956-11965. https://hal.science/hal-03184936/document
- class geomfum.refine.ZoomOut(nit=10, step=1, p2p_from_fm_converter=None, fm_from_p2p_converter=None)[source]#
Bases:
IterativeRefinerZoomout algorithm.
- Parameters:
nit (int) – Number of iterations.
step (int or tuple[2, int]) – How much to increase each basis per iteration.
p2p_from_fm_converter (P2pFromFmConverter) – Pointwise map from functional map.
fm_from_p2p_converter (FmFromP2pConverter) – Functional map from pointwise map.
References
[MRRSWO2019]Simone Melzi, Jing Ren, Emanuele Rodolà, Abhishek Sharma, Peter Wonka, and Maks Ovsjanikov. “ZoomOut: Spectral Upsampling for Efficient Shape Correspondence.” arXiv, September 12, 2019. http://arxiv.org/abs/1904.07865
geomfum.sample module#
Sampling methods. This module defines various sampling strategies for geometric shapes, including Poisson disk sampling and farthest point sampling to sample sets of point following geometric indications.
- class geomfum.sample.FarthestPointSampler(min_n_samples)[source]#
Bases:
BaseSamplerFarthest point sampling.
- Parameters:
min_n_samples (int) – Minimum number of samples to target.
- sample(shape, first_point=None, points_pool=None)[source]#
Perform farthest point sampling on a mesh.
- Parameters:
shape (TriangleMesh) – The mesh to sample points from.
first_point (int, optional) – Index of the initial point to start sampling from. If None, a random point is chosen.
points_pool (array-like or int, optional) – Pool of candidate points to sample from. If None, all vertices in the mesh are used.
- Returns:
samples (array-like of shape (min_n_samples,)) – Indices of sampled points.
- class geomfum.sample.NearestNeighbors(*, n_neighbors=5, radius=1.0, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, n_jobs=None)[source]#
Bases:
KNeighborsMixin,RadiusNeighborsMixin,NeighborsBaseUnsupervised learner for implementing neighbor searches.
Read more in the User Guide.
Added in version 0.9.
- Parameters:
n_neighbors (int, default=5) – Number of neighbors to use by default for
kneighbors()queries.radius (float, default=1.0) – Range of parameter space to use by default for
radius_neighbors()queries.algorithm ({‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute’}, default=’auto’) – Algorithm used to compute the nearest neighbors:
‘ball_tree’ will use
BallTree‘kd_tree’ will use
KDTree‘brute’ will use a brute-force search.
‘auto’ will attempt to decide the most appropriate algorithm based on the values passed to
fit()method.
Note: fitting on sparse input will override the setting of this parameter, using brute force.
leaf_size (int, default=30) – Leaf size passed to BallTree or KDTree. This can affect the speed of the construction and query, as well as the memory required to store the tree. The optimal value depends on the nature of the problem.
metric (str or callable, default=’minkowski’) – Metric to use for distance computation. Default is “minkowski”, which results in the standard Euclidean distance when p = 2. See the documentation of scipy.spatial.distance and the metrics listed in
distance_metricsfor valid metric values.If metric is “precomputed”, X is assumed to be a distance matrix and must be square during fit. X may be a sparse graph, in which case only “nonzero” elements may be considered neighbors.
If metric is a callable function, it takes two arrays representing 1D vectors as inputs and must return one value indicating the distance between those vectors. This works for Scipy’s metrics, but is less efficient than passing the metric name as a string.
p (float (positive), default=2) – Parameter for the Minkowski metric from sklearn.metrics.pairwise.pairwise_distances. When p = 1, this is equivalent to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used.
metric_params (dict, default=None) – Additional keyword arguments for the metric function.
n_jobs (int, default=None) – The number of parallel jobs to run for neighbors search.
Nonemeans 1 unless in ajoblib.parallel_backendcontext.-1means using all processors. See Glossary for more details.
- effective_metric_params_#
Parameters for the metric used to compute distances to neighbors.
- Type:
- feature_names_in_#
Names of features seen during fit. Defined only when X has feature names that are all strings.
Added in version 1.0.
- Type:
ndarray of shape (n_features_in_,)
See also
KNeighborsClassifierClassifier implementing the k-nearest neighbors vote.
RadiusNeighborsClassifierClassifier implementing a vote among neighbors within a given radius.
KNeighborsRegressorRegression based on k-nearest neighbors.
RadiusNeighborsRegressorRegression based on neighbors within a fixed radius.
BallTreeSpace partitioning data structure for organizing points in a multi-dimensional space, used for nearest neighbor search.
Notes
See Nearest Neighbors in the online documentation for a discussion of the choice of
algorithmandleaf_size.https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm
Examples
>>> import numpy as np >>> from sklearn.neighbors import NearestNeighbors >>> samples = [[0, 0, 2], [1, 0, 0], [0, 0, 1]] >>> neigh = NearestNeighbors(n_neighbors=2, radius=0.4) >>> neigh.fit(samples) NearestNeighbors(...) >>> neigh.kneighbors([[0, 0, 1.3]], 2, return_distance=False) array([[2, 0]]...) >>> nbrs = neigh.radius_neighbors( ... [[0, 0, 1.3]], 0.4, return_distance=False ... ) >>> np.asarray(nbrs[0][0]) array(2)
- fit(X, y=None)[source]#
Fit the nearest neighbors estimator from the training dataset.
- Parameters:
X ({array-like, sparse matrix} of shape (n_samples, n_features) or (n_samples, n_samples) if metric=’precomputed’) – Training data.
y (Ignored) – Not used, present for API consistency by convention.
- Returns:
self (NearestNeighbors) – The fitted nearest neighbors estimator.
- class geomfum.sample.PoissonSampler(*args, **kwargs)[source]#
Bases:
WhichRegistryMixinsPoisson disk sampling.
- class geomfum.sample.PoissonSamplerRegistry[source]#
Bases:
Registry- MAP = {'pymeshlab': ('PymeshlabPoissonSampler', None)}#
- default = 'pymeshlab'#
- class geomfum.sample.VertexProjectionSampler(min_n_samples=100, sampler=None, neighbor_finder=None, unique=False)[source]#
Bases:
BaseSamplerSample by projecting samples to the closest vertex.
Uses nearest neighbor to get indices of sample coordinates resulting from another sampler.
- Parameters:
min_n_samples (int) – Minimum number of samples to target. Ignored if
sampleris not None. Not guaranteed ifuniqueis True.sampler (BaseSampler) – Coordinates sampler.
neighbor_finder (sklearn.NearestNeighbors) – Nearest neighbors finder.
unique (bool) – Whether to remove duplicates.