How can I use KNN, Random Forest models in Pytorch?

This may seems like an X Y problem, but initially I had huge data and I was not able to train in given resources (RAM problem). So I thought I could use batch feature of Pytorch. But I want to use Methods like KNN, Random Forest, Clustering except Deep Learning. So is it possible or can I use scikit libraries?

Skorch aims at providing sklearn functions in a PyTorch basis.
That said, if there is something you need that it does not provide, sklearn is a great library and converting Tensors to NumPy arrays is seamless as long as you don’t need gradients flowing through the converted parts.

Best regards

Thomas

3 Likes

But I think Skorch, does not provide RNN, Random Forest. It only helps in Deep Neural Network.

Hi I’ve implemented a first version of Random Forest in Pytorch https://github.com/ValentinFigue/Sklearn_PyTorch. This is still a work in progress but I aim to add new models such as SVM.

Feel free to extend it,

Regards,

Valentin

2 Likes