How to create Tabularpandas from a list, instead of a dataframe?

Hi,

I am working on a project where I used Neural Network and Random forest, to improve the performance I have used embeddings. It gave a better score for Random forest, but in Neural network, I dont know how to create a Tabularpandas using a list (since when I used embeddings, my result is in the form of list) , and presently I know to create neural network by following the steps in fast ai book, where they are working with tabularpandas.

Can someone let me know how to create a neural network using list.

Hi @akshaypt7,

so you build a custom Neural Net already and in there you got Embeddings, right?! So why don’t you add some more layers in your Neural Net to further process the Embeddings like in lesson 8 Collaborative Filtering

class CollabNN(Module):
    def __init__(self, user_sz, item_sz, y_range=(0,5.5), n_act=100):
        self.user_factors = Embedding(*user_sz)
        self.item_factors = Embedding(*item_sz)
        self.layers = nn.Sequential(
            nn.Linear(user_sz[1]+item_sz[1], n_act),
            nn.ReLU(),
            nn.Linear(n_act, 1))
        self.y_range = y_range
        
    def forward(self, x):
        embs = self.user_factors(x[:,0]),self.item_factors(x[:,1])
        x = self.layers(torch.cat(embs, dim=1))
        return sigmoid_range(x, *self.y_range)

@JackByte Thanks Jack, I think I could work on a customized model and make this work, It didnt crossed my mind. Thank you.

1 Like