Multiinput Keras
Creating the Labels
from sklearn import preprocessing
from keras.utils import to_categorical
label_encoder = preprocessing.LabelEncoder()
# the y that is being passed in is a pandas series of categorical data
y = label_encoder.fit_transform(y)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)
y_train = to_categorical(y_train)
y_test = to_categorical(y_test)
# prints the classes of y
print(label_encoder.classes_)Preparing Text Input
Minimizing noise
To minimize noise in our text, we process the text by removing puncutations, numbers, and excessive spacing.
Convert text into suitable input format for model
Our model only understands numeric values, so we have to convert our textual input into vectors
We use pretrained word embeddings to create these vectors.
Creating vectors for each word provided by gloVe
Converting text to sequences
Creating word embeddings
Preparing meta data
We don't need to do much to this data since it is already numerical data.
Building the Model
Training the Model
Last updated
Was this helpful?