Mobius strip
[1]:
%matplotlib inline
[2]:
# Not really required
import sys
sys.path.insert(0, '../../..')
[3]:
from pyLDLE2 import datasets
from pyLDLE2 import buml_, util_
matplotlib.get_backend() = module://matplotlib_inline.backend_inline
[4]:
save_dir_root = '../data/pyLDLE2/mobiusstrip3d/'
[5]:
X, labelsMat, ddX = datasets.Datasets().mobiusstrip3d()
X.shape = (8280, 3)
[6]:
# The supplied options would override the default options
buml_obj = buml_.BUML(local_opts={'algo':'LDLE'},
intermed_opts={'eta_min': 5},
vis_opts={'c': labelsMat[:,0], 'save_dir': save_dir_root},
verbose=True, debug=True)
local_opts['k_nn0'] = 700 is created.
Options provided:
local_opts:
{
"Atilde_method": "LDLE_1",
"N": 100,
"U_method": "k_nn",
"algo": "LDLE",
"alpha": 1,
"debug": true,
"delta": 0.9,
"gl_type": "unnorm",
"k": 28,
"k_nn": 49,
"k_nn0": 700,
"k_tune": 7,
"lambda1_decay": 0.75,
"lambda1_init": 8,
"lambda1_min": 0.001,
"max_iter": 300,
"max_sparsity": 0.9,
"metric": "euclidean",
"n_proc": 32,
"p": 0.99,
"power": 5,
"pp_n_thresh": 32,
"radius": 0.5,
"reg": 0.0,
"scale_by": "gamma",
"tau": 50,
"to_postprocess": true,
"verbose": true
}
intermed_opts:
{
"algo": "best",
"debug": true,
"eta_max": 25,
"eta_min": 5,
"len_S_thresh": 256,
"local_algo": "LDLE",
"metric": "euclidean",
"n_proc": 32,
"n_times": 4,
"verbose": true
}
global_opts:
{
"add_dim": false,
"align_transform": "rigid",
"align_w_parent_only": true,
"alpha": 0.3,
"beta": {
"align": null,
"repel": 1
},
"color_tear": true,
"compute_error": false,
"debug": true,
"eps": 1e-08,
"err_tol": 0.0001,
"far_off_points_type": "reuse_fixed",
"init_algo_name": "procrustes",
"k": 28,
"max_internal_iter": 100,
"max_iter": 20,
"metric": "euclidean",
"n_proc": 32,
"n_repel": 0,
"nu": 3,
"patience": 5,
"refine_algo_name": "rgd",
"repel_by": 0.0,
"to_tear": true,
"verbose": true,
"vis_before_init": false
}
[7]:
buml_obj.fit(X=X)
Computing local views using LDLE
Constructing unnorm graph Laplacian + its eigendecomposition.
Done.
##############################
Time elapsed from last time log: 2.7 seconds
Total time elapsed: 2.7 seconds
##############################
Computing Atilde: Inner Prod of Grad of EigFuncs.
FEM for Atilde.
Atilde: 0 points processed...
Atilde: 2070 points processed...
Atilde: 4140 points processed...
Atilde: 6210 points processed...
Atilde: all points processed...
Done.
##############################
Time elapsed from last time log: 0.6 seconds
Total time elapsed: 3.4 seconds
##############################
Computing LDLE.
local_param: all 8280 points processed...
max distortion is 1004.665859
Done.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 4.9 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 7795, max distortion: 10.215162
#Param replaced: 3599, max distortion: 5.101422
#Param replaced: 1207, max distortion: 5.062659
#Param replaced: 311, max distortion: 5.062659
#Param replaced: 65, max distortion: 5.062659
#Param replaced: 16, max distortion: 5.062659
#Param replaced: 1, max distortion: 5.062659
#Param replaced: 0, max distortion: 5.062659
Max local distortion after postprocessing: 5.062659433467454
Done.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 11.3 seconds
##############################
Max local distortion = 5.062659433467454
Constructing intermediate views.
eta = 2.
#non-empty views with sz < 2 = 8280
#nodes in views with sz < 2 = 8280
Costs computed when eta = 2.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 7.1 seconds
##############################
ctr=6431, total_len_S=42462, avg_len_S=6.603
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 158.4 seconds
Total time elapsed: 165.5 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 442
#nodes in views with sz < 3 = 884
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 167.0 seconds
##############################
ctr=777, total_len_S=14526, avg_len_S=18.695
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 8.2 seconds
Total time elapsed: 175.2 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 338
#nodes in views with sz < 4 = 1014
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 1.4 seconds
Total time elapsed: 176.6 seconds
##############################
ctr=915, total_len_S=24304, avg_len_S=26.562
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 15.7 seconds
Total time elapsed: 192.4 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 210
#nodes in views with sz < 5 = 840
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 193.8 seconds
##############################
ctr=780, total_len_S=24837, avg_len_S=31.842
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 14.2 seconds
Total time elapsed: 208.0 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.8 seconds
Total time elapsed: 208.8 seconds
##############################
After clustering, max distortion is 5.170363
Using rigid transforms for alignment.
Computing laterations scores for overlaps b/w intermed views
Done
##############################
Time elapsed from last time log: 1.4 seconds
Total time elapsed: 1.4 seconds
##############################
Computing a lateration.
Seq of intermediate views and their predecessors computed.
No. of connected components = 1
Done.
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.4 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.4 seconds
##############################
Initial alignment of 242 views completed
Initial alignment of 484 views completed
Initial alignment of 726 views completed
Initial alignment of 968 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 0.9 seconds
Total time elapsed: 2.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 0
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 8.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.0 seconds
Total time elapsed: 14.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 18.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 24.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 27.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.0 seconds
Total time elapsed: 34.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 38.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 10.9 seconds
Total time elapsed: 49.4 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 52.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 11.8 seconds
Total time elapsed: 64.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 67.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.7 seconds
Total time elapsed: 74.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 77.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 83.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 86.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.7 seconds
Total time elapsed: 92.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 95.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.6 seconds
Total time elapsed: 102.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 105.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 111.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 115.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.7 seconds
Total time elapsed: 121.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 124.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 131.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 134.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.6 seconds
Total time elapsed: 140.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 143.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 149.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 152.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 159.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 162.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.0 seconds
Total time elapsed: 169.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 172.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.2 seconds
Total time elapsed: 179.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 182.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 189.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 192.4 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.7 seconds
Total time elapsed: 199.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 202.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.3 seconds
Total time elapsed: 209.6 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 970 multiplied with B
Computing svd
Done
Alignment error: 1.234180
##############################
Time elapsed from last time log: 3.4 seconds
Total time elapsed: 213.0 seconds
##############################
[7]:
array([[0.0915467 , 0.09981265],
[0.09332139, 0.09977557],
[0.09698226, 0.09969434],
...,
[0.09658628, 0.11246386],
[0.09313934, 0.11155664],
[0.09133735, 0.10783215]])
[10]:
%matplotlib inline
buml_obj.GlobalViews.vis_embedding(buml_obj.GlobalViews.y_final, buml_obj.vis, buml_obj.vis_opts,
buml_obj.GlobalViews.color_of_pts_on_tear_final,
title='Final global embedding', )
[11]:
util_.save(save_dir_root, 'ldle.dat', [X, labelsMat, buml_obj])
[ ]: