Sphere
[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/'
[5]:
X, labelsMat, ddX = datasets.Datasets().sphere()
X.shape = (10000, 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: 4.0 seconds
Total time elapsed: 4.0 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.8 seconds
Total time elapsed: 4.8 seconds
##############################
Computing LDLE.
local_param: all 10000 points processed...
max distortion is 97.457831
Done.
##############################
Time elapsed from last time log: 1.6 seconds
Total time elapsed: 6.4 seconds
##############################
Posprocessing local parameterizations.
#Param replaced: 9039, max distortion: 4.410566
#Param replaced: 3065, max distortion: 2.513654
#Param replaced: 1115, max distortion: 2.199853
#Param replaced: 677, max distortion: 2.199853
#Param replaced: 667, max distortion: 2.199371
#Param replaced: 532, max distortion: 2.199371
#Param replaced: 312, max distortion: 2.199371
#Param replaced: 384, max distortion: 2.199371
#Param replaced: 632, max distortion: 1.822182
#Param replaced: 360, max distortion: 1.736012
#Param replaced: 196, max distortion: 1.736012
#Param replaced: 160, max distortion: 1.736012
#Param replaced: 130, max distortion: 1.736012
#Param replaced: 110, max distortion: 1.736012
#Param replaced: 66, max distortion: 1.736012
#Param replaced: 14, max distortion: 1.736012
#Param replaced: 0, max distortion: 1.736012
Max local distortion after postprocessing: 1.7360120354288724
Done.
##############################
Time elapsed from last time log: 12.2 seconds
Total time elapsed: 18.6 seconds
##############################
Max local distortion = 1.7360120354288724
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: 12.1 seconds
Total time elapsed: 12.8 seconds
##############################
ctr=8165, total_len_S=70319, avg_len_S=8.612
Remaining #nodes in views with sz < 2 = 0
Done with eta = 2.
##############################
Time elapsed from last time log: 288.1 seconds
Total time elapsed: 300.9 seconds
##############################
eta = 3.
#non-empty views with sz < 3 = 342
#nodes in views with sz < 3 = 684
Costs computed when eta = 3.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 302.4 seconds
##############################
ctr=616, total_len_S=11827, avg_len_S=19.200
Remaining #nodes in views with sz < 3 = 0
Done with eta = 3.
##############################
Time elapsed from last time log: 6.2 seconds
Total time elapsed: 308.6 seconds
##############################
eta = 4.
#non-empty views with sz < 4 = 317
#nodes in views with sz < 4 = 951
Costs computed when eta = 4.
##############################
Time elapsed from last time log: 1.5 seconds
Total time elapsed: 310.2 seconds
##############################
ctr=864, total_len_S=23569, avg_len_S=27.279
Remaining #nodes in views with sz < 4 = 0
Done with eta = 4.
##############################
Time elapsed from last time log: 16.2 seconds
Total time elapsed: 326.4 seconds
##############################
eta = 5.
#non-empty views with sz < 5 = 208
#nodes in views with sz < 5 = 832
Costs computed when eta = 5.
##############################
Time elapsed from last time log: 1.6 seconds
Total time elapsed: 328.0 seconds
##############################
ctr=751, total_len_S=24850, avg_len_S=33.089
Remaining #nodes in views with sz < 5 = 0
Done with eta = 5.
##############################
Time elapsed from last time log: 16.5 seconds
Total time elapsed: 344.5 seconds
##############################
Pruning and cleaning up.
Done.
##############################
Time elapsed from last time log: 0.9 seconds
Total time elapsed: 345.4 seconds
##############################
After clustering, max distortion is 2.017937
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 = 1
Done.
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.7 seconds
##############################
Computing initial embedding using: procrustes algorithm
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 1.7 seconds
##############################
Initial alignment of 265 views completed
Initial alignment of 530 views completed
Initial alignment of 795 views completed
Initial alignment of 1060 views completed
Embedding initialized.
##############################
Time elapsed from last time log: 1.1 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: 14.7 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.6 seconds
Total time elapsed: 23.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 1
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 31.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.6 seconds
Total time elapsed: 39.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 2
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 47.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.0 seconds
Total time elapsed: 55.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 3
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 63.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 70.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 4
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 77.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.8 seconds
Total time elapsed: 85.1 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 5
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 91.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.2 seconds
Total time elapsed: 99.7 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 6
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 106.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.0 seconds
Total time elapsed: 113.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 7
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 119.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 127.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 8
##############################
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 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.5 seconds
Total time elapsed: 141.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 9
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 146.9 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.9 seconds
Total time elapsed: 154.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 10
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 160.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.7 seconds
Total time elapsed: 169.3 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 11
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 175.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.8 seconds
Total time elapsed: 183.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 12
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 189.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.2 seconds
Total time elapsed: 197.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 13
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 202.6 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.4 seconds
Total time elapsed: 209.9 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 14
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 215.0 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.6 seconds
Total time elapsed: 222.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 15
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 227.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.3 seconds
Total time elapsed: 234.5 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 16
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 239.1 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 7.7 seconds
Total time elapsed: 246.8 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 17
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 252.3 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 8.4 seconds
Total time elapsed: 260.6 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 18
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 266.2 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 9.2 seconds
Total time elapsed: 275.4 seconds
##############################
Refining with rgd algorithm for 100 iterations.
Refinement iteration: 19
##############################
Time elapsed from last time log: 0.0 seconds
Total time elapsed: 280.5 seconds
##############################
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Descent starts
Done.
##############################
Time elapsed from last time log: 10.1 seconds
Total time elapsed: 290.6 seconds
##############################
Computing error.
min and max weights: 1.0 1.0
Computing Pseudoinverse of a matrix of L of size 10000 + 1061 multiplied with B
Computing svd
Done
Alignment error: 5.389239
##############################
Time elapsed from last time log: 5.4 seconds
Total time elapsed: 296.0 seconds
##############################
[7]:
array([[-0.08708605, -0.22894782],
[-0.07808012, -0.22689346],
[-0.09153192, -0.22144552],
...,
[ 0.07377034, 0.34712208],
[ 0.06071595, 0.35346134],
[ 0.06974186, 0.35476431]])
[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', )
[9]:
util_.save(save_dir_root, 'ldle.dat', [X, labelsMat, buml_obj])
[ ]: