2
$\begingroup$

What I have understood thus far is that transform() gives you values that are qualitatively similar to X (your features) and predict() gives you values that are qualitatively similar to y (your labels). But what I'm seeking some clarity over is why are there only a few classes that have BOTH of these methods, e.g KMeans, PLSRegression, etc.

Why doesn't it make sense to either put both methods in every class, or never let these two occur in the same class together? For example, if KMeans needed to have a method that returns the Euclidean points, why not let it have a separate method? Implementing transform() to achieve this functionality, in my opinion, takes away the clear distinction between the two methods. Similarly, in PLSRegression, I haven't been able to understand the difference between the two methods.

$\endgroup$

1 Answer 1

3
$\begingroup$

Partial Least Squares Regression is a supervised learning technique that also does dimensionality reduction. The PLSRegression class needs both transform and predict interfaces to properly implement the behavior of Partial Least Squares Regression. The transform method is the interface for dimensionality reduction. The predict method is the interface for generating targets from a trained regression model.

Not all Estimators in scikit-learn do both feature manipulation and prediction (typically target), thus not all classes are going to have both transform and predict interfaces.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.