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':'LPCA'},
                  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": "LPCA",
    "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": "LPCA",
    "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 LPCA
local_param: all 8280 points processed...
max distortion is 1.005234
Done.
##############################
Time elapsed from last time log: 0.8 seconds
Total time elapsed: 0.8 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 951, max distortion: 1.005234
#Param replaced: 2, max distortion: 1.005234
#Param replaced: 0, max distortion: 1.005234
Max local distortion after postprocessing: 1.0052336714783159
Done.
##############################
Time elapsed from last time log: 1.9 seconds
Total time elapsed: 2.7 seconds
##############################
Max local distortion = 1.0052336714783159
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: 5.1 seconds
Total time elapsed: 5.7 seconds
##############################
ctr=4775, total_len_S=13674, avg_len_S=2.864
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 25.5 seconds
Total time elapsed: 31.2 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 2437
#nodes in views with sz < 3 = 4874
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 2.5 seconds
Total time elapsed: 33.8 seconds
##############################
ctr=3197, total_len_S=57774, avg_len_S=18.071
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 139.4 seconds
Total time elapsed: 173.2 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 744
#nodes in views with sz < 4 = 2232
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 174.7 seconds
##############################
ctr=1658, total_len_S=41151, avg_len_S=24.820
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 44.5 seconds
Total time elapsed: 219.2 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 388
#nodes in views with sz < 5 = 1552
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 1.0 seconds
Total time elapsed: 220.2 seconds
##############################
ctr=1199, total_len_S=38111, avg_len_S=31.786
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 27.1 seconds
Total time elapsed: 247.3 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.7 seconds
Total time elapsed: 248.0 seconds
##############################
After clustering, max distortion is 1.007395
Using rigid transforms for alignment.
Computing laterations scores for overlaps b/w intermed views
Done
##############################
Time elapsed from last time log: 0.8 seconds
Total time elapsed: 0.8 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: 0.8 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 0.8 seconds
##############################
Initial alignment of 296 views completed
Initial alignment of 592 views completed
Initial alignment of 888 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 1.2 seconds
Total time elapsed: 2.0 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_1.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 0
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 4.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 11.0 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_3.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 13.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 19.3 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_5.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 21.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 27.9 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_7.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 30.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 36.6 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_9.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 38.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.6 seconds
Total time elapsed: 45.4 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_11.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 47.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 54.1 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_13.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 56.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 62.9 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_15.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 65.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.0 seconds
Total time elapsed: 71.2 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_17.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 73.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 79.7 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_19.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 82.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 88.1 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_21.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 90.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 96.6 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_23.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 98.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 105.3 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_25.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 107.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 114.1 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_27.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 116.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.7 seconds
Total time elapsed: 123.3 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_29.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 125.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 131.7 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_31.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 134.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.4 seconds
Total time elapsed: 140.5 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_33.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 142.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 148.9 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_35.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 151.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.0 seconds
Total time elapsed: 157.2 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_37.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 159.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 165.7 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_39.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 168.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.1 seconds
Total time elapsed: 174.2 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 8280 + 1184 multiplied with B
Computing svd
Done
Alignment error: 0.001550
##############################
Time elapsed from last time log: 3.7 seconds
Total time elapsed: 177.9 seconds
##############################
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_7_41.png
[7]:
array([[-0.20290935, -0.53078131],
       [-0.2034394 , -0.5363045 ],
       [-0.20396265, -0.54181468],
       ...,
       [-0.21120584, -0.54101489],
       [-0.21047748, -0.53551813],
       [-0.20975785, -0.53001663]])
[8]:
%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', )
../../_images/lpca_nbks_non_orientable_manifolds_mobiusstrip3d_8_0.png
[9]:
util_.save(save_dir_root, 'lpca.dat', [X, labelsMat, buml_obj])
[ ]: