No, I don’t think there is a built-in PyTorch method, but you could of course use the scikit-learn methods and I would also recommend to use already implemented and tested methods from the Python ecosystem, if possible.