I'm relatively new to the world of recurrent neural nets and I'm trying to build a classifier using an LSTM model to predict HIV activity from a given molecule (the original dataset can be found here ).
I have sequences of different lengths (from few dozen to almost 400 characters) but I'm not sure how to proceed. Let's say that I have a dataset structured like so:
import pandas as pd
import random
import string
random.seed(42)
seqs = [[random.choice(string.ascii_letters) for i in range(random.randint(1,10))] for i in range(5)]
classes = [random.randint(0,1) for i in range(5)]
df = pd.DataFrame({
"seq": seqs,
"class": classes
})
print(df)
seq class
0 [b, V] 0
1 [p, o, i, V, g] 0
2 [f, L, B, c, b, f, n, o, G] 1
3 [b, J, m, T, P, S, I, A, o, C] 0
4 [r, Z, a, W, Z, k, S, B, v, r] 0
I know I should:
- one hot encode the elements,
- perform masking and padding
But I don't know how to perform it in Keras/TF2 and I can't find any resources online that explain how to code something similar.