Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGram changes for FastText classification. #158

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 38 additions & 31 deletions gluonnlp/logs/classification/fasttext-ag-news.log
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
NFO:root:Ngrams range for the training run : 1
/home/ubuntu/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
INFO:root:Ngrams range for the training run : 2
INFO:root:Loading Training data
INFO:root:Opening file fastText/data/ag_news.train for reading input
INFO:root:Opening file /dev/shm/fastText/data/ag_news.train for reading input
INFO:root:Loading Test data
INFO:root:Opening file /dev/shm/fastText/data/ag_news.test for reading input
INFO:root:Vocabulary size: 95814
INFO:root:Training data converting to sequences...
INFO:root:Reading test dataset
INFO:root:Opening file fastText/data/ag_news.test for reading input
INFO:root:Done! Sequence conversion Time=16.82s, #Sentences=120000
INFO:root:Done! Sequence conversion Time=16.32s, #Sentences=7600
INFO:root:Adding 2-gram features
INFO:root:Added n-gram features to train and test datasets!!
INFO:root:Encoding labels
INFO:root:Label mapping:{'__label__1': 0, '__label__2': 1, '__label__3': 2, '__label__4': 3}
INFO:root:Done! Preprocessing Time=3.17s, #Sentences=120000
INFO:root:Done! Preprocessing Time=1.59s, #Sentences=7600
INFO:root:Number of labels: 4
INFO:root:Initializing network
INFO:root:Running Training on ctx:gpu(0)
INFO:root:Embedding Matrix Length:1252686
INFO:root:Number of output units in the last layer :4
INFO:root:Network initialized
INFO:root:Loss function for training:SoftmaxCrossEntropyLoss(batch_axis=0, w=None)
INFO:root:Starting Training!
INFO:root:Loading the training data to memory and creating sequences!
INFO:root:Loading the test data to memory and creating sequences
INFO:root:Training on 120000 samples and testing on 7600 samples
INFO:root:Number of batches for each epoch : 7500.0, Display cadence: 750
INFO:root:Epoch : 0, Batches complete :0
Expand All @@ -29,7 +36,7 @@ INFO:root:Epoch : 0, Batches complete :5250
INFO:root:Epoch : 0, Batches complete :6000
INFO:root:Epoch : 0, Batches complete :6750
INFO:root:Epoch complete :0, Computing Accuracy
INFO:root:Epochs completed : 0 Test Accuracy: 0.901578947368421, Test Loss: 0.3497309461236
INFO:root:Epochs completed : 0 Test Accuracy: 0.9272368421052631, Test Loss: 0.23818149359994806
INFO:root:Epoch : 1, Batches complete :0
INFO:root:Epoch : 1, Batches complete :750
INFO:root:Epoch : 1, Batches complete :1500
Expand All @@ -41,7 +48,7 @@ INFO:root:Epoch : 1, Batches complete :5250
INFO:root:Epoch : 1, Batches complete :6000
INFO:root:Epoch : 1, Batches complete :6750
INFO:root:Epoch complete :1, Computing Accuracy
INFO:root:Epochs completed : 1 Test Accuracy: 0.8919736842105264, Test Loss: 0.3435315266251564
INFO:root:Epochs completed : 1 Test Accuracy: 0.9247368421052632, Test Loss: 0.29014398449394646
INFO:root:Epoch : 2, Batches complete :0
INFO:root:Epoch : 2, Batches complete :750
INFO:root:Epoch : 2, Batches complete :1500
Expand All @@ -53,7 +60,7 @@ INFO:root:Epoch : 2, Batches complete :5250
INFO:root:Epoch : 2, Batches complete :6000
INFO:root:Epoch : 2, Batches complete :6750
INFO:root:Epoch complete :2, Computing Accuracy
INFO:root:Epochs completed : 2 Test Accuracy: 0.8844736842105263, Test Loss: 0.35490143299102783
INFO:root:Epochs completed : 2 Test Accuracy: 0.9226315789473685, Test Loss: 0.3575628486603624
INFO:root:Epoch : 3, Batches complete :0
INFO:root:Epoch : 3, Batches complete :750
INFO:root:Epoch : 3, Batches complete :1500
Expand All @@ -65,7 +72,7 @@ INFO:root:Epoch : 3, Batches complete :5250
INFO:root:Epoch : 3, Batches complete :6000
INFO:root:Epoch : 3, Batches complete :6750
INFO:root:Epoch complete :3, Computing Accuracy
INFO:root:Epochs completed : 3 Test Accuracy: 0.9018421052631579, Test Loss: 0.3105466142296791
INFO:root:Epochs completed : 3 Test Accuracy: 0.9219736842105263, Test Loss: 0.4178947208634587
INFO:root:Epoch : 4, Batches complete :0
INFO:root:Epoch : 4, Batches complete :750
INFO:root:Epoch : 4, Batches complete :1500
Expand All @@ -77,7 +84,7 @@ INFO:root:Epoch : 4, Batches complete :5250
INFO:root:Epoch : 4, Batches complete :6000
INFO:root:Epoch : 4, Batches complete :6750
INFO:root:Epoch complete :4, Computing Accuracy
INFO:root:Epochs completed : 4 Test Accuracy: 0.8989473684210526, Test Loss: 0.2917391434311867
INFO:root:Epochs completed : 4 Test Accuracy: 0.9225, Test Loss: 0.4478347347173829
INFO:root:Epoch : 5, Batches complete :0
INFO:root:Epoch : 5, Batches complete :750
INFO:root:Epoch : 5, Batches complete :1500
Expand All @@ -89,7 +96,7 @@ INFO:root:Epoch : 5, Batches complete :5250
INFO:root:Epoch : 5, Batches complete :6000
INFO:root:Epoch : 5, Batches complete :6750
INFO:root:Epoch complete :5, Computing Accuracy
INFO:root:Epochs completed : 5 Test Accuracy: 0.9032894736842105, Test Loss: 0.277567557990551
INFO:root:Epochs completed : 5 Test Accuracy: 0.9223684210526316, Test Loss: 0.46587714708614214
INFO:root:Epoch : 6, Batches complete :0
INFO:root:Epoch : 6, Batches complete :750
INFO:root:Epoch : 6, Batches complete :1500
Expand All @@ -101,7 +108,7 @@ INFO:root:Epoch : 6, Batches complete :5250
INFO:root:Epoch : 6, Batches complete :6000
INFO:root:Epoch : 6, Batches complete :6750
INFO:root:Epoch complete :6, Computing Accuracy
INFO:root:Epochs completed : 6 Test Accuracy: 0.905921052631579, Test Loss: 0.2719111517071724
INFO:root:Epochs completed : 6 Test Accuracy: 0.9228947368421052, Test Loss: 0.4737367654729097
INFO:root:Epoch : 7, Batches complete :0
INFO:root:Epoch : 7, Batches complete :750
INFO:root:Epoch : 7, Batches complete :1500
Expand All @@ -113,7 +120,7 @@ INFO:root:Epoch : 7, Batches complete :5250
INFO:root:Epoch : 7, Batches complete :6000
INFO:root:Epoch : 7, Batches complete :6750
INFO:root:Epoch complete :7, Computing Accuracy
INFO:root:Epochs completed : 7 Test Accuracy: 0.9088157894736842, Test Loss: 0.26787755638360977
INFO:root:Epochs completed : 7 Test Accuracy: 0.9222368421052631, Test Loss: 0.4784198134985576
INFO:root:Epoch : 8, Batches complete :0
INFO:root:Epoch : 8, Batches complete :750
INFO:root:Epoch : 8, Batches complete :1500
Expand All @@ -125,7 +132,7 @@ INFO:root:Epoch : 8, Batches complete :5250
INFO:root:Epoch : 8, Batches complete :6000
INFO:root:Epoch : 8, Batches complete :6750
INFO:root:Epoch complete :8, Computing Accuracy
INFO:root:Epochs completed : 8 Test Accuracy: 0.9089473684210526, Test Loss: 0.2658883258700371
INFO:root:Epochs completed : 8 Test Accuracy: 0.9218421052631579, Test Loss: 0.48082475678738923
INFO:root:Epoch : 9, Batches complete :0
INFO:root:Epoch : 9, Batches complete :750
INFO:root:Epoch : 9, Batches complete :1500
Expand All @@ -137,7 +144,7 @@ INFO:root:Epoch : 9, Batches complete :5250
INFO:root:Epoch : 9, Batches complete :6000
INFO:root:Epoch : 9, Batches complete :6750
INFO:root:Epoch complete :9, Computing Accuracy
INFO:root:Epochs completed : 9 Test Accuracy: 0.9101315789473684, Test Loss: 0.26578377932310104
INFO:root:Epochs completed : 9 Test Accuracy: 0.9219736842105263, Test Loss: 0.48236229044004497
INFO:root:Epoch : 10, Batches complete :0
INFO:root:Epoch : 10, Batches complete :750
INFO:root:Epoch : 10, Batches complete :1500
Expand All @@ -149,7 +156,7 @@ INFO:root:Epoch : 10, Batches complete :5250
INFO:root:Epoch : 10, Batches complete :6000
INFO:root:Epoch : 10, Batches complete :6750
INFO:root:Epoch complete :10, Computing Accuracy
INFO:root:Epochs completed : 10 Test Accuracy: 0.9107894736842105, Test Loss: 0.265712708234787
INFO:root:Epochs completed : 10 Test Accuracy: 0.9221052631578948, Test Loss: 0.48294173663551476
INFO:root:Epoch : 11, Batches complete :0
INFO:root:Epoch : 11, Batches complete :750
INFO:root:Epoch : 11, Batches complete :1500
Expand All @@ -161,7 +168,7 @@ INFO:root:Epoch : 11, Batches complete :5250
INFO:root:Epoch : 11, Batches complete :6000
INFO:root:Epoch : 11, Batches complete :6750
INFO:root:Epoch complete :11, Computing Accuracy
INFO:root:Epochs completed : 11 Test Accuracy: 0.9101315789473684, Test Loss: 0.26596125215291977
INFO:root:Epochs completed : 11 Test Accuracy: 0.9219736842105263, Test Loss: 0.48327548733156006
INFO:root:Epoch : 12, Batches complete :0
INFO:root:Epoch : 12, Batches complete :750
INFO:root:Epoch : 12, Batches complete :1500
Expand All @@ -173,7 +180,7 @@ INFO:root:Epoch : 12, Batches complete :5250
INFO:root:Epoch : 12, Batches complete :6000
INFO:root:Epoch : 12, Batches complete :6750
INFO:root:Epoch complete :12, Computing Accuracy
INFO:root:Epochs completed : 12 Test Accuracy: 0.9096052631578947, Test Loss: 0.2660171762108803
INFO:root:Epochs completed : 12 Test Accuracy: 0.9218421052631579, Test Loss: 0.48341383955952494
INFO:root:Epoch : 13, Batches complete :0
INFO:root:Epoch : 13, Batches complete :750
INFO:root:Epoch : 13, Batches complete :1500
Expand All @@ -185,7 +192,7 @@ INFO:root:Epoch : 13, Batches complete :5250
INFO:root:Epoch : 13, Batches complete :6000
INFO:root:Epoch : 13, Batches complete :6750
INFO:root:Epoch complete :13, Computing Accuracy
INFO:root:Epochs completed : 13 Test Accuracy: 0.9096052631578947, Test Loss: 0.26602624356746674
INFO:root:Epochs completed : 13 Test Accuracy: 0.9218421052631579, Test Loss: 0.48347091130704933
INFO:root:Epoch : 14, Batches complete :0
INFO:root:Epoch : 14, Batches complete :750
INFO:root:Epoch : 14, Batches complete :1500
Expand All @@ -197,7 +204,7 @@ INFO:root:Epoch : 14, Batches complete :5250
INFO:root:Epoch : 14, Batches complete :6000
INFO:root:Epoch : 14, Batches complete :6750
INFO:root:Epoch complete :14, Computing Accuracy
INFO:root:Epochs completed : 14 Test Accuracy: 0.9097368421052632, Test Loss: 0.266008622944355
INFO:root:Epochs completed : 14 Test Accuracy: 0.9218421052631579, Test Loss: 0.48350696036323887
INFO:root:Epoch : 15, Batches complete :0
INFO:root:Epoch : 15, Batches complete :750
INFO:root:Epoch : 15, Batches complete :1500
Expand All @@ -209,7 +216,7 @@ INFO:root:Epoch : 15, Batches complete :5250
INFO:root:Epoch : 15, Batches complete :6000
INFO:root:Epoch : 15, Batches complete :6750
INFO:root:Epoch complete :15, Computing Accuracy
INFO:root:Epochs completed : 15 Test Accuracy: 0.9097368421052632, Test Loss: 0.2660045027732849
INFO:root:Epochs completed : 15 Test Accuracy: 0.9218421052631579, Test Loss: 0.48351032549803885
INFO:root:Epoch : 16, Batches complete :0
INFO:root:Epoch : 16, Batches complete :750
INFO:root:Epoch : 16, Batches complete :1500
Expand All @@ -221,7 +228,7 @@ INFO:root:Epoch : 16, Batches complete :5250
INFO:root:Epoch : 16, Batches complete :6000
INFO:root:Epoch : 16, Batches complete :6750
INFO:root:Epoch complete :16, Computing Accuracy
INFO:root:Epochs completed : 16 Test Accuracy: 0.9097368421052632, Test Loss: 0.2660120502114296
INFO:root:Epochs completed : 16 Test Accuracy: 0.9218421052631579, Test Loss: 0.48350887055986097
INFO:root:Epoch : 17, Batches complete :0
INFO:root:Epoch : 17, Batches complete :750
INFO:root:Epoch : 17, Batches complete :1500
Expand All @@ -233,7 +240,7 @@ INFO:root:Epoch : 17, Batches complete :5250
INFO:root:Epoch : 17, Batches complete :6000
INFO:root:Epoch : 17, Batches complete :6750
INFO:root:Epoch complete :17, Computing Accuracy
INFO:root:Epochs completed : 17 Test Accuracy: 0.9097368421052632, Test Loss: 0.2660161182284355
INFO:root:Epochs completed : 17 Test Accuracy: 0.9218421052631579, Test Loss: 0.483507971540666
INFO:root:Epoch : 18, Batches complete :0
INFO:root:Epoch : 18, Batches complete :750
INFO:root:Epoch : 18, Batches complete :1500
Expand All @@ -245,7 +252,7 @@ INFO:root:Epoch : 18, Batches complete :5250
INFO:root:Epoch : 18, Batches complete :6000
INFO:root:Epoch : 18, Batches complete :6750
INFO:root:Epoch complete :18, Computing Accuracy
INFO:root:Epochs completed : 18 Test Accuracy: 0.9097368421052632, Test Loss: 0.26601601392030716
INFO:root:Epochs completed : 18 Test Accuracy: 0.9218421052631579, Test Loss: 0.4835074149108605
INFO:root:Epoch : 19, Batches complete :0
INFO:root:Epoch : 19, Batches complete :750
INFO:root:Epoch : 19, Batches complete :1500
Expand All @@ -257,7 +264,7 @@ INFO:root:Epoch : 19, Batches complete :5250
INFO:root:Epoch : 19, Batches complete :6000
INFO:root:Epoch : 19, Batches complete :6750
INFO:root:Epoch complete :19, Computing Accuracy
INFO:root:Epochs completed : 19 Test Accuracy: 0.9097368421052632, Test Loss: 0.2660166919231415
INFO:root:Epochs completed : 19 Test Accuracy: 0.9218421052631579, Test Loss: 0.483507287394626
INFO:root:Epoch : 20, Batches complete :0
INFO:root:Epoch : 20, Batches complete :750
INFO:root:Epoch : 20, Batches complete :1500
Expand All @@ -269,7 +276,7 @@ INFO:root:Epoch : 20, Batches complete :5250
INFO:root:Epoch : 20, Batches complete :6000
INFO:root:Epoch : 20, Batches complete :6750
INFO:root:Epoch complete :20, Computing Accuracy
INFO:root:Epochs completed : 20 Test Accuracy: 0.9097368421052632, Test Loss: 0.26601699739694595
INFO:root:Epochs completed : 20 Test Accuracy: 0.9218421052631579, Test Loss: 0.4835072638455215
INFO:root:Epoch : 21, Batches complete :0
INFO:root:Epoch : 21, Batches complete :750
INFO:root:Epoch : 21, Batches complete :1500
Expand All @@ -281,7 +288,7 @@ INFO:root:Epoch : 21, Batches complete :5250
INFO:root:Epoch : 21, Batches complete :6000
INFO:root:Epoch : 21, Batches complete :6750
INFO:root:Epoch complete :21, Computing Accuracy
INFO:root:Epochs completed : 21 Test Accuracy: 0.9097368421052632, Test Loss: 0.2660171613097191
INFO:root:Epochs completed : 21 Test Accuracy: 0.9218421052631579, Test Loss: 0.48350725740763206
INFO:root:Epoch : 22, Batches complete :0
INFO:root:Epoch : 22, Batches complete :750
INFO:root:Epoch : 22, Batches complete :1500
Expand All @@ -293,7 +300,7 @@ INFO:root:Epoch : 22, Batches complete :5250
INFO:root:Epoch : 22, Batches complete :6000
INFO:root:Epoch : 22, Batches complete :6750
INFO:root:Epoch complete :22, Computing Accuracy
INFO:root:Epochs completed : 22 Test Accuracy: 0.9097368421052632, Test Loss: 0.26601725816726685
INFO:root:Epochs completed : 22 Test Accuracy: 0.9218421052631579, Test Loss: 0.48350725701647607
INFO:root:Epoch : 23, Batches complete :0
INFO:root:Epoch : 23, Batches complete :750
INFO:root:Epoch : 23, Batches complete :1500
Expand All @@ -305,7 +312,7 @@ INFO:root:Epoch : 23, Batches complete :5250
INFO:root:Epoch : 23, Batches complete :6000
INFO:root:Epoch : 23, Batches complete :6750
INFO:root:Epoch complete :23, Computing Accuracy
INFO:root:Epochs completed : 23 Test Accuracy: 0.9097368421052632, Test Loss: 0.26601728796958923
INFO:root:Epochs completed : 23 Test Accuracy: 0.9218421052631579, Test Loss: 0.4835072557101737
INFO:root:Epoch : 24, Batches complete :0
INFO:root:Epoch : 24, Batches complete :750
INFO:root:Epoch : 24, Batches complete :1500
Expand All @@ -317,4 +324,4 @@ INFO:root:Epoch : 24, Batches complete :5250
INFO:root:Epoch : 24, Batches complete :6000
INFO:root:Epoch : 24, Batches complete :6750
INFO:root:Epoch complete :24, Computing Accuracy
INFO:root:Epochs completed : 24 Test Accuracy: 0.9097368421052632, Test Loss: 0.266017310321331
INFO:root:Epochs completed : 24 Test Accuracy: 0.9218421052631579, Test Loss: 0.48350725605647904
Loading