Embeddings with Random forest


Has anyone tried to use embeddings with random forest? I fail to see how to make use of fastai embedding layer (or PyTorch) and fetch that to a random forest

Does anyone know how to accomplish this?


The embeddings will be in the weights of the Embedding layer, you can get the data from there and feed it to your RF (ex: to_np(emb_layer.weight) ).


Thank you! I get the idea but I’d love it if there is a sample code that I can build on it so as not to mess it up!

1 Like

I agree. Jeremy mentions this in lesson 5 that embeddings significantly improve Random Forest performance, but I’d like to see an example of how to do that. Can we still use Categorify?

How do you even do a RF now that fastai 1.0 is out? Use sklearn directly? Or are people using old versions of fastai still? Are the future versions of fastai going to add the RF functionality back?

Just trying to piece this all together given the vast differences in the apis.