Klein Bottle
[1]:
%matplotlib inline
[2]:
# Not really required
import sys
sys.path.insert(0, '../../..')
[3]:
from pyLDLE2 import datasets
from pyLDLE2 import buml_
from pyLDLE2 import util_
matplotlib.get_backend() = module://matplotlib_inline.backend_inline
[4]:
save_dir_root = '../data/pyLDLE2/kleinbottle4d/'
[5]:
X, labelsMat, ddX = datasets.Datasets().kleinbottle4d()
X.shape = (10000, 4)
[6]:
# The supplied options would override the default options
buml_obj = buml_.BUML(local_opts={'algo':'LDLE'},
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.5 seconds
Total time elapsed: 2.5 seconds
##############################
Computing Atilde: Inner Prod of Grad of EigFuncs.
FEM for Atilde.
Atilde: 0 points processed...
Atilde: 2500 points processed...
Atilde: 5000 points processed...
Atilde: 7500 points processed...
Atilde: all points processed...
Done.
##############################
Time elapsed from last time log: 0.6 seconds
Total time elapsed: 3.2 seconds
##############################
Computing LDLE.
local_param: all 10000 points processed...
max distortion is 300818.505462
Done.
##############################
Time elapsed from last time log: 1.3 seconds
Total time elapsed: 4.5 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 9305, max distortion: 2.717290
#Param replaced: 3589, max distortion: 2.273641
#Param replaced: 927, max distortion: 2.105250
#Param replaced: 19, max distortion: 2.105250
#Param replaced: 2, max distortion: 2.105250
#Param replaced: 0, max distortion: 2.105250
Max local distortion after postprocessing: 2.1052497464502324
Done.
##############################
Time elapsed from last time log: 5.4 seconds
Total time elapsed: 9.9 seconds
##############################
Max local distortion = 2.1052497464502324
Constructing intermediate views.
eta = 2.
#non-empty views with sz < 2 = 10000
#nodes in views with sz < 2 = 10000
Costs computed when eta = 2.
##############################
Time elapsed from last time log: 9.7 seconds
Total time elapsed: 10.5 seconds
##############################
ctr=7633, total_len_S=50505, avg_len_S=6.617
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 161.2 seconds
Total time elapsed: 171.7 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 626
#nodes in views with sz < 3 = 1252
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 1.4 seconds
Total time elapsed: 173.1 seconds
##############################
ctr=1096, total_len_S=20452, avg_len_S=18.661
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 10.5 seconds
Total time elapsed: 183.6 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 460
#nodes in views with sz < 4 = 1380
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 1.4 seconds
Total time elapsed: 185.0 seconds
##############################
ctr=1252, total_len_S=32972, avg_len_S=26.335
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 18.8 seconds
Total time elapsed: 203.8 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 237
#nodes in views with sz < 5 = 948
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 1.1 seconds
Total time elapsed: 204.9 seconds
##############################
ctr=907, total_len_S=30216, avg_len_S=33.314
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 12.7 seconds
Total time elapsed: 217.7 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.7 seconds
Total time elapsed: 218.4 seconds
##############################
After clustering, max distortion is 2.318075
Using rigid transforms for alignment.
Computing laterations scores for overlaps b/w intermed views
Done
##############################
Time elapsed from last time log: 1.3 seconds
Total time elapsed: 1.3 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.3 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.3 seconds
##############################
Initial alignment of 296 views completed
Initial alignment of 592 views completed
Initial alignment of 888 views completed
Initial alignment of 1184 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 1.0 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: 12.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.3 seconds
Total time elapsed: 19.4 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 27.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 34.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 42.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.3 seconds
Total time elapsed: 50.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 57.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 64.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 72.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 79.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 86.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.9 seconds
Total time elapsed: 93.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 100.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 108.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 115.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 122.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 128.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 6.9 seconds
Total time elapsed: 135.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 142.4 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.1 seconds
Total time elapsed: 149.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 156.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.0 seconds
Total time elapsed: 163.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 170.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 10.7 seconds
Total time elapsed: 181.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 188.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.3 seconds
Total time elapsed: 195.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 204.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.0 seconds
Total time elapsed: 211.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 219.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 227.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 233.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.4 seconds
Total time elapsed: 243.2 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 250.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.2 seconds
Total time elapsed: 257.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 266.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.0 seconds
Total time elapsed: 273.0 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 281.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.6 seconds
Total time elapsed: 288.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 295.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.0 seconds
Total time elapsed: 304.6 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1185 multiplied with B
Computing svd
Done
Alignment error: 1.091973
##############################
Time elapsed from last time log: 4.2 seconds
Total time elapsed: 308.7 seconds
##############################
[7]:
array([[-0.22098953, 0.77398432],
[-0.22981159, 0.76893245],
[-0.23761342, 0.76336981],
...,
[-0.24099828, 0.74995988],
[-0.23222645, 0.75466678],
[-0.2240784 , 0.75953947]])
[8]:
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', )
[9]:
util_.save(save_dir_root, 'ldle.dat', [X, labelsMat, buml_obj])