Exemplo n.º 1
0
If you plan to estimate the Riemannian Metric then when you
compute the Laplacian for best results you should use
laplacian_method = 'geometric' and set the keyword
parameter 'scaling_epps' to the 'radius' that was used
in the affinity method.

First import the class:
'''

from megaman.geometry.rmetric import RiemannMetric

'''
We can then estimate the R metric on each embedding with:
'''
geom.laplacian_method = 'geometric'
geom.laplacian_kwds = {'scaling_epps':radius} # scaling ensures convergence to Laplace-Beltrami operator
laplacian_matrix = geom.compute_laplacian_matrix()


rmetric_spectral = RiemannMetric(embed_spectral, geom.laplacian_matrix)
H_spectral = rmetric_spectral.get_dual_rmetric()

rmetric_ltsa = RiemannMetric(embed_ltsa, geom.laplacian_matrix)
H_ltsa = rmetric_ltsa.get_dual_rmetric()

rmetric_lle = RiemannMetric(embed_lle, geom.laplacian_matrix)
H_lle = rmetric_lle.get_dual_rmetric()

rmetric_isomap = RiemannMetric(embed_isomap, geom.laplacian_matrix)
H_isomap = rmetric_isomap.get_dual_rmetric()
Exemplo n.º 2
0
adjacency_method = 'cyflann'
adjacency_kwds = {'radius': radius}
affinity_method = 'gaussian'
affinity_kwds = {'radius': radius}
laplacian_method = 'symmetricnormalized'
laplacian_kwds = {'scaling_epps': radius}
dataname = workingdirectory + '/untracked_data/chemistry_data/tolueneangles020619_pca50'
#dataname = '/Users/samsonkoelle/Downloads/manigrad-100818/mani-samk-gradients/untracked_data/chemistry_data/ethanolangles022119_pca50'
data = np.load(dataname + '.npy')
geom = Geometry(adjacency_method=adjacency_method,
                adjacency_kwds=adjacency_kwds,
                affinity_method=affinity_method,
                affinity_kwds=affinity_kwds,
                laplacian_method=laplacian_method,
                laplacian_kwds=laplacian_kwds)
geom.set_data_matrix(data)
geom.laplacian_method = 'geometric'
geom.laplacian_kwds = {'scaling_epps': radius}
laplacian_matrix = geom.compute_laplacian_matrix()
geom.compute_laplacian_matrix()
sample = np.arange(0, data.shape[0], 1000)
distorion_vs_rad_dim2 = run_estimate_radius(data,
                                            geom.adjacency_matrix,
                                            sample=sample,
                                            d=1,
                                            rmin=1,
                                            rmax=10,
                                            ntry=50,
                                            run_parallel=True,
                                            search_space='logspace')
np.save(dataname + '_distortionradius', distorion_vs_rad_dim2)
Exemplo n.º 3
0
If you plan to estimate the Riemannian Metric then when you
compute the Laplacian for best results you should use
laplacian_method = 'geometric' and set the keyword
parameter 'scaling_epps' to the 'radius' that was used
in the affinity method.

First import the class:
'''

from megaman.geometry.rmetric import RiemannMetric
'''
We can then estimate the R metric on each embedding with:
'''
geom.laplacian_method = 'geometric'
geom.laplacian_kwds = {
    'scaling_epps': radius
}  # scaling ensures convergence to Laplace-Beltrami operator
laplacian_matrix = geom.compute_laplacian_matrix()

rmetric_spectral = RiemannMetric(embed_spectral, geom.laplacian_matrix)
H_spectral = rmetric_spectral.get_dual_rmetric()

rmetric_ltsa = RiemannMetric(embed_ltsa, geom.laplacian_matrix)
H_ltsa = rmetric_ltsa.get_dual_rmetric()

rmetric_lle = RiemannMetric(embed_lle, geom.laplacian_matrix)
H_lle = rmetric_lle.get_dual_rmetric()

rmetric_isomap = RiemannMetric(embed_isomap, geom.laplacian_matrix)
H_isomap = rmetric_isomap.get_dual_rmetric()
'''