let
    docs_dir = dirname(dirname(@__DIR__))
    pkg_dir = dirname(docs_dir)
    
    using Pkg: Pkg
    Pkg.activate(docs_dir)
    Pkg.develop(; path=pkg_dir)
    Pkg.instantiate()
end;
using CairoMakie
true
begin
    using MLDatasets
    ENV["DATADEPS_ALWAYS_ACCEPT"] = true
end
using UMAP
10000
n_examples = 10_000
fmnist_x = reshape(FashionMNIST.traintensor(Float64, 1:n_examples), :, n_examples);
fmnist_y = FashionMNIST.trainlabels(1:n_examples);
result = UMAP.fit(fmnist_x);
begin
    f = Figure()
    axis = f[1, 1] = Axis(f)
    scatter!(axis, getindex.(result.embedding, 1), getindex.(result.embedding, 2), color=fmnist_y, markersize=4)
    f
end
784×3000 Matrix{Float64}:
 0.0  0.0       0.0  0.0  0.0         0.0  …  0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.00784314  0.0     0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.00392157  0.0  …  0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.00392157  0.0     0.0  0.0  0.0  0.0  0.0        0.0
 ⋮                                    ⋮    ⋱       ⋮                         
 0.0  0.682353  0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0784314  0.309804
 0.0  0.741176  0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.494118   0.0
 0.0  0.262745  0.0  0.0  0.0         0.0  …  0.0  0.0  0.0  0.0  0.486275   0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.105882   0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0        0.0
 0.0  0.0       0.0  0.0  0.0         0.0     0.0  0.0  0.0  0.0  0.0        0.0
fmnist_x_2 = reshape(FashionMNIST.testtensor(Float64, 1:3000), :, 3000)
3000-element Vector{Int64}:
 9
 2
 1
 1
 6
 1
 4
 ⋮
 1
 9
 7
 0
 6
 2
fmnist_y_2 = FashionMNIST.testlabels(1:3000)
UMAP.UMAPTransformResult{Matrix{Float64}, Vector{Vector{Float64}}, Tuple{Matrix{Int64}, Matrix{Float64}}, SparseArrays.SparseMatrixCSC{Float64, Int64}, SparseArrays.SparseMatrixCSC{Float64, Int64}}([0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0; … ; 0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0], [[8.61074778659741, -3.1769003439835086], [-3.0437106500874904, 6.371260169055699], [-4.038986445290677, -9.213052261873784], [-3.332290841715234, -7.961582138152386], [-2.890772530252853, 3.1983340973343233], [-4.734747216991303, -9.572868955678658], [-1.869787996137676, 0.8695278374099289], [-2.157450631212629, 2.608511112777642], [5.829699122167504, -5.601186143967524], [7.274550524923589, -6.330518731239415]  …  [7.271297210069601, -4.995386538989347], [-5.451521682170517, -1.5748129377007327], [-5.835737845530426, -1.270960986990523], [-2.7910550734306043, -7.034956889247622], [-4.67402363506363, -8.551504285519032], [8.458983339519001, -0.6244401649394286], [9.046210314441852, -4.560632072710153], [-3.589498616559826, -1.5405257563677126], [-2.668142342712135, 5.377809826541202], [-3.1251333083747954, 2.693904375212453]], ([8777 8573 … 4095 1905; 112 3885 … 4914 485; … ; 6586 8558 … 5172 2353; 7632 3883 … 9481 904], [3.2712699717371594 5.129419260053288 … 4.296647119625748 4.578721492256593; 3.2791771363060866 5.422477319870131 … 4.751978482715619 4.61178804849368; … ; 4.300151549058167 6.0644976286489936 … 5.489414510195449 5.1053642699717505; 4.30751245975291 6.07991632715245 … 5.522425011574017 5.160904998886878]), sparse([112, 885, 1778, 2557, 2689, 3246, 4307, 5540, 6586, 6730  …  1905, 2353, 3809, 5207, 6421, 7017, 7027, 7523, 8524, 8541], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000], [0.9800088938051942, 0.2557397962728606, 0.07294127820015874, 0.1667349524707592, 0.07855531810193152, 0.10760219014147139, 0.16076705051520904, 0.0869775670643022, 0.07225174628223945, 0.12184407316887451  …  1.0, 0.06789686542269183, 0.09987419101857296, 0.09108723328938327, 0.19230378223165526, 0.21292061411337565, 0.18390725510424075, 0.21308512343478725, 0.1523772479691946, 0.3100808470600001], 10000, 3000), sparse([112, 885, 1778, 2557, 2689, 3246, 4307, 5540, 6586, 6730  …  1905, 2353, 3809, 5207, 6421, 7017, 7027, 7523, 8524, 8541], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1  …  3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000], [0.9800088938051942, 0.2557397962728606, 0.07294127820015874, 0.1667349524707592, 0.07855531810193152, 0.10760219014147139, 0.16076705051520904, 0.0869775670643022, 0.07225174628223945, 0.12184407316887451  …  1.0, 0.06789686542269183, 0.09987419101857296, 0.09108723328938327, 0.19230378223165526, 0.21292061411337565, 0.18390725510424075, 0.21308512343478725, 0.1523772479691946, 0.3100808470600001], 10000, 3000))
transform_result = UMAP.transform(result, fmnist_x_2)
begin
    f2 = Figure()
    axis2 = f[1, 1] = Axis(f2)
    scatter!(axis2, getindex.(transform_result.embedding, 1), getindex.(transform_result.embedding, 2), color=fmnist_y_2, markersize=4)
    f2
end