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, result.embedding[1, :], 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}, Matrix{Float32}, Tuple{Matrix{Int64}, Matrix{Float64}}, SparseArrays.SparseMatrixCSC{Float32, Int64}, SparseArrays.SparseMatrixCSC{Float32, 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], Float32[-8.476854 3.2472334 … 3.0080278 2.8100517; 2.622329 -5.9940743 … -5.0191298 -2.5392563], ([8777 8573 … 4095 1905; 112 3885 … 4914 485; … ; 6586 8558 … 5172 2353; 7632 4475 … 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.077729244710623 … 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], Float32[0.9800091, 0.25573984, 0.07294129, 0.16673498, 0.07855533, 0.10760221, 0.16076708, 0.08697758, 0.07225176, 0.12184409  …  1.0, 0.06789687, 0.099874206, 0.091087244, 0.1923038, 0.21292065, 0.18390729, 0.21308516, 0.15237728, 0.3100809], 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], Float32[0.9800091, 0.25573984, 0.07294129, 0.16673498, 0.07855533, 0.10760221, 0.16076708, 0.08697758, 0.07225176, 0.12184409  …  1.0, 0.06789687, 0.099874206, 0.091087244, 0.1923038, 0.21292065, 0.18390729, 0.21308516, 0.15237728, 0.3100809], 10000, 3000))
transform_result = UMAP.transform(result, fmnist_x_2)
begin
    f2 = Figure()
    axis2 = f[1, 1] = Axis(f2)
    scatter!(axis2, transform_result.embedding[1, :], transform_result.embedding[2, :], color=fmnist_y_2, markersize=4)
    f2
end