sklearn.manifold.MDS has no transform method

scikit-learn

Solution

For a scikit-learn transformer, `estimator.fit_transform(X)` is always equivalent to `estimator.fit(X).transform(X)`, but usually implemented more efficiently. In this case, it is indeed the same as `estimator.fit(X).embedding_`; it's there because scikit-learn classes such as `Pipeline` may call it.

It seems there's no `transform` method on any of the manifold learners, perhaps by mistake; I just opened an issue about this.

Problem

After I make an MDS object `mds`, and fit it with `mds.fit(X)`, I thought I would be able to project new points using `mds.transform(X_new)`. I think that's the API in other manifold classes. But there is only `fit_transform`. I guess from the description that `fit_transform` does some more fitting, and I don't want to change the projection which has already been calculated! EDIT: wait, maybe this doesn't make sense. I did some more reading. If I now understand right, the MDS algorithm is an iterative one that "just moves points around" until the stress value gets low -- and doesn't actually allow for projection. But still, I'm a bit confused about what `fit_transform` does. The docs say "Fit the data from X, and returns the embedded coordinates". How is that different from just fitting and taking `mds.embedding_`?

Original source