MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / main

Function main

nlp_class2/ner_rnn.py:13–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11from pos_rnn import RNN
12
13def main():
14 Xtrain, Ytrain, Xtest, Ytest, word2idx, tag2idx = get_data(split_sequences=True)
15 V = len(word2idx)
16 K = len(tag2idx)
17 rnn = RNN(10, [10], V, K)
18 rnn.fit(Xtrain, Ytrain, epochs=70)
19 print("train score:", rnn.score(Xtrain, Ytrain))
20 print("test score:", rnn.score(Xtest, Ytest))
21 print("train f1 score:", rnn.f1_score(Xtrain, Ytrain))
22 print("test f1 score:", rnn.f1_score(Xtest, Ytest))
23
24
25if __name__ == '__main__':

Callers 1

ner_rnn.pyFile · 0.70

Calls 5

fitMethod · 0.95
scoreMethod · 0.95
f1_scoreMethod · 0.95
get_dataFunction · 0.90
RNNClass · 0.90

Tested by

no test coverage detected