Actualización código

parent 7373f811
Showing with 1 additions and 4 deletions
...@@ -121,10 +121,8 @@ def classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, twee ...@@ -121,10 +121,8 @@ def classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, twee
embedding_matrix[index] = embedding_vector embedding_matrix[index] = embedding_vector
#max_len_input = 30 #max_len_input = 30
train_features_pad = sequence.pad_sequences(corpus_train_index, maxlen=max_len_input, padding="post", truncating="post", dtype=type(corpus_train_index[0][0])) train_features_pad = sequence.pad_sequences(corpus_train_index, maxlen=max_len_input, padding="post", truncating="post", dtype=type(corpus_train_index[0][0]))
# define RNN model # define RNN model
model = Sequential() model = Sequential()
...@@ -139,7 +137,7 @@ def classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, twee ...@@ -139,7 +137,7 @@ def classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, twee
model.add(Dense(len(CLASSES), activation='softmax')) model.add(Dense(len(CLASSES), activation='softmax'))
# compile the model # compile the model
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['acc']) model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['acc'])
# summarize the model # summarize the model
print(model.summary()) print(model.summary())
...@@ -175,6 +173,5 @@ def main (): ...@@ -175,6 +173,5 @@ def main ():
tweets_dev_classified_labels = classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, tweets_dev) tweets_dev_classified_labels = classification_embedings_rnn(tweets_train, tweets_train_labels_numeric, tweets_dev)
calculate_quality_performamnce(tweets_dev_labels, tweets_dev_classified_labels, "RNN_LSTM") calculate_quality_performamnce(tweets_dev_labels, tweets_dev_classified_labels, "RNN_LSTM")
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment