Sphere and swissroll with noise = 0.01
[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/sphere_and_swissoll/'
[5]:
X, labelsMat, ddX = datasets.Datasets().sphere_and_swissroll()
X.shape = (5000, 3)
X.shape = (5207, 3)
X.shape = (10207, 3)
[6]:
# The supplied options would override the default options
buml_obj = buml_.BUML(local_opts={'algo':'LDLE'},
intermed_opts={'algo':'best', '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: 3.8 seconds
Total time elapsed: 3.8 seconds
##############################
Computing Atilde: Inner Prod of Grad of EigFuncs.
FEM for Atilde.
Atilde: 0 points processed...
Atilde: 2551 points processed...
Atilde: 5102 points processed...
Atilde: 7653 points processed...
Atilde: 10204 points processed...
Atilde: all points processed...
Done.
##############################
Time elapsed from last time log: 0.7 seconds
Total time elapsed: 4.6 seconds
##############################
Computing LDLE.
local_param: all 10207 points processed...
max distortion is 1201.183123
Done.
##############################
Time elapsed from last time log: 1.7 seconds
Total time elapsed: 6.3 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 9688, max distortion: 116.956648
#Param replaced: 4868, max distortion: 69.101870
#Param replaced: 1902, max distortion: 69.101870
#Param replaced: 963, max distortion: 69.101870
#Param replaced: 721, max distortion: 63.102186
#Param replaced: 436, max distortion: 63.102186
#Param replaced: 112, max distortion: 63.102186
#Param replaced: 46, max distortion: 63.102186
#Param replaced: 10, max distortion: 63.102186
#Param replaced: 8, max distortion: 63.102186
#Param replaced: 9, max distortion: 63.102186
#Param replaced: 0, max distortion: 63.102186
Max local distortion after postprocessing: 63.10218619922525
Done.
##############################
Time elapsed from last time log: 9.3 seconds
Total time elapsed: 15.6 seconds
##############################
Max local distortion = 63.10218619922525
Constructing intermediate views.
eta = 2.
#non-empty views with sz < 2 = 10207
#nodes in views with sz < 2 = 10207
Costs computed when eta = 2.
##############################
Time elapsed from last time log: 9.7 seconds
Total time elapsed: 10.6 seconds
##############################
ctr=7794, total_len_S=50233, avg_len_S=6.445
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 163.3 seconds
Total time elapsed: 173.9 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 642
#nodes in views with sz < 3 = 1284
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 1.9 seconds
Total time elapsed: 175.8 seconds
##############################
ctr=1103, total_len_S=20221, avg_len_S=18.333
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 11.8 seconds
Total time elapsed: 187.6 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 429
#nodes in views with sz < 4 = 1287
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 1.8 seconds
Total time elapsed: 189.4 seconds
##############################
ctr=1147, total_len_S=30453, avg_len_S=26.550
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 16.1 seconds
Total time elapsed: 205.5 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 322
#nodes in views with sz < 5 = 1288
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 1.7 seconds
Total time elapsed: 207.2 seconds
##############################
ctr=1122, total_len_S=37592, avg_len_S=33.504
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 20.6 seconds
Total time elapsed: 227.8 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.9 seconds
Total time elapsed: 228.8 seconds
##############################
After clustering, max distortion is 92.094365
Using rigid transforms for alignment.
Computing laterations scores for overlaps b/w intermed views
Done
##############################
Time elapsed from last time log: 1.7 seconds
Total time elapsed: 1.7 seconds
##############################
Computing a lateration.
Seq of intermediate views and their predecessors computed.
No. of connected components = 2
Multiple connected components detected
Done.
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.8 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.8 seconds
##############################
Initial alignment of 303 views completed
Initial alignment of 303 views completed
Initial alignment of 606 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 1.0 seconds
Total time elapsed: 2.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 0
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 10.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 18.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 23.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.8 seconds
Total time elapsed: 31.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 35.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 42.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 47.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 55.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 59.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.8 seconds
Total time elapsed: 67.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 71.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.0 seconds
Total time elapsed: 79.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 83.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.3 seconds
Total time elapsed: 91.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 96.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 104.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 109.4 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.2 seconds
Total time elapsed: 117.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 121.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.7 seconds
Total time elapsed: 131.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 135.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.4 seconds
Total time elapsed: 143.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 148.4 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 156.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 161.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.8 seconds
Total time elapsed: 169.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 172.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.9 seconds
Total time elapsed: 182.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 186.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.1 seconds
Total time elapsed: 194.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 199.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 207.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 212.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.2 seconds
Total time elapsed: 220.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 224.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.3 seconds
Total time elapsed: 233.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 238.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.5 seconds
Total time elapsed: 246.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 251.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.8 seconds
Total time elapsed: 258.9 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10207 + 1213 multiplied with B
Computing svd
Done
Alignment error: 15.493539
##############################
Time elapsed from last time log: 5.1 seconds
Total time elapsed: 263.9 seconds
##############################
[7]:
array([[-0.24955428, -0.23055957],
[-0.24665172, -0.24239243],
[-0.26277892, -0.23021224],
...,
[ 2.13479731, 0.30073441],
[ 2.14975114, 0.29813219],
[ 2.13405762, 0.27891651]])
[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', )
[10]:
util_.save(save_dir_root, 'ldle.dat', [X, labelsMat, buml_obj])
[ ]: