From 97351d316cce953402fd4626170fafa230b9d2c6 Mon Sep 17 00:00:00 2001 From: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com> Date: Sat, 25 Nov 2023 04:06:17 +0100 Subject: [PATCH] Add livebook about MDS (#210) --- mix.exs | 3 +- notebooks/mds.livemd | 1123 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1125 insertions(+), 1 deletion(-) create mode 100644 notebooks/mds.livemd diff --git a/mix.exs b/mix.exs index 770c9539..85d2ed85 100644 --- a/mix.exs +++ b/mix.exs @@ -58,7 +58,8 @@ defmodule Scholar.MixProject do "notebooks/linear_regression.livemd", "notebooks/k_means.livemd", "notebooks/k_nearest_neighbors.livemd", - "notebooks/cv_gradient_boosting_tree.livemd" + "notebooks/cv_gradient_boosting_tree.livemd", + "notebooks/mds.livemd" ], groups_for_modules: [ Models: [ diff --git a/notebooks/mds.livemd b/notebooks/mds.livemd new file mode 100644 index 00000000..c11dfa0c --- /dev/null +++ b/notebooks/mds.livemd @@ -0,0 +1,1123 @@ +# MDS + +```elixir +Mix.install([ + {:scholar, github: "elixir-nx/scholar", override: true}, + {:kino, "~> 0.11.3", override: true}, + {:kino_vega_lite, "~> 0.1.9"}, + {:exla, "~> 0.6.4"}, + {:tucan, "~> 0.2.1"}, + {:explorer, "~> 0.7.1"}, + {:req, "~> 0.4.5"} +]) +``` + +## Setup + +```elixir +alias Scholar.Manifold.MDS +alias VegaLite, as: Vl +alias Explorer.DataFrame, as: DF +``` + + + +## Swiss Roll + +The first example demonstrating MDS will use so-called Swiss Roll dataset. It's call as such because it resembles a popular sponge cake. Let's have a look on this dataset. + +| ![Skewness](https://scikit-learn.org/stable/_images/sphx_glr_plot_swissroll_001.png) | +| :---------------------------------------------------------------------------------------------------------: | +| Figure 1: Swiss Roll (Source: https://scikit-learn.org/stable/auto_examples/manifold/plot_swissroll.html) | + + + +Because there are no good swiss roll datasets available on the Internet directly, we'll load to tensor created swiss roll dataset with 1000 samples. + +```elixir +swiss_roll = + Nx.tensor([ + [-8.8313152, 2.10151711, -4.45670876], + [6.15941887, 5.17977657, 2.58770188], + [10.23410953, 19.38484837, -6.29460341], + [11.60978359, 8.25325228, 5.93527204], + [-9.44716177, 4.1405192, -1.75077878], + [-9.14066212, 10.03281252, 1.49703653], + [-8.30319363, 8.17661164, 3.53076713], + [-3.50163931, 0.06305818, -10.06943069], + [-5.36417404, 9.28502669, -8.97624018], + [-5.74223798, 4.48630607, -8.68466132], + [11.51680254, 1.85733993, -4.09883143], + [-3.67908164, 6.4411102, -9.98645122], + [-7.38759241, 6.97403281, -7.00970874], + [-5.01240594, 5.82777801, 6.84732906], + [-9.34088572, 10.66496615, 0.6029048], + [-5.31263585, 13.34134448, 6.66928822], + [10.78417439, 20.0123519, -5.47919839], + [7.43646909, 7.77331775, -9.01371917], + [5.35145344, 18.18259548, 4.48193741], + [-9.47674306, 1.42425568, -1.09677707], + [5.57085789, 18.54771524, 4.10142655], + [-4.80862233, 5.3346213, 6.95886807], + [11.91401456, 12.42519895, -3.10333003], + [3.52144312, 4.79076306, -4.1197149], + [-3.88239859, 1.62842458, 7.37931694], + [4.50836922, 16.70636732, 5.58104807], + [12.50699262, 15.08508412, 2.57579946], + [1.33187579, 11.11716535, 7.56329701], + [11.94849042, 12.24028964, 5.03235914], + [-7.62193067, 13.40510227, -6.69624307], + [4.31595182, 6.04745455, -3.55837632], + [-0.47401598, 8.12957525, -10.94201811], + [-7.54759353, 13.36704012, -6.79844625], + [-2.83238685, 20.62432552, 7.70208861], + [11.02660149, 9.67867052, -5.06808249], + [4.97693483, 6.31073777, 12.83620986], + [12.54070575, 16.70115382, -0.28211401], + [-3.12322929, 14.36409155, -10.23335682], + [6.15504322, 6.17994614, 12.20604373], + [-9.46928984, 7.89309513, -1.38427241], + [-3.57353186, 20.46941371, 7.49035496], + [0.74117884, 10.16360345, -11.03776613], + [5.75830231, 20.12651737, -1.68213898], + [0.33151929, 19.54850012, -4.77026848], + [4.06279356, 9.47926784, -3.76096312], + [4.78869214, 10.34172688, -3.10600293], + [7.85635468, 6.93968359, 10.99932961], + [-3.86985637, 2.22281317, -9.89271464], + [8.19692404, 7.06896747, -8.44132047], + [0.44250408, 16.90923521, -4.78419875], + [6.3446155, 16.42643105, 0.53255482], + [6.07222961, 0.55829229, 2.89848962], + [4.19249291, 1.48283922, 5.89768184], + [-5.49908409, 14.64743159, 6.55005453], + [9.53695925, 13.44975138, -7.15522323], + [-8.93428834, 14.84191116, 2.14788096], + [11.02594346, 13.52161869, 7.1507573], + [1.63692776, 8.98139788, 7.46052236], + [4.32153517, 12.7298557, 5.77309443], + [-8.70674945, 15.37617867, 2.72063783], + [-4.81699699, 10.70378252, 6.95442742], + [5.86026776, 15.15945121, -1.45905989], + [6.44342732, 14.61781518, -9.62821188], + [12.58899959, 5.56269559, 0.34418107], + [11.89886403, 5.75441231, -3.14647192], + [10.84038438, 12.56144376, 7.47955699], + [8.22545033, 12.69229784, 10.68067914], + [-8.29320994, 7.8364129, 3.5484666], + [-6.08674638, 4.12945347, 6.12651234], + [3.74341434, 6.38150565, 13.34880751], + [4.24853793, 16.95338914, 5.84433787], + [-9.30843557, 7.95630492, -2.78160162], + [6.34476788, 13.44014924, 1.44330463], + [-8.76058105, 17.72028715, 2.59489988], + [5.63857516, 12.40441207, -10.03157055], + [-5.14799209, 12.69503064, -9.130977], + [-4.31509327, 17.38568396, 7.1998396], + [5.76534121, 20.31141789, -9.97320641], + [8.51320446, 10.27123949, 10.41535388], + [4.95945381, 14.00276241, -2.9136638], + [2.7874212, 8.18363232, 6.93225434], + [6.82948167, 13.41956201, 11.77423634], + [1.27886402, 17.65631858, 7.57970442], + [-8.07758036, 14.30406837, -6.0028668], + [4.13266509, 16.6570385, -3.70747957], + [12.5825374, 2.50703498, 0.22986054], + [-2.2605078, 11.50682434, 7.81518798], + [3.37348866, 12.04572521, 6.56291498], + [-6.49904453, 20.73956309, -8.00862441], + [4.00047908, 18.37510258, -3.80717916], + [5.98031223, 2.33735624, 3.17611432], + [6.34227329, 14.14384321, 0.50119354], + [2.73379039, 3.88664814, 6.96233845], + [11.79080211, 18.99432667, -3.44035457], + [12.08528456, 9.28169687, -2.57456403], + [2.74475645, 4.98017065, -4.48851969], + [10.80000471, 20.49884326, -5.45345469], + [-9.28620542, 11.34853999, 0.89233151], + [-6.77355445, 11.66460162, 5.52425488], + [2.76730238, 3.66446413, -10.89839044], + [-5.9174973, 9.29464305, -8.539737], + [-2.66403786, 10.18609958, 7.73982977], + [1.8803158, 9.67455061, 13.87565254], + [4.4742536, 13.94489946, -10.48412406], + [0.83245284, 15.00524786, -4.81221014], + [-1.45908722, 18.99011584, 7.90298737], + [6.34678493, 15.23879447, 0.56368875], + [6.3059199, 2.99744911, 0.15547907], + [-9.07517772, 1.61968996, 1.72252085], + [11.54373672, 11.70252553, -4.03865376], + [-1.79745436, 17.91955908, -10.67859439], + [1.98102707, 10.23384359, -4.71087471], + [-7.38878555, 13.5510619, 4.85862952], + [1.99277958, 20.74908238, -10.9957415], + [-9.4754214, 11.41981006, -1.18301902], + [4.79069647, 11.90037425, 5.26090616], + [-0.4470774, 4.45873243, 7.89788473], + [12.60587502, 10.22424953, 1.03455834], + [-3.02284231, 13.71775046, -10.27395798], + [1.89692351, 6.52916473, -4.72759871], + [-8.98162829, 2.45226941, 2.01254378], + [-8.85074596, 2.16862452, -4.40568126], + [-9.09477444, 9.10920615, 1.65725701], + [-1.59420735, 15.92413901, -10.73030283], + [3.84253976, 19.747862, 6.20639199], + [2.99588934, 3.7427977, -4.38613248], + [-7.63287559, 6.76846841, 4.55180338], + [-9.44495828, 11.30192091, -1.77793528], + [-9.3714683, 13.50778735, -2.41065506], + [-5.66214464, 7.21900098, -8.74877148], + [4.89889258, 1.06334016, 12.87287917], + [2.48047748, 9.56255577, 7.09672506], + [2.28405917, 3.0025995, -10.96557981], + [-4.91976519, 8.21809381, 6.89894202], + [-6.77264339, 6.50043151, -7.72833737], + [5.68637128, 17.834621, 3.87542805], + [-7.36919831, 2.76915445, 4.88207307], + [-4.67551326, 7.5889942, -9.44150225], + [4.61082309, 9.74047523, 5.46932658], + [2.55781647, 17.46513455, -4.55502376], + [2.54333691, 7.75362726, 7.06453858], + [-7.93896942, 9.00625301, 4.12306274], + [4.0461184, 16.86758555, -3.77346553], + [-6.11865229, 0.83166964, 6.10127456], + [-1.2958277, 1.05183285, -10.79867562], + [8.13882818, 10.71772927, -8.48856341], + [-8.6676732, 18.34670324, 2.80876248], + [-9.19093659, 10.89141337, 1.30747332], + [2.83893255, 16.62682712, 13.63964549], + [8.22365353, 7.59402792, -8.41937623], + [-9.44834484, 10.16153756, -0.25531781], + [12.46867557, 5.30573332, 2.85570706], + [-0.00738733, 18.32033424, -10.99489992], + [3.77209917, 2.0015116, -10.68876556], + [-5.77501984, 4.93348532, 6.36060111], + [4.97557715, 16.12420438, 5.02821176], + [8.3576441, 12.9549197, -8.30735835], + [-5.50944353, 20.22917632, 6.54322691], + [6.2902454, 18.84446588, 12.1239157], + [-8.82155888, 14.86681432, 2.44575791], + [3.22446319, 16.79289452, 6.66425592], + [4.75460865, 0.00877746, -3.14235018], + [0.91481478, 16.05261378, -4.81403011], + [11.19712672, 9.66134372, 6.82622795], + [-9.46768405, 0.83689931, -1.42159092], + [-5.53375621, 18.3998009, 6.52711765], + [10.96044847, 6.71630255, -5.18400692], + [10.4351764, 15.26003256, -6.01297327], + [4.18087526, 18.69528983, -3.66952153], + [6.22937585, 19.98937415, -0.2926236], + [-9.46938658, 2.11172417, -1.38190959], + [6.35393757, 4.27216985, 0.68868349], + [6.20282647, 0.38603574, 2.40642951], + [12.51159145, 10.60661689, 2.53874859], + [2.2754204, 7.7811052, -4.64043337], + [10.91956822, 4.13148501, -5.25418863], + [5.01569359, 15.80616581, -2.84629111], + [3.78456699, 17.88768735, -3.95705292], + [5.30830065, 19.72249123, -2.45758728], + [9.17003027, 16.58250053, -7.54907087], + [3.67149946, 10.54910499, 6.34340481], + [-5.68172263, 6.40012611, -8.73322022], + [2.61491996, 18.1532473, -10.92190052], + [12.29800693, 7.2092361, -1.76413294], + [2.50773863, 18.38404008, 13.72935656], + [2.25900517, 7.69168124, -4.64485463], + [-8.04833423, 10.64461678, -6.05133859], + [6.16508487, 0.57625979, -0.56846685], + [12.29762626, 14.78252085, -1.76581264], + [-8.79717701, 13.65648542, 2.50630109], + [7.23127936, 16.81039757, 11.48913947], + [6.16294153, 2.8500571, 2.57379403], + [-8.51342001, 16.81909389, -5.19360231], + [4.64255568, 7.24713667, -3.25744236], + [12.57202663, 14.81449512, 0.07383412], + [4.52682027, 3.2278555, 5.56127892], + [11.85103674, 12.62481635, 5.31396507], + [5.7433291, 10.23432855, -1.7129558], + [5.42176832, 2.52761295, -2.28632458], + [-9.45673506, 0.84492645, -0.37130913], + [11.28131752, 15.43200474, 6.65806894], + [11.25562486, 14.54476269, -4.64185679], + [5.53665318, 20.67696068, -2.09829731], + [6.24979379, 3.73527961, -0.19059094], + [6.05762713, 5.84889942, -9.83140315], + [11.34836526, 7.80851894, 6.51965563], + [4.62922328, 12.54565264, -3.27070438], + [3.88597741, 17.65496259, 6.17021748], + [6.09040706, 12.80852517, -0.83349675], + [4.98923228, 2.97183159, -2.8782543], + [4.31831015, 6.77654364, -10.53384521], + [4.30648895, 20.11727773, 5.78794618], + [2.59423262, 12.53698395, -4.54270217], + [3.95395557, 8.62692975, 6.11243484], + [-0.02429998, 7.4352724, 7.85703681], + [6.3398709, 1.58844699, 1.50746241], + [6.01869697, 16.47012319, 3.06507259], + [0.70415449, 7.7466722, -4.80654807], + [5.19192276, 4.55229095, 12.73206923], + [9.18178458, 13.32628919, 9.73366853], + [6.5502299, 8.93943139, 11.9598403], + [4.72367491, 9.6064527, -3.17478658], + [6.34581918, 14.64753812, 0.54955323], + [9.24500012, 11.79369975, 9.66393968], + [9.54218705, 18.37170203, 9.32230048], + [1.75081984, 15.02651711, 7.41840641], + [12.601052, 3.72181327, 1.3477256], + [12.51779379, 6.4347312, -0.48887104], + [4.42082809, 3.39523891, 13.08470694], + [12.43037807, 13.24812235, -1.09495397], + [11.09369122, 15.64626259, 7.02494162], + [-9.41659692, 6.77682741, -2.0676137], + [12.60580513, 10.18949219, 0.94048968], + [4.79385999, 1.62751429, 5.25709001], + [1.42409054, 19.99621531, -4.7940951], + [-5.9432868, 11.49566492, 6.23700443], + [9.84608487, 7.61662726, -6.7936431], + [-2.97012464, 20.87154095, 7.66840673], + [-3.78808993, 6.20248289, -9.93347304], + [-8.09109113, 13.5439202, 3.88812014], + [-1.94526534, 16.40543157, 7.8594572], + [3.37725903, 6.73427783, -4.20023195], + [2.18260996, 10.9808, -4.66465822], + [12.2538423, 14.17331298, -1.95224796], + [-3.58745667, 14.74504765, 7.48564561], + [6.2817215, 16.46669624, -0.00915335], + [4.60124278, 1.52827391, 5.47997853], + [-4.35618994, 14.37024175, -9.6315042], + [2.13533057, 15.40890678, 7.26044861], + [11.66390434, 5.01064442, 5.80382567], + [6.25953795, 15.03770352, 2.12531083], + [-6.97076522, 20.55338737, -7.5112793], + [5.48480022, 3.58901443, 12.5826365], + [-6.92549248, 12.20969922, -7.56199456], + [5.44653741, 16.31855163, 4.32387036], + [12.29441665, 17.75830125, 3.79029361], + [2.84603717, 2.94229036, 6.89869935], + [-1.24800989, 3.28858041, 7.9126011], + [2.56655831, 17.51901644, -4.55209358], + [-4.23407672, 8.86042395, 7.23563509], + [-9.42834435, 14.94327951, -0.03421047], + [-7.24138736, 2.7101173, -7.19317848], + [-9.19273969, 12.69473007, 1.30035888], + [-9.25063343, 20.26818152, 1.05783357], + [3.1527838, 20.68514372, -4.31424557], + [6.36074527, 17.5196472, 1.04554292], + [4.3772878, 10.34191952, -3.50546943], + [12.52915803, 7.23070999, -0.39024239], + [-3.77133484, 0.87217498, -9.94171654], + [-6.30584026, 17.99294701, 5.94813829], + [12.2693674, 8.84908718, 3.89931927], + [3.86110068, 19.64905301, 13.30585603], + [12.48585667, 5.97180791, 2.73585372], + [1.52311473, 15.68329522, 7.50055389], + [-6.61668276, 6.95179101, -7.89072957], + [5.45751823, 13.78570209, -2.22950852], + [5.57564272, 19.69873111, -2.03065558], + [-9.46772669, 10.53690656, -0.56910505], + [-9.47114535, 1.9365499, -0.65339504], + [7.21026985, 0.10135008, 11.50459741], + [6.36096027, 6.47941012, 1.01172813], + [-5.25528799, 9.10220351, -9.05521994], + [1.00409689, 11.59121384, -4.81440925], + [0.34952479, 12.79532865, -11.02173525], + [7.07135617, 5.90826433, 11.60525068], + [9.10414674, 2.12121685, -7.61610888], + [-9.13399816, 0.25393018, 1.52100015], + [4.15161677, 12.78203788, -3.69266238], + [5.10011276, 13.18989975, -2.74104088], + [-3.61799236, 1.88819289, 7.47522145], + [-6.47177577, 5.53708564, 5.80480478], + [-7.96813607, 6.14447986, 4.07925246], + [-9.46311926, 15.77750804, -0.47685411], + [10.00346835, 9.53470295, 8.74124915], + [11.72898907, 6.91332187, -3.5987422], + [5.9470408, 12.7901538, 12.32825978], + [12.26320873, 9.46255155, 3.92547593], + [-9.38822975, 4.48344336, 0.29864154], + [9.78991479, 3.22969719, -6.86155209], + [-6.30827905, 1.29334933, 5.94608448], + [12.361408, 11.64379715, -1.46748043], + [11.30324182, 7.50511035, 6.61326375], + [5.99099333, 20.22954069, 3.14584202], + [2.55340503, 6.36581665, -10.93078332], + [-8.28459554, 5.99454125, -5.64063984], + [-0.37540677, 3.32674247, 7.89258732], + [2.44500437, 16.3876331, 7.11455853], + [-3.21696928, 16.14180269, -10.19436565], + [3.10091446, 10.59185756, -4.3387045], + [-7.81614116, 5.61665964, 4.30163126], + [0.87011369, 5.12098907, -4.81321782], + [-1.37994813, 18.6569221, -10.78029786], + [5.97314654, 1.72113245, 3.19616827], + [-9.02535826, 5.11330826, -3.90236601], + [7.95426716, 7.35276076, 10.91705601], + [-7.92300608, 15.40103177, -6.25234414], + [-7.81568354, 1.55017873, 4.30227939], + [-6.52807472, 0.98103109, 5.75447049], + [5.74224614, 0.10326456, -1.71516719], + [-6.75182519, 1.59190599, 5.54536644], + [0.5991863, 4.09046489, 14.08190054], + [7.52957906, 1.40338925, 11.26278159], + [-7.9410127, 4.76624703, -6.22410593], + [0.54610649, 18.93896027, -4.79479657], + [5.71716963, 6.33811849, 3.81145832], + [3.47614624, 14.01604482, 6.48991841], + [7.09570829, 2.58574642, 11.58779908], + [11.77508873, 20.12065245, 5.52000733], + [-7.13864965, 0.63987368, 5.14613712], + [0.89565756, 4.17831196, -11.04025234], + [4.15011698, 2.12071053, -3.69383987], + [4.86894048, 17.37555409, 12.88679422], + [11.6913201, 15.43163044, -3.69219589], + [3.08433424, 1.35716429, 6.75477706], + [6.05238036, 7.36953597, -0.9531857], + [11.79590859, 19.14943813, 5.46458363], + [-4.20142934, 15.86864982, -9.71820285], + [3.73555399, 17.99281478, -3.98895873], + [9.17794322, 13.13426478, 9.73787396], + [3.9634721, 5.38358719, 6.10422933], + [7.59716226, 11.3187506, 11.20966007], + [-0.01103023, 10.57013661, 7.85537805], + [-4.51770169, 13.92496597, -9.53731381], + [-0.90475834, 19.06530699, 7.91624394], + [-6.1946827, 1.78627047, 6.04013266], + [-9.37443576, 8.35945887, 0.39441501], + [5.84155867, 3.26076758, 3.53371073], + [2.50670401, 20.35062954, -10.93729414], + [2.39628476, 15.93318147, 13.75758567], + [-3.02053692, 7.88756689, -10.27487648], + [-4.82170487, 20.88248788, 6.95192576], + [5.85884411, 5.92115656, -1.46234971], + [12.60399379, 3.93198339, 1.21795084], + [12.26568109, 7.87485496, -1.90309687], + [-8.82042808, 20.52858812, 2.44859376], + [2.3772035, 2.11304822, -4.61169746], + [0.06347708, 0.05088757, -4.72539502], + [-5.90551322, 5.82067884, -8.54985496], + [4.34659564, 12.02800538, -10.52501035], + [7.89846129, 17.33800614, -8.67762127], + [7.12876977, 14.69956143, 11.56397524], + [8.28299708, 16.80131632, -8.37018192], + [-2.19313184, 12.03371615, 7.82571806], + [-9.47534143, 9.25007197, -0.80221252], + [-5.79121753, 20.25213489, -8.64480938], + [1.64658927, 11.86884501, 13.92241276], + [12.05525654, 16.85064776, 4.69676261], + [5.80764757, 2.73570108, -9.95331037], + [6.35900294, 8.69661188, 0.82866805], + [-6.72997637, 16.21024445, 5.56644629], + [-9.46929759, 17.90890879, -1.3840838], + [-5.6947518, 16.2829144, -8.72282809], + [12.14933621, 17.26681116, 4.37109197], + [12.23583401, 7.1123822, 4.03889424], + [2.03068953, 3.49669124, -4.70029534], + [4.53077988, 5.85285972, -3.36593169], + [4.38959297, 2.78110543, 5.70480142], + [-9.07486681, 3.12246385, 1.72354229], + [5.32909709, 14.41859745, 4.51775806], + [6.02755813, 14.62919674, 3.0385062], + [-4.90210598, 15.46834082, 6.90860782], + [-0.99808115, 19.21451886, -10.85813638], + [9.20902847, 16.72393706, 9.70373876], + [11.46872605, 15.43412385, -4.2041334], + [12.34279577, 17.12224186, -1.55833575], + [-9.43790935, 15.33828436, -1.85908374], + [1.99016484, 8.11488289, -4.70896748], + [-3.83241639, 7.27475864, -9.9114869], + [2.99627921, 0.02675155, -10.85900779], + [12.33643285, 6.58530293, -1.58862717], + [6.05436989, 16.65693804, 2.9557556], + [1.05202781, 16.82225469, -11.04056566], + [-1.66199583, 19.32661758, 7.88845224], + [5.80712869, 2.13211514, -9.95355567], + [-6.2964307, 20.19366583, 5.95604802], + [-5.14501005, 6.30899751, 6.7707572], + [-5.9666599, 20.09866973, 6.21933018], + [7.50833768, 11.59772557, 11.27933456], + [2.36291408, 2.84039175, -4.61586971], + [6.1310463, 18.24281247, 2.69540916], + [-9.39227363, 7.97328725, 0.26914986], + [-9.40321575, 13.49050263, 0.18556303], + [-9.46509247, 9.16614047, -0.51417707], + [5.76390055, 18.5098781, 3.71098125], + [1.59744539, 10.63620367, -11.02433937], + [1.79854898, 6.52625605, -11.01156319], + [5.85603983, 10.37783546, 3.49905603], + [-8.50271151, 9.86210371, -5.21582292], + [6.25985428, 6.17816142, 2.12354282], + [6.15791552, 9.28390112, 2.59359896], + [11.2397899, 1.99368337, -4.67268335], + [9.38162489, 10.78751905, 9.50978695], + [5.13648602, 19.69917224, -10.24477884], + [0.28665043, 17.79842244, -11.01785707], + [1.86140801, 17.70020377, 7.37550435], + [3.83204229, 13.94018893, 6.21504835], + [11.46178071, 8.76352008, -4.21912963], + [2.43912605, 0.67611828, -4.59309238], + [11.34364384, 1.05018713, 6.52953999], + [-1.32375274, 10.33976747, 7.90979692], + [2.89460039, 11.95668048, -4.42926939], + [7.8589346, 6.8281969, -8.70774987], + [9.99859098, 6.14712165, -6.6039573], + [3.46544093, 2.75516009, 6.49765572], + [-9.47161899, 8.81006602, -0.66678511], + [10.72045337, 10.04258051, -5.58138651], + [12.03931017, 1.89335016, 4.74896161], + [10.01173798, 9.7489887, 8.73020013], + [3.99796396, 7.57771853, 6.07424541], + [-9.32683759, 9.35436205, -2.68192582], + [5.51926424, 7.23713298, -2.12780584], + [0.59878822, 16.24718722, -11.03355475], + [7.81590619, 3.76358506, 11.03285825], + [12.60505652, 8.71746935, 1.14541992], + [-9.00606252, 20.06165813, -3.96260683], + [0.35454903, 4.64864947, -4.77337996], + [-8.14689924, 12.92547141, -5.88543586], + [1.37525108, 7.4975037, 7.54955642], + [-5.47016524, 6.7296145, 6.56899967], + [5.38624612, 15.05021673, -2.34137344], + [-7.25126369, 8.45229537, -7.18105549], + [1.98976683, 0.73151342, -4.70905093], + [-9.47714535, 11.06303073, -0.94141357], + [7.27530961, 10.55097285, -9.12304797], + [-3.53097316, 0.01383815, 7.50457704], + [3.04359826, 3.98678095, 6.78025648], + [11.63679475, 18.62236351, 5.87017886], + [2.91401955, 11.868894, -10.87371853], + [5.82280496, 16.1509102, 3.57780421], + [12.60238486, 14.5760398, 1.29598465], + [0.1176621, 11.53465036, -11.00563601], + [4.83888272, 5.03822054, 5.20217929], + [-2.93194237, 15.45594742, -10.30970463], + [0.48833024, 0.46655802, -4.78917125], + [-9.24269689, 17.21720597, 1.09286587], + [9.20316205, 15.70190032, -7.51495278], + [-8.11047755, 12.99992421, -5.94759208], + [-5.56341682, 11.64913545, -8.8260334], + [0.89170045, 9.11693995, -11.04021566], + [0.8646575, 9.06777345, -4.81309017], + [-4.82983027, 4.81220433, -9.34407639], + [0.56019485, 8.48648438, 7.76174327], + [4.37026041, 7.31233976, -3.51161109], + [10.8547143, 15.24431357, 7.45493612], + [-9.47718815, 19.83729967, -1.03939175], + [-9.29031076, 13.00373561, -2.87449023], + [-6.36275192, 15.36969199, 5.89980572], + [12.60012589, 14.14331356, 0.61450063], + [5.81088842, 6.13381954, 3.60537995], + [3.87696013, 5.59306171, -3.89481542], + [11.10792913, 19.44556782, -4.92135198], + [2.86219443, 19.08417168, -4.4425404], + [-9.04903241, 4.30529595, -3.8265574], + [3.74239517, 7.85611232, -3.98455075], + [12.60357326, 12.34155331, 0.75313191], + [-9.32339508, 10.10850062, -2.70102594], + [10.59578128, 18.21811348, -5.77498426], + [-5.82897872, 0.51797505, 6.321654], + [3.52145295, 12.22948375, 6.45684404], + [6.73503903, 18.8845359, 11.83812236], + [-4.26024317, 4.42108256, 7.22418645], + [1.92345172, 7.06781192, -4.72248495], + [4.83891432, 13.95433521, -3.05124739], + [12.36657513, 11.77361769, 3.4481163], + [3.29979683, 0.09416538, 13.5000047], + [6.06021219, 19.02784327, 2.93722125], + [12.31246447, 6.38994103, -1.69951716], + [4.20787683, 3.15661216, -10.56756465], + [-3.50992086, 15.26826299, 7.51151708], + [3.67866439, 5.69096418, -4.02505182], + [4.23700065, 1.61247185, -3.62421353], + [1.27488189, 7.32462386, -11.03718705], + [10.29556247, 4.34428818, -6.21033762], + [-0.16432605, 17.50756184, -10.97937897], + [4.75209949, 7.1181983, -10.38933435], + [0.44346509, 6.10329572, -4.78430769], + [-7.63301286, 2.55616106, -6.68077377], + [-9.47498197, 8.15792291, -1.20397191], + [8.7979396, 1.59395401, 10.13686886], + [6.69524513, 2.18849218, 11.86469681], + [-6.74889247, 20.60677591, 5.54820453], + [12.16243832, 12.84567217, 4.32302805], + [6.18323611, 3.06971496, 2.49105418], + [6.01887607, 17.0489327, -1.05208758], + [3.54992646, 17.63831891, -4.10310671], + [6.08936601, 0.10844492, 2.84176066], + [-5.04920645, 0.56150948, 6.8263997], + [-9.46578573, 13.42557794, -0.52800229], + [6.12076913, 17.49023208, 2.73270283], + [-6.17954918, 3.87426946, 6.05241633], + [-8.60224837, 17.20952077, -5.00356863], + [-3.79156681, 20.79433091, 7.41341343], + [-7.51321729, 8.75562251, -6.84481511], + [1.10145608, 11.05790765, -11.04020413], + [4.56746174, 5.4577204, -3.33099388], + [6.17453501, 3.72451825, 12.19433571], + [-9.43859471, 16.81870388, -0.14025644], + [6.89462801, 6.6286802, 11.72948947], + [3.69406382, 1.40513988, -4.01538034], + [-7.34432123, 13.74035769, 4.9116108], + [-6.85639863, 5.18748609, -7.63810342], + [-7.34860447, 16.44101179, 4.90654387], + [8.29074022, 13.9049743, 10.62182902], + [5.44662705, 6.94592814, -2.24697224], + [-1.46734963, 20.11162257, -10.76045855], + [9.02392798, 19.55197246, -7.69631424], + [5.97771219, 6.5877462, -1.16650159], + [7.47988343, 12.30306392, -8.98358819], + [1.82503545, 17.38688446, 13.88708684], + [0.17767577, 2.41797825, -4.74648035], + [-1.63810091, 14.12366422, -10.71949123], + [5.88638256, 17.4340991, -9.91571993], + [12.49876229, 0.02031415, 2.6400017], + [8.51989295, 18.56741116, 10.40899947], + [0.8673597, 2.69609331, 7.69296694], + [0.34873548, 0.6232146, -4.77260547], + [4.06956032, 18.4227781, -3.75586119], + [4.29158857, 14.28829805, 13.13828865], + [-9.25933893, 17.77338568, -3.0231234], + [-3.2456347, 7.52485346, 7.59334776], + [5.21265378, 17.57705164, 4.69687797], + [3.54084664, 10.21214184, 13.41992889], + [-2.95299672, 4.10610572, 7.67273347], + [12.11884289, 1.30642208, -2.46036719], + [-9.47554847, 16.40000633, -0.81268906], + [0.92782626, 8.68732058, -11.04049778], + [3.70172911, 10.57273094, -4.01053907], + [12.3872413, 12.94397538, 3.34060489], + [6.3596338, 16.41864444, 0.85616289], + [-7.9111896, 8.23933225, -6.27076269], + [-6.26566138, 16.58858831, 5.98175358], + [3.37812941, 3.83734792, 13.47452059], + [-7.94594789, 0.70253853, 4.11263163], + [-2.7944145, 20.06634664, 7.71092918], + [-1.5540607, 20.12695528, 7.89683053], + [2.49865902, 3.01916596, -10.93839546], + [-8.36800472, 12.55981801, 3.41352341], + [5.22721792, 9.83689994, -2.57234913], + [10.47084609, 4.01465493, 8.07577536], + [3.07560641, 20.69897246, -10.84422151], + [-9.43967166, 11.18912572, -0.1521841], + [4.79579307, 14.74894143, 5.25475545], + [0.79062295, 1.97199731, -4.81074344], + [12.16699566, 11.33081205, 4.30613589], + [-3.75412428, 10.73107315, 7.42711622], + [4.32886347, 1.63803329, 5.76582894], + [-3.3013088, 16.669283, -10.15838327], + [5.45608624, 15.80270468, -2.23181256], + [5.00111016, 15.36512194, -2.86396549], + [4.93866614, 5.74507531, 12.85426572], + [-9.4234495, 17.49104976, 0.01244129], + [-6.87873729, 17.52868308, -7.61366481], + [-9.46866135, 17.5374019, -1.39928829], + [-0.90392149, 12.87036609, 7.91623464], + [6.18951066, 16.26833148, -0.4702797], + [-0.85552941, 19.37277951, 7.91554637], + [12.33187964, 2.79376583, 3.61842486], + [5.25588882, 11.04386537, -2.53244505], + [11.16860606, 16.41953337, 6.8818557], + [-6.54016179, 12.211683, 5.74354796], + [1.73961061, 12.17746339, -4.75488612], + [-0.28488445, 8.73968421, -10.96590111], + [11.7142917, 18.70734494, 5.67762732], + [3.55024469, 16.03396452, -10.74332526], + [12.60436753, 11.12709945, 0.79837264], + [6.32414558, 12.04173024, -9.69303326], + [9.37394658, 19.63008045, 9.51857862], + [-5.14641819, 18.16308386, 6.76992677], + [0.98496101, 11.49504399, -4.81446724], + [6.05594593, 18.31928124, -0.94231887], + [11.11159075, 14.042427, -4.91463133], + [6.35869106, 20.40877215, 1.15983541], + [-9.37410419, 16.86405121, -2.39295929], + [-9.47680298, 12.4590394, -1.09105948], + [-9.43862046, 6.03791649, -1.85124712], + [6.17519366, 20.20104478, 2.52439778], + [2.20009617, 18.29589992, -4.66023726], + [5.99578554, 1.65576537, -1.11715678], + [11.18317097, 3.84372312, -4.78117205], + [5.53466904, 1.61257183, 4.16820673], + [-5.2487189, 12.5521913, -9.05991653], + [4.93303926, 9.71290717, 5.08356735], + [3.74382626, 14.7536552, -3.9836268], + [3.13111586, 7.65415415, 13.55314343], + [4.66159147, 3.84270901, 5.4121466], + [2.81572649, 14.84206724, 6.91613947], + [7.10412348, 2.99496085, 11.58174949], + [-1.88592718, 3.06986314, -10.65476532], + [9.63660653, 2.61086759, -7.04183732], + [6.16582042, 6.15217363, 12.19957572], + [9.92021403, 3.94659523, 8.85116779], + [-7.5188064, 19.52724364, -6.83731373], + [-9.47728176, 13.10625841, -1.00993349], + [-3.74244014, 14.93903458, 7.43135038], + [11.39015546, 12.65765968, 6.43122135], + [4.31572789, 17.13462906, -10.53464773], + [5.24643535, 19.85979079, 12.70492389], + [5.87582192, 6.92838142, 3.4508175], + [5.95335505, 2.08095667, -1.23097851], + [-9.28522659, 1.70164748, 0.89709069], + [10.49909571, 6.27361871, -5.91971986], + [-6.78846021, 2.78309506, -7.71146331], + [9.90086175, 5.07066187, 8.8763812], + [-8.67129047, 17.78578717, 2.80071005], + [2.19086918, 5.19600509, -4.66257833], + [12.43040252, 16.94196127, 3.09788978], + [5.10029457, 19.62225802, -10.25906684], + [-8.41650557, 1.21800784, -5.38977798], + [12.57832486, 1.57968741, 1.83144584], + [3.81913271, 0.93674051, -3.93409267], + [2.91528393, 7.11641766, 13.61771334], + [1.66609636, 7.24979965, 7.44993373], + [-6.75627239, 1.48906974, 5.54105764], + [5.62326217, 20.90913604, -1.9450963], + [-5.05757277, 13.22078267, -9.19326522], + [4.61694024, 11.25573834, 5.46250247], + [-6.34412953, 16.08907921, -8.15820808], + [10.63920934, 20.68478738, 7.81290083], + [-8.16111094, 10.63996389, 3.77427726], + [-5.42201444, 17.98986971, -8.93340439], + [-9.12578158, 6.83357564, 1.55020747], + [6.88306428, 13.08051611, 11.73747302], + [6.05684674, 18.19987502, -0.93956248], + [6.28141425, 20.08377426, -0.01106354], + [-1.06500681, 9.70301364, 7.91639313], + [9.79709465, 5.34802496, -6.85292853], + [-9.22591665, 0.7652322, 1.16494521], + [5.93862884, 8.20388954, 3.2900805], + [-5.25605952, 14.1519058, 6.70413007], + [6.3837549, 5.31305765, -9.66086697], + [-9.34318851, 10.64116378, -2.58801175], + [-0.70795571, 10.45229065, -10.90781136], + [6.05630832, 1.45919688, 2.94962688], + [-1.85212118, 13.67564763, -10.6639658], + [6.22064833, 13.66297803, 2.3246352], + [-3.199839, 5.94272537, 7.60654191], + [-9.46267974, 9.94678496, -0.46890345], + [-2.00044279, 2.89967645, 7.85262463], + [0.45599332, 3.63610625, 14.09745963], + [2.41802752, 17.02242174, 13.75215548], + [5.9278506, 15.56156951, 12.33928764], + [4.93413221, 13.423613, -10.32284735], + [0.99915092, 16.35520192, 14.03054334], + [-9.32311682, 5.68672998, 0.70262972], + [-2.46486278, 20.20524868, -10.47854364], + [-3.17244161, 20.0109507, -10.21301767], + [10.29306801, 11.93640366, 8.33927129], + [-5.37675505, 6.99307973, 6.6290553], + [1.35589495, 17.78749875, 13.97482237], + [4.57628448, 1.58475759, 5.50752676], + [-3.17525198, 14.5783939, -10.21184745], + [7.09731258, 8.16235268, 11.58664653], + [12.50114725, 4.38415572, 2.62166143], + [5.29660167, 6.43599442, -2.47451684], + [-3.72491348, 14.04319513, -9.96436467], + [9.38792604, 16.87281961, -7.31953179], + [4.16077212, 12.93563346, 5.92736846], + [-5.3976888, 15.81872297, 6.61574638], + [6.18277881, 13.6931034, -0.49804191], + [-7.96057023, 8.17733191, -6.19319822], + [6.15580942, 11.286278, 2.60182253], + [5.56776118, 13.18907695, -2.04449842], + [5.95559246, 10.63665137, -1.22514796], + [-9.03053575, 15.70837466, -3.88597032], + [3.06473602, 18.33178946, -4.35535679], + [12.58280032, 14.09650402, 0.23417547], + [0.90799653, 14.40025496, -4.8139331], + [-8.06500986, 10.13458813, 3.92956857], + [6.22136812, 7.84474729, 2.32122306], + [11.04498948, 11.28130852, -5.03532394], + [6.36051762, 7.20954733, 0.90949498], + [2.6357712, 14.66611826, 7.01582793], + [11.09544351, 12.31031817, -4.94419279], + [-4.93935905, 5.77351781, -9.27261397], + [5.00971792, 4.74601751, -2.85355087], + [11.43831001, 6.63807929, 6.32713239], + [6.07283571, 15.97730192, -0.88987287], + [6.0335698, 4.67858974, 3.02026837], + [1.28431482, 4.2938609, 13.98675865], + [-2.27992619, 11.96177583, 7.81204479], + [1.18143677, 20.73034349, -4.81026869], + [6.43961185, 7.68935974, 12.03065569], + [0.23839815, 19.10432274, 7.81987179], + [-6.51512802, 16.30336814, -7.99273038], + [-8.31391581, 16.98680447, -5.58635483], + [9.06033909, 8.62488821, 9.86490498], + [-9.47625216, 0.4635807, -0.85402702], + [4.02145845, 17.62702022, 6.05360022], + [8.16548244, 0.88843843, -8.46696497], + [-8.9838694, 10.13967428, 2.00596379], + [-0.83623931, 2.35037183, -10.88684357], + [2.78976271, 0.4273365, 6.93092751], + [-7.40749902, 8.41097489, 4.83607613], + [-4.07236922, 10.39055184, -9.78791913], + [-6.20607875, 3.56672804, -8.2863697], + [1.35033842, 5.84902076, -4.80029411], + [5.83151255, 3.82552406, -1.52448351], + [-8.28483628, 11.70322644, -5.64019737], + [2.99787415, 6.23336687, -10.85871631], + [2.17921721, 19.50976176, 7.24081747], + [-9.38784164, 2.97615214, -2.29679281], + [5.96390174, 5.99667829, 3.22174855], + [-8.04949257, 13.81871622, 3.9539914], + [11.28454038, 17.42551197, -4.58499959], + [0.5921885, 16.43592456, -11.03331483], + [-2.09286511, 9.76988448, 7.84031106], + [-7.56980225, 10.91098349, 4.63380879], + [6.70242802, 2.11246651, -9.48109822], + [11.97525385, 7.1122447, 4.95114575], + [-1.853731, 2.44455543, 7.86993848], + [12.60589483, 14.64181732, 0.96656689], + [5.09490443, 14.59220534, -2.74768404], + [-0.22053996, 0.21078255, -10.97326308], + [-7.56082812, 19.15814931, -6.78044607], + [2.00301756, 13.8367927, 13.84943815], + [-5.51732243, 19.33516012, 6.5380196], + [0.77454046, 17.09259726, -4.81008202], + [11.88357976, 7.05959255, 5.22223515], + [12.10322728, 15.80150215, 4.53472121], + [9.26921032, 16.18634071, -7.44611168], + [-9.4661205, 16.94277537, -0.53482799], + [-6.46176534, 17.08161524, 5.81366242], + [5.82307852, 15.52884317, -1.54327674], + [-3.48058838, 10.45205717, 7.52108215], + [3.6106127, 6.64516035, 6.39017315], + [1.59031817, 13.02416839, -4.77600803], + [4.20132619, 5.81720564, -10.56952623], + [5.57424669, 6.58946441, -2.03311391], + [-7.78475074, 4.11542664, 4.34580707], + [-2.91347949, 7.7876348, -10.31684812], + [0.54947172, 11.25606715, 7.76390739], + [11.18817476, 15.84956135, 6.84375884], + [5.77607797, 4.77319603, -1.64495333], + [12.54244574, 5.85757716, 2.26213447], + [1.3151522, 11.24810046, -11.03609724], + [6.35285163, 10.44839605, 1.31060098], + [6.1728297, 19.3850004, 2.53405652], + [-4.03095697, 7.1572094, 7.32090959], + [5.65572309, 4.4004285, 3.93744533], + [12.15472852, 11.65721866, 4.35139945], + [12.2649096, 19.40163358, -1.90632692], + [1.61127087, 20.69977191, 7.46972463], + [-4.30383035, 12.89401082, 7.2048776], + [5.89220996, 9.32936465, -1.38377349], + [-8.66797021, 8.55688838, 2.80810209], + [-6.06824121, 12.63313092, -8.40976077], + [6.32716094, 8.21372886, 1.64536444], + [4.6702708, 20.51725842, 12.97689368], + [3.61089891, 1.28044345, 6.38995569], + [3.7491159, 17.69158421, 6.28228048], + [11.51609826, 8.88434517, 6.15369484], + [1.61567566, 17.08598593, -11.02333218], + [5.46987073, 3.68405937, -10.10637165], + [2.80336154, 16.46977888, 6.92319941], + [-1.84757928, 3.74639429, -10.66519292], + [-3.67775637, 12.69670072, 7.45443219], + [12.57236122, 4.48004318, 0.07838943], + [4.52766414, 14.64131342, -10.46652292], + [0.45728431, 4.12921238, 14.09732598], + [-3.48669783, 0.51691372, 7.51909994], + [-6.72289977, 3.39064286, -7.78091197], + [2.2685462, 2.74231692, -10.96738138], + [-8.48742605, 1.81028308, 3.18593572], + [-1.49512168, 2.46051283, 7.90078523], + [6.34239074, 1.45029468, 1.47550467], + [3.6809035, 14.13394809, 13.3711321], + [3.34173768, 4.28502893, -10.79028548], + [7.6600934, 12.73571569, 11.15956488], + [6.23874165, 10.48190969, -0.24692683], + [7.82081145, 13.93686441, -8.73655807], + [9.4114013, 18.36473565, -7.29405697], + [-7.20874646, 10.44706769, -7.2329754], + [-8.27209696, 16.90406282, 3.58559094], + [-9.04368029, 5.59278093, 1.82391426], + [2.655589, 12.13740042, -10.9158361], + [-9.39760807, 3.92064544, -2.22379997], + [0.76452381, 5.45531427, 7.71746368], + [12.60143647, 6.62935714, 0.66039499], + [12.10614689, 5.79345452, -2.50405231], + [11.96759072, 1.05526872, -2.94645934], + [4.85962149, 19.69529851, 5.17650123], + [2.665549, 8.41914546, -4.51768818], + [-9.37679259, 4.7405001, 0.37853799], + [2.85086189, 13.69305981, -4.44712134], + [-9.31459748, 0.57699202, 0.74833698], + [0.28797263, 13.84688223, 14.11382866], + [5.25792698, 19.80607923, 4.62866321], + [10.36814562, 6.70638885, 8.22965894], + [5.06194113, 13.29591228, -2.78926485], + [5.74519213, 8.77304827, -1.70914605], + [0.90307573, 14.12080951, 7.68410811], + [11.68536201, 14.70021788, 5.75055147], + [3.53317689, 16.24064654, 6.44819806], + [6.35614972, 19.12805125, 1.23692659], + [4.19013107, 20.24238803, -3.66213329], + [4.02378074, 2.6718563, 13.24447984], + [1.06633343, 18.82718163, -11.04048377], + [-8.73986013, 7.71880889, 2.64392147], + [-9.38860265, 20.82373441, -2.29125443], + [3.66363184, 16.69917135, 6.3495058], + [-9.47012158, 10.6023231, -0.62611705], + [7.50322226, 13.78849333, -8.96726925], + [2.90117132, 5.17725021, -4.42654732], + [9.95020824, 18.00163836, 8.81184046], + [-4.14922269, 7.61963527, -9.74668352], + [11.13528086, 15.31303164, 6.94603751], + [-9.34975224, 3.23567856, 0.55063758], + [5.57921356, 10.4399444, 4.08575269], + [6.15843267, 18.32898384, 2.59157293], + [2.4120058, 11.75523405, 13.75366311], + [-9.04635914, 4.22084065, 1.81544943], + [10.45356386, 13.80161056, -5.98633972], + [4.40796752, 11.08258169, 5.68604361], + [3.72575869, 11.18310085, 6.30085517], + [-3.34255814, 16.86798991, 7.56446859], + [1.67174315, 15.52183638, -4.76506206], + [3.98750217, 11.0080951, 13.25837003], + [5.0044622, 16.20853306, -2.85991582], + [-8.89589192, 13.81296773, 2.2529198], + [1.76551138, 7.73381367, -4.75074957], + [2.31853658, 12.33138393, 7.17623474], + [-7.47900512, 15.01466393, -6.89041981], + [5.82461393, 8.60363142, -1.53986838], + [-3.74746931, 1.80940914, 7.42953032], + [1.48102878, 8.062214, 7.51484426], + [12.39198912, 0.13903103, -1.31005014], + [6.22501762, 13.88620367, 2.30378269], + [1.87624155, 15.2125167, 7.3695971], + [-5.84847976, 13.44961807, -8.59758378], + [3.57680664, 9.07684902, 13.40756063], + [6.23403815, 15.34535655, -0.27009539], + [-0.0283997, 16.30207145, 7.85754462], + [-9.45532029, 11.53357657, -1.64034427], + [3.59681448, 13.41922739, 6.40063061], + [4.45391987, 20.55396369, -3.43711525], + [0.78075959, 3.2573418, -4.81034422], + [0.47311198, 2.77387042, 7.77886216], + [6.03680126, 9.54348831, -0.99987462], + [-0.18672304, 0.78150116, 7.87547339], + [2.97616419, 10.38512203, -4.39473153], + [-0.6569106, 3.51600339, 7.9096116], + [-1.02037396, 5.19592954, 7.91667739], + [2.8006065, 3.57206066, 6.92476815], + [0.58296908, 11.27885667, -4.79801226], + [-9.41908556, 10.02109474, 0.05225261], + [-7.06045336, 12.14730312, 5.23103075], + [-7.23818091, 20.75138294, 5.03474367], + [9.54433054, 1.78242614, 9.31974941], + [-2.96544787, 5.28489854, 7.66959206], + [-9.47678109, 17.4535852, -1.09318655], + [1.92079014, 3.17064829, -4.72300471], + [2.29680571, 9.30989509, -10.96408304], + [-0.89562274, 11.5732489, 7.91613766], + [6.16056055, 19.71582817, -9.77900671], + [-2.90544476, 9.89884562, -10.31994456], + [-6.103068, 3.87513355, 6.11363255], + [5.33925295, 0.44224098, -2.41216364], + [-6.46543583, 17.45931332, 5.81041782], + [10.62181766, 0.5204134, 7.84070021], + [-6.14388872, 8.77855441, 6.08113743], + [11.18969377, 3.05731189, -4.76880862], + [5.61589166, 13.40316314, -1.95856126], + [11.85155916, 19.00919151, -3.27798546], + [3.12835461, 7.7792221, 6.72682477], + [-8.18752325, 9.20184198, -5.81487252], + [5.02021859, 16.89350691, 12.81561363], + [-1.4085818, 5.7834015, -10.77388211], + [12.57724837, 15.85852768, 1.84755793], + [11.02018078, 12.48736056, 7.16130935], + [12.47065557, 13.32936423, -0.84136053], + [5.79926868, 2.36176081, 3.63195007], + [3.52338421, 13.23258192, -4.11859056], + [1.50273643, 5.9384242, 13.94913998], + [-5.17919659, 12.68524327, 6.75049211], + [6.24019288, 5.78462313, -0.23968494], + [-3.29673848, 4.53561858, -10.1603552], + [5.94696706, 8.42335455, -1.24752631], + [5.43682574, 7.07254093, 12.60772343], + [5.83603715, 20.05570828, -1.51432918], + [-9.21165711, 12.77590254, -3.23210049], + [-7.10545377, 14.45875101, 5.18245129], + [-8.30589034, 12.91679944, -5.60129365], + [8.91671755, 3.78304789, 10.01566435], + [-9.25397353, 4.60346437, 1.0428986], + [5.75202171, 13.30038507, -1.69512059], + [2.37407747, 16.45451768, 13.76309353], + [4.78227107, 16.15478589, 12.9265676], + [-4.5506191, 8.81520271, 7.08984212], + [0.95983301, 3.65733836, -4.81442809], + [4.20856222, 10.26099018, 5.88250466], + [-4.48273029, 10.51206298, 7.12246679], + [-4.38623592, 4.30524189, 7.16755271], + [-4.94497545, 10.84140858, -9.26889668], + [-3.15337977, 2.00129042, 7.6196332], + [2.32708204, 16.81850836, 7.17215977], + [6.11406143, 0.58132816, -0.75436705], + [-1.95156118, 16.97813048, -10.63656481], + [-4.63522155, 13.30046047, -9.46632649], + [6.89559337, 16.08113297, 11.72882219], + [2.60547148, 20.95452597, 7.03197819], + [11.96224339, 19.10529238, 4.99085171], + [-9.4772763, 10.93974307, -0.97608829], + [1.83017627, 16.44522632, -11.00922031], + [2.94455372, 11.63343377, 6.84068353], + [3.63314369, 18.50448852, -4.05321835], + [-5.73007393, 16.44690031, -8.69448192], + [0.28104078, 19.42323864, 14.11446032], + [10.03609414, 6.73687564, 8.69751784], + [5.24059175, 2.50383401, -2.55382496], + [-9.47426022, 12.70793063, -1.23445033], + [10.84103024, 0.48800361, -5.38605633], + [6.31362165, 7.66723108, 1.76575821], + [11.98365616, 12.69803211, 4.9252699], + [3.69710942, 3.97615552, 6.32342537], + [-9.43658231, 13.44263299, -1.87352076], + [1.3893681, 16.41538043, -4.79715323], + [12.45403973, 3.60403513, 2.95193129], + [6.34587712, 17.09102444, 0.55038829], + [-8.43812877, 12.96946242, -5.34693923], + [-8.32793578, 8.68041905, 3.48649454], + [-2.56860996, 2.96179631, 7.75956508], + [6.35161696, 13.24838702, 0.6430925], + [3.35921256, 14.922693, 6.57285694], + [2.91332736, 12.70367062, -4.42148382], + [2.12477287, 19.31235662, -4.67881007], + [4.98259723, 11.42409861, 5.01896571], + [6.28307295, 10.33002964, -0.00070569], + [4.13042193, 10.05683455, 5.9554379], + [4.57384431, 7.04109692, -3.32484941], + [0.00707521, 2.68084339, 7.8530775], + [-9.17843827, 7.48937662, 1.35614938], + [-3.87616772, 19.79081681, 7.38169477], + [2.56923907, 7.48151936, 7.05105578], + [-6.08311141, 10.1165004, -8.39666201], + [-9.09121543, 12.09778042, -3.68576978], + [-0.61306988, 8.92723948, 7.90762607], + [-2.4380857, 18.25407482, 7.78463196], + [5.43508502, 2.54775681, -10.12139265], + [11.68723835, 8.6986158, -3.7021906], + [9.85092052, 4.11975947, 8.94087536], + [5.05006632, 8.46914232, -2.80405123], + [6.04706331, 17.03691486, 2.9786743], + [0.44733292, 19.90373177, -4.78474409], + [2.72799771, 14.76401771, -4.4948139], + [1.27950318, 17.33199782, -4.80519287], + [11.85132612, 14.78501498, 5.31315893], + [9.97911072, 15.31811261, 8.77365454], + [4.55891885, 12.06777708, -10.45608692], + [10.9408185, 4.79416889, 7.30434388], + [5.38308599, 9.6637121, -2.34620525], + [8.02985923, 20.72195231, -8.57553242], + [7.4150793, 7.39107389, 11.35121], + [-3.52196407, 10.45529604, 7.50755464], + [-9.44620147, 7.04982356, -1.76273218], + [9.38340826, 8.4251251, -7.3244173], + [2.55860699, 16.24099748, -10.93004566], + [0.2326738, 18.42587479, 14.11877161], + [-9.401443, 13.48065195, -2.19391115], + [-7.62198324, 3.08572018, 4.56610795], + [-9.36039132, 11.82283746, -2.48268759], + [6.3609914, 0.20873186, 1.0007836], + [8.31257343, 13.25950889, -8.3454169], + [5.74292616, 13.38404266, -1.71377887], + [1.85450172, 19.1407703, -11.0073566], + [3.43440484, 15.38210781, -4.16902115], + [4.68187389, 17.80879432, -3.21780624], + [4.37413777, 12.38342191, 5.72047255], + [8.37687345, 5.71583271, -8.2910022], + [-8.92912508, 3.51695361, -4.1905712], + [5.45210322, 2.34019079, -2.23820856], + [5.14312669, 0.37008062, 12.7561125], + [-9.42951441, 20.93101766, -0.04570735], + [-5.33917271, 6.75316158, 6.65273389], + [5.75121537, 19.01304607, -1.69678142], + [10.28897652, 12.06908724, -6.2194425], + [-2.05223603, 15.17399051, 7.84585835], + [-1.42016368, 2.90483486, -10.77126387], + [-6.73512703, 9.31084134, -7.76805775], + [12.43958974, 9.51776908, 3.04242137], + [11.19924714, 17.51695551, 6.82206591] + ]) +``` + +Now we will call `MDS.fit/1` on our dataset. To speed up calculations we'll use `EXLA.jit_apply/2` that JITs the computations and make them faster. + +```elixir +key = Nx.Random.key(42) +embedding = EXLA.jit_apply(&MDS.fit(&1, key: &2), [swiss_roll, key]) +``` + +Extract only embedded data from struct + +```elixir +embedded_data = embedding.embedding +``` + +Now we will plot the resulting embedded swiss roll + +```elixir +embedded_data = + embedded_data + |> Nx.as_type(:f64) + |> DF.new() + |> DF.rename(["x coordinate", "y coordinate"]) + +Tucan.scatter(embedded_data, "x coordinate", "y coordinate", filled: true) +|> Tucan.set_size(500, 500) +|> Tucan.set_title("Scatterplot showing embedded Swiss roll data set", offset: 20) +``` + +As we see, MDS collapsed one dimension and what we see is similar to a cross section of the original dataset. + + + +## Digits Dataset + +In the next section we change dataset to Digits dataset. It consists of almost 1800 8x8 images with digits. + +```elixir +digits_url = + "https://github.com/scikit-learn/scikit-learn/raw/main/sklearn/datasets/data/digits.csv.gz" + +image_width = 8 +image_height = 8 + +data = + Req.get!(digits_url).body + +df_data = DF.load_csv!(data, delimiter: ",", header: false) +labels = DF.select(df_data, "column_65") |> DF.rename(["labels"]) +digits_data = Nx.stack(df_data, axis: 1) + +# remove labels from data +digits_data = digits_data[[.., 0..(image_width * image_height - 1)]] +labels +``` + +Let's look how one of the images look like + +```elixir +digits_data[[1234, ..]] |> Nx.reshape({image_height, image_width}) |> Nx.to_heatmap() +``` + +```elixir +embedding = EXLA.jit_apply(&MDS.fit(&1, key: &2), [digits_data, key]) +embedded_data = embedding.embedding +``` + +As we can observe, digits with the same label are embedded close to each other. The most problematic label is 5 which is similar to 9 and some samples lie close to each other. + +```elixir +embedded_data = + embedded_data + |> Nx.as_type(:f64) + |> DF.new() + |> DF.rename(["x coordinate", "y coordinate"]) + +embedded_data = DF.concat_columns([embedded_data, labels]) + +Tucan.scatter(embedded_data, "x coordinate", "y coordinate", filled: true, color_by: "labels") +|> Tucan.set_size(500, 500) +|> Tucan.Scale.set_color_scheme(:paired) +|> Tucan.set_title("Scatterplot showing embedded Digits data set", offset: 20) +```