I fit t-SNE on my training data and want to project my test data into the same 2D space, but TSNE has no transform method.
Why this happens
t-SNE doesn't learn a function from the input space to the 2D space. It directly optimizes the position of each training point so that neighbors stay close. There's no mapping to apply to a new point, so scikit-learn only offers fit_transform. Running t-SNE again on combined data produces a completely new layout.
Answer 1: Use UMAP, which has a real transform method
UMAP learns a mapping that can be applied to new points. If you need to embed new data, it's usually the simplest switch:
import umap
reducer = umap.UMAP(n_components=2,
random_state=42).fit(X_train_scaled)
emb_train = reducer.embedding_
emb_test = reducer.transform(X_test_scaled)
