pyLDLE2 package

Submodules

pyLDLE2.datasets module

class pyLDLE2.datasets.Datasets[source]

Bases: object

RP1(RES=100, noise=0)[source]
RP2(n=10000, noise=0)[source]
barbell(RES=100)[source]
checkered_board(m, n, RES=100, noise=0)[source]
circle(RES=100, noise=0)[source]
closedcurve_1(n=1000, noise=0)[source]
cuboid_and_swissroll(n=5000, RES=70, noise1=0.01, noise2=0.015, sep=0)[source]
curvedtorus3d(n=10000, noise=0, Rmax=0.25)[source]
cyclooctane(fpath)[source]
face_data(fpath, pc=False, n_pca=0)[source]
figure_eight(RES=100, noise=0)[source]
flattorus4d(ar=4, RES=100)[source]
floor(fpath, noise=0.01, n_transmitters=42, eps=1)[source]
helicical_tree(RES=100, noise=0)[source]
kleinbottle4d(ar=4, RES=100)[source]
linesegment(RES=100, noise=0)[source]
mnist(digits, n, n_pca=25, scale=True)[source]
mobiusstrip3d(ar=4, RES=90)[source]
multi_spheres(m=3, n=3000, noise=0, sep=1)[source]
noisyswissroll(RES=100, noise=0.01, noise_type='normal')[source]
non_uniform_trapezoid(ar=2, RES=100, r0=0.98, r1=0.75, noise=0, noise_type='uniform')[source]
puppets_data(dirpath, prefix='s1', n=None, bbox=None, grayscale=False, normalize=False, n_pca=100)[source]
rectanglegrid(ar=16, RES=100, noise=0, noise_type='uniform')[source]
rectanglegrid_mog(ar=16, RES=10, n=100, sigma=0.015, noise=0, noise_type='uniform')[source]
rose(ang_freq_n=2, ang_freq_d=1, radius=1, RES=1000, noise=0, n_cycles=None)[source]
soils88(labels_path, X_path)[source]
solidcuboid3d(l=0.5, w=0.5, RES=20)[source]
sphere(n=10000, noise=0)[source]
sphere3(n=10000, noise=0)[source]
sphere_and_swissroll(n=5000, RES=70, noise1=0.01, noise2=0.015, sep=1)[source]
sphere_mog(k=10, n=1000, sigma=0.1, noise=0)[source]
spherewithanomaly(n=10000, epsilon=0.05, noise=0.05)[source]
spherewithhole(n=10000)[source]
squarewithtwoholes(RES=100)[source]
swissrollwithhole(RES=100)[source]
twinpeaks(n=10000, noise=0, ar=4)[source]
wave_on_circle(RES=25, R_in=2, R_out=3, r=0.5, f=8)[source]
pyLDLE2.datasets.do_pca(X, n_pca)[source]
pyLDLE2.datasets.read_img(fpath, grayscale=False, bbox=None)[source]

pyLDLE2.gl_ module

class pyLDLE2.gl_.GL(debug=False)[source]

Bases: object

fit(neigh_dist, neigh_ind, local_opts)[source]
pyLDLE2.gl_.graph_laplacian(neigh_dist, neigh_ind, k_nn, k_tune, gl_type, return_diag=False, use_out_degree=True, tuning='self', doubly_stochastic_max_iter=0)[source]
pyLDLE2.gl_.sinkhorn(M, k)[source]

Sinkhorn algorithm with fixed number of iterations https://arxiv.org/abs/1306.0895

pyLDLE2.gl_.umap_kernel(knn_indices, knn_dists, k_tune)[source]

pyLDLE2.global_reg_ module

pyLDLE2.global_reg_.build_ortho_optim(d, Utilde, intermed_param, far_off_points=[], repel_by=0.0, beta=None, ret_CCs=False)[source]
pyLDLE2.global_reg_.compute_CC(D, B, Lpinv_BT)[source]
pyLDLE2.global_reg_.compute_Lpinv_BT(W, B)[source]
pyLDLE2.global_reg_.compute_Lpinv_BT_cg(Utilde, B)[source]
pyLDLE2.global_reg_.compute_Lpinv_MT(Lpinv_helpers, B)[source]
pyLDLE2.global_reg_.compute_Lpinv_helpers(W)[source]
pyLDLE2.global_reg_.compute_Z_s_to_tear(y, s, Z_s, C, c, k, metric='euclidean')[source]
pyLDLE2.global_reg_.compute_alignment_err(d, Utilde, intermed_param, scale_num, far_off_points=[], repel_by=0.0, beta=None)[source]
pyLDLE2.global_reg_.compute_far_off_points(d_e, global_opts, force_compute=False)[source]
pyLDLE2.global_reg_.gpm_alignment(y, d, Utilde, C, intermed_param, global_opts)[source]
pyLDLE2.global_reg_.ltsa_alignment(y, d, Utilde, C, intermed_param, global_opts, seq_of_intermed_views_in_cluster)[source]
pyLDLE2.global_reg_.procrustes_final(y, d, Utilde, C, intermed_param, seq_of_intermed_views_in_cluster, global_opts)[source]
pyLDLE2.global_reg_.procrustes_init(seq, rho, y, is_visited_view, d, Utilde, n_Utilde_Utilde, C, c, intermed_param, global_opts, print_freq=1000)[source]
pyLDLE2.global_reg_.rgd_alignment(y, d, Utilde, C, intermed_param, global_opts)[source]
pyLDLE2.global_reg_.sdp_alignment(y, d, Utilde, C, intermed_param, global_opts, seq_of_intermed_views_in_cluster, solver=None)[source]
pyLDLE2.global_reg_.spectral_alignment(y, d, Utilde, C, intermed_param, global_opts, seq_of_intermed_views_in_cluster)[source]
pyLDLE2.global_reg_.vec(A)[source]

pyLDLE2.global_views_ module

class pyLDLE2.global_views_.GlobalViews(exit_at, print_logs=True, debug=False)[source]

Bases: object

add_spacing_bw_clusters(y, d, seq_of_intermed_views_in_cluster, intermed_param, C)[source]
compute_Utildeg(y, C, global_opts)[source]
compute_color_of_pts_on_tear(y, Utilde, C, global_opts, n_Utilde_Utilde, Utildeg=None)[source]
compute_color_of_pts_on_tear_heuristic(y, Utilde, C, global_opts, n_Utilde_Utilde, Utildeg=None)[source]
compute_final_embedding(y, d, d_e, Utilde, C, c, intermed_param, n_Utilde_Utilde, seq_of_intermed_views_in_cluster, parents_of_intermed_views_in_cluster, cluster_of_intermed_view, global_opts, vis, vis_opts, reset=True)[source]
compute_init_embedding(d, d_e, Utilde, n_Utilde_Utilde, intermed_param, seq_of_intermed_views_in_cluster, parents_of_intermed_views_in_cluster, C, c, vis, vis_opts, global_opts, print_prop=0.25)[source]
compute_pwise_dist_in_embedding(intermed_param, Utilde, C, global_opts, y=None, dist=None, max_crossings=5, tol=1e-06)[source]
compute_seq_of_intermediate_views(Utilde, n_C, n_Utilde_Utilde, intermed_param, global_opts, print_prop=0.25)[source]
compute_spectral_color_of_pts_on_tear(y, Utilde, C, global_opts, n_Utilde_Utilde, Utildeg=None, return_G_T=False)[source]
fit(d, d_e, Utilde, C, c, n_C, intermed_param, global_opts, vis, vis_opts)[source]
log(s='', log_time=False)[source]
vis_embedding(y, vis, vis_opts, color_of_pts_on_tear=None, title='')[source]
vis_embedding_(y, d, intermed_param, c, C, Utilde, n_Utilde_Utilde, global_opts, vis, vis_opts, title='', color_of_pts_on_tear=None, Utilde_t=None)[source]

pyLDLE2.intermed_views_ module

class pyLDLE2.intermed_views_.IntermedViews(exit_at, verbose=True, debug=False)[source]

Bases: object

best(d, d_e, U, neigh_ind_, local_param, intermed_opts)[source]
fit(d, d_e, U, local_param, intermed_opts)[source]
log(s='', log_time=False)[source]
match_n_merge(d, d_e, U, neigh_ind, local_param, intermed_opts)[source]
pyLDLE2.intermed_views_.cost_of_moving(k, d_e, neigh_ind_k, U_k, local_param, c, n_C, Utilde, eta_min, eta_max)[source]
pyLDLE2.intermed_views_.merging_cost(s, m, Utilde_s, Utilde_m, d_e, local_param)[source]

pyLDLE2.ipge_ module

class pyLDLE2.ipge_.IPGE(debug=False)[source]

Bases: object

FeymanKac(L, phi, U, print_prop=0.25)[source]
compute_Atilde_LDLE_3(L, phi0, phi, lmbda0, lmbda, d_e, U, epsilon, p, d, autotune, print_prop=0.25)[source]
compute_gradient_using_LLR(X, phi, d_e, U, t, d, print_prop=0.25)[source]
fem(opts, print_prop=0.25)[source]
llr(X, phi, d_e, U, epsilon, p, d, print_prop=0.25)[source]

pyLDLE2.ldle_ module

pyLDLE2.local_views_ module

class pyLDLE2.local_views_.LocalViews(exit_at=None, verbose=True, debug=False)[source]

Bases: object

compute_LDLE(d, d_e, phi, U, Atilde, gamma, local_opts, print_prop=0.25)[source]
compute_LISOMAP(d, X, d_e, U, local_opts, print_prop=0.25)[source]
compute_LKPCA(d, X, d_e, U, local_opts, print_prop=0.25)[source]
compute_LPCA(d, X, d_e, U, local_opts, print_prop=0.25)[source]
compute_Smooth_LPCA(d, X, d_e, U, local_opts, print_prop=0.25)[source]
fit(d, X, d_e, neigh_dist, neigh_ind, ddX, local_opts)[source]
log(s='', log_time=False)[source]
postprocess(d_e, local_param_pre, U, local_opts)[source]

pyLDLE2.util_ module

class pyLDLE2.util_.Param(algo='LPCA', **kwargs)[source]

Bases: object

alignment_wts(opts)[source]
eval_(opts)[source]
out_of_sample_eval_(opts)[source]
reconstruct_(opts)[source]
repulsion_wts(opts)[source]
pyLDLE2.util_.compute_distortion_at(y_d_e, s_d_e)[source]
pyLDLE2.util_.compute_global_distortions(X, y, n_nbr=10, buml_obj_path='', read_dir_root='', save_dir_root='', n_proc=32)[source]
pyLDLE2.util_.compute_prctile_distortion_at(y_d_e, s_d_e, prctile=50)[source]
pyLDLE2.util_.compute_zeta(d_e_mask0, Psi_k_mask)[source]
pyLDLE2.util_.custom_procrustes(X, Y, reflection='best')[source]
pyLDLE2.util_.get_path_lengths_in_embedding_space(s_d_e, pred, y_d_e, n_proc=8, verbose=True)[source]
pyLDLE2.util_.ixmax(x, k=0, idx=None)[source]
pyLDLE2.util_.lexargmax(x)[source]
pyLDLE2.util_.makedirs(dirpath)[source]
pyLDLE2.util_.nearest_neighbors(data, k_nn, metric, n_jobs=-1, sort_results=True)[source]
pyLDLE2.util_.path_exists(path)[source]
pyLDLE2.util_.print_log(s, log_time, local_start_time, global_start_time)[source]
pyLDLE2.util_.procrustes(A, B)[source]
pyLDLE2.util_.read(fpath, verbose=True)[source]
pyLDLE2.util_.reconstruct_(self, opts)[source]
pyLDLE2.util_.reconstruct_data(p, buml_obj, y, is_init=False, averaging=True)[source]
pyLDLE2.util_.save(dirpath, fname, data, verbose=True)[source]
pyLDLE2.util_.shortest_paths(X, n_nbrs)[source]
pyLDLE2.util_.sparse_matrix(neigh_ind, neigh_dist)[source]
pyLDLE2.util_.to_dense(x)[source]

pyLDLE2.visualize_ module

class pyLDLE2.visualize_.Visualize(save_dir='')[source]

Bases: object

Atilde(X, phi, i, j, Atilde, figsize=None, s=20)[source]
chosen_eigevec_inds_for_intermediate_views(X, Psitilde_i, c, figsize=(16, 8), s=20)[source]
chosen_eigevec_inds_for_local_views(X, Psi_i, figsize=(16, 8), s=20)[source]
compare_intermediate_high_low_distortion(X, Atilde, Psitilde_gamma, Psitilde_i, zetatilde, c, save_subdir='', figsize=None, s=20)[source]
compare_local_high_low_distortion(X, Atilde, Psi_gamma, Psi_i, zeta, save_subdir='', figsize=None, s=20)[source]
dX(X, ddX, title, figsize=None, s=20)[source]
data(X, labels, title='Data', figsize=None, s=20, cmap='jet', azim=None, elev=None, colorbar=False)[source]
distortion(X, zeta, title, figsize=None, s=20)[source]
distortion_boxplot(zeta, title, figsize=None)[source]
eigenvalues(lmbda, figsize=None)[source]
eigenvector(X, phi, i, figsize=None, s=20)[source]
gamma(X, gamma, i, figsize=None, s=20)[source]
global_distortion_viloinplot(dist_dict, ylabel='$\\log(D_k)$', title='violinplot for $\\log(D_k)$', log_scale=True, figsize=None)[source]
global_distortion_viloinplot_overlay(dist_dicts, label='$\\log(\\mathcal{G}_k)$', title='violinplot for $\\log(\\mathcal{G}_k)$', log_scale=True, figsize=None, color=None, widths=0.5, lw=3, offset1=1, offset2=0.01, legend=True, rotation=0, filled=False, loc_='lower right', bbox_to_anchor_=(1, -0.05, 0.35, 0.35), vert=True, ncol=1, columnspacing=2, prop={'size': 26}, remove_annotation=True)[source]
global_embedding(y, labels, cmap0, color_of_pts_on_tear=None, cmap1=None, title=None, figsize=None, s=30, set_title=False, elev=None, azim=None)[source]
global_embedding_images(X, img_shape, y, labels, cmap0, color_of_pts_on_tear=None, cmap1=None, title=None, figsize=None, s=30, zoom=1, offset_ratio=0.2, w_ratio=0.0025)[source]
global_embedding_images_v2(X, img_shape, y, labels, cmap0, color_of_pts_on_tear=None, cmap1=None, title='images', offset_ratio=0.3, zoom=1, nx=8, ny=8, v_ratio=0.8, w_ratio=0.005, figsize=None, s=30, to_remove=False, k_to_avoid=[], to_T=True)[source]
grad_phi(X, phi, grad_phi, i, prop=0.01, figsize=None, s=20)[source]
intermediate_views(X, phi, Utilde, gamma, Atilde, Psitilde_gamma, Psitilde_i, zetatilde, c, k=None, figsize=(15, 10), s=20, save_subdir='')[source]
intrinsic_dim(X, chi, figsize=None, s=20)[source]
local_views(X, local_param, U, gamma, Atilde, k=None, save_subdir='', figsize=(15, 10), s=20)[source]
local_views_lpca(X, local_param, U, k=None, save_subdir='', figsize=(15, 10), s=20)[source]
n_eigvecs_w_grad_lt(X, Atilde, thresh_prctile=None, figsize=(16, 8), s=20)[source]
seq_of_intermediate_views(X, c, seq, rho, Utilde, figsize=None, s=20, cmap='jet')[source]
visualize_epoch_data(X, Ls)[source]
pyLDLE2.visualize_.closest_pt(x_min, x_max, y_min, y_max, p)[source]
pyLDLE2.visualize_.colorcube(m)[source]
pyLDLE2.visualize_.combine_cmaps(zeta, U_k)[source]
pyLDLE2.visualize_.eval_param(phi, Psi_gamma, Psi_i, k, mask, beta=None, T=None, v=None)[source]
pyLDLE2.visualize_.get_orientations(step_size=15, max_angle=2520)[source]
pyLDLE2.visualize_.imscatter(x, y, image, ax=None, zoom=1)[source]
pyLDLE2.visualize_.on_close(event)[source]
pyLDLE2.visualize_.save_gif(y, labels, vis_obj, fpath, cmap='jet', FPS=10, step_size=15, max_angle=2880, s=1, figsize=(8, 8))[source]
pyLDLE2.visualize_.set_axes_equal(ax)[source]

Make axes of 3D plot have equal scale so that spheres appear as spheres, cubes as cubes, etc.. This is one possible solution to Matplotlib’s ax.set_aspect(‘equal’) and ax.axis(‘equal’) not working for 3D.

Input

ax: a matplotlib axis, e.g., as output from plt.gca().

Module contents