from lstm.res import model_tf as lstm
from lstm.fileHandlers import dataset as ds
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
model_res = lstm.epoch_gridsearch(epochs = 100)
WARNING:tensorflow:From C:\Users\livb1\Anaconda3\lib\site-packages\tensorflow\python\ops\init_ops.py:1251: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor WARNING:tensorflow:Large dropout rate: 0.555 (>0.5). In TensorFlow 2.x, dropout() uses dropout rate instead of keep_prob. Please ensure that this is intended. Model: "sequential" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= lstm (LSTM) (None, 64, 665) 2167900 _________________________________________________________________ dropout (Dropout) (None, 64, 665) 0 _________________________________________________________________ lstm_1 (LSTM) (None, 64, 444) 1971360 _________________________________________________________________ dropout_1 (Dropout) (None, 64, 444) 0 _________________________________________________________________ lstm_2 (LSTM) (None, 222) 592296 _________________________________________________________________ dropout_2 (Dropout) (None, 222) 0 _________________________________________________________________ dense (Dense) (None, 8) 1784 ================================================================= Total params: 4,733,340 Trainable params: 4,733,340 Non-trainable params: 0 _________________________________________________________________ Saving model to disk
Model Metrics: Accuracy: 0.797752808988764 Precision: [0.71608833 0.68918919 0.81790123 0.7300885 0.82857143 0.81654676 0.92664093 0.87837838] Recall: [0.76430976 0.68227425 0.88333333 0.75688073 0.60416667 0.8972332 0.86330935 0.86956522] F-Score: [0.73941368 0.68571429 0.84935897 0.74324324 0.69879518 0.85499058 0.89385475 0.87394958] Support: [297 299 300 218 192 253 278 299] 56448/56448 [==============================] - 560s 10ms/sample - loss: 0.0521 - categorical_accuracy: 0.9811 Model Metrics (epoch 1): Accuracy: 0.2157968970380818 Precision: [0. 0.23360656 0.25 0. 0. 0. 0. 0.20514653] Recall: [0. 0.57190635 0.00333333 0. 0. 0. 0. 0.95986622] F-Score: [0. 0.33171678 0.00657895 0. 0. 0. 0. 0.33804476] Model Metrics (epoch 2): Accuracy: 0.23127340823970038 Precision: [0. 0.21052632 0.4229765 0.19615385 0. 0. 0. 0.18792402] Recall: [0. 0.01337793 0.54 0.23394495 0. 0. 0. 0.9264214 ] F-Score: [0. 0.02515723 0.47437775 0.21338912 0. 0. 0. 0.31246475] Model Metrics (epoch 3): Accuracy: 0.28370786516853935 Precision: [0.221875 0.29508197 0.32380952 0.21052632 0. 0. 0. 0.2991851 ] Recall: [0.23905724 0.06020067 0.68 0.25688073 0. 0. 0. 0.85953177] F-Score: [0.23014587 0.1 0.43870968 0.23140496 0. 0. 0. 0.44386874] Model Metrics (epoch 4): Accuracy: 0.28136704119850187 Precision: [0.42857143 0.26728111 0.4924812 0.18950437 0.31578947 0.77777778 0. 0.2509058 ] Recall: [0.01010101 0.19397993 0.43666667 0.29816514 0.3125 0.02766798 0. 0.9264214 ] F-Score: [0.01973684 0.2248062 0.46289753 0.23172906 0.31413613 0.05343511 0. 0.39486814] Model Metrics (epoch 5): Accuracy: 0.39185393258426965 Precision: [0.55329949 0.27842227 0.44520548 0.33714286 0.24747475 0.47337278 0. 0.40389972] Recall: [0.36700337 0.40133779 0.65 0.2706422 0.25520833 0.63241107 0. 0.48494983] F-Score: [0.44129555 0.32876712 0.52845528 0.30025445 0.25128205 0.54145516 0. 0.44072948] Model Metrics (epoch 6): Accuracy: 0.39747191011235955 Precision: [0.36507937 0.43820225 0.48888889 0.31456954 0.2 0.42348008 0. 0.38952164] Recall: [0.54208754 0.13043478 0.58666667 0.43577982 0.02604167 0.79841897 0. 0.57190635] F-Score: [0.43631436 0.20103093 0.53333333 0.36538462 0.04608295 0.55342466 0. 0.46341463] Model Metrics (epoch 7): Accuracy: 0.42743445692883897 Precision: [0.4135514 0.44148936 0.56934307 0.41176471 0.43165468 0.552 0.425 0.33566434] Recall: [0.5959596 0.27759197 0.52 0.19266055 0.3125 0.54545455 0.06115108 0.80267559] F-Score: [0.48827586 0.34086242 0.54355401 0.2625 0.36253776 0.54870775 0.10691824 0.47337278] Model Metrics (epoch 8): Accuracy: 0.49765917602996257 Precision: [0.5335689 0.42361111 0.54572271 0.48571429 0.44654088 0.51381215 0.58015267 0.46867168] Recall: [0.50841751 0.40802676 0.61666667 0.38990826 0.36979167 0.73517787 0.27338129 0.62541806] F-Score: [0.52068966 0.41567291 0.57902973 0.43256997 0.4045584 0.60487805 0.37163814 0.53581662] Model Metrics (epoch 9): Accuracy: 0.577247191011236 Precision: [0.65983607 0.42162162 0.6744186 0.5 0.50515464 0.6 0.78947368 0.57894737] Recall: [0.54208754 0.52173913 0.58 0.51376147 0.51041667 0.69960474 0.48561151 0.73578595] F-Score: [0.59519409 0.46636771 0.62365591 0.50678733 0.50777202 0.6459854 0.6013363 0.64801178] Model Metrics (epoch 10): Accuracy: 0.6081460674157303 Precision: [0.54945055 0.46380697 0.76442308 0.60227273 0.63793103 0.5328084 0.77366255 0.71272727] Recall: [0.67340067 0.57859532 0.53 0.48623853 0.38541667 0.80237154 0.67625899 0.65551839] F-Score: [0.60514372 0.51488095 0.62598425 0.53807107 0.48051948 0.64037855 0.72168906 0.68292683] Model Metrics (epoch 11): Accuracy: 0.5674157303370787 Precision: [0.58885017 0.54356846 0.75555556 0.43278689 0.55900621 0.56140351 0.83687943 0.49287169] Recall: [0.56902357 0.43812709 0.56666667 0.60550459 0.46875 0.63241107 0.42446043 0.80936455] F-Score: [0.57876712 0.48518519 0.64761905 0.50478011 0.50991501 0.59479554 0.56324582 0.61265823] Model Metrics (epoch 12): Accuracy: 0.6563670411985019 Precision: [0.64686469 0.47193878 0.73722628 0.71851852 0.58659218 0.63664596 0.86697248 0.71246006] Recall: [0.65993266 0.6187291 0.67333333 0.44495413 0.546875 0.81027668 0.67985612 0.7458194 ] F-Score: [0.65333333 0.53545586 0.70383275 0.54957507 0.56603774 0.71304348 0.76209677 0.72875817] Model Metrics (epoch 13): Accuracy: 0.6821161048689138 Precision: [0.66778523 0.56382979 0.74433657 0.62631579 0.56221198 0.65780731 0.85232068 0.75496689] Recall: [0.67003367 0.53177258 0.76666667 0.54587156 0.63541667 0.7826087 0.72661871 0.76254181] F-Score: [0.66890756 0.54733219 0.75533662 0.58333333 0.59657702 0.71480144 0.78446602 0.75873544] Model Metrics (epoch 14): Accuracy: 0.6933520599250936 Precision: [0.66211604 0.6023166 0.80859375 0.55183946 0.62303665 0.65116279 0.91826923 0.78671329] Recall: [0.65319865 0.52173913 0.69 0.75688073 0.61979167 0.88537549 0.68705036 0.75250836] F-Score: [0.65762712 0.55913978 0.74460432 0.63829787 0.62140992 0.75041876 0.78600823 0.76923077] Model Metrics (epoch 15): Accuracy: 0.7186329588014981 Precision: [0.71698113 0.67346939 0.73976608 0.64285714 0.66486486 0.64117647 0.85258964 0.8028169 ] Recall: [0.63973064 0.55183946 0.84333333 0.66055046 0.640625 0.86166008 0.76978417 0.76254181] F-Score: [0.67615658 0.60661765 0.78816199 0.65158371 0.65251989 0.73524452 0.80907372 0.78216123] Model Metrics (epoch 16): Accuracy: 0.7340823970037453 Precision: [0.67711599 0.64262295 0.7827476 0.7607362 0.68449198 0.69579288 0.92056075 0.75766871] Recall: [0.72727273 0.65551839 0.81666667 0.56880734 0.66666667 0.84980237 0.70863309 0.82608696] F-Score: [0.7012987 0.64900662 0.79934747 0.65091864 0.67546174 0.76512456 0.80081301 0.7904 ] Model Metrics (epoch 17): Accuracy: 0.7298689138576779 Precision: [0.65676568 0.65017668 0.84230769 0.61153846 0.73584906 0.70226537 0.89669421 0.771875 ] Recall: [0.67003367 0.61538462 0.73 0.7293578 0.609375 0.85770751 0.78057554 0.82608696] F-Score: [0.66333333 0.63230241 0.78214286 0.66527197 0.66666667 0.77224199 0.83461538 0.79806139] Model Metrics (epoch 18): Accuracy: 0.7598314606741573 Precision: [0.6918239 0.6953125 0.78550725 0.70873786 0.75294118 0.69875776 0.90833333 0.84946237] Recall: [0.74074074 0.59531773 0.90333333 0.66972477 0.66666667 0.88932806 0.78417266 0.79264214] F-Score: [0.71544715 0.64144144 0.84031008 0.68867925 0.70718232 0.7826087 0.84169884 0.8200692 ] Model Metrics (epoch 19): Accuracy: 0.7621722846441947 Precision: [0.72693727 0.67615658 0.79179811 0.65086207 0.69312169 0.82509506 0.86594203 0.82084691] Recall: [0.66329966 0.63545151 0.83666667 0.69266055 0.68229167 0.85770751 0.85971223 0.84280936] F-Score: [0.69366197 0.65517241 0.81361426 0.67111111 0.68766404 0.84108527 0.86281588 0.83168317] Model Metrics (epoch 20): Accuracy: 0.7729400749063671 Precision: [0.72354949 0.70566038 0.78654971 0.72192513 0.6875 0.83464567 0.82410423 0.84797297] Recall: [0.71380471 0.62541806 0.89666667 0.61926606 0.6875 0.83794466 0.91007194 0.83946488] F-Score: [0.71864407 0.66312057 0.83800623 0.66666667 0.6875 0.83629191 0.86495726 0.84369748] Model Metrics (epoch 21): Accuracy: 0.7780898876404494 Precision: [0.7184466 0.66869301 0.84262295 0.71291866 0.79861111 0.76013514 0.85517241 0.88976378] Recall: [0.74747475 0.73578595 0.85666667 0.68348624 0.59895833 0.88932806 0.89208633 0.75585284] F-Score: [0.73267327 0.70063694 0.84958678 0.69789227 0.68452381 0.81967213 0.87323944 0.81735986] Model Metrics (epoch 22): Accuracy: 0.7752808988764045 Precision: [0.72945205 0.65359477 0.77101449 0.74619289 0.76821192 0.80597015 0.85121107 0.875 ] Recall: [0.71717172 0.66889632 0.88666667 0.67431193 0.60416667 0.85375494 0.88489209 0.84280936] F-Score: [0.72325976 0.66115702 0.8248062 0.70843373 0.67638484 0.82917466 0.86772487 0.85860307] Model Metrics (epoch 23): Accuracy: 0.774812734082397 Precision: [0.67462687 0.66323024 0.81350482 0.67741935 0.74534161 0.86345382 0.87412587 0.87762238] Recall: [0.76094276 0.64548495 0.84333333 0.67431193 0.625 0.84980237 0.89928058 0.83946488] F-Score: [0.71518987 0.65423729 0.82815057 0.67586207 0.67988669 0.85657371 0.88652482 0.85811966] Model Metrics (epoch 24): Accuracy: 0.7865168539325843 Precision: [0.71028037 0.67391304 0.825 0.77456647 0.76744186 0.79783394 0.91732283 0.84511785] Recall: [0.76767677 0.72575251 0.88 0.6146789 0.6875 0.87351779 0.8381295 0.83946488] F-Score: [0.73786408 0.69887279 0.8516129 0.68542199 0.72527473 0.83396226 0.87593985 0.84228188] Model Metrics (epoch 25): Accuracy: 0.7799625468164794 Precision: [0.7073955 0.66555184 0.90196078 0.68376068 0.71052632 0.82287823 0.85958904 0.87323944] Recall: [0.74074074 0.66555184 0.76666667 0.73394495 0.703125 0.88142292 0.9028777 0.82943144] F-Score: [0.72368421 0.66555184 0.82882883 0.7079646 0.70680628 0.85114504 0.88070175 0.85077187] Model Metrics (epoch 26): Accuracy: 0.7860486891385767 Precision: [0.70382166 0.68707483 0.80733945 0.71219512 0.73652695 0.88429752 0.9037037 0.83596215] Recall: [0.74410774 0.67558528 0.88 0.66972477 0.640625 0.8458498 0.87769784 0.88628763] F-Score: [0.72340426 0.68128162 0.84210526 0.69030733 0.68523677 0.86464646 0.89051095 0.86038961] Model Metrics (epoch 27): Accuracy: 0.7776217228464419 Precision: [0.70642202 0.7254902 0.76744186 0.76842105 0.73888889 0.77972028 0.88846154 0.84353741] Recall: [0.77777778 0.6187291 0.88 0.66972477 0.69270833 0.88142292 0.83093525 0.82943144] F-Score: [0.74038462 0.66787004 0.81987578 0.71568627 0.71505376 0.82745826 0.85873606 0.83642496] Model Metrics (epoch 28): Accuracy: 0.7808988764044944 Precision: [0.74729242 0.67666667 0.80495356 0.69058296 0.7247191 0.82051282 0.88475836 0.86348123] Recall: [0.6969697 0.67892977 0.86666667 0.70642202 0.671875 0.88537549 0.85611511 0.84615385] F-Score: [0.72125436 0.67779633 0.83467095 0.6984127 0.6972973 0.85171103 0.8702011 0.85472973] Model Metrics (epoch 29): Accuracy: 0.7860486891385767 Precision: [0.68343195 0.71311475 0.81388013 0.72197309 0.6984127 0.859375 0.886121 0.88194444] Recall: [0.77777778 0.5819398 0.86 0.73853211 0.6875 0.86956522 0.89568345 0.84949833] F-Score: [0.72755906 0.64088398 0.8363047 0.73015873 0.69291339 0.86444008 0.89087657 0.86541738] Model Metrics (epoch 30): Accuracy: 0.7752808988764045 Precision: [0.66472303 0.64536741 0.81424149 0.77192982 0.79591837 0.79432624 0.89010989 0.86971831] Recall: [0.76767677 0.67558528 0.87666667 0.60550459 0.609375 0.88537549 0.87410072 0.82608696] F-Score: [0.7125 0.66013072 0.84430177 0.67866324 0.69026549 0.83738318 0.88203267 0.84734134] Model Metrics (epoch 31): Accuracy: 0.7874531835205992 Precision: [0.75824176 0.71071429 0.79117647 0.69911504 0.72375691 0.81428571 0.85517241 0.90977444] Recall: [0.6969697 0.66555184 0.89666667 0.72477064 0.68229167 0.90118577 0.89208633 0.80936455] F-Score: [0.72631579 0.68739206 0.840625 0.71171171 0.70241287 0.85553471 0.87323944 0.85663717] Model Metrics (epoch 32): Accuracy: 0.7940074906367042 Precision: [0.78148148 0.68078176 0.79331307 0.69709544 0.82550336 0.83834586 0.86619718 0.87931034] Recall: [0.71043771 0.69899666 0.87 0.7706422 0.640625 0.88142292 0.88489209 0.85284281] F-Score: [0.74426808 0.68976898 0.82988871 0.73202614 0.72140762 0.85934489 0.87544484 0.86587436] Model Metrics (epoch 33): Accuracy: 0.7930711610486891 Precision: [0.72491909 0.70242215 0.8537415 0.71681416 0.77439024 0.83396226 0.8641115 0.85430464] Recall: [0.75420875 0.67892977 0.83666667 0.74311927 0.66145833 0.87351779 0.89208633 0.86287625] F-Score: [0.73927393 0.69047619 0.84511785 0.72972973 0.71348315 0.85328185 0.87787611 0.85856905] Model Metrics (epoch 34): Accuracy: 0.778558052434457 Precision: [0.72852234 0.62395543 0.8537415 0.73267327 0.75949367 0.81343284 0.86120996 0.87632509] Recall: [0.71380471 0.74916388 0.83666667 0.67889908 0.625 0.86166008 0.8705036 0.82943144] F-Score: [0.72108844 0.68085106 0.84511785 0.7047619 0.68571429 0.83685221 0.86583184 0.85223368] Model Metrics (epoch 35): Accuracy: 0.7888576779026217 Precision: [0.72222222 0.6635514 0.86486486 0.73762376 0.7721519 0.82706767 0.85958904 0.85762712] Recall: [0.74410774 0.71237458 0.85333333 0.68348624 0.63541667 0.86956522 0.9028777 0.84615385] F-Score: [0.73300166 0.68709677 0.8590604 0.70952381 0.69714286 0.8477842 0.88070175 0.85185185] Model Metrics (epoch 36): Accuracy: 0.7916666666666666 Precision: [0.73584906 0.71484375 0.78134111 0.75757576 0.76331361 0.83333333 0.87544484 0.85049834] Recall: [0.78787879 0.61204013 0.89333333 0.68807339 0.671875 0.88932806 0.88489209 0.85618729] F-Score: [0.76097561 0.65945946 0.83359253 0.72115385 0.71468144 0.86042065 0.88014311 0.85333333] Model Metrics (epoch 37): Accuracy: 0.8000936329588015 Precision: [0.71165644 0.75665399 0.82352941 0.75 0.78658537 0.86 0.83112583 0.87328767] Recall: [0.78114478 0.66555184 0.88666667 0.74311927 0.671875 0.84980237 0.9028777 0.85284281] F-Score: [0.74478331 0.70818505 0.85393258 0.74654378 0.7247191 0.85487078 0.86551724 0.86294416] Model Metrics (epoch 38): Accuracy: 0.7944756554307116 Precision: [0.71601208 0.63400576 0.86986301 0.74736842 0.79354839 0.83394834 0.89705882 0.9028777 ] Recall: [0.7979798 0.73578595 0.84666667 0.65137615 0.640625 0.89328063 0.87769784 0.83946488] F-Score: [0.75477707 0.68111455 0.85810811 0.69607843 0.70893372 0.86259542 0.88727273 0.87001733] Model Metrics (epoch 39): Accuracy: 0.797752808988764 Precision: [0.73154362 0.7147651 0.8370607 0.69421488 0.81333333 0.82656827 0.91570881 0.85148515] Recall: [0.73400673 0.71237458 0.87333333 0.7706422 0.63541667 0.88537549 0.85971223 0.86287625] F-Score: [0.73277311 0.71356784 0.8548124 0.73043478 0.71345029 0.85496183 0.88682746 0.85714286] Model Metrics (epoch 40): Accuracy: 0.7837078651685393 Precision: [0.71380471 0.75770925 0.7393617 0.72123894 0.77514793 0.83018868 0.88086643 0.84949833] Recall: [0.71380471 0.57525084 0.92666667 0.74770642 0.68229167 0.86956522 0.87769784 0.84949833] F-Score: [0.71380471 0.6539924 0.82248521 0.73423423 0.72576177 0.84942085 0.87927928 0.84949833] Model Metrics (epoch 41): Accuracy: 0.7846441947565543 Precision: [0.76573427 0.64688427 0.79320988 0.72857143 0.79166667 0.77931034 0.90262172 0.89208633] Recall: [0.73737374 0.72909699 0.85666667 0.70183486 0.59375 0.89328063 0.86690647 0.82943144] F-Score: [0.75128645 0.68553459 0.82371795 0.71495327 0.67857143 0.83241252 0.88440367 0.85961872] Model Metrics (epoch 42): Accuracy: 0.7902621722846442 Precision: [0.73941368 0.6838488 0.80864198 0.74752475 0.69354839 0.81338028 0.90530303 0.89928058] Recall: [0.76430976 0.66555184 0.87333333 0.69266055 0.671875 0.91304348 0.85971223 0.8361204 ] F-Score: [0.75165563 0.67457627 0.83974359 0.71904762 0.68253968 0.8603352 0.88191882 0.86655113] Model Metrics (epoch 43): Accuracy: 0.7916666666666666 Precision: [0.68644068 0.73540856 0.77286136 0.74129353 0.775 0.83703704 0.89416058 0.90035587] Recall: [0.81818182 0.63210702 0.87333333 0.68348624 0.64583333 0.89328063 0.88129496 0.84615385] F-Score: [0.74654378 0.67985612 0.8200313 0.71121718 0.70454545 0.86424474 0.88768116 0.87241379] Model Metrics (epoch 44): Accuracy: 0.7897940074906367 Precision: [0.74918567 0.71212121 0.74104683 0.73732719 0.8 0.81884058 0.91119691 0.86206897] Recall: [0.77441077 0.62876254 0.89666667 0.73394495 0.66666667 0.89328063 0.84892086 0.8361204 ] F-Score: [0.7615894 0.6678508 0.81146305 0.73563218 0.72727273 0.85444234 0.87895717 0.84889643] Model Metrics (epoch 45): Accuracy: 0.7916666666666666 Precision: [0.73225806 0.61878453 0.85910653 0.73831776 0.85611511 0.84555985 0.89298893 0.86896552] Recall: [0.76430976 0.74916388 0.83333333 0.72477064 0.61979167 0.86561265 0.8705036 0.84280936] F-Score: [0.74794069 0.67776097 0.84602369 0.73148148 0.71903323 0.85546875 0.88160291 0.85568761] Model Metrics (epoch 46): Accuracy: 0.7902621722846442 Precision: [0.7208589 0.73245614 0.74520548 0.73891626 0.75287356 0.82846715 0.90073529 0.8877551 ] Recall: [0.79124579 0.55852843 0.90666667 0.68807339 0.68229167 0.8972332 0.88129496 0.8729097 ] F-Score: [0.75441413 0.63377609 0.81804511 0.71258907 0.71584699 0.86148008 0.89090909 0.88026981] Model Metrics (epoch 47): Accuracy: 0.7869850187265918 Precision: [0.7173913 0.68531469 0.80707395 0.78021978 0.71502591 0.80645161 0.88929889 0.88013699] Recall: [0.77777778 0.65551839 0.83666667 0.65137615 0.71875 0.88932806 0.86690647 0.85953177] F-Score: [0.74636511 0.67008547 0.82160393 0.71 0.71688312 0.84586466 0.87795993 0.86971235] Model Metrics (epoch 48): Accuracy: 0.7949438202247191 Precision: [0.74757282 0.6877193 0.77391304 0.72072072 0.80392157 0.83088235 0.93333333 0.87118644] Recall: [0.77777778 0.65551839 0.89 0.73394495 0.640625 0.89328063 0.85611511 0.85953177] F-Score: [0.76237624 0.67123288 0.82790698 0.72727273 0.71304348 0.86095238 0.89305816 0.86531987] Model Metrics (epoch 49): Accuracy: 0.798689138576779 Precision: [0.7191358 0.7238806 0.80298507 0.72641509 0.79166667 0.82481752 0.89454545 0.89642857] Recall: [0.78451178 0.64882943 0.89666667 0.70642202 0.69270833 0.89328063 0.88489209 0.83946488] F-Score: [0.75040258 0.68430335 0.84724409 0.71627907 0.73888889 0.85768501 0.88969259 0.86701209] Model Metrics (epoch 50): Accuracy: 0.7897940074906367 Precision: [0.74482759 0.68976898 0.82315113 0.67219917 0.78846154 0.77966102 0.92607004 0.89399293] Recall: [0.72727273 0.69899666 0.85333333 0.74311927 0.640625 0.90909091 0.85611511 0.84615385] F-Score: [0.73594549 0.69435216 0.83797054 0.70588235 0.70689655 0.83941606 0.88971963 0.86941581] Model Metrics (epoch 51): Accuracy: 0.7982209737827716 Precision: [0.7284345 0.65014577 0.83333333 0.74619289 0.84027778 0.8267148 0.90636704 0.90106007] Recall: [0.76767677 0.7458194 0.86666667 0.67431193 0.63020833 0.90513834 0.8705036 0.85284281] F-Score: [0.74754098 0.69470405 0.8496732 0.70843373 0.7202381 0.86415094 0.88807339 0.87628866] Model Metrics (epoch 52): Accuracy: 0.7940074906367042 Precision: [0.76140351 0.6975089 0.81790123 0.70386266 0.69518717 0.84074074 0.8962963 0.89160839] Recall: [0.73063973 0.65551839 0.88333333 0.75229358 0.67708333 0.8972332 0.8705036 0.85284281] F-Score: [0.74570447 0.67586207 0.84935897 0.72727273 0.68601583 0.86806883 0.88321168 0.87179487] Model Metrics (epoch 53): Accuracy: 0.8080524344569289 Precision: [0.73291925 0.70915033 0.8729097 0.76923077 0.79375 0.81818182 0.92941176 0.84565916] Recall: [0.79461279 0.72575251 0.87 0.73394495 0.66145833 0.88932806 0.85251799 0.87959866] F-Score: [0.76252019 0.71735537 0.87145242 0.75117371 0.72159091 0.85227273 0.88930582 0.86229508] Model Metrics (epoch 54): Accuracy: 0.797752808988764 Precision: [0.72155689 0.68881119 0.78362573 0.79473684 0.82517483 0.83955224 0.89454545 0.86577181] Recall: [0.81144781 0.65886288 0.89333333 0.69266055 0.61458333 0.88932806 0.88489209 0.86287625] F-Score: [0.76386688 0.67350427 0.83489097 0.74019608 0.70447761 0.86372361 0.88969259 0.86432161] Model Metrics (epoch 55): Accuracy: 0.8047752808988764 Precision: [0.69616519 0.72280702 0.83333333 0.73364486 0.79268293 0.89112903 0.88380282 0.88965517] Recall: [0.79461279 0.68896321 0.86666667 0.72018349 0.67708333 0.87351779 0.9028777 0.86287625] F-Score: [0.74213836 0.70547945 0.8496732 0.72685185 0.73033708 0.88223553 0.89323843 0.87606112] Model Metrics (epoch 56): Accuracy: 0.8029026217228464 Precision: [0.72151899 0.74603175 0.76944444 0.73873874 0.80379747 0.86486486 0.86868687 0.91544118] Recall: [0.76767677 0.62876254 0.92333333 0.75229358 0.66145833 0.88537549 0.92805755 0.83277592] F-Score: [0.74388254 0.68239564 0.83939394 0.74545455 0.72571429 0.875 0.8973913 0.87215412] Model Metrics (epoch 57): Accuracy: 0.7911985018726592 Precision: [0.6909621 0.67123288 0.84666667 0.77835052 0.70652174 0.84586466 0.89416058 0.89045936] Recall: [0.7979798 0.65551839 0.84666667 0.69266055 0.67708333 0.88932806 0.88129496 0.84280936] F-Score: [0.740625 0.66328257 0.84666667 0.73300971 0.69148936 0.86705202 0.88768116 0.86597938] Model Metrics (epoch 58): Accuracy: 0.8038389513108615 Precision: [0.73333333 0.72426471 0.80645161 0.72294372 0.78343949 0.82310469 0.92619926 0.89198606] Recall: [0.74074074 0.65886288 0.91666667 0.76605505 0.640625 0.90118577 0.9028777 0.85618729] F-Score: [0.73701843 0.69001751 0.85803432 0.74387528 0.70487106 0.86037736 0.9143898 0.87372014] Model Metrics (epoch 59): Accuracy: 0.8014981273408239 Precision: [0.70694864 0.67912773 0.87323944 0.75376884 0.79268293 0.84758364 0.91538462 0.86363636] Recall: [0.78787879 0.72909699 0.82666667 0.68807339 0.67708333 0.90118577 0.85611511 0.88963211] F-Score: [0.74522293 0.70322581 0.84931507 0.71942446 0.73033708 0.87356322 0.88475836 0.87644152] Model Metrics (epoch 60): Accuracy: 0.7921348314606742 Precision: [0.73898305 0.73484848 0.79341317 0.73239437 0.71282051 0.81949458 0.86879433 0.89855072] Recall: [0.73400673 0.64882943 0.88333333 0.71559633 0.72395833 0.8972332 0.88129496 0.82943144] F-Score: [0.73648649 0.68916519 0.83596215 0.72389791 0.71834625 0.85660377 0.875 0.8626087 ] Model Metrics (epoch 61): Accuracy: 0.8038389513108615 Precision: [0.71692308 0.68608414 0.8627451 0.76649746 0.81208054 0.82142857 0.90145985 0.875 ] Recall: [0.78451178 0.7090301 0.88 0.69266055 0.63020833 0.90909091 0.88848921 0.86622074] F-Score: [0.74919614 0.69736842 0.87128713 0.72771084 0.70967742 0.8630394 0.89492754 0.87058824] Model Metrics (epoch 62): Accuracy: 0.8000936329588015 Precision: [0.71515152 0.70408163 0.80804954 0.77083333 0.78616352 0.82857143 0.90217391 0.89007092] Recall: [0.79461279 0.69230769 0.87 0.67889908 0.65104167 0.91699605 0.89568345 0.83946488] F-Score: [0.75279107 0.69814503 0.83788122 0.72195122 0.71225071 0.87054409 0.89891697 0.86402754] Model Metrics (epoch 63): Accuracy: 0.799625468164794 Precision: [0.75342466 0.67823344 0.81677019 0.73853211 0.7654321 0.84410646 0.91791045 0.87414966] Recall: [0.74074074 0.71906355 0.87666667 0.73853211 0.64583333 0.87747036 0.88489209 0.85953177] F-Score: [0.74702886 0.69805195 0.84565916 0.73853211 0.70056497 0.86046512 0.9010989 0.86677909] Model Metrics (epoch 64): Accuracy: 0.7940074906367042 Precision: [0.73684211 0.74561404 0.73854447 0.74193548 0.73913043 0.82562278 0.91044776 0.90106007] Recall: [0.75420875 0.56856187 0.91333333 0.73853211 0.70833333 0.91699605 0.87769784 0.85284281] F-Score: [0.74542429 0.64516129 0.81669151 0.74022989 0.72340426 0.86891386 0.89377289 0.87628866] Model Metrics (epoch 65): Accuracy: 0.7954119850187266 Precision: [0.72468354 0.65349544 0.84589041 0.8 0.71808511 0.85877863 0.9141791 0.85947712] Recall: [0.77104377 0.71906355 0.82333333 0.64220183 0.703125 0.88932806 0.88129496 0.87959866] F-Score: [0.74714519 0.68471338 0.83445946 0.71246819 0.71052632 0.87378641 0.8974359 0.86942149] Model Metrics (epoch 66): Accuracy: 0.798689138576779 Precision: [0.71246006 0.70671378 0.83280757 0.6872428 0.79375 0.86206897 0.92720307 0.86577181] Recall: [0.75084175 0.66889632 0.88 0.76605505 0.66145833 0.88932806 0.8705036 0.86287625] F-Score: [0.73114754 0.68728522 0.85575365 0.72451193 0.72159091 0.87548638 0.89795918 0.86432161] Model Metrics (epoch 67): Accuracy: 0.7963483146067416 Precision: [0.75 0.66049383 0.80368098 0.7989418 0.76969697 0.83712121 0.91320755 0.85478548] Recall: [0.75757576 0.71571906 0.87333333 0.69266055 0.66145833 0.87351779 0.8705036 0.86622074] F-Score: [0.75376884 0.68699839 0.8370607 0.74201474 0.71148459 0.8549323 0.89134438 0.86046512] Model Metrics (epoch 68): Accuracy: 0.7897940074906367 Precision: [0.69230769 0.70955882 0.79692308 0.79775281 0.75690608 0.8125 0.92015209 0.84364821] Recall: [0.78787879 0.64548495 0.86333333 0.65137615 0.71354167 0.87351779 0.8705036 0.86622074] F-Score: [0.73700787 0.67600701 0.8288 0.71717172 0.73458445 0.84190476 0.89463956 0.85478548] Model Metrics (epoch 69): Accuracy: 0.798689138576779 Precision: [0.69827586 0.69155844 0.82484076 0.80116959 0.80769231 0.84790875 0.88530466 0.86868687] Recall: [0.81818182 0.71237458 0.86333333 0.62844037 0.65625 0.88142292 0.88848921 0.86287625] F-Score: [0.75348837 0.70181219 0.84364821 0.70437018 0.72413793 0.86434109 0.88689408 0.86577181] Model Metrics (epoch 70): Accuracy: 0.7968164794007491 Precision: [0.71962617 0.77542373 0.7740113 0.76683938 0.69387755 0.80565371 0.89568345 0.92 ] Recall: [0.77777778 0.61204013 0.91333333 0.67889908 0.70833333 0.90118577 0.89568345 0.84615385] F-Score: [0.74757282 0.68411215 0.83792049 0.72019465 0.70103093 0.85074627 0.89568345 0.8815331 ] Model Metrics (epoch 71): Accuracy: 0.7911985018726592 Precision: [0.70426829 0.71272727 0.83946488 0.72685185 0.68341709 0.82733813 0.91891892 0.89007092] Recall: [0.77777778 0.65551839 0.83666667 0.72018349 0.70833333 0.90909091 0.85611511 0.83946488] F-Score: [0.7392 0.68292683 0.83806344 0.7235023 0.69565217 0.86629002 0.88640596 0.86402754] Model Metrics (epoch 72): Accuracy: 0.8029026217228464 Precision: [0.71052632 0.69932432 0.87586207 0.79487179 0.76744186 0.78571429 0.91764706 0.8869863 ] Recall: [0.81818182 0.69230769 0.84666667 0.71100917 0.6875 0.91304348 0.84172662 0.86622074] F-Score: [0.76056338 0.69579832 0.86101695 0.75060533 0.72527473 0.84460695 0.87804878 0.87648054] Model Metrics (epoch 73): Accuracy: 0.8029026217228464 Precision: [0.75 0.73021583 0.79178886 0.75233645 0.80368098 0.85338346 0.83946488 0.89818182] Recall: [0.75757576 0.67892977 0.9 0.73853211 0.68229167 0.8972332 0.9028777 0.82608696] F-Score: [0.75376884 0.70363951 0.8424337 0.74537037 0.73802817 0.87475915 0.87001733 0.86062718] Model Metrics (epoch 74): Accuracy: 0.8000936329588015 Precision: [0.73927393 0.73646209 0.7632312 0.75242718 0.84172662 0.80136986 0.88297872 0.90647482] Recall: [0.75420875 0.68227425 0.91333333 0.71100917 0.609375 0.92490119 0.89568345 0.84280936] F-Score: [0.74666667 0.70833333 0.83156297 0.73113208 0.70694864 0.8587156 0.88928571 0.87348354] Model Metrics (epoch 75): Accuracy: 0.7963483146067416 Precision: [0.74840764 0.66561514 0.82747604 0.78238342 0.79084967 0.7781457 0.87142857 0.9280303 ] Recall: [0.79124579 0.70568562 0.86333333 0.69266055 0.63020833 0.92885375 0.87769784 0.81939799] F-Score: [0.76923077 0.68506494 0.84502447 0.73479319 0.70144928 0.84684685 0.87455197 0.87033748] Model Metrics (epoch 76): Accuracy: 0.799625468164794 Precision: [0.72615385 0.69337979 0.81402439 0.74654378 0.7972028 0.86538462 0.88530466 0.86868687] Recall: [0.79461279 0.66555184 0.89 0.74311927 0.59375 0.88932806 0.88848921 0.86287625] F-Score: [0.75884244 0.67918089 0.85031847 0.74482759 0.68059701 0.87719298 0.88689408 0.86577181] Model Metrics (epoch 77): Accuracy: 0.798689138576779 Precision: [0.70897833 0.68338558 0.88380282 0.73809524 0.75581395 0.86206897 0.89962825 0.8590604 ] Recall: [0.77104377 0.72909699 0.83666667 0.71100917 0.67708333 0.88932806 0.8705036 0.85618729] F-Score: [0.73870968 0.70550162 0.85958904 0.72429907 0.71428571 0.87548638 0.88482633 0.85762144] Model Metrics (epoch 78): Accuracy: 0.7982209737827716 Precision: [0.74285714 0.68421053 0.81372549 0.77272727 0.7393617 0.83754513 0.86 0.917603 ] Recall: [0.78787879 0.65217391 0.83 0.70183486 0.72395833 0.91699605 0.92805755 0.81939799] F-Score: [0.76470588 0.66780822 0.82178218 0.73557692 0.73157895 0.8754717 0.89273356 0.86572438] Model Metrics (epoch 79): Accuracy: 0.8043071161048689 Precision: [0.72981366 0.76095618 0.78425656 0.76303318 0.75418994 0.84191176 0.87543253 0.91078067] Recall: [0.79124579 0.63879599 0.89666667 0.73853211 0.703125 0.90513834 0.91007194 0.81939799] F-Score: [0.75928918 0.69454545 0.83670295 0.75058275 0.7277628 0.87238095 0.89241623 0.86267606] Model Metrics (epoch 80): Accuracy: 0.7954119850187266 Precision: [0.75261324 0.73207547 0.80060423 0.69915254 0.72043011 0.85283019 0.88768116 0.87586207] Recall: [0.72727273 0.64882943 0.88333333 0.75688073 0.69791667 0.89328063 0.88129496 0.84949833] F-Score: [0.73972603 0.68794326 0.83993661 0.72687225 0.70899471 0.87258687 0.88447653 0.86247878] Model Metrics (epoch 81): Accuracy: 0.802434456928839 Precision: [0.69590643 0.73722628 0.79411765 0.76842105 0.8 0.83272727 0.91698113 0.88965517] Recall: [0.8013468 0.67558528 0.9 0.66972477 0.66666667 0.90513834 0.87410072 0.86287625] F-Score: [0.74491393 0.70506108 0.84375 0.71568627 0.72727273 0.86742424 0.89502762 0.87606112] Model Metrics (epoch 82): Accuracy: 0.8052434456928839 Precision: [0.71385542 0.68910256 0.84590164 0.76442308 0.80952381 0.84615385 0.92075472 0.87414966] Recall: [0.7979798 0.71906355 0.86 0.7293578 0.61979167 0.91304348 0.87769784 0.85953177] F-Score: [0.75357711 0.70376432 0.85289256 0.74647887 0.7020649 0.878327 0.89871087 0.86677909] Model Metrics (epoch 83): Accuracy: 0.800561797752809 Precision: [0.73538462 0.65060241 0.86241611 0.81318681 0.76023392 0.8 0.92248062 0.89122807] Recall: [0.8047138 0.72240803 0.85666667 0.67889908 0.67708333 0.90118577 0.85611511 0.84949833] F-Score: [0.76848875 0.68462758 0.85953177 0.74 0.71625344 0.84758364 0.8880597 0.86986301] Model Metrics (epoch 84): Accuracy: 0.8066479400749064 Precision: [0.71301775 0.70333333 0.82043344 0.80555556 0.8410596 0.81588448 0.91729323 0.87707641] Recall: [0.81144781 0.70568562 0.88333333 0.66513761 0.66145833 0.89328063 0.87769784 0.88294314] F-Score: [0.75905512 0.70450751 0.85072231 0.72864322 0.74052478 0.85283019 0.89705882 0.88 ] Model Metrics (epoch 85): Accuracy: 0.8043071161048689 Precision: [0.71260997 0.70689655 0.83174603 0.76142132 0.77575758 0.82105263 0.92164179 0.90545455] Recall: [0.81818182 0.68561873 0.87333333 0.68807339 0.66666667 0.92490119 0.88848921 0.83277592] F-Score: [0.76175549 0.69609508 0.85203252 0.72289157 0.71708683 0.86988848 0.9047619 0.86759582] Model Metrics (epoch 86): Accuracy: 0.7921348314606742 Precision: [0.77205882 0.72941176 0.76589595 0.72444444 0.69117647 0.82142857 0.90671642 0.88811189] Recall: [0.70707071 0.62207358 0.88333333 0.74770642 0.734375 0.90909091 0.87410072 0.84949833] F-Score: [0.73813708 0.67148014 0.82043344 0.73589165 0.71212121 0.8630394 0.89010989 0.86837607] Model Metrics (epoch 87): Accuracy: 0.802434456928839 Precision: [0.78091873 0.74444444 0.8030303 0.70815451 0.7037037 0.83636364 0.91078067 0.88501742] Recall: [0.74410774 0.6722408 0.88333333 0.75688073 0.69270833 0.90909091 0.88129496 0.84949833] F-Score: [0.76206897 0.70650264 0.84126984 0.73170732 0.69816273 0.87121212 0.89579525 0.8668942 ] Model Metrics (epoch 88): Accuracy: 0.7926029962546817 Precision: [0.73972603 0.67109635 0.85714286 0.70247934 0.73446328 0.83512545 0.88447653 0.89323843] Recall: [0.72727273 0.67558528 0.82 0.77981651 0.67708333 0.92094862 0.88129496 0.83946488] F-Score: [0.73344652 0.67333333 0.83816014 0.73913043 0.70460705 0.87593985 0.88288288 0.86551724] Model Metrics (epoch 89): Accuracy: 0.7935393258426966 Precision: [0.68011527 0.73151751 0.82484076 0.69709544 0.84090909 0.81468531 0.87197232 0.91851852] Recall: [0.79461279 0.62876254 0.86333333 0.7706422 0.578125 0.92094862 0.90647482 0.82943144] F-Score: [0.73291925 0.67625899 0.84364821 0.73202614 0.68518519 0.86456401 0.88888889 0.87170475] Model Metrics (epoch 90): Accuracy: 0.8014981273408239 Precision: [0.77083333 0.671875 0.82153846 0.78756477 0.72625698 0.80902778 0.93333333 0.88541667] Recall: [0.74747475 0.71906355 0.89 0.69724771 0.67708333 0.92094862 0.85611511 0.85284281] F-Score: [0.75897436 0.69466882 0.8544 0.73965937 0.70080863 0.86136784 0.89305816 0.86882453] Model Metrics (epoch 91): Accuracy: 0.7968164794007491 Precision: [0.73202614 0.72377622 0.8496732 0.74178404 0.71666667 0.7704918 0.89219331 0.91881919] Recall: [0.75420875 0.69230769 0.86666667 0.72477064 0.671875 0.92885375 0.86330935 0.83277592] F-Score: [0.74295191 0.70769231 0.85808581 0.73317865 0.69354839 0.84229391 0.87751371 0.87368421] Model Metrics (epoch 92): Accuracy: 0.8014981273408239 Precision: [0.72136223 0.69407895 0.84437086 0.7755102 0.75144509 0.81625442 0.90181818 0.9 ] Recall: [0.78451178 0.70568562 0.85 0.69724771 0.67708333 0.91304348 0.89208633 0.84280936] F-Score: [0.7516129 0.69983416 0.84717608 0.73429952 0.71232877 0.8619403 0.89692586 0.87046632] Model Metrics (epoch 93): Accuracy: 0.802434456928839 Precision: [0.7120743 0.71331058 0.79239766 0.72321429 0.8671875 0.85714286 0.90145985 0.8951049 ] Recall: [0.77441077 0.69899666 0.90333333 0.74311927 0.578125 0.90118577 0.88848921 0.85618729] F-Score: [0.74193548 0.70608108 0.84423676 0.73303167 0.69375 0.87861272 0.89492754 0.87521368] Model Metrics (epoch 94): Accuracy: 0.795880149812734 Precision: [0.7414966 0.66346154 0.8006135 0.77894737 0.71657754 0.876 0.91881919 0.8627451 ] Recall: [0.73400673 0.69230769 0.87 0.67889908 0.69791667 0.86561265 0.89568345 0.88294314] F-Score: [0.73773266 0.67757774 0.83386581 0.7254902 0.70712401 0.87077535 0.90710383 0.87272727] Model Metrics (epoch 95): Accuracy: 0.7935393258426966 Precision: [0.76653696 0.69520548 0.78698225 0.6539924 0.78846154 0.85658915 0.90909091 0.88552189] Recall: [0.66329966 0.67892977 0.88666667 0.78899083 0.640625 0.87351779 0.89928058 0.87959866] F-Score: [0.71119134 0.68697124 0.8338558 0.71517672 0.70689655 0.86497065 0.90415913 0.88255034] Model Metrics (epoch 96): Accuracy: 0.7982209737827716 Precision: [0.77859779 0.69256757 0.78338279 0.71748879 0.75 0.81428571 0.91512915 0.91134752] Recall: [0.71043771 0.68561873 0.88 0.73394495 0.6875 0.90118577 0.89208633 0.85953177] F-Score: [0.74295775 0.68907563 0.8288854 0.72562358 0.7173913 0.85553471 0.90346084 0.88468158] Model Metrics (epoch 97): Accuracy: 0.7926029962546817 Precision: [0.70461538 0.72972973 0.77207977 0.68965517 0.79452055 0.85606061 0.90145985 0.89473684] Recall: [0.77104377 0.63210702 0.90333333 0.73394495 0.60416667 0.89328063 0.88848921 0.85284281] F-Score: [0.73633441 0.67741935 0.83256528 0.71111111 0.68639053 0.87427466 0.89492754 0.87328767] Model Metrics (epoch 98): Accuracy: 0.7907303370786517 Precision: [0.69164265 0.6466877 0.8615917 0.73762376 0.80405405 0.86328125 0.9010989 0.85526316] Recall: [0.80808081 0.68561873 0.83 0.68348624 0.61979167 0.87351779 0.88489209 0.86956522] F-Score: [0.74534161 0.66558442 0.84550085 0.70952381 0.7 0.86836935 0.89292196 0.86235489] Model Metrics (epoch 99): Accuracy: 0.8033707865168539 Precision: [0.70710059 0.68690096 0.79279279 0.78571429 0.88321168 0.88235294 0.86971831 0.89115646] Recall: [0.8047138 0.71906355 0.88 0.6559633 0.63020833 0.88932806 0.88848921 0.87625418] F-Score: [0.75275591 0.70261438 0.83412322 0.715 0.73556231 0.88582677 0.87900356 0.8836425 ] Model Metrics (epoch 100): Accuracy: 0.797752808988764 Precision: [0.71608833 0.68918919 0.81790123 0.7300885 0.82857143 0.81654676 0.92664093 0.87837838] Recall: [0.76430976 0.68227425 0.88333333 0.75688073 0.60416667 0.8972332 0.86330935 0.86956522] F-Score: [0.73941368 0.68571429 0.84935897 0.74324324 0.69879518 0.85499058 0.89385475 0.87394958] Saving model to disk
accuracies, precisions, recalls, fscores = model_res
avgprecisions = [np.mean(x) for x in precisions]
avgrecalls = [np.mean(x) for x in recalls]
avgfscores = [np.mean(x) for x in fscores]
evaluations = list(zip(accuracies, avgprecisions, avgrecalls, avgfscores))
eval_df = pd.DataFrame(evaluations, columns = ["accuracy", "avg_precision", "avg_recalls", "avg_fscore"])
display(eval_df)
eval_df.to_csv('8_16_classified.csv', index=False)
accuracy | avg_precision | avg_recalls | avg_fscore | |
---|---|---|---|---|
0 | 0.215797 | 0.086094 | 0.191888 | 0.084543 |
1 | 0.231273 | 0.127198 | 0.214218 | 0.128174 |
2 | 0.283708 | 0.168810 | 0.261959 | 0.180516 |
3 | 0.281367 | 0.340289 | 0.275688 | 0.212701 |
4 | 0.391854 | 0.342352 | 0.382694 | 0.354030 |
... | ... | ... | ... | ... |
95 | 0.798221 | 0.795350 | 0.793788 | 0.793451 |
96 | 0.792603 | 0.792857 | 0.784901 | 0.785789 |
97 | 0.790730 | 0.795155 | 0.781869 | 0.786200 |
98 | 0.803371 | 0.812369 | 0.793003 | 0.798566 |
99 | 0.797753 | 0.800426 | 0.790134 | 0.792415 |
100 rows × 4 columns
plt.figure()
eval_df.plot(figsize = (15,10))
<matplotlib.axes._subplots.AxesSubplot at 0x181eebc3ef0>
<Figure size 432x288 with 0 Axes>
print("Epoch max fscore:", avgfscores.index(max(avgfscores)))
print(lstm.check_all_test("testMids")
Epoch max fscore: 52
Test Accuracy : 0.803152