예제 #1
0
 def test_size(self, dummy_dmap, size):
     mydmap = dummy_dmap
     scatter_kwargs = {'s': size}
     fig = viz.data_plot(mydmap, 1, scatter_kwargs=scatter_kwargs, show=False)
     SC = fig.axes[0].collections[0]
     actual_sizes = SC.get_sizes()
     assert(np.all(actual_sizes == size))
#test_evals = -4./eps*(mydmap.evals - 1)
#eval_error = np.abs(test_evals-real_evals)/real_evals
#print(test_evals)
#print(eval_error)

from pydiffmap.visualization import embedding_plot, data_plot

embedding_plot(mydmap,
               dim=2,
               scatter_kwargs={
                   'c': mydmap.dmap[:, 0],
                   'cmap': 'Spectral'
               })

plt.show()
data_plot(mydmap, dim=3, scatter_kwargs={'cmap': 'Spectral'})
plt.show()

northpole = np.argmax(mydmap.dmap[:, 0])
north = data[northpole, :]
phi_n = Phi[northpole]
theta_n = Theta[northpole]
R = np.array([[
    np.sin(theta_n) * np.cos(phi_n),
    np.sin(theta_n) * np.sin(phi_n), -np.cos(theta_n)
], [-np.sin(phi_n), np.cos(phi_n), 0],
              [
                  np.cos(theta_n) * np.cos(phi_n),
                  np.cos(theta_n) * np.sin(phi_n),
                  np.sin(theta_n)
              ]])
예제 #3
0
dmap = mydmap.fit_transform(X)

from pydiffmap.visualization import embedding_plot

embedding_plot(mydmap,
               scatter_kwargs={
                   'c': X[:, 0],
                   's': 5,
                   'cmap': 'coolwarm'
               })

plt.show()

from pydiffmap.visualization import data_plot

data_plot(mydmap, scatter_kwargs={'s': 5, 'cmap': 'coolwarm'})
plt.show()

V = DW
beta = 1
target_distribution = np.zeros(len(X))
for i in range(len(X)):
    target_distribution[i] = np.exp(-beta * V(X[i]))
mytdmap = dm.DiffusionMap(alpha=1.0, n_evecs=2, epsilon=.2, k=400)
tmdmap = mytdmap.fit_transform(X, weights=target_distribution)

embedding_plot(mytdmap,
               scatter_kwargs={
                   'c': X[:, 0],
                   's': 5,
                   'cmap': 'coolwarm'
예제 #4
0
 def test_no_kwargs(self, dummy_dmap):
     mydmap = dummy_dmap
     fig = viz.data_plot(mydmap, scatter_kwargs=None, show=False)
     assert (fig)