Optimize experimental disk-backed t-SNE affinities
Source:R/massive_tsne_optimizer.R
massive_tsne_optimize.RdStreams a normalized symmetric CSR affinity graph on every iteration. The CPU optimizer retains only its float32 coordinates and update state in RAM, reuses the package's 2D or 3D FFT repulsion, and writes the final coordinates to a file. The CUDA route streams the same affinities through its 2D FFT optimizer and retains coordinates on the GPU. This is a full-graph fit, not landmark projection. Optimization uses fixed iteration counts, without automatic KL stopping. Disk reads can be substantial. Both routes can checkpoint optimizer state.
Usage
massive_tsne_optimize(
graph,
init,
output,
early_exaggeration_iter = 250L,
n_iter = 500L,
early_exaggeration = 12,
exaggeration = 1,
learning_rate = "auto",
initial_momentum = 0.8,
final_momentum = 0.8,
min_gain = 0.01,
max_step_norm = Inf,
memory_limit = "8GB",
backend = "cpu",
n.cores = 1L,
checkpoint = FALSE,
resume = FALSE,
checkpoint_every = 100L
)Arguments
- graph
A result of
massive_tsne_affinities().- init
File-backed
.f32initial coordinates with two or three columns.- output
New
.f32output path.- early_exaggeration_iter, n_iter
Iterations in each phase.
- early_exaggeration, exaggeration
Phase affinity multipliers.
- learning_rate
Positive value or
"auto"forn / exaggeration.- initial_momentum, final_momentum
Phase momentum values.
- min_gain
Minimum per-coordinate adaptive gain.
- max_step_norm
Maximum update norm;
Infdisables clipping.- memory_limit
RAM budget, including coordinates, optimizer state, and a conservative FFT workspace allowance.
- backend
"cpu"or"cuda"; CUDA currently requires 2D output.- n.cores
CPU worker count for FFT and coordinate updates.
- checkpoint
Save coordinates and optimizer state periodically.
- resume
Continue a matching interrupted fit.
- checkpoint_every
Iterations between state snapshots.