Swissroll with noise = 0.02

[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]:
noise = 0.02
[5]:
save_dir_root = '../data/pyLDLE2/swissroll_with_noise_'+str(noise)+'/'
[6]:
X, labelsMat, ddX = datasets.Datasets().noisyswissroll(noise=noise)
X.shape =  (10260, 3)
[7]:
# The supplied options would override the default options
buml_obj = buml_.BUML(local_opts={'algo':'LDLE'},
                  intermed_opts={'eta_min': 10},
                  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": 10,
    "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
}
[8]:
buml_obj.fit(X=X)
Computing local views using LDLE
Constructing unnorm graph Laplacian + its eigendecomposition.
Done.
##############################
Time elapsed from last time log: 3.6 seconds
Total time elapsed: 3.6 seconds
##############################
Computing Atilde: Inner Prod of Grad of EigFuncs.
FEM for Atilde.
Atilde: 0 points processed...
Atilde: 2565 points processed...
Atilde: 5130 points processed...
Atilde: 7695 points processed...
Atilde: all points processed...
Done.
##############################
Time elapsed from last time log: 1.0 seconds
Total time elapsed: 4.6 seconds
##############################
Computing LDLE.
local_param: all 10260 points processed...
max distortion is 1890.841660
Done.
##############################
Time elapsed from last time log: 1.6 seconds
Total time elapsed: 6.3 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 9846, max distortion: 58.899614
#Param replaced: 4087, max distortion: 49.377678
#Param replaced: 1101, max distortion: 49.377678
#Param replaced: 323, max distortion: 49.377678
#Param replaced: 87, max distortion: 49.377678
#Param replaced: 35, max distortion: 49.377678
#Param replaced: 4, max distortion: 47.049139
#Param replaced: 1, max distortion: 47.049139
#Param replaced: 0, max distortion: 47.049139
Max local distortion after postprocessing: 47.049138817000966
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 13.9 seconds
##############################
Max local distortion = 47.049138817000966
Constructing intermediate views.
eta = 2.
#non-empty views with sz < 2 = 10260
#nodes in views with sz < 2 = 10260
Costs computed when eta = 2.
##############################
Time elapsed from last time log: 11.2 seconds
Total time elapsed: 12.2 seconds
##############################
ctr=7085, total_len_S=31117, avg_len_S=4.392
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 105.0 seconds
Total time elapsed: 117.2 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 1188
#nodes in views with sz < 3 = 2376
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 2.2 seconds
Total time elapsed: 119.4 seconds
##############################
ctr=1899, total_len_S=32976, avg_len_S=17.365
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 38.6 seconds
Total time elapsed: 158.0 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 678
#nodes in views with sz < 4 = 2034
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 2.2 seconds
Total time elapsed: 160.1 seconds
##############################
ctr=1688, total_len_S=44912, avg_len_S=26.607
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 54.1 seconds
Total time elapsed: 214.2 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 427
#nodes in views with sz < 5 = 1708
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 2.1 seconds
Total time elapsed: 216.3 seconds
##############################
ctr=1457, total_len_S=48195, avg_len_S=33.078
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 57.5 seconds
Total time elapsed: 273.8 seconds
##############################
eta = 6.
#non-empty views with sz < 6 = 246
#nodes in views with sz < 6 = 1230
Costs computed when eta = 6.
##############################
Time elapsed from last time log: 2.1 seconds
Total time elapsed: 275.9 seconds
##############################
ctr=1078, total_len_S=42705, avg_len_S=39.615
Remaining #nodes in views with sz < 6 = 0
Done with eta = 6.
##############################
Time elapsed from last time log: 44.6 seconds
Total time elapsed: 320.5 seconds
##############################
eta = 7.
#non-empty views with sz < 7 = 193
#nodes in views with sz < 7 = 1158
Costs computed when eta = 7.
##############################
Time elapsed from last time log: 1.7 seconds
Total time elapsed: 322.2 seconds
##############################
ctr=1042, total_len_S=46661, avg_len_S=44.780
Remaining #nodes in views with sz < 7 = 0
Done with eta = 7.
##############################
Time elapsed from last time log: 48.9 seconds
Total time elapsed: 371.1 seconds
##############################
eta = 8.
#non-empty views with sz < 8 = 115
#nodes in views with sz < 8 = 805
Costs computed when eta = 8.
##############################
Time elapsed from last time log: 1.7 seconds
Total time elapsed: 372.7 seconds
##############################
ctr=725, total_len_S=35741, avg_len_S=49.298
Remaining #nodes in views with sz < 8 = 0
Done with eta = 8.
##############################
Time elapsed from last time log: 33.6 seconds
Total time elapsed: 406.3 seconds
##############################
eta = 9.
#non-empty views with sz < 9 = 114
#nodes in views with sz < 9 = 912
Costs computed when eta = 9.
##############################
Time elapsed from last time log: 1.8 seconds
Total time elapsed: 408.1 seconds
##############################
ctr=792, total_len_S=44934, avg_len_S=56.735
Remaining #nodes in views with sz < 9 = 0
Done with eta = 9.
##############################
Time elapsed from last time log: 42.2 seconds
Total time elapsed: 450.3 seconds
##############################
eta = 10.
#non-empty views with sz < 10 = 81
#nodes in views with sz < 10 = 729
Costs computed when eta = 10.
##############################
Time elapsed from last time log: 1.4 seconds
Total time elapsed: 451.8 seconds
##############################
ctr=674, total_len_S=41514, avg_len_S=61.593
Remaining #nodes in views with sz < 10 = 0
Done with eta = 10.
##############################
Time elapsed from last time log: 39.8 seconds
Total time elapsed: 491.6 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.8 seconds
Total time elapsed: 492.5 seconds
##############################
After clustering, max distortion is 87.912179
Using rigid transforms for alignment.
Computing laterations scores for overlaps b/w intermed views
Done
##############################
Time elapsed from last time log: 1.6 seconds
Total time elapsed: 1.6 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.6 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.6 seconds
##############################
Initial alignment of 172 views completed
Initial alignment of 344 views completed
Initial alignment of 516 views completed
Initial alignment of 688 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 0.9 seconds
Total time elapsed: 2.5 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_1.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 0
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 14.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.4 seconds
Total time elapsed: 19.5 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_3.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 25.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.6 seconds
Total time elapsed: 31.2 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_5.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 36.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.8 seconds
Total time elapsed: 42.6 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_7.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 48.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.8 seconds
Total time elapsed: 53.9 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_9.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 59.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.7 seconds
Total time elapsed: 65.0 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_11.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 69.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.3 seconds
Total time elapsed: 74.8 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_13.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 80.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.3 seconds
Total time elapsed: 85.2 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_15.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 90.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.5 seconds
Total time elapsed: 96.4 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_17.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 101.4 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.9 seconds
Total time elapsed: 107.3 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_19.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 112.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.4 seconds
Total time elapsed: 118.1 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_21.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 122.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.4 seconds
Total time elapsed: 128.3 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_23.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 133.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.8 seconds
Total time elapsed: 138.9 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_25.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 144.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 5.7 seconds
Total time elapsed: 149.8 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_27.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 155.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 161.6 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_29.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 168.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.6 seconds
Total time elapsed: 176.5 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_31.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 181.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 16.4 seconds
Total time elapsed: 198.2 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_33.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 204.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.0 seconds
Total time elapsed: 212.0 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_35.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 217.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.9 seconds
Total time elapsed: 224.7 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_37.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 229.8 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.3 seconds
Total time elapsed: 236.1 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_39.png
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 241.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.5 seconds
Total time elapsed: 248.3 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10260 + 691 multiplied with B
Computing svd
Done
Alignment error: 19.838226
##############################
Time elapsed from last time log: 3.2 seconds
Total time elapsed: 251.5 seconds
##############################
../../_images/ldle_nbks_noisy_manifolds_noisy_swissroll_3_8_41.png
[8]:
array([[-0.71492196,  0.73003926],
       [-0.71008357,  0.72615779],
       [-0.68214258,  0.73772597],
       ...,
       [ 0.76349803, -0.73912293],
       [ 0.75535667, -0.74612411],
       [ 0.75450399, -0.77501823]])
[9]:
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/ldle_nbks_noisy_manifolds_noisy_swissroll_3_9_0.png
[10]:
util_.save(save_dir_root, 'ldle.dat', [X, labelsMat, buml_obj])