├── README.md ├── TF_IDF_and_Count_Vectorizer.ipynb ├── Custom_Named_Entity_Recognizer.ipynb └── Text_classification_Tensorflow_Multiclass.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # Natural-Language-Processing 2 | This repository host code of my NLP playlist here - https://www.youtube.com/playlist?list=PL3N9eeOlCrP6zMkHMxFJV4yXIsET5aWlc 3 | -------------------------------------------------------------------------------- /TF_IDF_and_Count_Vectorizer.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "TF IDF and Count Vectorizer.ipynb", 7 | "provenance": [], 8 | "authorship_tag": "ABX9TyOn0Ys/826N+yamkhts4yoO", 9 | "include_colab_link": true 10 | }, 11 | "kernelspec": { 12 | "name": "python3", 13 | "display_name": "Python 3" 14 | } 15 | }, 16 | "cells": [ 17 | { 18 | "cell_type": "markdown", 19 | "metadata": { 20 | "id": "view-in-github", 21 | "colab_type": "text" 22 | }, 23 | "source": [ 24 | "\"Open" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "metadata": { 30 | "id": "3Tib-VoNf3SU", 31 | "colab_type": "code", 32 | "colab": {} 33 | }, 34 | "source": [ 35 | "from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer\n", 36 | "import numpy as np" 37 | ], 38 | "execution_count": null, 39 | "outputs": [] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "metadata": { 44 | "id": "WShP9UhDdqqz", 45 | "colab_type": "code", 46 | "colab": {} 47 | }, 48 | "source": [ 49 | "sentences=['I have a credit card account','My account card, debit card is lost','My credit card stopped working']" 50 | ], 51 | "execution_count": null, 52 | "outputs": [] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "metadata": { 57 | "id": "bWwAqyZubjXg", 58 | "colab_type": "code", 59 | "colab": {} 60 | }, 61 | "source": [ 62 | "vectorizer=CountVectorizer()\n", 63 | "countvec=vectorizer.fit_transform(sentences)" 64 | ], 65 | "execution_count": null, 66 | "outputs": [] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "metadata": { 71 | "id": "gidCFkK2bjUm", 72 | "colab_type": "code", 73 | "colab": { 74 | "base_uri": "https://localhost:8080/", 75 | "height": 71 76 | }, 77 | "outputId": "b722a8a3-9b0e-40f5-bf89-5eb5a4f9e1e0" 78 | }, 79 | "source": [ 80 | "countvec.A" 81 | ], 82 | "execution_count": null, 83 | "outputs": [ 84 | { 85 | "output_type": "execute_result", 86 | "data": { 87 | "text/plain": [ 88 | "array([[1, 1, 1, 0, 1, 0, 0, 0, 0, 0],\n", 89 | " [1, 2, 0, 1, 0, 1, 1, 1, 0, 0],\n", 90 | " [0, 1, 1, 0, 0, 0, 0, 1, 1, 1]])" 91 | ] 92 | }, 93 | "metadata": { 94 | "tags": [] 95 | }, 96 | "execution_count": 4 97 | } 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "metadata": { 103 | "id": "IfQXzKR8bjRY", 104 | "colab_type": "code", 105 | "colab": { 106 | "base_uri": "https://localhost:8080/", 107 | "height": 196 108 | }, 109 | "outputId": "2615baa2-635f-4b5b-947d-98e9be758267" 110 | }, 111 | "source": [ 112 | "vectorizer.get_feature_names()" 113 | ], 114 | "execution_count": null, 115 | "outputs": [ 116 | { 117 | "output_type": "execute_result", 118 | "data": { 119 | "text/plain": [ 120 | "['account',\n", 121 | " 'card',\n", 122 | " 'credit',\n", 123 | " 'debit',\n", 124 | " 'have',\n", 125 | " 'is',\n", 126 | " 'lost',\n", 127 | " 'my',\n", 128 | " 'stopped',\n", 129 | " 'working']" 130 | ] 131 | }, 132 | "metadata": { 133 | "tags": [] 134 | }, 135 | "execution_count": 5 136 | } 137 | ] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "metadata": { 142 | "id": "0HX9sTs-jGv-", 143 | "colab_type": "code", 144 | "colab": {} 145 | }, 146 | "source": [ 147 | "vectorizer=CountVectorizer(max_features=4)\n", 148 | "countvec=vectorizer.fit_transform(sentences)" 149 | ], 150 | "execution_count": null, 151 | "outputs": [] 152 | }, 153 | { 154 | "cell_type": "code", 155 | "metadata": { 156 | "id": "n0dnuMHijISd", 157 | "colab_type": "code", 158 | "colab": { 159 | "base_uri": "https://localhost:8080/", 160 | "height": 88 161 | }, 162 | "outputId": "f67abf47-7193-4f20-b57b-e0883635e80c" 163 | }, 164 | "source": [ 165 | "print(countvec.A)\n", 166 | "print(vectorizer.get_feature_names())" 167 | ], 168 | "execution_count": null, 169 | "outputs": [ 170 | { 171 | "output_type": "stream", 172 | "text": [ 173 | "[[1 1 1 0]\n", 174 | " [1 2 0 1]\n", 175 | " [0 1 1 1]]\n", 176 | "['account', 'card', 'credit', 'my']\n" 177 | ], 178 | "name": "stdout" 179 | } 180 | ] 181 | }, 182 | { 183 | "cell_type": "code", 184 | "metadata": { 185 | "id": "qeGcIJgHc-rG", 186 | "colab_type": "code", 187 | "colab": {} 188 | }, 189 | "source": [ 190 | "vectorizer=CountVectorizer(max_features=4, stop_words='english')\n", 191 | "countvec=vectorizer.fit_transform(sentences)" 192 | ], 193 | "execution_count": null, 194 | "outputs": [] 195 | }, 196 | { 197 | "cell_type": "code", 198 | "metadata": { 199 | "id": "oMprZNb6c-oo", 200 | "colab_type": "code", 201 | "colab": { 202 | "base_uri": "https://localhost:8080/", 203 | "height": 88 204 | }, 205 | "outputId": "a9c7b5ce-302f-4c62-fcd1-62b32062cff5" 206 | }, 207 | "source": [ 208 | "print(countvec.A)\n", 209 | "print(vectorizer.get_feature_names())" 210 | ], 211 | "execution_count": null, 212 | "outputs": [ 213 | { 214 | "output_type": "stream", 215 | "text": [ 216 | "[[1 1 1 0]\n", 217 | " [1 2 0 1]\n", 218 | " [0 1 1 0]]\n", 219 | "['account', 'card', 'credit', 'debit']\n" 220 | ], 221 | "name": "stdout" 222 | } 223 | ] 224 | }, 225 | { 226 | "cell_type": "code", 227 | "metadata": { 228 | "id": "vJOj7ucXbjIg", 229 | "colab_type": "code", 230 | "colab": {} 231 | }, 232 | "source": [ 233 | "vectorizer=CountVectorizer(max_features=6, ngram_range=(1,2))\n", 234 | "countvec=vectorizer.fit_transform(sentences)" 235 | ], 236 | "execution_count": null, 237 | "outputs": [] 238 | }, 239 | { 240 | "cell_type": "code", 241 | "metadata": { 242 | "id": "9VFcQsvKc-uy", 243 | "colab_type": "code", 244 | "colab": { 245 | "base_uri": "https://localhost:8080/", 246 | "height": 88 247 | }, 248 | "outputId": "5998c84a-304f-44d8-c4de-29681cbe0a07" 249 | }, 250 | "source": [ 251 | "print(countvec.A)\n", 252 | "print(vectorizer.get_feature_names())" 253 | ], 254 | "execution_count": null, 255 | "outputs": [ 256 | { 257 | "output_type": "stream", 258 | "text": [ 259 | "[[1 1 1 1 0 0]\n", 260 | " [1 2 0 0 1 0]\n", 261 | " [0 1 1 1 1 1]]\n", 262 | "['account', 'card', 'credit', 'credit card', 'my', 'stopped']\n" 263 | ], 264 | "name": "stdout" 265 | } 266 | ] 267 | }, 268 | { 269 | "cell_type": "markdown", 270 | "metadata": { 271 | "id": "wKy15maGfXIJ", 272 | "colab_type": "text" 273 | }, 274 | "source": [ 275 | "TF = (# occurrences of term t in document) / (# of words in document)\n" 276 | ] 277 | }, 278 | { 279 | "cell_type": "code", 280 | "metadata": { 281 | "id": "tqjK7ppXc-kp", 282 | "colab_type": "code", 283 | "colab": {} 284 | }, 285 | "source": [ 286 | "vectorizer=TfidfVectorizer(use_idf=False, norm='l1')\n", 287 | "tfvec=vectorizer.fit_transform(sentences)" 288 | ], 289 | "execution_count": null, 290 | "outputs": [] 291 | }, 292 | { 293 | "cell_type": "code", 294 | "metadata": { 295 | "id": "hpgLWhqodzOq", 296 | "colab_type": "code", 297 | "colab": { 298 | "base_uri": "https://localhost:8080/", 299 | "height": 142 300 | }, 301 | "outputId": "eff13d46-7ca5-4ee5-ec5a-d2b856ce0bdd" 302 | }, 303 | "source": [ 304 | "print(tfvec.A)\n", 305 | "print(vectorizer.get_feature_names())" 306 | ], 307 | "execution_count": null, 308 | "outputs": [ 309 | { 310 | "output_type": "stream", 311 | "text": [ 312 | "[[0.25 0.25 0.25 0. 0.25 0.\n", 313 | " 0. 0. 0. 0. ]\n", 314 | " [0.14285714 0.28571429 0. 0.14285714 0. 0.14285714\n", 315 | " 0.14285714 0.14285714 0. 0. ]\n", 316 | " [0. 0.2 0.2 0. 0. 0.\n", 317 | " 0. 0.2 0.2 0.2 ]]\n", 318 | "['account', 'card', 'credit', 'debit', 'have', 'is', 'lost', 'my', 'stopped', 'working']\n" 319 | ], 320 | "name": "stdout" 321 | } 322 | ] 323 | }, 324 | { 325 | "cell_type": "markdown", 326 | "metadata": { 327 | "id": "6DGVPbtbh097", 328 | "colab_type": "text" 329 | }, 330 | "source": [ 331 | "sentences=['I have a credit card account','My card, debit card account','My credit card is not working']" 332 | ] 333 | }, 334 | { 335 | "cell_type": "code", 336 | "metadata": { 337 | "id": "wERaF8RodzLj", 338 | "colab_type": "code", 339 | "colab": {} 340 | }, 341 | "source": [ 342 | "vectorizer=TfidfVectorizer(use_idf=False, norm='l2')\n", 343 | "tfvec=vectorizer.fit_transform(sentences)" 344 | ], 345 | "execution_count": null, 346 | "outputs": [] 347 | }, 348 | { 349 | "cell_type": "code", 350 | "metadata": { 351 | "id": "vfUA6DledzIr", 352 | "colab_type": "code", 353 | "colab": { 354 | "base_uri": "https://localhost:8080/", 355 | "height": 142 356 | }, 357 | "outputId": "6dc691d7-ba7d-4891-e41d-a7ab3649ce3c" 358 | }, 359 | "source": [ 360 | "print(tfvec.A)\n", 361 | "print(vectorizer.get_feature_names())" 362 | ], 363 | "execution_count": null, 364 | "outputs": [ 365 | { 366 | "output_type": "stream", 367 | "text": [ 368 | "[[0.5 0.5 0.5 0. 0.5 0.\n", 369 | " 0. 0. 0. 0. ]\n", 370 | " [0.33333333 0.66666667 0. 0.33333333 0. 0.33333333\n", 371 | " 0.33333333 0.33333333 0. 0. ]\n", 372 | " [0. 0.4472136 0.4472136 0. 0. 0.\n", 373 | " 0. 0.4472136 0.4472136 0.4472136 ]]\n", 374 | "['account', 'card', 'credit', 'debit', 'have', 'is', 'lost', 'my', 'stopped', 'working']\n" 375 | ], 376 | "name": "stdout" 377 | } 378 | ] 379 | }, 380 | { 381 | "cell_type": "code", 382 | "metadata": { 383 | "id": "F0R2lhAVdzGK", 384 | "colab_type": "code", 385 | "colab": { 386 | "base_uri": "https://localhost:8080/", 387 | "height": 35 388 | }, 389 | "outputId": "c267aa06-d313-4a35-d989-60ca623fa99c" 390 | }, 391 | "source": [ 392 | "print(2/np.sqrt(9))" 393 | ], 394 | "execution_count": null, 395 | "outputs": [ 396 | { 397 | "output_type": "stream", 398 | "text": [ 399 | "0.6666666666666666\n" 400 | ], 401 | "name": "stdout" 402 | } 403 | ] 404 | }, 405 | { 406 | "cell_type": "code", 407 | "metadata": { 408 | "id": "BKO1_ap3dzDP", 409 | "colab_type": "code", 410 | "colab": {} 411 | }, 412 | "source": [ 413 | "vectorizer=TfidfVectorizer(use_idf=False, norm=None)\n", 414 | "tfvec=vectorizer.fit_transform(sentences)" 415 | ], 416 | "execution_count": null, 417 | "outputs": [] 418 | }, 419 | { 420 | "cell_type": "code", 421 | "metadata": { 422 | "id": "aucBmRAOdzAo", 423 | "colab_type": "code", 424 | "colab": { 425 | "base_uri": "https://localhost:8080/", 426 | "height": 88 427 | }, 428 | "outputId": "705b9204-bc16-4e3b-da84-83a763c08687" 429 | }, 430 | "source": [ 431 | "print(tfvec.A)\n", 432 | "print(vectorizer.get_feature_names())" 433 | ], 434 | "execution_count": null, 435 | "outputs": [ 436 | { 437 | "output_type": "stream", 438 | "text": [ 439 | "[[1. 1. 1. 0. 1. 0. 0. 0. 0. 0.]\n", 440 | " [1. 2. 0. 1. 0. 1. 1. 1. 0. 0.]\n", 441 | " [0. 1. 1. 0. 0. 0. 0. 1. 1. 1.]]\n", 442 | "['account', 'card', 'credit', 'debit', 'have', 'is', 'lost', 'my', 'stopped', 'working']\n" 443 | ], 444 | "name": "stdout" 445 | } 446 | ] 447 | }, 448 | { 449 | "cell_type": "markdown", 450 | "metadata": { 451 | "id": "cuvVmX32AUup", 452 | "colab_type": "text" 453 | }, 454 | "source": [ 455 | "IDF = log(# of documents / # documents with term t in it)" 456 | ] 457 | }, 458 | { 459 | "cell_type": "code", 460 | "metadata": { 461 | "id": "5UHJcaQMdy9h", 462 | "colab_type": "code", 463 | "colab": {} 464 | }, 465 | "source": [ 466 | "vectorizer_idf=TfidfVectorizer(smooth_idf=False)\n", 467 | "tfidfvec=vectorizer_idf.fit_transform(sentences)" 468 | ], 469 | "execution_count": null, 470 | "outputs": [] 471 | }, 472 | { 473 | "cell_type": "code", 474 | "metadata": { 475 | "id": "TKFsfbK3AMLR", 476 | "colab_type": "code", 477 | "colab": { 478 | "base_uri": "https://localhost:8080/", 479 | "height": 71 480 | }, 481 | "outputId": "f0587a66-6d9f-45ba-e62b-b2d65cb89a55" 482 | }, 483 | "source": [ 484 | "print(vectorizer_idf.idf_)\n", 485 | "print(vectorizer_idf.get_feature_names())" 486 | ], 487 | "execution_count": null, 488 | "outputs": [ 489 | { 490 | "output_type": "stream", 491 | "text": [ 492 | "[1.40546511 1. 1.40546511 2.09861229 2.09861229 2.09861229\n", 493 | " 2.09861229 1.40546511 2.09861229 2.09861229]\n", 494 | "['account', 'card', 'credit', 'debit', 'have', 'is', 'lost', 'my', 'stopped', 'working']\n" 495 | ], 496 | "name": "stdout" 497 | } 498 | ] 499 | }, 500 | { 501 | "cell_type": "markdown", 502 | "metadata": { 503 | "id": "MHhC4HZ_A53x", 504 | "colab_type": "text" 505 | }, 506 | "source": [ 507 | "sentences=['I have a credit card account','My card, debit card account','My credit card is not working']" 508 | ] 509 | }, 510 | { 511 | "cell_type": "code", 512 | "metadata": { 513 | "id": "x9Tsup0ZAMHe", 514 | "colab_type": "code", 515 | "colab": { 516 | "base_uri": "https://localhost:8080/", 517 | "height": 35 518 | }, 519 | "outputId": "4e7e1f7b-d771-4195-90c5-ca8df7a7e282" 520 | }, 521 | "source": [ 522 | "print(np.log(3/2)+1)" 523 | ], 524 | "execution_count": null, 525 | "outputs": [ 526 | { 527 | "output_type": "stream", 528 | "text": [ 529 | "1.4054651081081644\n" 530 | ], 531 | "name": "stdout" 532 | } 533 | ] 534 | }, 535 | { 536 | "cell_type": "code", 537 | "metadata": { 538 | "id": "olxtjaNE2FYW", 539 | "colab_type": "code", 540 | "colab": { 541 | "base_uri": "https://localhost:8080/", 542 | "height": 124 543 | }, 544 | "outputId": "82502547-aa20-46c8-93f8-ba300bd12aba" 545 | }, 546 | "source": [ 547 | "tfidfvec.A\n" 548 | ], 549 | "execution_count": null, 550 | "outputs": [ 551 | { 552 | "output_type": "execute_result", 553 | "data": { 554 | "text/plain": [ 555 | "array([[0.45951737, 0.3269504 , 0.45951737, 0. , 0.68614212,\n", 556 | " 0. , 0. , 0. , 0. , 0. ],\n", 557 | " [0.3055129 , 0.43474989, 0. , 0.45618573, 0. ,\n", 558 | " 0.45618573, 0.45618573, 0.3055129 , 0. , 0. ],\n", 559 | " [0. , 0.26959162, 0.37890161, 0. , 0. ,\n", 560 | " 0. , 0. , 0.37890161, 0.56576828, 0.56576828]])" 561 | ] 562 | }, 563 | "metadata": { 564 | "tags": [] 565 | }, 566 | "execution_count": 23 567 | } 568 | ] 569 | }, 570 | { 571 | "cell_type": "code", 572 | "metadata": { 573 | "id": "eQrN5c3a9y2F", 574 | "colab_type": "code", 575 | "colab": {} 576 | }, 577 | "source": [ 578 | "" 579 | ], 580 | "execution_count": null, 581 | "outputs": [] 582 | } 583 | ] 584 | } -------------------------------------------------------------------------------- /Custom_Named_Entity_Recognizer.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "Custom Named Entity Recognizer.ipynb", 7 | "provenance": [], 8 | "authorship_tag": "ABX9TyMrTP0esB/oLM4ONLzuKxrt", 9 | "include_colab_link": true 10 | }, 11 | "kernelspec": { 12 | "name": "python3", 13 | "display_name": "Python 3" 14 | } 15 | }, 16 | "cells": [ 17 | { 18 | "cell_type": "markdown", 19 | "metadata": { 20 | "id": "view-in-github", 21 | "colab_type": "text" 22 | }, 23 | "source": [ 24 | "\"Open" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "metadata": { 30 | "id": "y6WGOu6XECUX" 31 | }, 32 | "source": [ 33 | "import spacy" 34 | ], 35 | "execution_count": null, 36 | "outputs": [] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "metadata": { 41 | "id": "kZ0Q7Gb0ELMw", 42 | "outputId": "818f0c7e-eea7-4ab4-ae6c-64ec89425e13", 43 | "colab": { 44 | "base_uri": "https://localhost:8080/", 45 | "height": 35 46 | } 47 | }, 48 | "source": [ 49 | "nlp=spacy.load('en_core_web_sm')\n", 50 | "nlp.pipe_names" 51 | ], 52 | "execution_count": null, 53 | "outputs": [ 54 | { 55 | "output_type": "execute_result", 56 | "data": { 57 | "text/plain": [ 58 | "['tagger', 'parser', 'ner']" 59 | ] 60 | }, 61 | "metadata": { 62 | "tags": [] 63 | }, 64 | "execution_count": 2 65 | } 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "metadata": { 71 | "id": "akHZfr1eEOyt" 72 | }, 73 | "source": [ 74 | "doc = nlp(\"Australia wants to force Facebook and Google to pay media companies for news\")" 75 | ], 76 | "execution_count": null, 77 | "outputs": [] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "metadata": { 82 | "id": "247QhVxBF9tP", 83 | "outputId": "0cffb243-f518-4e7b-9c2e-908eafe8c57d", 84 | "colab": { 85 | "base_uri": "https://localhost:8080/", 86 | "height": 53 87 | } 88 | }, 89 | "source": [ 90 | "for ent in doc.ents:\n", 91 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 92 | ], 93 | "execution_count": null, 94 | "outputs": [ 95 | { 96 | "output_type": "stream", 97 | "text": [ 98 | "Australia 0 9 GPE\n", 99 | "Facebook and Google 25 44 ORG\n" 100 | ], 101 | "name": "stdout" 102 | } 103 | ] 104 | }, 105 | { 106 | "cell_type": "code", 107 | "metadata": { 108 | "id": "cT3bu1v2GC9a" 109 | }, 110 | "source": [ 111 | "doc = nlp(\"I do not have money to pay my credit card account\")" 112 | ], 113 | "execution_count": null, 114 | "outputs": [] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "metadata": { 119 | "id": "EUWhQQ6dGgRh" 120 | }, 121 | "source": [ 122 | "for ent in doc.ents:\n", 123 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 124 | ], 125 | "execution_count": null, 126 | "outputs": [] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "metadata": { 131 | "id": "pgswH8YyGig1" 132 | }, 133 | "source": [ 134 | "doc = nlp(\"what is the process to open a new savings account\")" 135 | ], 136 | "execution_count": null, 137 | "outputs": [] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "metadata": { 142 | "id": "EF1BOeBaGo58" 143 | }, 144 | "source": [ 145 | "for ent in doc.ents:\n", 146 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 147 | ], 148 | "execution_count": null, 149 | "outputs": [] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "metadata": { 154 | "id": "tWIlhDnHGsFs" 155 | }, 156 | "source": [ 157 | "train = [\n", 158 | " (\"Money transfer from my checking account is not working\", {\"entities\": [(6, 13, \"ACTIVITY\"), (23, 39, 'PRODUCT')]}),\n", 159 | " (\"I want to check balance in my savings account\", {\"entities\": [(16, 23, \"ACTIVITY\"), (30, 45, 'PRODUCT')]}),\n", 160 | " (\"I suspect a fraud in my credit card account\", {\"entities\": [(12, 17, \"ACTIVITY\"), (24, 35, 'PRODUCT')]}),\n", 161 | " (\"I am here for opening a new savings account\", {\"entities\": [(14, 21, \"ACTIVITY\"), (28, 43, 'PRODUCT')]}),\n", 162 | " (\"Your mortgage is in delinquent status\", {\"entities\": [(20, 30, \"ACTIVITY\"), (5, 13, 'PRODUCT')]}),\n", 163 | " (\"Your credit card is in past due status\", {\"entities\": [(23, 31, \"ACTIVITY\"), (5, 16, 'PRODUCT')]}),\n", 164 | " (\"My loan account is still not approved and funded\", {\"entities\": [(25, 37, \"ACTIVITY\"), (3, 15, 'PRODUCT'), (42, 48, \"ACTIVITY\")]}),\n", 165 | " (\"How do I open a new loan account\", {\"entities\": [(9, 13, \"ACTIVITY\"), (20, 32, 'PRODUCT')]}),\n", 166 | " (\"What are the charges on Investment account\", {\"entities\": [(13, 20, \"ACTIVITY\"), (24, 42, 'PRODUCT')]}),\n", 167 | " (\"Can you explain late charges on my credit card\", {\"entities\": [(21, 28, \"ACTIVITY\"), (35, 46, 'PRODUCT')]}),\n", 168 | " (\"I want to open a new loan account\", {\"entities\": [(10, 14, \"ACTIVITY\"), (21, 33, 'PRODUCT')]}),\n", 169 | " (\"Can you help updating payment on my credit card\", {\"entities\": [(22, 29, \"ACTIVITY\"), (36, 47, 'PRODUCT')]}),\n", 170 | " (\"When is the payment due date on my card\", {\"entities\": [(12, 19, \"ACTIVITY\"), (35, 39, 'PRODUCT')]})\n", 171 | " ]" 172 | ], 173 | "execution_count": null, 174 | "outputs": [] 175 | }, 176 | { 177 | "cell_type": "code", 178 | "metadata": { 179 | "id": "wv-ewhnMQHq9", 180 | "outputId": "3eabc003-b14f-4162-cc0a-f54c1acfc408", 181 | "colab": { 182 | "base_uri": "https://localhost:8080/", 183 | "height": 35 184 | } 185 | }, 186 | "source": [ 187 | "nlp.pipe_names" 188 | ], 189 | "execution_count": null, 190 | "outputs": [ 191 | { 192 | "output_type": "execute_result", 193 | "data": { 194 | "text/plain": [ 195 | "['tagger', 'parser', 'ner']" 196 | ] 197 | }, 198 | "metadata": { 199 | "tags": [] 200 | }, 201 | "execution_count": 10 202 | } 203 | ] 204 | }, 205 | { 206 | "cell_type": "code", 207 | "metadata": { 208 | "id": "-Mh-FrBRp4kr" 209 | }, 210 | "source": [ 211 | "ner=nlp.get_pipe(\"ner\")" 212 | ], 213 | "execution_count": null, 214 | "outputs": [] 215 | }, 216 | { 217 | "cell_type": "code", 218 | "metadata": { 219 | "id": "rrDAdCiop7F9" 220 | }, 221 | "source": [ 222 | "for _, annotations in train:\n", 223 | " for ent in annotations.get(\"entities\"):\n", 224 | " ner.add_label(ent[2])" 225 | ], 226 | "execution_count": null, 227 | "outputs": [] 228 | }, 229 | { 230 | "cell_type": "code", 231 | "metadata": { 232 | "id": "1FtL16XBqk20" 233 | }, 234 | "source": [ 235 | "disable_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'ner']" 236 | ], 237 | "execution_count": null, 238 | "outputs": [] 239 | }, 240 | { 241 | "cell_type": "code", 242 | "metadata": { 243 | "id": "BHF4BAifrFTE", 244 | "outputId": "0bf2508c-cd61-48d9-dba9-6c8538a25a2e", 245 | "colab": { 246 | "base_uri": "https://localhost:8080/", 247 | "height": 1000 248 | } 249 | }, 250 | "source": [ 251 | "import random\n", 252 | "from spacy.util import minibatch, compounding\n", 253 | "from pathlib import Path\n", 254 | "\n", 255 | "with nlp.disable_pipes(*disable_pipes):\n", 256 | " optimizer = nlp.resume_training()\n", 257 | "\n", 258 | " for iteration in range(100):\n", 259 | "\n", 260 | " random.shuffle(train)\n", 261 | " losses = {}\n", 262 | "\n", 263 | " batches = minibatch(train, size=compounding(1.0, 4.0, 1.001))\n", 264 | " for batch in batches:\n", 265 | " text, annotation = zip(*batch)\n", 266 | " nlp.update(\n", 267 | " text, \n", 268 | " annotation, \n", 269 | " drop=0.5, \n", 270 | " losses=losses,\n", 271 | " sgd=optimizer\n", 272 | " )\n", 273 | " print(\"Losses\", losses)" 274 | ], 275 | "execution_count": null, 276 | "outputs": [ 277 | { 278 | "output_type": "stream", 279 | "text": [ 280 | "Losses {'ner': 6.854678056978502}\n", 281 | "Losses {'ner': 14.679185251066825}\n", 282 | "Losses {'ner': 23.950488703485256}\n", 283 | "Losses {'ner': 32.36337262751686}\n", 284 | "Losses {'ner': 42.090825372785396}\n", 285 | "Losses {'ner': 50.74776712642291}\n", 286 | "Losses {'ner': 59.078528280037375}\n", 287 | "Losses {'ner': 67.89365277086264}\n", 288 | "Losses {'ner': 78.11245668663716}\n", 289 | "Losses {'ner': 88.82007650024909}\n", 290 | "Losses {'ner': 98.59731430207623}\n", 291 | "Losses {'ner': 108.66014529320736}\n", 292 | "Losses {'ner': 116.38581796682075}\n", 293 | "Losses {'ner': 6.447028030822807}\n", 294 | "Losses {'ner': 13.636424764846865}\n", 295 | "Losses {'ner': 20.294305473189283}\n", 296 | "Losses {'ner': 29.512459657462145}\n", 297 | "Losses {'ner': 38.08894005723536}\n", 298 | "Losses {'ner': 44.182104308243694}\n", 299 | "Losses {'ner': 49.5827408020687}\n", 300 | "Losses {'ner': 56.5009826144121}\n", 301 | "Losses {'ner': 64.20241453156788}\n", 302 | "Losses {'ner': 72.5024181514352}\n", 303 | "Losses {'ner': 82.18058728643948}\n", 304 | "Losses {'ner': 94.28702119211513}\n", 305 | "Losses {'ner': 103.80432979672761}\n", 306 | "Losses {'ner': 10.187788695795462}\n", 307 | "Losses {'ner': 18.081422520428532}\n", 308 | "Losses {'ner': 28.794723854692165}\n", 309 | "Losses {'ner': 40.28298084560174}\n", 310 | "Losses {'ner': 49.71875985089082}\n", 311 | "Losses {'ner': 60.91519144932863}\n", 312 | "Losses {'ner': 68.89577293033835}\n", 313 | "Losses {'ner': 75.8228719802155}\n", 314 | "Losses {'ner': 84.85175630435151}\n", 315 | "Losses {'ner': 91.66670909508866}\n", 316 | "Losses {'ner': 100.89659002908775}\n", 317 | "Losses {'ner': 105.51072317102262}\n", 318 | "Losses {'ner': 114.20053455451307}\n", 319 | "Losses {'ner': 11.874910920858383}\n", 320 | "Losses {'ner': 18.01470400033577}\n", 321 | "Losses {'ner': 24.703046558090136}\n", 322 | "Losses {'ner': 33.36074939680111}\n", 323 | "Losses {'ner': 39.91389299680304}\n", 324 | "Losses {'ner': 48.00802506257605}\n", 325 | "Losses {'ner': 55.54554043740791}\n", 326 | "Losses {'ner': 63.80877638702805}\n", 327 | "Losses {'ner': 73.32706822032924}\n", 328 | "Losses {'ner': 85.52767444725032}\n", 329 | "Losses {'ner': 91.07808620805736}\n", 330 | "Losses {'ner': 100.74398750948603}\n", 331 | "Losses {'ner': 108.81150460007484}\n", 332 | "Losses {'ner': 7.934205207973719}\n", 333 | "Losses {'ner': 15.934533151739743}\n", 334 | "Losses {'ner': 21.027907810988836}\n", 335 | "Losses {'ner': 28.812518112245016}\n", 336 | "Losses {'ner': 36.44433230150025}\n", 337 | "Losses {'ner': 42.86461384582799}\n", 338 | "Losses {'ner': 48.47094472160097}\n", 339 | "Losses {'ner': 57.29003682953771}\n", 340 | "Losses {'ner': 63.68655196519103}\n", 341 | "Losses {'ner': 73.54652700514998}\n", 342 | "Losses {'ner': 77.3524747932097}\n", 343 | "Losses {'ner': 86.79359536617994}\n", 344 | "Losses {'ner': 92.79727795813233}\n", 345 | "Losses {'ner': 6.634555273223668}\n", 346 | "Losses {'ner': 16.53426442341879}\n", 347 | "Losses {'ner': 24.421383856300963}\n", 348 | "Losses {'ner': 32.20073594848509}\n", 349 | "Losses {'ner': 36.98140308537404}\n", 350 | "Losses {'ner': 45.849100391875254}\n", 351 | "Losses {'ner': 54.649693273502635}\n", 352 | "Losses {'ner': 64.98607749727671}\n", 353 | "Losses {'ner': 72.75458178346162}\n", 354 | "Losses {'ner': 80.51576386814122}\n", 355 | "Losses {'ner': 84.554741669941}\n", 356 | "Losses {'ner': 90.92880824257736}\n", 357 | "Losses {'ner': 100.84326446105842}\n", 358 | "Losses {'ner': 7.952673215419054}\n", 359 | "Losses {'ner': 17.2674349732697}\n", 360 | "Losses {'ner': 21.523766089230776}\n", 361 | "Losses {'ner': 27.892275128513575}\n", 362 | "Losses {'ner': 35.487615782767534}\n", 363 | "Losses {'ner': 39.741029826924205}\n", 364 | "Losses {'ner': 48.04311957769096}\n", 365 | "Losses {'ner': 52.71369392359077}\n", 366 | "Losses {'ner': 61.49295378410636}\n", 367 | "Losses {'ner': 70.09444463187276}\n", 368 | "Losses {'ner': 77.33230934226333}\n", 369 | "Losses {'ner': 85.43105769836723}\n", 370 | "Losses {'ner': 92.78215870567976}\n", 371 | "Losses {'ner': 9.37793830037117}\n", 372 | "Losses {'ner': 15.78346205712296}\n", 373 | "Losses {'ner': 22.14838053029962}\n", 374 | "Losses {'ner': 32.11705849808641}\n", 375 | "Losses {'ner': 37.52599359792657}\n", 376 | "Losses {'ner': 43.9832932644058}\n", 377 | "Losses {'ner': 51.33871530788019}\n", 378 | "Losses {'ner': 59.05185642139986}\n", 379 | "Losses {'ner': 64.48175515281036}\n", 380 | "Losses {'ner': 73.84196700202301}\n", 381 | "Losses {'ner': 80.81183512555435}\n", 382 | "Losses {'ner': 87.9049289575778}\n", 383 | "Losses {'ner': 93.06944430386648}\n", 384 | "Losses {'ner': 5.729617261489011}\n", 385 | "Losses {'ner': 11.446438267988242}\n", 386 | "Losses {'ner': 16.72908604906229}\n", 387 | "Losses {'ner': 25.55583632753519}\n", 388 | "Losses {'ner': 31.97593139314381}\n", 389 | "Losses {'ner': 38.71585701608387}\n", 390 | "Losses {'ner': 48.8103742172691}\n", 391 | "Losses {'ner': 55.134292485353626}\n", 392 | "Losses {'ner': 63.48538004128318}\n", 393 | "Losses {'ner': 69.21415071776141}\n", 394 | "Losses {'ner': 74.38793004524928}\n", 395 | "Losses {'ner': 82.2656147390328}\n", 396 | "Losses {'ner': 90.56016727385145}\n", 397 | "Losses {'ner': 8.836490333080292}\n", 398 | "Losses {'ner': 13.39085802435875}\n", 399 | "Losses {'ner': 17.91396930254996}\n", 400 | "Losses {'ner': 25.47182067669928}\n", 401 | "Losses {'ner': 33.9477038923651}\n", 402 | "Losses {'ner': 42.33498232997954}\n", 403 | "Losses {'ner': 49.69304501451552}\n", 404 | "Losses {'ner': 58.27087866701186}\n", 405 | "Losses {'ner': 62.80300857964903}\n", 406 | "Losses {'ner': 69.96559551917017}\n", 407 | "Losses {'ner': 76.30653195641935}\n", 408 | "Losses {'ner': 84.69388272427022}\n", 409 | "Losses {'ner': 93.44208221696317}\n", 410 | "Losses {'ner': 7.147528566420078}\n", 411 | "Losses {'ner': 12.889900453388691}\n", 412 | "Losses {'ner': 18.736523993313313}\n", 413 | "Losses {'ner': 26.811991669237614}\n", 414 | "Losses {'ner': 32.31238783150911}\n", 415 | "Losses {'ner': 40.58795603364706}\n", 416 | "Losses {'ner': 46.98593680560589}\n", 417 | "Losses {'ner': 52.05221910774708}\n", 418 | "Losses {'ner': 58.74864035472274}\n", 419 | "Losses {'ner': 68.11968791112304}\n", 420 | "Losses {'ner': 77.53653096780181}\n", 421 | "Losses {'ner': 86.34884483739734}\n", 422 | "Losses {'ner': 94.63039743807167}\n", 423 | "Losses {'ner': 5.823946202173829}\n", 424 | "Losses {'ner': 12.37797607248649}\n", 425 | "Losses {'ner': 20.018206847365946}\n", 426 | "Losses {'ner': 26.543494140263647}\n", 427 | "Losses {'ner': 36.37409854447469}\n", 428 | "Losses {'ner': 42.54213133436193}\n", 429 | "Losses {'ner': 49.4013396946763}\n", 430 | "Losses {'ner': 58.872807320957385}\n", 431 | "Losses {'ner': 68.3301379948904}\n", 432 | "Losses {'ner': 73.52504656166334}\n", 433 | "Losses {'ner': 80.13463794142504}\n", 434 | "Losses {'ner': 86.02515788823862}\n", 435 | "Losses {'ner': 90.75273410142896}\n", 436 | "Losses {'ner': 6.9001882411539555}\n", 437 | "Losses {'ner': 12.830617222934961}\n", 438 | "Losses {'ner': 22.736001405864954}\n", 439 | "Losses {'ner': 30.63187744282186}\n", 440 | "Losses {'ner': 36.87274959497154}\n", 441 | "Losses {'ner': 45.0199228040874}\n", 442 | "Losses {'ner': 52.89800136908889}\n", 443 | "Losses {'ner': 63.31615722179413}\n", 444 | "Losses {'ner': 69.34721626155078}\n", 445 | "Losses {'ner': 77.26570436172187}\n", 446 | "Losses {'ner': 87.76075747422874}\n", 447 | "Losses {'ner': 95.2162308068946}\n", 448 | "Losses {'ner': 102.36635011527687}\n", 449 | "Losses {'ner': 8.829036563634872}\n", 450 | "Losses {'ner': 17.793309539556503}\n", 451 | "Losses {'ner': 22.275110956281424}\n", 452 | "Losses {'ner': 30.783266987651587}\n", 453 | "Losses {'ner': 38.69325646851212}\n", 454 | "Losses {'ner': 46.836528928019106}\n", 455 | "Losses {'ner': 54.884297610260546}\n", 456 | "Losses {'ner': 62.16467279288918}\n", 457 | "Losses {'ner': 67.1179793740157}\n", 458 | "Losses {'ner': 72.51661206212884}\n", 459 | "Losses {'ner': 79.04418377009279}\n", 460 | "Losses {'ner': 85.07068915468699}\n", 461 | "Losses {'ner': 93.71870751482493}\n", 462 | "Losses {'ner': 7.699155494570732}\n", 463 | "Losses {'ner': 15.206922814249992}\n", 464 | "Losses {'ner': 21.760664390400052}\n", 465 | "Losses {'ner': 28.72892284579575}\n", 466 | "Losses {'ner': 33.77670083194971}\n", 467 | "Losses {'ner': 41.51397476345301}\n", 468 | "Losses {'ner': 49.70087129622698}\n", 469 | "Losses {'ner': 58.79034722596407}\n", 470 | "Losses {'ner': 65.4125291928649}\n", 471 | "Losses {'ner': 73.44664230197668}\n", 472 | "Losses {'ner': 83.01173567026854}\n", 473 | "Losses {'ner': 91.04990243166685}\n", 474 | "Losses {'ner': 102.59921204298735}\n", 475 | "Losses {'ner': 7.339088708162308}\n", 476 | "Losses {'ner': 12.611825069412589}\n", 477 | "Losses {'ner': 18.472229743376374}\n", 478 | "Losses {'ner': 27.75297119654715}\n", 479 | "Losses {'ner': 35.10574642010033}\n", 480 | "Losses {'ner': 40.57586035318673}\n", 481 | "Losses {'ner': 47.995918275788426}\n", 482 | "Losses {'ner': 52.058594988659024}\n", 483 | "Losses {'ner': 62.35949330218136}\n", 484 | "Losses {'ner': 72.49258642084897}\n", 485 | "Losses {'ner': 79.45430750586092}\n", 486 | "Losses {'ner': 87.23270291276276}\n", 487 | "Losses {'ner': 92.57364662922919}\n", 488 | "Losses {'ner': 3.6503168870985974}\n", 489 | "Losses {'ner': 10.870846763515146}\n", 490 | "Losses {'ner': 18.496614078321727}\n", 491 | "Losses {'ner': 27.135703215637477}\n", 492 | "Losses {'ner': 33.83578345278147}\n", 493 | "Losses {'ner': 41.46698893705252}\n", 494 | "Losses {'ner': 48.11869699234012}\n", 495 | "Losses {'ner': 56.4534288095856}\n", 496 | "Losses {'ner': 63.57055812800172}\n", 497 | "Losses {'ner': 71.23469021758865}\n", 498 | "Losses {'ner': 77.87891702400066}\n", 499 | "Losses {'ner': 85.2201062594495}\n", 500 | "Losses {'ner': 91.88286719866574}\n", 501 | "Losses {'ner': 9.229445546865463}\n", 502 | "Losses {'ner': 14.215890167281032}\n", 503 | "Losses {'ner': 22.269946543499827}\n", 504 | "Losses {'ner': 29.60468049161136}\n", 505 | "Losses {'ner': 36.22072656452656}\n", 506 | "Losses {'ner': 42.19673217087984}\n", 507 | "Losses {'ner': 48.9839754588902}\n", 508 | "Losses {'ner': 57.12435572221875}\n", 509 | "Losses {'ner': 65.28704552690033}\n", 510 | "Losses {'ner': 70.21899104546173}\n", 511 | "Losses {'ner': 81.07558191250428}\n", 512 | "Losses {'ner': 87.2079395838955}\n", 513 | "Losses {'ner': 94.10452071772306}\n", 514 | "Losses {'ner': 8.615095805376768}\n", 515 | "Losses {'ner': 17.790699009156924}\n", 516 | "Losses {'ner': 24.570987523139593}\n", 517 | "Losses {'ner': 28.6134593085726}\n", 518 | "Losses {'ner': 36.15380290005032}\n", 519 | "Losses {'ner': 39.96950445877064}\n", 520 | "Losses {'ner': 46.05321906838708}\n", 521 | "Losses {'ner': 51.597297178638655}\n", 522 | "Losses {'ner': 58.691839003992754}\n", 523 | "Losses {'ner': 64.78833980491527}\n", 524 | "Losses {'ner': 73.2546335645593}\n", 525 | "Losses {'ner': 78.51356465445042}\n", 526 | "Losses {'ner': 85.27206732780814}\n", 527 | "Losses {'ner': 5.963086374569684}\n", 528 | "Losses {'ner': 11.07804983528331}\n", 529 | "Losses {'ner': 19.50438860373106}\n", 530 | "Losses {'ner': 25.464138395502232}\n", 531 | "Losses {'ner': 31.159398240735754}\n", 532 | "Losses {'ner': 35.27982206293382}\n", 533 | "Losses {'ner': 40.650069407525734}\n", 534 | "Losses {'ner': 48.9647959548638}\n", 535 | "Losses {'ner': 55.5575977138833}\n", 536 | "Losses {'ner': 59.708324261414774}\n", 537 | "Losses {'ner': 67.86908105801321}\n", 538 | "Losses {'ner': 75.80537037242665}\n", 539 | "Losses {'ner': 81.10804493055674}\n", 540 | "Losses {'ner': 8.035124458372593}\n", 541 | "Losses {'ner': 14.159927494823933}\n", 542 | "Losses {'ner': 19.942668574280106}\n", 543 | "Losses {'ner': 27.782351332134567}\n", 544 | "Losses {'ner': 33.36747594398912}\n", 545 | "Losses {'ner': 36.9921278792026}\n", 546 | "Losses {'ner': 45.870216770708794}\n", 547 | "Losses {'ner': 54.101175053656334}\n", 548 | "Losses {'ner': 58.06072480106377}\n", 549 | "Losses {'ner': 62.21034709914238}\n", 550 | "Losses {'ner': 69.79912729366333}\n", 551 | "Losses {'ner': 76.81558566578315}\n", 552 | "Losses {'ner': 85.59074277468608}\n", 553 | "Losses {'ner': 5.532645975763444}\n", 554 | "Losses {'ner': 12.331780774111394}\n", 555 | "Losses {'ner': 16.73145840090001}\n", 556 | "Losses {'ner': 24.960306590015534}\n", 557 | "Losses {'ner': 31.84252139698947}\n", 558 | "Losses {'ner': 36.2446917440393}\n", 559 | "Losses {'ner': 43.78912331123138}\n", 560 | "Losses {'ner': 51.36057970166439}\n", 561 | "Losses {'ner': 58.33069170132512}\n", 562 | "Losses {'ner': 60.483628267014865}\n", 563 | "Losses {'ner': 66.83239509590203}\n", 564 | "Losses {'ner': 74.91908384911949}\n", 565 | "Losses {'ner': 78.62201189022744}\n", 566 | "Losses {'ner': 3.5933411383302882}\n", 567 | "Losses {'ner': 8.114165685430635}\n", 568 | "Losses {'ner': 13.8472918489133}\n", 569 | "Losses {'ner': 21.275720141187776}\n", 570 | "Losses {'ner': 27.517832501151133}\n", 571 | "Losses {'ner': 37.33208374521928}\n", 572 | "Losses {'ner': 43.088284633806325}\n", 573 | "Losses {'ner': 47.85757335483504}\n", 574 | "Losses {'ner': 55.561077984268195}\n", 575 | "Losses {'ner': 63.6751087030716}\n", 576 | "Losses {'ner': 72.11037627070618}\n", 577 | "Losses {'ner': 80.88667711078597}\n", 578 | "Losses {'ner': 89.33889339327288}\n", 579 | "Losses {'ner': 9.696653604507446}\n", 580 | "Losses {'ner': 15.819194853305817}\n", 581 | "Losses {'ner': 21.354009941220284}\n", 582 | "Losses {'ner': 27.215589746832848}\n", 583 | "Losses {'ner': 34.05021492578089}\n", 584 | "Losses {'ner': 41.297477880492806}\n", 585 | "Losses {'ner': 49.37415222264826}\n", 586 | "Losses {'ner': 54.51619722601026}\n", 587 | "Losses {'ner': 62.42615731060505}\n", 588 | "Losses {'ner': 69.83439235389233}\n", 589 | "Losses {'ner': 76.6830275207758}\n", 590 | "Losses {'ner': 83.31510054133832}\n", 591 | "Losses {'ner': 90.7782075908035}\n", 592 | "Losses {'ner': 7.08732707798481}\n", 593 | "Losses {'ner': 11.32866232842207}\n", 594 | "Losses {'ner': 19.390027336776257}\n", 595 | "Losses {'ner': 25.752743802964687}\n", 596 | "Losses {'ner': 32.975013016723096}\n", 597 | "Losses {'ner': 40.166978363879025}\n", 598 | "Losses {'ner': 46.88893180061132}\n", 599 | "Losses {'ner': 55.53468662220985}\n", 600 | "Losses {'ner': 61.91332108393544}\n", 601 | "Losses {'ner': 68.88162567379186}\n", 602 | "Losses {'ner': 73.68714231811464}\n", 603 | "Losses {'ner': 79.53117959015071}\n", 604 | "Losses {'ner': 87.00928415171802}\n", 605 | "Losses {'ner': 9.937609377338958}\n", 606 | "Losses {'ner': 15.51616502089746}\n", 607 | "Losses {'ner': 22.652049440446717}\n", 608 | "Losses {'ner': 28.531651215183956}\n", 609 | "Losses {'ner': 35.57319627844117}\n", 610 | "Losses {'ner': 41.849561066272145}\n", 611 | "Losses {'ner': 46.23552863360237}\n", 612 | "Losses {'ner': 52.4967592385583}\n", 613 | "Losses {'ner': 59.98969102920819}\n", 614 | "Losses {'ner': 65.63834841286734}\n", 615 | "Losses {'ner': 73.55368089487456}\n", 616 | "Losses {'ner': 82.32160243203543}\n", 617 | "Losses {'ner': 90.45344420124457}\n", 618 | "Losses {'ner': 6.78220139327459}\n", 619 | "Losses {'ner': 14.638479961780831}\n", 620 | "Losses {'ner': 20.889903884672094}\n", 621 | "Losses {'ner': 29.64078059262829}\n", 622 | "Losses {'ner': 37.3748260497232}\n", 623 | "Losses {'ner': 41.66892284742789}\n", 624 | "Losses {'ner': 49.987930549599696}\n", 625 | "Losses {'ner': 57.237297273510194}\n", 626 | "Losses {'ner': 67.03563727250003}\n", 627 | "Losses {'ner': 71.53847091177158}\n", 628 | "Losses {'ner': 81.32327510693722}\n", 629 | "Losses {'ner': 87.06252113995288}\n", 630 | "Losses {'ner': 96.3794089433286}\n", 631 | "Losses {'ner': 7.994896857664571}\n", 632 | "Losses {'ner': 17.477103083059774}\n", 633 | "Losses {'ner': 26.643398775384412}\n", 634 | "Losses {'ner': 31.81358806963368}\n", 635 | "Losses {'ner': 35.08509938872709}\n", 636 | "Losses {'ner': 42.06566057621791}\n", 637 | "Losses {'ner': 47.18620012223079}\n", 638 | "Losses {'ner': 55.99548087536647}\n", 639 | "Losses {'ner': 64.62627191364123}\n", 640 | "Losses {'ner': 72.19367960921778}\n", 641 | "Losses {'ner': 77.067520492592}\n", 642 | "Losses {'ner': 83.45677741791411}\n", 643 | "Losses {'ner': 90.2534515318676}\n", 644 | "Losses {'ner': 7.2169159054756165}\n", 645 | "Losses {'ner': 13.213882341980934}\n", 646 | "Losses {'ner': 21.664439246058464}\n", 647 | "Losses {'ner': 23.415242763236165}\n", 648 | "Losses {'ner': 30.893796669319272}\n", 649 | "Losses {'ner': 35.810268842062214}\n", 650 | "Losses {'ner': 40.95996239758824}\n", 651 | "Losses {'ner': 46.924533098165284}\n", 652 | "Losses {'ner': 56.015925049011}\n", 653 | "Losses {'ner': 62.55570885461975}\n", 654 | "Losses {'ner': 70.35461271756549}\n", 655 | "Losses {'ner': 79.16328762580861}\n", 656 | "Losses {'ner': 87.06673272435773}\n", 657 | "Losses {'ner': 7.650479853153229}\n", 658 | "Losses {'ner': 13.518638294190168}\n", 659 | "Losses {'ner': 18.081444684416056}\n", 660 | "Losses {'ner': 26.272033397108316}\n", 661 | "Losses {'ner': 35.69618720188737}\n", 662 | "Losses {'ner': 42.38152563944459}\n", 663 | "Losses {'ner': 49.42615080066025}\n", 664 | "Losses {'ner': 54.03273921459913}\n", 665 | "Losses {'ner': 63.11778735369444}\n", 666 | "Losses {'ner': 71.57237128540874}\n", 667 | "Losses {'ner': 77.84991792030632}\n", 668 | "Losses {'ner': 83.58425956405699}\n", 669 | "Losses {'ner': 88.88383590718149}\n", 670 | "Losses {'ner': 4.543200899846852}\n", 671 | "Losses {'ner': 13.378170688636601}\n", 672 | "Losses {'ner': 23.245688465423882}\n", 673 | "Losses {'ner': 27.99181078094989}\n", 674 | "Losses {'ner': 36.01516140718013}\n", 675 | "Losses {'ner': 42.68156119529158}\n", 676 | "Losses {'ner': 48.59166883211583}\n", 677 | "Losses {'ner': 56.874961662106216}\n", 678 | "Losses {'ner': 65.74323196988553}\n", 679 | "Losses {'ner': 72.24689479451627}\n", 680 | "Losses {'ner': 77.09194593842221}\n", 681 | "Losses {'ner': 84.41278638283802}\n", 682 | "Losses {'ner': 91.60791129770769}\n", 683 | "Losses {'ner': 2.745592750608921}\n", 684 | "Losses {'ner': 12.33163920789957}\n", 685 | "Losses {'ner': 20.43974707275629}\n", 686 | "Losses {'ner': 28.819326780736446}\n", 687 | "Losses {'ner': 37.5180703625083}\n", 688 | "Losses {'ner': 40.985966857362655}\n", 689 | "Losses {'ner': 49.47082686210342}\n", 690 | "Losses {'ner': 58.86488362932869}\n", 691 | "Losses {'ner': 66.60005446309515}\n", 692 | "Losses {'ner': 73.11647051393811}\n", 693 | "Losses {'ner': 81.38828065812413}\n", 694 | "Losses {'ner': 88.37590992271726}\n", 695 | "Losses {'ner': 95.13550001203839}\n", 696 | "Losses {'ner': 6.919821934774518}\n", 697 | "Losses {'ner': 14.555832449812442}\n", 698 | "Losses {'ner': 20.755660955328494}\n", 699 | "Losses {'ner': 25.291602647397667}\n", 700 | "Losses {'ner': 32.073393835220486}\n", 701 | "Losses {'ner': 40.84797481028363}\n", 702 | "Losses {'ner': 45.9263850192528}\n", 703 | "Losses {'ner': 52.436870167823116}\n", 704 | "Losses {'ner': 57.12397028398661}\n", 705 | "Losses {'ner': 63.473757608653585}\n", 706 | "Losses {'ner': 73.63302786541132}\n", 707 | "Losses {'ner': 78.00733132180719}\n", 708 | "Losses {'ner': 84.00477000963835}\n", 709 | "Losses {'ner': 5.105752165662125}\n", 710 | "Losses {'ner': 13.189234852558002}\n", 711 | "Losses {'ner': 19.657137392787263}\n", 712 | "Losses {'ner': 25.977207891450234}\n", 713 | "Losses {'ner': 31.47900021336318}\n", 714 | "Losses {'ner': 36.89120796582938}\n", 715 | "Losses {'ner': 47.70132854840995}\n", 716 | "Losses {'ner': 53.25135786700048}\n", 717 | "Losses {'ner': 62.76926393675603}\n", 718 | "Losses {'ner': 67.09993133702301}\n", 719 | "Losses {'ner': 72.67041791739393}\n", 720 | "Losses {'ner': 77.71566522548386}\n", 721 | "Losses {'ner': 85.60607752630898}\n", 722 | "Losses {'ner': 6.303561344742775}\n", 723 | "Losses {'ner': 9.226222827099264}\n", 724 | "Losses {'ner': 17.356666221283376}\n", 725 | "Losses {'ner': 20.062742606955}\n", 726 | "Losses {'ner': 27.579283253508038}\n", 727 | "Losses {'ner': 37.904683849352296}\n", 728 | "Losses {'ner': 45.16958438749134}\n", 729 | "Losses {'ner': 51.78330009574711}\n", 730 | "Losses {'ner': 55.28806694484956}\n", 731 | "Losses {'ner': 61.820500942412764}\n", 732 | "Losses {'ner': 65.84830928267911}\n", 733 | "Losses {'ner': 71.8783134999685}\n", 734 | "Losses {'ner': 78.80966157047078}\n", 735 | "Losses {'ner': 7.724133208394051}\n", 736 | "Losses {'ner': 13.77644667416098}\n", 737 | "Losses {'ner': 20.3824666489636}\n", 738 | "Losses {'ner': 27.894644341689855}\n", 739 | "Losses {'ner': 33.761647106158534}\n", 740 | "Losses {'ner': 40.67930490617732}\n", 741 | "Losses {'ner': 49.783701636838714}\n", 742 | "Losses {'ner': 56.770958521413604}\n", 743 | "Losses {'ner': 60.9132529831943}\n", 744 | "Losses {'ner': 68.40709933354378}\n", 745 | "Losses {'ner': 75.32455064623875}\n", 746 | "Losses {'ner': 79.93690114444846}\n", 747 | "Losses {'ner': 87.83453381410592}\n", 748 | "Losses {'ner': 7.394446647376753}\n", 749 | "Losses {'ner': 13.537713228084613}\n", 750 | "Losses {'ner': 22.39370706520276}\n", 751 | "Losses {'ner': 26.525327703275252}\n", 752 | "Losses {'ner': 31.347168311593123}\n", 753 | "Losses {'ner': 35.1359414831968}\n", 754 | "Losses {'ner': 42.030789665994234}\n", 755 | "Losses {'ner': 50.75337981444318}\n", 756 | "Losses {'ner': 54.333469824028725}\n", 757 | "Losses {'ner': 61.841186479759926}\n", 758 | "Losses {'ner': 68.92825908875238}\n", 759 | "Losses {'ner': 77.1341961539365}\n", 760 | "Losses {'ner': 84.63207843420241}\n", 761 | "Losses {'ner': 4.680213417857885}\n", 762 | "Losses {'ner': 11.562678634305485}\n", 763 | "Losses {'ner': 18.303011215408333}\n", 764 | "Losses {'ner': 25.265518820961006}\n", 765 | "Losses {'ner': 33.231034778640606}\n", 766 | "Losses {'ner': 35.82354236919232}\n", 767 | "Losses {'ner': 42.08280605928771}\n", 768 | "Losses {'ner': 48.99960487238891}\n", 769 | "Losses {'ner': 54.57194100493975}\n", 770 | "Losses {'ner': 61.52302012021132}\n", 771 | "Losses {'ner': 69.05057764226981}\n", 772 | "Losses {'ner': 75.4229185887863}\n", 773 | "Losses {'ner': 78.58599912089008}\n", 774 | "Losses {'ner': 7.712236762046814}\n", 775 | "Losses {'ner': 14.159782343833285}\n", 776 | "Losses {'ner': 19.975698245978492}\n", 777 | "Losses {'ner': 25.97280018433048}\n", 778 | "Losses {'ner': 36.3213186751218}\n", 779 | "Losses {'ner': 40.69833790167286}\n", 780 | "Losses {'ner': 49.13896421744539}\n", 781 | "Losses {'ner': 56.40302308353239}\n", 782 | "Losses {'ner': 63.95068116935545}\n", 783 | "Losses {'ner': 70.0972304583538}\n", 784 | "Losses {'ner': 77.0508723498333}\n", 785 | "Losses {'ner': 83.98793180373286}\n", 786 | "Losses {'ner': 89.59292089385235}\n", 787 | "Losses {'ner': 6.5966881737113}\n", 788 | "Losses {'ner': 13.94437312334776}\n", 789 | "Losses {'ner': 20.246734973043203}\n", 790 | "Losses {'ner': 28.301533963531256}\n", 791 | "Losses {'ner': 35.06995196340722}\n", 792 | "Losses {'ner': 42.007730895515124}\n", 793 | "Losses {'ner': 47.36108505712036}\n", 794 | "Losses {'ner': 53.07745143943612}\n", 795 | "Losses {'ner': 56.25479069780704}\n", 796 | "Losses {'ner': 63.839388106578554}\n", 797 | "Losses {'ner': 68.97240287610475}\n", 798 | "Losses {'ner': 71.95710603785847}\n", 799 | "Losses {'ner': 79.79499667775963}\n", 800 | "Losses {'ner': 7.0752062178216875}\n", 801 | "Losses {'ner': 14.59025621181354}\n", 802 | "Losses {'ner': 20.804381696041673}\n", 803 | "Losses {'ner': 30.471490082796663}\n", 804 | "Losses {'ner': 38.1082507338142}\n", 805 | "Losses {'ner': 44.12200194632169}\n", 806 | "Losses {'ner': 50.02642200363334}\n", 807 | "Losses {'ner': 52.5514944489114}\n", 808 | "Losses {'ner': 57.98287413152866}\n", 809 | "Losses {'ner': 65.5758009168785}\n", 810 | "Losses {'ner': 75.35766252013855}\n", 811 | "Losses {'ner': 86.44991548988037}\n", 812 | "Losses {'ner': 95.48067557369359}\n", 813 | "Losses {'ner': 6.23468953371048}\n", 814 | "Losses {'ner': 14.850488971918821}\n", 815 | "Losses {'ner': 19.358761756622698}\n", 816 | "Losses {'ner': 25.930424170801416}\n", 817 | "Losses {'ner': 34.14732621819712}\n", 818 | "Losses {'ner': 43.4411260799443}\n", 819 | "Losses {'ner': 51.14495412080396}\n", 820 | "Losses {'ner': 55.3314752868082}\n", 821 | "Losses {'ner': 63.48095509323139}\n", 822 | "Losses {'ner': 69.9297851613428}\n", 823 | "Losses {'ner': 78.99003168853778}\n", 824 | "Losses {'ner': 89.60286220821399}\n", 825 | "Losses {'ner': 95.87513403617413}\n", 826 | "Losses {'ner': 3.317772831986076}\n", 827 | "Losses {'ner': 7.78686331048084}\n", 828 | "Losses {'ner': 15.927168114329106}\n", 829 | "Losses {'ner': 23.41521182305587}\n", 830 | "Losses {'ner': 29.67151690668834}\n", 831 | "Losses {'ner': 35.64144785805547}\n", 832 | "Losses {'ner': 41.60789656742418}\n", 833 | "Losses {'ner': 48.026687921192206}\n", 834 | "Losses {'ner': 53.95124562567071}\n", 835 | "Losses {'ner': 59.353862001960806}\n", 836 | "Losses {'ner': 65.58487474120193}\n", 837 | "Losses {'ner': 73.05952159355365}\n", 838 | "Losses {'ner': 80.33981946652875}\n", 839 | "Losses {'ner': 9.206989377737045}\n", 840 | "Losses {'ner': 15.801590630027931}\n", 841 | "Losses {'ner': 23.370243587705772}\n", 842 | "Losses {'ner': 28.03542397095589}\n", 843 | "Losses {'ner': 32.727918564516585}\n", 844 | "Losses {'ner': 41.35597696824698}\n", 845 | "Losses {'ner': 49.48694810195593}\n", 846 | "Losses {'ner': 53.23832738323836}\n", 847 | "Losses {'ner': 57.61898048146395}\n", 848 | "Losses {'ner': 65.83839227183489}\n", 849 | "Losses {'ner': 71.44635011492937}\n", 850 | "Losses {'ner': 77.00680233658932}\n", 851 | "Losses {'ner': 82.30375385035586}\n", 852 | "Losses {'ner': 4.5445506405085325}\n", 853 | "Losses {'ner': 10.712119970703498}\n", 854 | "Losses {'ner': 15.5331940674223}\n", 855 | "Losses {'ner': 24.82027060026303}\n", 856 | "Losses {'ner': 33.26705880695954}\n", 857 | "Losses {'ner': 42.321034538093954}\n", 858 | "Losses {'ner': 48.9633353385143}\n", 859 | "Losses {'ner': 55.31384023091232}\n", 860 | "Losses {'ner': 62.25769354960357}\n", 861 | "Losses {'ner': 69.65128142944013}\n", 862 | "Losses {'ner': 74.77624605780875}\n", 863 | "Losses {'ner': 82.4033312182728}\n", 864 | "Losses {'ner': 90.02643846637511}\n", 865 | "Losses {'ner': 7.605037219822407}\n", 866 | "Losses {'ner': 17.65081863477826}\n", 867 | "Losses {'ner': 23.229513563945886}\n", 868 | "Losses {'ner': 28.789196062049825}\n", 869 | "Losses {'ner': 35.66926130201574}\n", 870 | "Losses {'ner': 42.21317568156775}\n", 871 | "Losses {'ner': 48.409533349013884}\n", 872 | "Losses {'ner': 57.895678487754424}\n", 873 | "Losses {'ner': 66.16473199162539}\n", 874 | "Losses {'ner': 72.23624174777325}\n", 875 | "Losses {'ner': 79.14369903985317}\n", 876 | "Losses {'ner': 87.16348474208172}\n", 877 | "Losses {'ner': 94.32584263224527}\n", 878 | "Losses {'ner': 7.563532739877701}\n", 879 | "Losses {'ner': 16.39803197979927}\n", 880 | "Losses {'ner': 23.165393471717834}\n", 881 | "Losses {'ner': 30.25813716650009}\n", 882 | "Losses {'ner': 38.36177801422309}\n", 883 | "Losses {'ner': 45.81105871681211}\n", 884 | "Losses {'ner': 49.60892334189339}\n", 885 | "Losses {'ner': 53.7061242385148}\n", 886 | "Losses {'ner': 60.69354275974224}\n", 887 | "Losses {'ner': 68.82340384634922}\n", 888 | "Losses {'ner': 76.51966686161946}\n", 889 | "Losses {'ner': 80.39701989517967}\n", 890 | "Losses {'ner': 88.47368139486248}\n", 891 | "Losses {'ner': 7.267329299856783}\n", 892 | "Losses {'ner': 12.394975090433718}\n", 893 | "Losses {'ner': 18.80508978482044}\n", 894 | "Losses {'ner': 25.10083458715758}\n", 895 | "Losses {'ner': 32.82858128243765}\n", 896 | "Losses {'ner': 38.933663268375085}\n", 897 | "Losses {'ner': 47.485912860172675}\n", 898 | "Losses {'ner': 52.68135553868956}\n", 899 | "Losses {'ner': 58.55016654720998}\n", 900 | "Losses {'ner': 62.964021319635094}\n", 901 | "Losses {'ner': 69.20357800686065}\n", 902 | "Losses {'ner': 76.55649184532263}\n", 903 | "Losses {'ner': 82.56757160780285}\n", 904 | "Losses {'ner': 6.008643825389299}\n", 905 | "Losses {'ner': 13.944438790987078}\n", 906 | "Losses {'ner': 21.86602721930558}\n", 907 | "Losses {'ner': 26.233721565423366}\n", 908 | "Losses {'ner': 32.08912624741515}\n", 909 | "Losses {'ner': 36.24286127014511}\n", 910 | "Losses {'ner': 42.69277259485989}\n", 911 | "Losses {'ner': 50.11690911429196}\n", 912 | "Losses {'ner': 56.36595115798718}\n", 913 | "Losses {'ner': 63.62283209018369}\n", 914 | "Losses {'ner': 70.0706490575077}\n", 915 | "Losses {'ner': 76.87213033751789}\n", 916 | "Losses {'ner': 83.73066490669692}\n", 917 | "Losses {'ner': 5.595291564241052}\n", 918 | "Losses {'ner': 12.640726855024695}\n", 919 | "Losses {'ner': 19.07795881293714}\n", 920 | "Losses {'ner': 25.9683241751045}\n", 921 | "Losses {'ner': 30.03958389442414}\n", 922 | "Losses {'ner': 39.36873910110444}\n", 923 | "Losses {'ner': 44.46404045289735}\n", 924 | "Losses {'ner': 50.86518745711426}\n", 925 | "Losses {'ner': 55.493878163680236}\n", 926 | "Losses {'ner': 62.71111221267263}\n", 927 | "Losses {'ner': 69.83916460948883}\n", 928 | "Losses {'ner': 76.90433593320547}\n", 929 | "Losses {'ner': 83.55203993937819}\n", 930 | "Losses {'ner': 3.552855370566249}\n", 931 | "Losses {'ner': 8.363671364844777}\n", 932 | "Losses {'ner': 15.088690411881544}\n", 933 | "Losses {'ner': 23.58288453205023}\n", 934 | "Losses {'ner': 29.05741092993412}\n", 935 | "Losses {'ner': 37.66278070642147}\n", 936 | "Losses {'ner': 47.43216216994915}\n", 937 | "Losses {'ner': 53.53581718041096}\n", 938 | "Losses {'ner': 60.54849595448468}\n", 939 | "Losses {'ner': 68.35864886885975}\n", 940 | "Losses {'ner': 74.5370900692651}\n", 941 | "Losses {'ner': 82.01954089535866}\n", 942 | "Losses {'ner': 89.1256180597702}\n", 943 | "Losses {'ner': 4.386830955038022}\n", 944 | "Losses {'ner': 11.477327137479733}\n", 945 | "Losses {'ner': 19.345326095113705}\n", 946 | "Losses {'ner': 26.28862206334452}\n", 947 | "Losses {'ner': 31.16216084802727}\n", 948 | "Losses {'ner': 36.0316643145934}\n", 949 | "Losses {'ner': 39.893646587996955}\n", 950 | "Losses {'ner': 47.816273869394536}\n", 951 | "Losses {'ner': 49.94888177727444}\n", 952 | "Losses {'ner': 58.3159504160667}\n", 953 | "Losses {'ner': 63.89180660344755}\n", 954 | "Losses {'ner': 70.34508086139431}\n", 955 | "Losses {'ner': 75.0796094625639}\n", 956 | "Losses {'ner': 7.107414930127561}\n", 957 | "Losses {'ner': 14.873883872292936}\n", 958 | "Losses {'ner': 23.62517604138702}\n", 959 | "Losses {'ner': 31.6246095886454}\n", 960 | "Losses {'ner': 39.79474756773561}\n", 961 | "Losses {'ner': 48.04249602841446}\n", 962 | "Losses {'ner': 53.8283535031951}\n", 963 | "Losses {'ner': 60.82325650121493}\n", 964 | "Losses {'ner': 65.706233171848}\n", 965 | "Losses {'ner': 73.48395843627804}\n", 966 | "Losses {'ner': 79.55973751666897}\n", 967 | "Losses {'ner': 88.67623837116116}\n", 968 | "Losses {'ner': 93.79223574521893}\n", 969 | "Losses {'ner': 7.463415324687958}\n", 970 | "Losses {'ner': 10.704512495314702}\n", 971 | "Losses {'ner': 18.03542872122489}\n", 972 | "Losses {'ner': 24.034727442311123}\n", 973 | "Losses {'ner': 29.876417714403942}\n", 974 | "Losses {'ner': 36.88550396566279}\n", 975 | "Losses {'ner': 41.202513690135675}\n", 976 | "Losses {'ner': 48.235695834300714}\n", 977 | "Losses {'ner': 54.26388071945985}\n", 978 | "Losses {'ner': 62.00098161867936}\n", 979 | "Losses {'ner': 68.79495506643434}\n", 980 | "Losses {'ner': 76.06022700018366}\n", 981 | "Losses {'ner': 84.55210548362811}\n", 982 | "Losses {'ner': 6.645692032761872}\n", 983 | "Losses {'ner': 14.111456833372358}\n", 984 | "Losses {'ner': 18.48231408704305}\n", 985 | "Losses {'ner': 24.92221527505899}\n", 986 | "Losses {'ner': 27.762354026057437}\n", 987 | "Losses {'ner': 36.94970829270096}\n", 988 | "Losses {'ner': 44.26456247578153}\n", 989 | "Losses {'ner': 50.02071151445398}\n", 990 | "Losses {'ner': 57.87435189383814}\n", 991 | "Losses {'ner': 64.7145290014405}\n", 992 | "Losses {'ner': 70.37311826709902}\n", 993 | "Losses {'ner': 77.90851117381953}\n", 994 | "Losses {'ner': 83.47508913179172}\n", 995 | "Losses {'ner': 8.268823377788067}\n", 996 | "Losses {'ner': 15.825346322046244}\n", 997 | "Losses {'ner': 22.74720203092147}\n", 998 | "Losses {'ner': 28.995603633651626}\n", 999 | "Losses {'ner': 35.583894913623226}\n", 1000 | "Losses {'ner': 42.896402183920145}\n", 1001 | "Losses {'ner': 47.78210600093007}\n", 1002 | "Losses {'ner': 52.73067970760167}\n", 1003 | "Losses {'ner': 58.09169026321615}\n", 1004 | "Losses {'ner': 64.215906521742}\n", 1005 | "Losses {'ner': 72.24991682471591}\n", 1006 | "Losses {'ner': 78.17425698848092}\n", 1007 | "Losses {'ner': 84.95616552667343}\n", 1008 | "Losses {'ner': 6.5665977001190186}\n", 1009 | "Losses {'ner': 12.40533014247194}\n", 1010 | "Losses {'ner': 18.774549855617806}\n", 1011 | "Losses {'ner': 28.8088083404582}\n", 1012 | "Losses {'ner': 34.66438569908496}\n", 1013 | "Losses {'ner': 43.391613020561635}\n", 1014 | "Losses {'ner': 49.92555584292859}\n", 1015 | "Losses {'ner': 59.14005197864026}\n", 1016 | "Losses {'ner': 66.25592173915356}\n", 1017 | "Losses {'ner': 74.79643811564893}\n", 1018 | "Losses {'ner': 80.32828738703392}\n", 1019 | "Losses {'ner': 86.72585726692341}\n", 1020 | "Losses {'ner': 90.11268468829803}\n", 1021 | "Losses {'ner': 4.781740781851113}\n", 1022 | "Losses {'ner': 10.941771387122571}\n", 1023 | "Losses {'ner': 17.50343659427017}\n", 1024 | "Losses {'ner': 25.531256082445907}\n", 1025 | "Losses {'ner': 34.055561423396284}\n", 1026 | "Losses {'ner': 39.05874046879035}\n", 1027 | "Losses {'ner': 42.3193508517943}\n", 1028 | "Losses {'ner': 49.17586146118265}\n", 1029 | "Losses {'ner': 58.080916924496705}\n", 1030 | "Losses {'ner': 64.4122991581462}\n", 1031 | "Losses {'ner': 74.81740814643126}\n", 1032 | "Losses {'ner': 78.99565234516922}\n", 1033 | "Losses {'ner': 87.99236631130043}\n", 1034 | "Losses {'ner': 4.514492720365524}\n", 1035 | "Losses {'ner': 12.087407071143389}\n", 1036 | "Losses {'ner': 20.238585067912936}\n", 1037 | "Losses {'ner': 26.163435309863416}\n", 1038 | "Losses {'ner': 33.37971895906958}\n", 1039 | "Losses {'ner': 36.73318888796848}\n", 1040 | "Losses {'ner': 44.177985927000464}\n", 1041 | "Losses {'ner': 49.33485355778021}\n", 1042 | "Losses {'ner': 55.0716436634807}\n", 1043 | "Losses {'ner': 61.1027386467008}\n", 1044 | "Losses {'ner': 70.97005662126821}\n", 1045 | "Losses {'ner': 77.25728753013891}\n", 1046 | "Losses {'ner': 82.91136272056383}\n", 1047 | "Losses {'ner': 6.537257420294736}\n", 1048 | "Losses {'ner': 15.16368311869428}\n", 1049 | "Losses {'ner': 22.0924280885838}\n", 1050 | "Losses {'ner': 25.415498923673113}\n", 1051 | "Losses {'ner': 35.07209051789232}\n", 1052 | "Losses {'ner': 40.617130395187814}\n", 1053 | "Losses {'ner': 46.86211402288154}\n", 1054 | "Losses {'ner': 50.880999955627885}\n", 1055 | "Losses {'ner': 56.94473835900408}\n", 1056 | "Losses {'ner': 65.26284208968264}\n", 1057 | "Losses {'ner': 68.41684644860197}\n", 1058 | "Losses {'ner': 73.19268246185948}\n", 1059 | "Losses {'ner': 78.72397523564268}\n", 1060 | "Losses {'ner': 6.492917105555534}\n", 1061 | "Losses {'ner': 9.447652729799302}\n", 1062 | "Losses {'ner': 16.86150358301893}\n", 1063 | "Losses {'ner': 22.70672076091796}\n", 1064 | "Losses {'ner': 28.40200124203693}\n", 1065 | "Losses {'ner': 36.966259577820324}\n", 1066 | "Losses {'ner': 43.32156383578092}\n", 1067 | "Losses {'ner': 51.431028749387565}\n", 1068 | "Losses {'ner': 55.24573470658049}\n", 1069 | "Losses {'ner': 60.368544218919936}\n", 1070 | "Losses {'ner': 68.30763037302322}\n", 1071 | "Losses {'ner': 73.71526834168262}\n", 1072 | "Losses {'ner': 78.62923224090272}\n", 1073 | "Losses {'ner': 7.614809278398752}\n", 1074 | "Losses {'ner': 14.838686618953943}\n", 1075 | "Losses {'ner': 21.59251133390353}\n", 1076 | "Losses {'ner': 26.641014084598282}\n", 1077 | "Losses {'ner': 30.840124776383163}\n", 1078 | "Losses {'ner': 35.58412731651333}\n", 1079 | "Losses {'ner': 41.40802976980922}\n", 1080 | "Losses {'ner': 45.333102370175766}\n", 1081 | "Losses {'ner': 54.77531527218525}\n", 1082 | "Losses {'ner': 60.35960794475977}\n", 1083 | "Losses {'ner': 68.02633477273048}\n", 1084 | "Losses {'ner': 73.47386417389498}\n", 1085 | "Losses {'ner': 82.25145116486237}\n", 1086 | "Losses {'ner': 8.080968966940418}\n", 1087 | "Losses {'ner': 12.764057344174944}\n", 1088 | "Losses {'ner': 22.258020958281122}\n", 1089 | "Losses {'ner': 29.128980206674896}\n", 1090 | "Losses {'ner': 34.95773560809903}\n", 1091 | "Losses {'ner': 41.00505122332834}\n", 1092 | "Losses {'ner': 44.01229843809415}\n", 1093 | "Losses {'ner': 48.90942977711564}\n", 1094 | "Losses {'ner': 55.60595857881015}\n", 1095 | "Losses {'ner': 61.846775752136075}\n", 1096 | "Losses {'ner': 69.22197751385863}\n", 1097 | "Losses {'ner': 75.74375865636864}\n", 1098 | "Losses {'ner': 81.46859660328516}\n", 1099 | "Losses {'ner': 7.235373020172119}\n", 1100 | "Losses {'ner': 12.90767341479659}\n", 1101 | "Losses {'ner': 20.751261826604605}\n", 1102 | "Losses {'ner': 28.650986041873693}\n", 1103 | "Losses {'ner': 33.342637716108584}\n", 1104 | "Losses {'ner': 37.32369215971994}\n", 1105 | "Losses {'ner': 43.842807831235405}\n", 1106 | "Losses {'ner': 48.85055918299622}\n", 1107 | "Losses {'ner': 53.98512790075256}\n", 1108 | "Losses {'ner': 59.321851252603665}\n", 1109 | "Losses {'ner': 62.578237176359835}\n", 1110 | "Losses {'ner': 68.71189750400299}\n", 1111 | "Losses {'ner': 75.3033536639523}\n", 1112 | "Losses {'ner': 7.133889243006706}\n", 1113 | "Losses {'ner': 13.988134307786822}\n", 1114 | "Losses {'ner': 19.65898352547083}\n", 1115 | "Losses {'ner': 27.34392664639745}\n", 1116 | "Losses {'ner': 31.678356120249646}\n", 1117 | "Losses {'ner': 36.05530745967144}\n", 1118 | "Losses {'ner': 43.66263981222028}\n", 1119 | "Losses {'ner': 47.74575169683112}\n", 1120 | "Losses {'ner': 53.74333379157497}\n", 1121 | "Losses {'ner': 62.123674382182344}\n", 1122 | "Losses {'ner': 65.78710662947879}\n", 1123 | "Losses {'ner': 74.10709151254878}\n", 1124 | "Losses {'ner': 77.34646128806662}\n", 1125 | "Losses {'ner': 7.386076789116487}\n", 1126 | "Losses {'ner': 13.346814602380618}\n", 1127 | "Losses {'ner': 23.344415455823764}\n", 1128 | "Losses {'ner': 29.34816974439309}\n", 1129 | "Losses {'ner': 37.71751240904996}\n", 1130 | "Losses {'ner': 43.212573508273636}\n", 1131 | "Losses {'ner': 52.44825218106416}\n", 1132 | "Losses {'ner': 60.26342637325433}\n", 1133 | "Losses {'ner': 61.55934809016435}\n", 1134 | "Losses {'ner': 64.87728607266581}\n", 1135 | "Losses {'ner': 73.51712508484161}\n", 1136 | "Losses {'ner': 76.43493828825558}\n", 1137 | "Losses {'ner': 83.77503696732128}\n", 1138 | "Losses {'ner': 7.823294808142236}\n", 1139 | "Losses {'ner': 14.651349124251283}\n", 1140 | "Losses {'ner': 22.08894000084547}\n", 1141 | "Losses {'ner': 26.638005364395212}\n", 1142 | "Losses {'ner': 32.52366303250892}\n", 1143 | "Losses {'ner': 37.6890615298762}\n", 1144 | "Losses {'ner': 46.07308448845288}\n", 1145 | "Losses {'ner': 52.21123395122413}\n", 1146 | "Losses {'ner': 57.68634887081862}\n", 1147 | "Losses {'ner': 62.6525201213517}\n", 1148 | "Losses {'ner': 70.18890241468034}\n", 1149 | "Losses {'ner': 74.9283506267675}\n", 1150 | "Losses {'ner': 79.14042073050223}\n", 1151 | "Losses {'ner': 7.583351444453001}\n", 1152 | "Losses {'ner': 13.056310055049835}\n", 1153 | "Losses {'ner': 19.22780205397794}\n", 1154 | "Losses {'ner': 26.302310437848064}\n", 1155 | "Losses {'ner': 33.79817317462221}\n", 1156 | "Losses {'ner': 40.94311181631565}\n", 1157 | "Losses {'ner': 48.286823579936026}\n", 1158 | "Losses {'ner': 55.127251835434436}\n", 1159 | "Losses {'ner': 58.73526621547171}\n", 1160 | "Losses {'ner': 63.704075486470174}\n", 1161 | "Losses {'ner': 69.91336625449003}\n", 1162 | "Losses {'ner': 75.7548811361903}\n", 1163 | "Losses {'ner': 84.44384131028892}\n", 1164 | "Losses {'ner': 4.143034110747976}\n", 1165 | "Losses {'ner': 10.940760768920882}\n", 1166 | "Losses {'ner': 17.69622656700085}\n", 1167 | "Losses {'ner': 22.33204381665564}\n", 1168 | "Losses {'ner': 29.654015948384767}\n", 1169 | "Losses {'ner': 34.11939722797251}\n", 1170 | "Losses {'ner': 41.57356312623597}\n", 1171 | "Losses {'ner': 45.765403147517645}\n", 1172 | "Losses {'ner': 52.05478136587044}\n", 1173 | "Losses {'ner': 56.95909354622563}\n", 1174 | "Losses {'ner': 60.63823323700581}\n", 1175 | "Losses {'ner': 67.3103622123972}\n", 1176 | "Losses {'ner': 76.61216967556629}\n", 1177 | "Losses {'ner': 3.1394224162736464}\n", 1178 | "Losses {'ner': 6.996966505708315}\n", 1179 | "Losses {'ner': 15.330051367980104}\n", 1180 | "Losses {'ner': 20.949886517476898}\n", 1181 | "Losses {'ner': 26.547738167334956}\n", 1182 | "Losses {'ner': 29.66400126949293}\n", 1183 | "Losses {'ner': 35.035395520034854}\n", 1184 | "Losses {'ner': 42.335485152195815}\n", 1185 | "Losses {'ner': 45.65968617068711}\n", 1186 | "Losses {'ner': 53.842142425646216}\n", 1187 | "Losses {'ner': 58.338013922964365}\n", 1188 | "Losses {'ner': 64.12843474948886}\n", 1189 | "Losses {'ner': 69.94904600380096}\n", 1190 | "Losses {'ner': 4.7903914377093315}\n", 1191 | "Losses {'ner': 14.118436453863978}\n", 1192 | "Losses {'ner': 16.206538774247605}\n", 1193 | "Losses {'ner': 24.580629110510785}\n", 1194 | "Losses {'ner': 29.178748597776433}\n", 1195 | "Losses {'ner': 32.762789634674704}\n", 1196 | "Losses {'ner': 41.70889076372973}\n", 1197 | "Losses {'ner': 47.84914675137392}\n", 1198 | "Losses {'ner': 56.79523848338417}\n", 1199 | "Losses {'ner': 65.4979663078337}\n", 1200 | "Losses {'ner': 69.69834875405635}\n", 1201 | "Losses {'ner': 75.2843687270923}\n", 1202 | "Losses {'ner': 80.87823669586018}\n", 1203 | "Losses {'ner': 6.253481306369395}\n", 1204 | "Losses {'ner': 10.255680754723471}\n", 1205 | "Losses {'ner': 14.465247182118219}\n", 1206 | "Losses {'ner': 20.31482612149648}\n", 1207 | "Losses {'ner': 29.41139607684545}\n", 1208 | "Losses {'ner': 36.53791334707148}\n", 1209 | "Losses {'ner': 42.61875774938471}\n", 1210 | "Losses {'ner': 48.89421547058828}\n", 1211 | "Losses {'ner': 56.431272870338034}\n", 1212 | "Losses {'ner': 62.54641126882143}\n", 1213 | "Losses {'ner': 69.69187457714088}\n", 1214 | "Losses {'ner': 77.50158145454634}\n", 1215 | "Losses {'ner': 83.37316652935851}\n", 1216 | "Losses {'ner': 5.605774514377117}\n", 1217 | "Losses {'ner': 13.651636060327291}\n", 1218 | "Losses {'ner': 17.319933862444287}\n", 1219 | "Losses {'ner': 23.2110553918599}\n", 1220 | "Losses {'ner': 29.22553437284003}\n", 1221 | "Losses {'ner': 36.454271803487046}\n", 1222 | "Losses {'ner': 43.75090071869343}\n", 1223 | "Losses {'ner': 48.87950357146181}\n", 1224 | "Losses {'ner': 52.17406280030062}\n", 1225 | "Losses {'ner': 62.33053126347457}\n", 1226 | "Losses {'ner': 67.03141824139473}\n", 1227 | "Losses {'ner': 74.33809301985619}\n", 1228 | "Losses {'ner': 79.54786646244773}\n", 1229 | "Losses {'ner': 7.555436967253627}\n", 1230 | "Losses {'ner': 14.701540867699805}\n", 1231 | "Losses {'ner': 19.493387867598358}\n", 1232 | "Losses {'ner': 26.59218355863777}\n", 1233 | "Losses {'ner': 33.74177704602698}\n", 1234 | "Losses {'ner': 38.28457968936709}\n", 1235 | "Losses {'ner': 41.702039482755936}\n", 1236 | "Losses {'ner': 47.07303230346588}\n", 1237 | "Losses {'ner': 53.27178078406723}\n", 1238 | "Losses {'ner': 58.237387371613295}\n", 1239 | "Losses {'ner': 65.63954005141471}\n", 1240 | "Losses {'ner': 73.91638269399022}\n", 1241 | "Losses {'ner': 78.54094024014097}\n", 1242 | "Losses {'ner': 6.940446823136881}\n", 1243 | "Losses {'ner': 10.068576643605866}\n", 1244 | "Losses {'ner': 15.102315190144964}\n", 1245 | "Losses {'ner': 20.310726244407192}\n", 1246 | "Losses {'ner': 27.627221037107006}\n", 1247 | "Losses {'ner': 33.2914987452649}\n", 1248 | "Losses {'ner': 39.42318183037867}\n", 1249 | "Losses {'ner': 44.09777679760563}\n", 1250 | "Losses {'ner': 49.92520274169701}\n", 1251 | "Losses {'ner': 56.368927940204316}\n", 1252 | "Losses {'ner': 61.62623128056484}\n", 1253 | "Losses {'ner': 66.08863844462584}\n", 1254 | "Losses {'ner': 72.3636852706787}\n", 1255 | "Losses {'ner': 3.9063876305590384}\n", 1256 | "Losses {'ner': 11.182184353179764}\n", 1257 | "Losses {'ner': 17.320483825809788}\n", 1258 | "Losses {'ner': 21.82736676716013}\n", 1259 | "Losses {'ner': 26.978839976422023}\n", 1260 | "Losses {'ner': 35.25846734427614}\n", 1261 | "Losses {'ner': 42.14318102023117}\n", 1262 | "Losses {'ner': 53.140204096050184}\n", 1263 | "Losses {'ner': 60.312283285028855}\n", 1264 | "Losses {'ner': 69.18041259802095}\n", 1265 | "Losses {'ner': 76.35347509157992}\n", 1266 | "Losses {'ner': 84.25124499348141}\n", 1267 | "Losses {'ner': 89.80625692528821}\n", 1268 | "Losses {'ner': 7.052966690855101}\n", 1269 | "Losses {'ner': 14.807016945676878}\n", 1270 | "Losses {'ner': 18.850947944447398}\n", 1271 | "Losses {'ner': 25.065566035569645}\n", 1272 | "Losses {'ner': 29.55539320554817}\n", 1273 | "Losses {'ner': 36.29180514597101}\n", 1274 | "Losses {'ner': 43.0758562401752}\n", 1275 | "Losses {'ner': 51.108350197726395}\n", 1276 | "Losses {'ner': 57.159085388237145}\n", 1277 | "Losses {'ner': 64.10013157286448}\n", 1278 | "Losses {'ner': 69.62351632147329}\n", 1279 | "Losses {'ner': 77.38214967055501}\n", 1280 | "Losses {'ner': 84.95074955029668}\n", 1281 | "Losses {'ner': 6.31663417625532}\n", 1282 | "Losses {'ner': 12.474777871233528}\n", 1283 | "Losses {'ner': 18.686473332243622}\n", 1284 | "Losses {'ner': 27.102643392878235}\n", 1285 | "Losses {'ner': 33.05748572855555}\n", 1286 | "Losses {'ner': 42.021924405389655}\n", 1287 | "Losses {'ner': 49.75613671451174}\n", 1288 | "Losses {'ner': 53.16174440665236}\n", 1289 | "Losses {'ner': 57.85118982961467}\n", 1290 | "Losses {'ner': 61.67038379094629}\n", 1291 | "Losses {'ner': 70.33071285759979}\n", 1292 | "Losses {'ner': 76.06850663352998}\n", 1293 | "Losses {'ner': 84.55335146714242}\n", 1294 | "Losses {'ner': 6.882367193698883}\n", 1295 | "Losses {'ner': 14.991978883743286}\n", 1296 | "Losses {'ner': 20.35892853140831}\n", 1297 | "Losses {'ner': 28.885643810033798}\n", 1298 | "Losses {'ner': 37.08068811893463}\n", 1299 | "Losses {'ner': 43.022685972973704}\n", 1300 | "Losses {'ner': 47.26658419275191}\n", 1301 | "Losses {'ner': 53.524310791515745}\n", 1302 | "Losses {'ner': 59.415877660387196}\n", 1303 | "Losses {'ner': 65.67114584109368}\n", 1304 | "Losses {'ner': 72.25112866385462}\n", 1305 | "Losses {'ner': 77.15445849324897}\n", 1306 | "Losses {'ner': 82.81206206266506}\n", 1307 | "Losses {'ner': 7.077811315655708}\n", 1308 | "Losses {'ner': 11.403119133989094}\n", 1309 | "Losses {'ner': 17.273290179873584}\n", 1310 | "Losses {'ner': 24.711534880305408}\n", 1311 | "Losses {'ner': 30.139073155791266}\n", 1312 | "Losses {'ner': 39.19652055946062}\n", 1313 | "Losses {'ner': 47.687054995883955}\n", 1314 | "Losses {'ner': 52.22401480792905}\n", 1315 | "Losses {'ner': 60.54090423739399}\n", 1316 | "Losses {'ner': 66.35366904173861}\n", 1317 | "Losses {'ner': 72.69266801952836}\n", 1318 | "Losses {'ner': 79.66821123539921}\n", 1319 | "Losses {'ner': 84.29866424339343}\n", 1320 | "Losses {'ner': 8.931178092956543}\n", 1321 | "Losses {'ner': 14.905956414029674}\n", 1322 | "Losses {'ner': 21.635423675379457}\n", 1323 | "Losses {'ner': 29.590134456953706}\n", 1324 | "Losses {'ner': 34.080090366503896}\n", 1325 | "Losses {'ner': 39.52374214699}\n", 1326 | "Losses {'ner': 45.5616999372977}\n", 1327 | "Losses {'ner': 53.719382594539525}\n", 1328 | "Losses {'ner': 59.52033243627727}\n", 1329 | "Losses {'ner': 67.48013494579561}\n", 1330 | "Losses {'ner': 75.0627230633653}\n", 1331 | "Losses {'ner': 80.15510035996328}\n", 1332 | "Losses {'ner': 85.92710114960562}\n", 1333 | "Losses {'ner': 3.241704310523346}\n", 1334 | "Losses {'ner': 8.383502061842592}\n", 1335 | "Losses {'ner': 12.66199148657688}\n", 1336 | "Losses {'ner': 18.278261808696698}\n", 1337 | "Losses {'ner': 25.261617517582636}\n", 1338 | "Losses {'ner': 32.86002536809883}\n", 1339 | "Losses {'ner': 38.375920614063034}\n", 1340 | "Losses {'ner': 47.11175542122055}\n", 1341 | "Losses {'ner': 53.620146734475384}\n", 1342 | "Losses {'ner': 59.951655162333736}\n", 1343 | "Losses {'ner': 68.52800635790754}\n", 1344 | "Losses {'ner': 75.44279704608255}\n", 1345 | "Losses {'ner': 76.44856812027493}\n", 1346 | "Losses {'ner': 5.288189964810954}\n", 1347 | "Losses {'ner': 12.120875435392009}\n", 1348 | "Losses {'ner': 16.77615447293465}\n", 1349 | "Losses {'ner': 21.70550007474958}\n", 1350 | "Losses {'ner': 29.638738118461333}\n", 1351 | "Losses {'ner': 35.24221098644193}\n", 1352 | "Losses {'ner': 41.38656534088659}\n", 1353 | "Losses {'ner': 46.71279574764776}\n", 1354 | "Losses {'ner': 51.835539745370625}\n", 1355 | "Losses {'ner': 58.72802058851812}\n", 1356 | "Losses {'ner': 64.93275560633629}\n", 1357 | "Losses {'ner': 72.05368276135414}\n", 1358 | "Losses {'ner': 78.92801468688413}\n", 1359 | "Losses {'ner': 4.997875289060175}\n", 1360 | "Losses {'ner': 12.44464706722647}\n", 1361 | "Losses {'ner': 18.801269436057964}\n", 1362 | "Losses {'ner': 25.01766021716253}\n", 1363 | "Losses {'ner': 33.7241105006899}\n", 1364 | "Losses {'ner': 37.62334695166578}\n", 1365 | "Losses {'ner': 44.89436458376372}\n", 1366 | "Losses {'ner': 54.199951964888214}\n", 1367 | "Losses {'ner': 61.985517682034015}\n", 1368 | "Losses {'ner': 68.15278232224887}\n", 1369 | "Losses {'ner': 74.4315431726784}\n", 1370 | "Losses {'ner': 80.77984000869697}\n", 1371 | "Losses {'ner': 86.21125192598561}\n", 1372 | "Losses {'ner': 3.182976794298156}\n", 1373 | "Losses {'ner': 10.827662181909545}\n", 1374 | "Losses {'ner': 16.76511937806208}\n", 1375 | "Losses {'ner': 23.689743049788376}\n", 1376 | "Losses {'ner': 31.3303825933217}\n", 1377 | "Losses {'ner': 37.841318663426215}\n", 1378 | "Losses {'ner': 44.454095896549994}\n", 1379 | "Losses {'ner': 50.321228619881445}\n", 1380 | "Losses {'ner': 55.77180905964459}\n", 1381 | "Losses {'ner': 63.039921108151326}\n", 1382 | "Losses {'ner': 72.57791644659127}\n", 1383 | "Losses {'ner': 79.83542353312123}\n", 1384 | "Losses {'ner': 84.82802598692115}\n", 1385 | "Losses {'ner': 4.870517799106892}\n", 1386 | "Losses {'ner': 9.635573440638836}\n", 1387 | "Losses {'ner': 16.07311622564498}\n", 1388 | "Losses {'ner': 21.54842395101491}\n", 1389 | "Losses {'ner': 30.466530280642246}\n", 1390 | "Losses {'ner': 39.34760852389786}\n", 1391 | "Losses {'ner': 44.90468266887524}\n", 1392 | "Losses {'ner': 55.05723223371365}\n", 1393 | "Losses {'ner': 60.08072801029243}\n", 1394 | "Losses {'ner': 63.440540981817094}\n", 1395 | "Losses {'ner': 68.92739813808635}\n", 1396 | "Losses {'ner': 75.78703743625715}\n", 1397 | "Losses {'ner': 84.27617758918836}\n", 1398 | "Losses {'ner': 5.38603750243783}\n", 1399 | "Losses {'ner': 10.379909493669402}\n", 1400 | "Losses {'ner': 16.75790695165051}\n", 1401 | "Losses {'ner': 20.660184365086025}\n", 1402 | "Losses {'ner': 25.760827810358023}\n", 1403 | "Losses {'ner': 34.79948289770982}\n", 1404 | "Losses {'ner': 41.95803745216108}\n", 1405 | "Losses {'ner': 46.79503007358289}\n", 1406 | "Losses {'ner': 57.14320255941129}\n", 1407 | "Losses {'ner': 62.28917074776837}\n", 1408 | "Losses {'ner': 70.4419899044151}\n", 1409 | "Losses {'ner': 76.78111679121503}\n", 1410 | "Losses {'ner': 82.40960066865955}\n", 1411 | "Losses {'ner': 6.116316489875317}\n", 1412 | "Losses {'ner': 10.975878477445804}\n", 1413 | "Losses {'ner': 15.064156043521507}\n", 1414 | "Losses {'ner': 21.931600579238875}\n", 1415 | "Losses {'ner': 29.71448987088297}\n", 1416 | "Losses {'ner': 34.937778369701846}\n", 1417 | "Losses {'ner': 41.405659373911476}\n", 1418 | "Losses {'ner': 46.92887409547984}\n", 1419 | "Losses {'ner': 53.14050308223523}\n", 1420 | "Losses {'ner': 58.16674426179088}\n", 1421 | "Losses {'ner': 65.6137188149587}\n", 1422 | "Losses {'ner': 71.20085164460033}\n", 1423 | "Losses {'ner': 78.443335310767}\n", 1424 | "Losses {'ner': 6.719270663335919}\n", 1425 | "Losses {'ner': 10.080099251352294}\n", 1426 | "Losses {'ner': 17.289016708118652}\n", 1427 | "Losses {'ner': 23.975394608276474}\n", 1428 | "Losses {'ner': 31.80285629007085}\n", 1429 | "Losses {'ner': 36.45334438403188}\n", 1430 | "Losses {'ner': 44.667302060695874}\n", 1431 | "Losses {'ner': 52.336811622428286}\n", 1432 | "Losses {'ner': 56.575909943690306}\n", 1433 | "Losses {'ner': 63.58583530168772}\n", 1434 | "Losses {'ner': 70.16782011966944}\n", 1435 | "Losses {'ner': 77.25562041383029}\n", 1436 | "Losses {'ner': 84.28154261659739}\n", 1437 | "Losses {'ner': 6.15818877518177}\n", 1438 | "Losses {'ner': 8.392752793617547}\n", 1439 | "Losses {'ner': 11.814364368037786}\n", 1440 | "Losses {'ner': 19.46136626036605}\n", 1441 | "Losses {'ner': 25.38579276757082}\n", 1442 | "Losses {'ner': 30.184429848508444}\n", 1443 | "Losses {'ner': 37.499867483504204}\n", 1444 | "Losses {'ner': 45.101836516983894}\n", 1445 | "Losses {'ner': 50.58294522435972}\n", 1446 | "Losses {'ner': 58.295316771775106}\n", 1447 | "Losses {'ner': 61.71394894519108}\n", 1448 | "Losses {'ner': 70.1279628141292}\n", 1449 | "Losses {'ner': 78.48247122742214}\n", 1450 | "Losses {'ner': 3.7799961492419243}\n", 1451 | "Losses {'ner': 5.607337014924269}\n", 1452 | "Losses {'ner': 9.867693742526171}\n", 1453 | "Losses {'ner': 15.310485839516332}\n", 1454 | "Losses {'ner': 21.35267133692105}\n", 1455 | "Losses {'ner': 27.717523348124814}\n", 1456 | "Losses {'ner': 36.03405638465483}\n", 1457 | "Losses {'ner': 43.64756456443865}\n", 1458 | "Losses {'ner': 51.33586441825901}\n", 1459 | "Losses {'ner': 58.39303486269107}\n", 1460 | "Losses {'ner': 63.56403406697443}\n", 1461 | "Losses {'ner': 70.43514527094901}\n", 1462 | "Losses {'ner': 78.43793658626616}\n", 1463 | "Losses {'ner': 4.551006153662456}\n", 1464 | "Losses {'ner': 9.270739841696923}\n", 1465 | "Losses {'ner': 16.508745465849643}\n", 1466 | "Losses {'ner': 23.318560164843802}\n", 1467 | "Losses {'ner': 30.405887081942637}\n", 1468 | "Losses {'ner': 35.89903041459911}\n", 1469 | "Losses {'ner': 42.80805529859208}\n", 1470 | "Losses {'ner': 49.750526027943124}\n", 1471 | "Losses {'ner': 55.590017867289134}\n", 1472 | "Losses {'ner': 63.04861282992351}\n", 1473 | "Losses {'ner': 68.78677135954786}\n", 1474 | "Losses {'ner': 78.7510098839848}\n", 1475 | "Losses {'ner': 84.40201030996104}\n", 1476 | "Losses {'ner': 5.577748167794198}\n", 1477 | "Losses {'ner': 14.39321844605729}\n", 1478 | "Losses {'ner': 21.123241354711354}\n", 1479 | "Losses {'ner': 29.713366110809147}\n", 1480 | "Losses {'ner': 35.67117546219379}\n", 1481 | "Losses {'ner': 42.51247594226152}\n", 1482 | "Losses {'ner': 48.989836448803544}\n", 1483 | "Losses {'ner': 57.62905724719167}\n", 1484 | "Losses {'ner': 63.28432932161377}\n", 1485 | "Losses {'ner': 69.73693478769513}\n", 1486 | "Losses {'ner': 77.02527043035246}\n", 1487 | "Losses {'ner': 83.80437247699177}\n", 1488 | "Losses {'ner': 91.45013333070796}\n", 1489 | "Losses {'ner': 8.412069380283356}\n", 1490 | "Losses {'ner': 15.557243809453212}\n", 1491 | "Losses {'ner': 23.195824385038577}\n", 1492 | "Losses {'ner': 27.35690536996117}\n", 1493 | "Losses {'ner': 35.33570197125664}\n", 1494 | "Losses {'ner': 39.80603559728479}\n", 1495 | "Losses {'ner': 44.16846432205057}\n", 1496 | "Losses {'ner': 51.23934542800998}\n", 1497 | "Losses {'ner': 57.92587715800619}\n", 1498 | "Losses {'ner': 64.38810080703115}\n", 1499 | "Losses {'ner': 71.91367382224416}\n", 1500 | "Losses {'ner': 78.44656218698947}\n", 1501 | "Losses {'ner': 86.13516544288723}\n", 1502 | "Losses {'ner': 3.4549757752829464}\n", 1503 | "Losses {'ner': 10.937465131606587}\n", 1504 | "Losses {'ner': 16.669419446410757}\n", 1505 | "Losses {'ner': 22.133028844979663}\n", 1506 | "Losses {'ner': 29.862045686485317}\n", 1507 | "Losses {'ner': 35.977020424642205}\n", 1508 | "Losses {'ner': 39.2643885926684}\n", 1509 | "Losses {'ner': 47.608920575805534}\n", 1510 | "Losses {'ner': 54.801043827074515}\n", 1511 | "Losses {'ner': 60.05750121700259}\n", 1512 | "Losses {'ner': 65.61266832114927}\n", 1513 | "Losses {'ner': 74.51279573203794}\n", 1514 | "Losses {'ner': 80.9375157576593}\n", 1515 | "Losses {'ner': 6.593068707355997}\n", 1516 | "Losses {'ner': 10.359729807576514}\n", 1517 | "Losses {'ner': 15.674999844406898}\n", 1518 | "Losses {'ner': 22.155291059599563}\n", 1519 | "Losses {'ner': 24.358077613708133}\n", 1520 | "Losses {'ner': 27.63665918966433}\n", 1521 | "Losses {'ner': 33.523448469389564}\n", 1522 | "Losses {'ner': 37.58430328744305}\n", 1523 | "Losses {'ner': 43.51247703808201}\n", 1524 | "Losses {'ner': 49.823634583084754}\n", 1525 | "Losses {'ner': 58.26404936942356}\n", 1526 | "Losses {'ner': 67.27696071895855}\n", 1527 | "Losses {'ner': 74.40046207937496}\n", 1528 | "Losses {'ner': 5.977907687425613}\n", 1529 | "Losses {'ner': 13.078782816599414}\n", 1530 | "Losses {'ner': 18.95572342167179}\n", 1531 | "Losses {'ner': 28.826566176512642}\n", 1532 | "Losses {'ner': 36.45495801887046}\n", 1533 | "Losses {'ner': 44.59157094082366}\n", 1534 | "Losses {'ner': 50.64776426419303}\n", 1535 | "Losses {'ner': 60.2835187898545}\n", 1536 | "Losses {'ner': 67.37471464886949}\n", 1537 | "Losses {'ner': 72.11292514815614}\n", 1538 | "Losses {'ner': 78.36995261773154}\n", 1539 | "Losses {'ner': 85.80925923451468}\n", 1540 | "Losses {'ner': 93.29100587829635}\n", 1541 | "Losses {'ner': 7.815787151790573}\n", 1542 | "Losses {'ner': 11.15673613861145}\n", 1543 | "Losses {'ner': 16.425613711969618}\n", 1544 | "Losses {'ner': 23.691074888603453}\n", 1545 | "Losses {'ner': 30.56016135719574}\n", 1546 | "Losses {'ner': 37.58111973482619}\n", 1547 | "Losses {'ner': 43.96396818102539}\n", 1548 | "Losses {'ner': 50.58972517864049}\n", 1549 | "Losses {'ner': 58.84318719522298}\n", 1550 | "Losses {'ner': 66.56687836067022}\n", 1551 | "Losses {'ner': 72.31094032523424}\n", 1552 | "Losses {'ner': 78.01646963201665}\n", 1553 | "Losses {'ner': 82.09463906879273}\n", 1554 | "Losses {'ner': 6.1527100540697575}\n", 1555 | "Losses {'ner': 15.249372456222773}\n", 1556 | "Losses {'ner': 21.87581952288747}\n", 1557 | "Losses {'ner': 28.456940381322056}\n", 1558 | "Losses {'ner': 38.17753937700763}\n", 1559 | "Losses {'ner': 44.664814846486024}\n", 1560 | "Losses {'ner': 50.907221676677636}\n", 1561 | "Losses {'ner': 55.94363023144024}\n", 1562 | "Losses {'ner': 60.43137622320273}\n", 1563 | "Losses {'ner': 67.94295731627562}\n", 1564 | "Losses {'ner': 75.8638748655626}\n", 1565 | "Losses {'ner': 83.0759482461558}\n", 1566 | "Losses {'ner': 87.12488584234734}\n", 1567 | "Losses {'ner': 5.207469066594058}\n", 1568 | "Losses {'ner': 12.757944067929202}\n", 1569 | "Losses {'ner': 18.26412405258816}\n", 1570 | "Losses {'ner': 24.85775473899048}\n", 1571 | "Losses {'ner': 32.779475660983735}\n", 1572 | "Losses {'ner': 37.981145270712204}\n", 1573 | "Losses {'ner': 44.22041853626206}\n", 1574 | "Losses {'ner': 48.636176404759226}\n", 1575 | "Losses {'ner': 55.92832001785928}\n", 1576 | "Losses {'ner': 61.649481026904596}\n", 1577 | "Losses {'ner': 66.73730596491916}\n", 1578 | "Losses {'ner': 72.58180007983606}\n", 1579 | "Losses {'ner': 79.58921179890308}\n" 1580 | ], 1581 | "name": "stdout" 1582 | } 1583 | ] 1584 | }, 1585 | { 1586 | "cell_type": "code", 1587 | "metadata": { 1588 | "id": "EA6TgTfCAwHy", 1589 | "outputId": "7a68545b-1d37-421e-951e-7b91608a3e5e", 1590 | "colab": { 1591 | "base_uri": "https://localhost:8080/", 1592 | "height": 249 1593 | } 1594 | }, 1595 | "source": [ 1596 | "for text, _ in train:\n", 1597 | " doc = nlp(text)\n", 1598 | " print('Entities', [(ent.text, ent.label_) for ent in doc.ents])" 1599 | ], 1600 | "execution_count": null, 1601 | "outputs": [ 1602 | { 1603 | "output_type": "stream", 1604 | "text": [ 1605 | "Entities [('loan account', 'PRODUCT')]\n", 1606 | "Entities [('loan account', 'PRODUCT')]\n", 1607 | "Entities [('credit card', 'PRODUCT'), ('past', 'ACTIVITY')]\n", 1608 | "Entities [('payment', 'ACTIVITY')]\n", 1609 | "Entities [('loan account', 'PRODUCT'), ('funded', 'ACTIVITY')]\n", 1610 | "Entities [('mortgage', 'PRODUCT'), ('delinquent', 'ACTIVITY')]\n", 1611 | "Entities [('savings account', 'PRODUCT')]\n", 1612 | "Entities [('Investment account', 'PRODUCT')]\n", 1613 | "Entities [('payment', 'ACTIVITY'), ('credit card', 'PRODUCT')]\n", 1614 | "Entities [('checking account', 'PRODUCT')]\n", 1615 | "Entities [('credit card', 'PRODUCT')]\n", 1616 | "Entities [('savings account', 'PRODUCT')]\n", 1617 | "Entities [('credit card', 'PRODUCT')]\n" 1618 | ], 1619 | "name": "stdout" 1620 | } 1621 | ] 1622 | }, 1623 | { 1624 | "cell_type": "code", 1625 | "metadata": { 1626 | "id": "nVhzGDSwsD65", 1627 | "outputId": "81c18bd5-6c4b-4ee6-cd92-9ac7aef6061d", 1628 | "colab": { 1629 | "base_uri": "https://localhost:8080/", 1630 | "height": 69 1631 | } 1632 | }, 1633 | "source": [ 1634 | "from spacy import displacy\n", 1635 | "\n", 1636 | "doc = nlp(\"what is the process to open a new savings account\")\n", 1637 | "for ent in doc.ents:\n", 1638 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)\n", 1639 | "displacy.render(nlp(doc.text),style='ent', jupyter=True) " 1640 | ], 1641 | "execution_count": null, 1642 | "outputs": [ 1643 | { 1644 | "output_type": "stream", 1645 | "text": [ 1646 | "savings account 34 49 PRODUCT\n" 1647 | ], 1648 | "name": "stdout" 1649 | }, 1650 | { 1651 | "output_type": "display_data", 1652 | "data": { 1653 | "text/html": [ 1654 | "
what is the process to open a new \n", 1655 | "\n", 1656 | " savings account\n", 1657 | " PRODUCT\n", 1658 | "\n", 1659 | "
" 1660 | ], 1661 | "text/plain": [ 1662 | "" 1663 | ] 1664 | }, 1665 | "metadata": { 1666 | "tags": [] 1667 | } 1668 | } 1669 | ] 1670 | }, 1671 | { 1672 | "cell_type": "code", 1673 | "metadata": { 1674 | "id": "mBMyBLIB-VQ7", 1675 | "outputId": "674b7b75-330a-4b27-ff7e-22240a03433b", 1676 | "colab": { 1677 | "base_uri": "https://localhost:8080/", 1678 | "height": 53 1679 | } 1680 | }, 1681 | "source": [ 1682 | "doc = nlp(\"My credit card payment will be delayed\")\n", 1683 | "for ent in doc.ents:\n", 1684 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 1685 | ], 1686 | "execution_count": null, 1687 | "outputs": [ 1688 | { 1689 | "output_type": "stream", 1690 | "text": [ 1691 | "credit card 3 14 PRODUCT\n", 1692 | "payment 15 22 ACTIVITY\n" 1693 | ], 1694 | "name": "stdout" 1695 | } 1696 | ] 1697 | }, 1698 | { 1699 | "cell_type": "code", 1700 | "metadata": { 1701 | "id": "tSHMjsQlSU7H", 1702 | "outputId": "3b99a34e-d8d9-4673-f155-671f54ed72e1", 1703 | "colab": { 1704 | "base_uri": "https://localhost:8080/", 1705 | "height": 87 1706 | } 1707 | }, 1708 | "source": [ 1709 | "doc = nlp(\"what are the charges on credit card late payment in Bank of America\")\n", 1710 | "for ent in doc.ents:\n", 1711 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)\n", 1712 | "displacy.render(nlp(doc.text),style='ent', jupyter=True)" 1713 | ], 1714 | "execution_count": null, 1715 | "outputs": [ 1716 | { 1717 | "output_type": "stream", 1718 | "text": [ 1719 | "credit card 24 35 PRODUCT\n", 1720 | "payment 41 48 ACTIVITY\n" 1721 | ], 1722 | "name": "stdout" 1723 | }, 1724 | { 1725 | "output_type": "display_data", 1726 | "data": { 1727 | "text/html": [ 1728 | "
what are the charges on \n", 1729 | "\n", 1730 | " credit card\n", 1731 | " PRODUCT\n", 1732 | "\n", 1733 | " late \n", 1734 | "\n", 1735 | " payment\n", 1736 | " ACTIVITY\n", 1737 | "\n", 1738 | " in Bank of America
" 1739 | ], 1740 | "text/plain": [ 1741 | "" 1742 | ] 1743 | }, 1744 | "metadata": { 1745 | "tags": [] 1746 | } 1747 | } 1748 | ] 1749 | }, 1750 | { 1751 | "cell_type": "code", 1752 | "metadata": { 1753 | "id": "wpUXh5O4Czel", 1754 | "outputId": "d0a46892-34ee-450f-9424-89d16028bf27", 1755 | "colab": { 1756 | "base_uri": "https://localhost:8080/", 1757 | "height": 87 1758 | } 1759 | }, 1760 | "source": [ 1761 | "doc = nlp(\"I lost my investment account password and cannot open my account now\")\n", 1762 | "for ent in doc.ents:\n", 1763 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)\n", 1764 | "displacy.render(nlp(doc.text),style='ent', jupyter=True)" 1765 | ], 1766 | "execution_count": null, 1767 | "outputs": [ 1768 | { 1769 | "output_type": "stream", 1770 | "text": [ 1771 | "investment account 10 28 PRODUCT\n", 1772 | "account now 57 68 PRODUCT\n" 1773 | ], 1774 | "name": "stdout" 1775 | }, 1776 | { 1777 | "output_type": "display_data", 1778 | "data": { 1779 | "text/html": [ 1780 | "
I lost my \n", 1781 | "\n", 1782 | " investment account\n", 1783 | " PRODUCT\n", 1784 | "\n", 1785 | " password and cannot open my \n", 1786 | "\n", 1787 | " account now\n", 1788 | " PRODUCT\n", 1789 | "\n", 1790 | "
" 1791 | ], 1792 | "text/plain": [ 1793 | "" 1794 | ] 1795 | }, 1796 | "metadata": { 1797 | "tags": [] 1798 | } 1799 | } 1800 | ] 1801 | }, 1802 | { 1803 | "cell_type": "code", 1804 | "metadata": { 1805 | "id": "fHDymKSM-WMT", 1806 | "outputId": "aa82ad93-fe02-4959-a395-a985b16d99eb", 1807 | "colab": { 1808 | "base_uri": "https://localhost:8080/", 1809 | "height": 35 1810 | } 1811 | }, 1812 | "source": [ 1813 | "doc = nlp(\"what is the status of my loan account\")\n", 1814 | "for ent in doc.ents:\n", 1815 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 1816 | ], 1817 | "execution_count": null, 1818 | "outputs": [ 1819 | { 1820 | "output_type": "stream", 1821 | "text": [ 1822 | "loan account 25 37 PRODUCT\n" 1823 | ], 1824 | "name": "stdout" 1825 | } 1826 | ] 1827 | }, 1828 | { 1829 | "cell_type": "markdown", 1830 | "metadata": { 1831 | "id": "_ZwmoYM-oZQN" 1832 | }, 1833 | "source": [ 1834 | "https://explosion.ai/blog/pseudo-rehearsal-catastrophic-forgetting" 1835 | ] 1836 | }, 1837 | { 1838 | "cell_type": "code", 1839 | "metadata": { 1840 | "id": "3lx4MlM1oZ4v" 1841 | }, 1842 | "source": [ 1843 | "doc = nlp(\"Australia wants to force Facebook and Google to pay media companies for news\")\n", 1844 | "for ent in doc.ents:\n", 1845 | " print(ent.text, ent.start_char, ent.end_char, ent.label_)" 1846 | ], 1847 | "execution_count": null, 1848 | "outputs": [] 1849 | }, 1850 | { 1851 | "cell_type": "code", 1852 | "metadata": { 1853 | "id": "EVtDfQxxNZls" 1854 | }, 1855 | "source": [ 1856 | "" 1857 | ], 1858 | "execution_count": null, 1859 | "outputs": [] 1860 | } 1861 | ] 1862 | } -------------------------------------------------------------------------------- /Text_classification_Tensorflow_Multiclass.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "Text classification Tensorflow - Multiclass", 7 | "provenance": [], 8 | "authorship_tag": "ABX9TyMgMTEkgjgLBJHYrQheLmp5", 9 | "include_colab_link": true 10 | }, 11 | "kernelspec": { 12 | "name": "python3", 13 | "display_name": "Python 3" 14 | }, 15 | "accelerator": "GPU" 16 | }, 17 | "cells": [ 18 | { 19 | "cell_type": "markdown", 20 | "metadata": { 21 | "id": "view-in-github", 22 | "colab_type": "text" 23 | }, 24 | "source": [ 25 | "\"Open" 26 | ] 27 | }, 28 | { 29 | "cell_type": "markdown", 30 | "metadata": { 31 | "id": "w_WSckhF77Ny", 32 | "colab_type": "text" 33 | }, 34 | "source": [ 35 | "Link to video explaining the code is availale at - https://youtu.be/dkpS2g4K08s" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "metadata": { 41 | "id": "fUbFvR7LDB3U", 42 | "colab_type": "code", 43 | "colab": {} 44 | }, 45 | "source": [ 46 | "from __future__ import absolute_import, division, print_function, unicode_literals\n", 47 | "\n", 48 | "import tensorflow as tf\n", 49 | "\n", 50 | "import os\n", 51 | "import datetime\n", 52 | "import tensorflow_hub as hub\n", 53 | "import numpy as np\n", 54 | " \n", 55 | "import pandas as pd\n", 56 | "from sklearn.model_selection import train_test_split" 57 | ], 58 | "execution_count": null, 59 | "outputs": [] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "metadata": { 64 | "id": "QDH43tw-DN4y", 65 | "colab_type": "code", 66 | "colab": {} 67 | }, 68 | "source": [ 69 | "df=pd.read_csv('https://github.com/srivatsan88/YouTubeLI/blob/master/dataset/consumer_compliants.zip?raw=true', compression='zip', sep=',', quotechar='\"')" 70 | ], 71 | "execution_count": null, 72 | "outputs": [] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "metadata": { 77 | "id": "AewvMzr1NBJc", 78 | "colab_type": "code", 79 | "colab": { 80 | "base_uri": "https://localhost:8080/", 81 | "height": 124 82 | }, 83 | "outputId": "5e3c8027-dfd1-424c-a319-3debbebdb01a" 84 | }, 85 | "source": [ 86 | "df.columns" 87 | ], 88 | "execution_count": null, 89 | "outputs": [ 90 | { 91 | "output_type": "execute_result", 92 | "data": { 93 | "text/plain": [ 94 | "Index(['Date received', 'Product', 'Sub-product', 'Issue', 'Sub-issue',\n", 95 | " 'Consumer complaint narrative', 'Company public response', 'Company',\n", 96 | " 'State', 'ZIP code', 'Tags', 'Consumer consent provided?',\n", 97 | " 'Submitted via', 'Date sent to company', 'Company response to consumer',\n", 98 | " 'Timely response?', 'Consumer disputed?', 'Complaint ID'],\n", 99 | " dtype='object')" 100 | ] 101 | }, 102 | "metadata": { 103 | "tags": [] 104 | }, 105 | "execution_count": 3 106 | } 107 | ] 108 | }, 109 | { 110 | "cell_type": "code", 111 | "metadata": { 112 | "id": "jCGEYEQJ3E9U", 113 | "colab_type": "code", 114 | "colab": { 115 | "base_uri": "https://localhost:8080/", 116 | "height": 1000 117 | }, 118 | "outputId": "6f04ccfb-a328-4f82-b1fa-1c3ddc50b284" 119 | }, 120 | "source": [ 121 | "pd.set_option('display.max_colwidth', -1)\n", 122 | "df" 123 | ], 124 | "execution_count": null, 125 | "outputs": [ 126 | { 127 | "output_type": "stream", 128 | "text": [ 129 | "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:1: FutureWarning: Passing a negative integer is deprecated in version 1.0 and will not be supported in future version. Instead, use None to not limit the column width.\n", 130 | " \"\"\"Entry point for launching an IPython kernel.\n" 131 | ], 132 | "name": "stderr" 133 | }, 134 | { 135 | "output_type": "execute_result", 136 | "data": { 137 | "text/html": [ 138 | "
\n", 139 | "\n", 152 | "\n", 153 | " \n", 154 | " \n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | " \n", 160 | " \n", 161 | " \n", 162 | " \n", 163 | " \n", 164 | " \n", 165 | " \n", 166 | " \n", 167 | " \n", 168 | " \n", 169 | " \n", 170 | " \n", 171 | " \n", 172 | " \n", 173 | " \n", 174 | " \n", 175 | " \n", 176 | " \n", 177 | " \n", 178 | " \n", 179 | " \n", 180 | " \n", 181 | " \n", 182 | " \n", 183 | " \n", 184 | " \n", 185 | " \n", 186 | " \n", 187 | " \n", 188 | " \n", 189 | " \n", 190 | " \n", 191 | " \n", 192 | " \n", 193 | " \n", 194 | " \n", 195 | " \n", 196 | " \n", 197 | " \n", 198 | " \n", 199 | " \n", 200 | " \n", 201 | " \n", 202 | " \n", 203 | " \n", 204 | " \n", 205 | " \n", 206 | " \n", 207 | " \n", 208 | " \n", 209 | " \n", 210 | " \n", 211 | " \n", 212 | " \n", 213 | " \n", 214 | " \n", 215 | " \n", 216 | " \n", 217 | " \n", 218 | " \n", 219 | " \n", 220 | " \n", 221 | " \n", 222 | " \n", 223 | " \n", 224 | " \n", 225 | " \n", 226 | " \n", 227 | " \n", 228 | " \n", 229 | " \n", 230 | " \n", 231 | " \n", 232 | " \n", 233 | " \n", 234 | " \n", 235 | " \n", 236 | " \n", 237 | " \n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | " \n", 264 | " \n", 265 | " \n", 266 | " \n", 267 | " \n", 268 | " \n", 269 | " \n", 270 | " \n", 271 | " \n", 272 | " \n", 273 | " \n", 274 | " \n", 275 | " \n", 276 | " \n", 277 | " \n", 278 | " \n", 279 | " \n", 280 | " \n", 281 | " \n", 282 | " \n", 283 | " \n", 284 | " \n", 285 | " \n", 286 | " \n", 287 | " \n", 288 | " \n", 289 | " \n", 290 | " \n", 291 | " \n", 292 | " \n", 293 | " \n", 294 | " \n", 295 | " \n", 296 | " \n", 297 | " \n", 298 | " \n", 299 | " \n", 300 | " \n", 301 | " \n", 302 | " \n", 303 | " \n", 304 | " \n", 305 | " \n", 306 | " \n", 307 | " \n", 308 | " \n", 309 | " \n", 310 | " \n", 311 | " \n", 312 | " \n", 313 | " \n", 314 | " \n", 315 | " \n", 316 | " \n", 317 | " \n", 318 | " \n", 319 | " \n", 320 | " \n", 321 | " \n", 322 | " \n", 323 | " \n", 324 | " \n", 325 | " \n", 326 | " \n", 327 | " \n", 328 | " \n", 329 | " \n", 330 | " \n", 331 | " \n", 332 | " \n", 333 | " \n", 334 | " \n", 335 | " \n", 336 | " \n", 337 | " \n", 338 | " \n", 339 | " \n", 340 | " \n", 341 | " \n", 342 | " \n", 343 | " \n", 344 | " \n", 345 | " \n", 346 | " \n", 347 | " \n", 348 | " \n", 349 | " \n", 350 | " \n", 351 | " \n", 352 | " \n", 353 | " \n", 354 | " \n", 355 | " \n", 356 | " \n", 357 | " \n", 358 | " \n", 359 | " \n", 360 | " \n", 361 | " \n", 362 | " \n", 363 | " \n", 364 | " \n", 365 | " \n", 366 | " \n", 367 | " \n", 368 | " \n", 369 | " \n", 370 | " \n", 371 | " \n", 372 | " \n", 373 | " \n", 374 | " \n", 375 | " \n", 376 | " \n", 377 | " \n", 378 | " \n", 379 | " \n", 380 | " \n", 381 | " \n", 382 | " \n", 383 | " \n", 384 | " \n", 385 | " \n", 386 | " \n", 387 | " \n", 388 | " \n", 389 | " \n", 390 | " \n", 391 | " \n", 392 | " \n", 393 | " \n", 394 | " \n", 395 | " \n", 396 | " \n", 397 | " \n", 398 | " \n", 399 | " \n", 400 | " \n", 401 | " \n", 402 | " \n", 403 | " \n", 404 | " \n", 405 | " \n", 406 | " \n", 407 | " \n", 408 | " \n", 409 | "
Date receivedProductSub-productIssueSub-issueConsumer complaint narrativeCompany public responseCompanyStateZIP codeTagsConsumer consent provided?Submitted viaDate sent to companyCompany response to consumerTimely response?Consumer disputed?Complaint ID
04/3/2020Vehicle loan or leaseLoanGetting a loan or leaseFraudulent loanThis auto loan was opened on XX/XX/2020 in XXXX, NC with BB & T in my name. I have NEVER been to North Carolina and I have NEVER been a resident. I have filed a dispute twice through my credit bureaus but both times BB & T has claimed that this is an accurate loan. Which I wasn't aware of until today. I have tried to contact BB & T multiple times but I have never gotten through to a live person. I do n't drive and I have never owned a car before. I didn't have any knowledge of this account until I checked XXXXXXXX XXXX and noticed it. I've tried twice to dispute it. Additionally I never received any bills or information about this account. This is my last resort in trying to remove this fraudulent loan off of my account.Company has responded to the consumer and the CFPB and chooses not to provide a public responseTRUIST FINANCIAL CORPORATIONPANoneNoneConsent providedWeb4/3/2020Closed with explanationYesNaN3591341
13/12/2020Debt collectionPayday loan debtAttempts to collect debt not owedDebt is not yoursIn XXXX of 2019 I noticed a debt for {$620.00} on my credit which i believed was mine I thought speedy cash had bought one of my old debts and sold it to XXXX XXXX XXXX XXXX. I contacted XXXX XXXX XXXX XXXX and after several attempts of giving my full name, nothing came up in their system. I gave my social and the rep said the account popped up but DID NOT tell me that the account was under someone elses name and continued to let me make a payment. The payment was for {$120.00}. Confirmation number-XXXX. After realizing it was not my account, I called back to get my money back and inform them of the mistake. I was told i needed to mail them an FTC report and dispute letter to get my money back. I completed all of this and when i called again they said they transferred the account back to speedy cash for fraud review and I would need to contact them. After contacting them i was again told that i can not get my money back. The issue im having is this representative at XXXX XXXX played blind to obvious fraud and let an innocent person make a payment on someone elses debt and i want my money back.NoneCURO Intermediate HoldingsCO806XXNoneConsent providedWeb3/12/2020Closed with explanationYesNaN3564184
22/6/2020Vehicle loan or leaseLoanGetting a loan or leaseCredit denialAs stated from Capital One, XXXX XX/XX/XXXX and XXXX 2018, My wife and I went to several car dealerships to request for a car loan to get a used car. However, according to their credit requirements unfortunately my credit score was insufficient for the car loan approval at that time. It seemed as though they pulled my credit report multiple times.NoneCAPITAL ONE FINANCIAL CORPORATIONOH430XXNoneConsent providedWeb2/6/2020Closed with explanationYesNaN3521949
33/6/2020Checking or savings accountSavings accountManaging an accountBanking errorsPlease see CFPB case XXXX. \\n\\nCapital One, in the letter they provided ( and attached to that case as their response ) said this : \" The funds were reversed and sent back to XXXX XXXX XXXX on XX/XX/XXXX ''. \\n\\nXXXX XXXX XXXX ( now XXXX XXXX ) has not received these funds. Staff at XXXX XXXX - and also staff at the account-holder 's business - have looked for return of my money ( {$650.00} ) and find nothing. \\n\\nCapital One needs to document - actually prove - they returned the funds, as stated in their letter. Capital One must provide electronic information, if the return was made that way, or document the paper check they sent back to XXXX XXXX. \\n\\nI've left 3 messages about this problem for the person who signed the letter ( XXXX ) from Capital One. I have received no call-backs. \\n\\nSummary : Capital One said they returned my money on XX/XX/XXXX : they did not. If they continue claim they did, then they need to prove that.NoneCAPITAL ONE FINANCIAL CORPORATIONCANoneNoneConsent providedWeb3/6/2020Closed with explanationYesNaN3556237
42/14/2020Debt collectionMedical debtAttempts to collect debt not owedDebt is not yoursThis debt was incurred due to medical malpractice ( XXXX XXXX XXXX, XXXX, TX ). I asked the doctor to turn over my claim to his malpractice insurance company. This has cost me thousands of dollars to XXXX XXXX XXXX. I am still trying to collect damages from this doctor. He never responded and turned over me to collections Merchants and Professional Collection Bureau , Inc. I sent them a letter describing exactly this issue and instead of not contacting me and verifying my debt they start reporting this debt to the credit reporting agencies. They never verified the debt, like I asked and they never stopped it from being reported when I specifically told them not to, due to the circumstances above.Company believes it acted appropriately as authorized by contract or lawMerchants and Professional Bureau, Inc.OH432XXNoneConsent providedWeb2/14/2020Closed with explanationYesNaN3531704
.........................................................
574482/29/2020Student loanFederal student loan servicingDealing with your lender or servicerTrouble with how payments are being handledI am attempting to make a payment toward my student loans on the Nelnet website today, XX/XX/20, and Nelnet will not allow me to post the payment sooner than XX/XX/20. By the time the payment posts, 2-3 days of additional interest will have accrued and my payments will apply more to interest than is due today, the day that I'm attempting to pay. My understanding was that I could make a payment at any time but this does not appear to be true. The funds are available in my bank account today regardless of whether Nelnet can collect over the weekend. I should not be penalized for this. \\n\\nI submitted complaint XXXX in XXXX for other deceptive practices with Nelnet. They have not yet resolved the issue identified in that complaint or contacted me as they said they would in their response. I believe this new issue is just one more deceptive practice by this company that causes financial harm to borrowers.NoneNelnet, Inc.KSNoneNoneConsent providedWeb2/29/2020Closed with explanationYesNaN3549178
574492/11/2020Debt collectionOther debtAttempts to collect debt not owedDebt was paidReceived letter for {$480.00}. Original creditor didnt contact me until past statute of limitations for insurance company recoupment per Arizona law. Debt collection is illegal for phantom debt. Additionally they are phoning my office excessively.Company has responded to the consumer and the CFPB and chooses not to provide a public responseThe Receivable Management Services LLC, New York, NY BranchAZ853XXNoneConsent providedWeb2/18/2020Closed with explanationYesNaN3527928
574502/29/2020Debt collectionOther debtCommunication tacticsUsed obscene, profane, or other abusive languageentire time 10 years until XX/XX/2020. XXXX makes my blood boil. I have called and was lied to told to provide my checking account information over the phone in order to turn my cell phone back on. i called at XXXX them at XXXX {$300.00} was added to my bill. \\n\\nScam scam scam I was told I can not call the office of the President just to write to XXXX XXXX XXXX XXXX XXXX XXXX XXXX, NM XXXX. I did three thousand times. the last letter I mailed on XX/XX/2020. Two collection agencies later. \\n\\nI chose to leave XXXX XXXX every time I called the XXXX supervisor would threaten me on a recorded line. I need peace of mind and a good Heart to beat inside of me. Im on a XXXX XXXX due to the stress at XXXX XXXX taking all my money 4 10 years.Company has responded to the consumer and the CFPB and chooses not to provide a public responseConvergent Resources, Inc.NJ8101NoneConsent providedWeb2/29/2020Closed with explanationYesNaN3549238
574511/16/2020Checking or savings accountChecking accountProblem with a lender or other company charging your accountTransaction was not authorizedI am a customer with Wells Fargo Bank. Recently money was withdrawn on a couple of occasions without my permission or consent to pay for a timeshare account that was never used by me nor anyone connected to me because of unfair policies pertaining to the fees of the said timeshare. I tried cancelling the said timeshare account several times because of these fees that were never mentioned at the initiation. My account was debited to pay for the timeshare fees without my knowledge or consent several times. I tried correcting this with Wells Fargo bank with no avail. I would appreciate it if you can look into this matter for me. I was left with no funds in my account and as such I could not take care of the basic necessities of my day to day life. \\nThanks in advance,Company has responded to the consumer and the CFPB and chooses not to provide a public responseWELLS FARGO & COMPANYAZ852XXNoneConsent providedWeb1/22/2020Closed with explanationYesNaN3498566
574521/16/2020Debt collectionAuto debtTook or threatened to take negative or legal actionThreatened or suggested your credit would be damagedI spoken with them several times in a year. An in XXXX they informed me yes they sold my information to a third party without my knowledge. Also, I told them that I dont owe them anything because my car was paid off by insurance XXXX an Gap an they said no. I also informed them that constantly calling me an telling me that my credit score would be damage was inappropriate. But on my credit they written several negative things. An I didnt give Exeter financial Corp no authority to sell my information to XXXX XXXXNoneExeter Finance Corp.SCNoneNoneConsent providedWeb1/16/2020Closed with explanationYesNaN3498524
\n", 410 | "

57453 rows × 18 columns

\n", 411 | "
" 412 | ], 413 | "text/plain": [ 414 | " Date received ... Complaint ID\n", 415 | "0 4/3/2020 ... 3591341 \n", 416 | "1 3/12/2020 ... 3564184 \n", 417 | "2 2/6/2020 ... 3521949 \n", 418 | "3 3/6/2020 ... 3556237 \n", 419 | "4 2/14/2020 ... 3531704 \n", 420 | "... ... ... ... \n", 421 | "57448 2/29/2020 ... 3549178 \n", 422 | "57449 2/11/2020 ... 3527928 \n", 423 | "57450 2/29/2020 ... 3549238 \n", 424 | "57451 1/16/2020 ... 3498566 \n", 425 | "57452 1/16/2020 ... 3498524 \n", 426 | "\n", 427 | "[57453 rows x 18 columns]" 428 | ] 429 | }, 430 | "metadata": { 431 | "tags": [] 432 | }, 433 | "execution_count": 4 434 | } 435 | ] 436 | }, 437 | { 438 | "cell_type": "code", 439 | "metadata": { 440 | "id": "U_UepjKp0fJ-", 441 | "colab_type": "code", 442 | "colab": {} 443 | }, 444 | "source": [ 445 | "X_train, X_test = train_test_split(df, test_size=0.2, random_state=111)" 446 | ], 447 | "execution_count": null, 448 | "outputs": [] 449 | }, 450 | { 451 | "cell_type": "code", 452 | "metadata": { 453 | "id": "ZsaEw_JM-UEp", 454 | "colab_type": "code", 455 | "colab": {} 456 | }, 457 | "source": [ 458 | "from sklearn.utils import class_weight\n", 459 | "class_weights = list(class_weight.compute_class_weight('balanced',\n", 460 | " np.unique(df['Product']),\n", 461 | " df['Product']))" 462 | ], 463 | "execution_count": null, 464 | "outputs": [] 465 | }, 466 | { 467 | "cell_type": "code", 468 | "metadata": { 469 | "id": "4_CyTvUGAFyw", 470 | "colab_type": "code", 471 | "colab": { 472 | "base_uri": "https://localhost:8080/", 473 | "height": 142 474 | }, 475 | "outputId": "9d066071-fa0d-44d2-8842-6aad60c275dd" 476 | }, 477 | "source": [ 478 | "df['Product'].value_counts()" 479 | ], 480 | "execution_count": null, 481 | "outputs": [ 482 | { 483 | "output_type": "execute_result", 484 | "data": { 485 | "text/plain": [ 486 | "Debt collection 21772\n", 487 | "Credit card or prepaid card 13193\n", 488 | "Mortgage 9799 \n", 489 | "Checking or savings account 7003 \n", 490 | "Student loan 2950 \n", 491 | "Vehicle loan or lease 2736 \n", 492 | "Name: Product, dtype: int64" 493 | ] 494 | }, 495 | "metadata": { 496 | "tags": [] 497 | }, 498 | "execution_count": 7 499 | } 500 | ] 501 | }, 502 | { 503 | "cell_type": "code", 504 | "metadata": { 505 | "id": "-7gu2a22_neX", 506 | "colab_type": "code", 507 | "colab": {} 508 | }, 509 | "source": [ 510 | "class_weights.sort()" 511 | ], 512 | "execution_count": null, 513 | "outputs": [] 514 | }, 515 | { 516 | "cell_type": "code", 517 | "metadata": { 518 | "id": "I92NNAnbaEFs", 519 | "colab_type": "code", 520 | "colab": { 521 | "base_uri": "https://localhost:8080/", 522 | "height": 124 523 | }, 524 | "outputId": "3e2e8255-5961-47e5-8eb3-fcf8934ce37b" 525 | }, 526 | "source": [ 527 | "class_weights" 528 | ], 529 | "execution_count": null, 530 | "outputs": [ 531 | { 532 | "output_type": "execute_result", 533 | "data": { 534 | "text/plain": [ 535 | "[0.43980801028844385,\n", 536 | " 0.7258015614340938,\n", 537 | " 0.9771915501581794,\n", 538 | " 1.3673425674710837,\n", 539 | " 3.2459322033898306,\n", 540 | " 3.4998172514619883]" 541 | ] 542 | }, 543 | "metadata": { 544 | "tags": [] 545 | }, 546 | "execution_count": 9 547 | } 548 | ] 549 | }, 550 | { 551 | "cell_type": "code", 552 | "metadata": { 553 | "id": "8brlwCEg0vnf", 554 | "colab_type": "code", 555 | "colab": {} 556 | }, 557 | "source": [ 558 | "weights={}" 559 | ], 560 | "execution_count": null, 561 | "outputs": [] 562 | }, 563 | { 564 | "cell_type": "code", 565 | "metadata": { 566 | "id": "nDvRpRbf05TV", 567 | "colab_type": "code", 568 | "colab": {} 569 | }, 570 | "source": [ 571 | "for index, weight in enumerate(class_weights) :\n", 572 | " weights[index]=weight" 573 | ], 574 | "execution_count": null, 575 | "outputs": [] 576 | }, 577 | { 578 | "cell_type": "code", 579 | "metadata": { 580 | "id": "pwZB03P_2Vyo", 581 | "colab_type": "code", 582 | "colab": { 583 | "base_uri": "https://localhost:8080/", 584 | "height": 124 585 | }, 586 | "outputId": "a29c8d9a-dcac-4761-c28a-edbfb11e8732" 587 | }, 588 | "source": [ 589 | "weights" 590 | ], 591 | "execution_count": null, 592 | "outputs": [ 593 | { 594 | "output_type": "execute_result", 595 | "data": { 596 | "text/plain": [ 597 | "{0: 0.43980801028844385,\n", 598 | " 1: 0.7258015614340938,\n", 599 | " 2: 0.9771915501581794,\n", 600 | " 3: 1.3673425674710837,\n", 601 | " 4: 3.2459322033898306,\n", 602 | " 5: 3.4998172514619883}" 603 | ] 604 | }, 605 | "metadata": { 606 | "tags": [] 607 | }, 608 | "execution_count": 12 609 | } 610 | ] 611 | }, 612 | { 613 | "cell_type": "code", 614 | "metadata": { 615 | "id": "hijEnYw7V_ey", 616 | "colab_type": "code", 617 | "colab": {} 618 | }, 619 | "source": [ 620 | "dataset_train = tf.data.Dataset.from_tensor_slices((X_train['Consumer complaint narrative'].values, X_train['Product'].values))\n", 621 | "dataset_test = tf.data.Dataset.from_tensor_slices((X_test['Consumer complaint narrative'].values, X_test['Product'].values))" 622 | ], 623 | "execution_count": null, 624 | "outputs": [] 625 | }, 626 | { 627 | "cell_type": "code", 628 | "metadata": { 629 | "id": "u1diITDtD9xD", 630 | "colab_type": "code", 631 | "colab": { 632 | "base_uri": "https://localhost:8080/", 633 | "height": 126 634 | }, 635 | "outputId": "3e9628c2-d4fe-4206-c496-a466c2b87931" 636 | }, 637 | "source": [ 638 | "for text, target in dataset_train.take(5):\n", 639 | " print ('Complaint: {}, Target: {}'.format(text, target))" 640 | ], 641 | "execution_count": null, 642 | "outputs": [ 643 | { 644 | "output_type": "stream", 645 | "text": [ 646 | "Complaint: b\"The below complaint was submitted to the CFPB numerous times prior, the Wells Fargo rep, XXXX XXXX, replies with the same general form response stating numerous attempts at resolution have been made and exhausted which is a lie. He also attempts to state he can not comment due to past litigation which is also a lie, he reverts to this reply so as to avoid detailing any supposed attempt at resolution which he can not as there is none. Further, he should be aware of resolution which is to refund fees totaling {$610.00} and has not done so, no refund received to date. Please see complaint below. The below complaint was submitted prior, a duplicate form response received from XXXX XXXX with Wells Fargo, one of several. Based on this, my complaint was not addressed. Further, a reply in XXXX was never received as was mentioned. XXXX replied by stating numerous attempts at resolution have been made but has not detailed one, there was no contact from anyone at Wells Fargo aside from XXXX XXXX whom offered a bogus settlement offer. Wells Fargo failed to honor this settlement offer made to me in XXXX by XXXX XXXX, a rep with Wells Fargo. The offer amount, {$3700.00}, was never received and it is now XXXX. Prior to this, I requested a refund in the amount of {$610.00} which includes mainly overdraft fees charged to accounts not authorized. A total of four mediation request forms were sent in, XXXX XXXX contacted me, offered settlement amount in XXXX, no payment received to date.. Since no payment was received in re, additional CFPB complaints were filed. XXXX replied most recently stating numerous attempts at resolution were made, which is a lie and seems to provide the same general form response to each and every complaint. I can assure the CPFB there were no such attempts and Wells Fargo is fully aware of resolution which has been detailed numerous times. I will reiterate again here, refund of {$610.00} will resolve matter since no settlement payment was received. I have contacted the XXXX XXXX XXXX Attorney as per instructions from a XXXX, a rep with class counsel for Wells Fargo Settlement. XXXX informed me Wells Fargo is involved in at least three class actions, XXXX Settlement, WF Settlement, also a settlement with all 50 states, the Attorney General of each state.. I have also contacted Attorney General here in Connecticut as well as California, advised them of my situation. I suspect XXXX will provide the same carbon copy reply in which case I can assure any third party Wells Fargo claims of attempts at resolution are 100 % false and bogus, he has not detailed one such attempt. Most recently as of, XX/XX/30, I spoke with XXXX XXXX in their Executive Office, she could not find any cases under my name despite numerous CFPB complaints filed as well as OCC, ( Office Of Comptroller Currency ). It appears Wells Fargo has not looked into this matter, evident in the fact they have not opened any cases in re. Another mediation request form was received recently, I've filed out a total of four of these forms, sent them in, was denied mediation. Complaints marked as unable to respond directly or due to litigation will be resubmitted\", Target: b'Checking or savings account'\n", 647 | "Complaint: b'The following items were all placed on my credit report at the same time. Phoenix Financial Services called and threatened to ruin by credit by placing the same item in collection multiple times. There should be only one ( 1 ) item, not four as submitted by Phoenix Financial Services. There is also an error in the Opened date. This one medical debt is several years old. I did not go to the doctor XX/XX/2019. I do not think Collection Agencies should be able to deliberately place multiple items on your credit in an effort to threaten me into paying. Can you please help me. My credit score dropped 24 points due to the four ( 4 ) Collection items added erroneously by Phoenix Financial Services. \\n\\nXXXX XXXX XXXX Phoenix Financial Servic Opened XX/XX/2019 {$1200.00} Original creditor : XXXX XXXX XXXX XXXX XXXX XXXX Phoenix Financial Servic Opened XX/XX/2019 {$1200.00} Original creditor : XXXXXXXX XXXX XXXX XXXX XXXX XXXX Phoenix Financial Servic Opened XX/XX/2019 {$1200.00} Original creditor : XXXX XXXX XXXX XXXX XXXX XXXX Phoenix Financial Servic Opened XX/XX/2019 {$1200.00} Original creditor : XXXX XXXX XXXX XXXX XXXX XXXX', Target: b'Debt collection'\n", 648 | "Complaint: b'Credit Management Lp. Did not contact about a debit that they received from XXXX XXXX XXXX. They did not follow Fair Debt Collection Practices Act and Consumer Credit Protection Act.', Target: b'Debt collection'\n", 649 | "Complaint: b'My husband and I visited XXXX for vacation from XX/XX/XXXX through XX/XX/XXXX. We have no family, friends, nor business connections in the country - we were simply there to visit a new place and experience a new culture. Except for one elegant XXXX XXXX XXXX dinner ( {$200.00} USD ) and a cash advance to take out Euros ( {$250.00} USD ), all of our purchases were below {$70.00} USD. \\n\\nOn our final day in XXXX, XX/XX/XXXX, we were eating lunch at a restaurant and I planned to pay with my Chase Sapphire card. The waiter said there was a problem with the wireless internet and took my Chase Sapphire card inside the restaurant ( we were seated outside on the patio ). He was in possession of my Chase Sapphire care for approximately 10 minutes outside of my supervision. He returned and claimed the internet was down and said we could pay in USD or go get Euros from a specific ATM that he directed us to in the back of a neighboring store. I opted to go to the ATM and get Euros in order to pay for our lunch because we were worried we would get scammed on the exchange rate he would try and offer us if we paid in USD. \\n\\nAfter resolving the issue at the restaurant and returning home within the next couple of days, I noticed a fraudulent charge for {$5500.00} on my Chase Sapphire card and another attempted charge for about the same amount that was declined by Chase. The statement showed that the fraudulent charge was made at XXXX XXXX, and after some research online I found this to be a marble gravestone/tomb manufacturing business. The charge was made on XX/XX/XXXX, it posted to my account on XX/XX/XXXX, and I noticed the charge on XX/XX/XXXX and immediately called Chase to dispute the charge. My mind immediately jumped to the situation with the restaurant ( see above ) when the card was out of my possession for about 10 minutes and I was directed to use a specific ATM. I relayed these same facts during my dispute claim and answered all questions and provided all details they asked for, and then I waited to hear back from Chase with a resolution. In addition to disputing the fraudulent charge with Chase, I also tracked down an email for the vendor where the fraudulent charge was made, XXXX XXXX, and emailed them on multiple occasions ( XX/XX/XXXX and XX/XX/XXXX ) to explain the situation and request a refund for the fraudulent charge. I also submitted the same inquiry and request on the \" messages \\'\\' portion of their website on XX/XX/XXXX. I haven\\'t heard any response from the business as of XX/XX/XXXX. Due to their lack of response, I also left a negative, public review of the business on XXXX explaining their lack of response to my inquiries about the fraudulent charge in hopes of deterring any potential REAL customers of using their services in the future. \\n\\nOn XX/XX/XXXX, I finally received a letter from Chase saying that my fraud claim had been denied because they deemed that I had received a benefit from the fraudulent charge. I immediately started the appeal process by calling Chase. After waiting on hold for 3 hours, I was told to send an email with my credit card number and full name to XXXX in order to file an appeal. Despite my security concerns of sending my credit card number via email, I felt I had no other options and on XX/XX/XXXX, I sent an email to XXXX with my name and credit card number and requested to start the appeal process. I also requested the following information : a copy of the receipt of this fraudulent charge ( {$5500.00} on XX/XX/XXXX ) and/or all relevant information ( time, date, address, swipe/chip/punch in numbers, etc. ), a copy of the receipts of all other charges made on XX/XX/XXXX on this account and/or all relevant information ( time, date, address, swipe/chip/punch in numbers, etc. ), and a copy of the report that includes a. ) all information that I provided to Chase about this fraudulent charge and b. ) an explanation of exactly why it was denied and deemed that I received a benefit. \\n\\nAfter not hearing back from Chase, I sent another email to XXXX on XX/XX/XXXX to confirm that my appeal request had been received and to request a phone call or email to confirm that it had been received and let me know that the appeal was in process. \\n\\nI received a phone call from Chase \\'s fraud dispute review department on XX/XX/XXXX confirming that my appeal request had been received. The representative who I talked with told me that he believed my claim was indeed fraudulent and relayed that he didn\\'t believe the fraud department looked at the claim closely enough. He said that they never requested a receipt from the vendor ( XXXX XXXX ) to compare the signature with other receipts on file and he also shared that there were two successive charges in two different counties in XXXX that they didn\\'t take into account when reviewing it because I couldn\\'t possibly be in two places at once. I also continued to request to see the receipt for the fraudulent charge, receipts for all other charges on XX/XX/XXXX, and the report that detailed the denial of the fraudulent claim. As of XX/XX/XXXX, Chase refuses to send me this information about my fraudulent charge claim, and I believe I have a right to see this as a Chase customer. \\n\\nOn XX/XX/XXXX, I received notice that my appeal of my fraudulent charge dispute had been denied, meaning that Chase is holding me responsible to pay the {$5500.00} fraudulent charge. It is at this point that I am filing a complaint with the CFPB.', Target: b'Credit card or prepaid card'\n", 650 | "Complaint: b'I deposited a client check in the amount of {$10000.00} and funds were transferred from XXXX XXXX to Wells Fargo on XX/XX/XXXX. Wells Fargo has put a hold on the funds until XX/XX/XXXX. They have given me a range of excuses such as there were not sufficient funds in the payees account to a suspicious signature. I have asked Wells Fargo to contact the XXXX XXXX employee that handles the account and XXXX XXXX continues to refuse to release the funds to my account. This appears to be yet another Wells Fargo scam. They are holding my funds and earning interest from XX/XX/XXXX to XX/XX/XXXX. I have full documentation.', Target: b'Checking or savings account'\n" 651 | ], 652 | "name": "stdout" 653 | } 654 | ] 655 | }, 656 | { 657 | "cell_type": "code", 658 | "metadata": { 659 | "id": "1gVAVaNeoNEH", 660 | "colab_type": "code", 661 | "colab": { 662 | "base_uri": "https://localhost:8080/", 663 | "height": 126 664 | }, 665 | "outputId": "446bec61-9095-4924-fa17-101b89599022" 666 | }, 667 | "source": [ 668 | "for text, target in dataset_test.take(5):\n", 669 | " print ('Complaint: {}, Target: {}'.format(text, target))" 670 | ], 671 | "execution_count": null, 672 | "outputs": [ 673 | { 674 | "output_type": "stream", 675 | "text": [ 676 | "Complaint: b'I have a business checking account at BB & T. On XX/XX/2019, I attempted to deposit a check into my account and I received a message stating that I was over my monthly mobile deposit limit. I was confused because it was the first of the month and I had not deposited any checks since the previous month. I called BB & T and they said that I couldnt deposit checks into business accounts via the mobile app even though I had done that before. \\n\\nI was instructed to open a personal account, into which I could deposit checks via the mobile app. I was told that if I opened the account online I would have immediate access, that I could link my personal and business accounts, and immediately be able to transfer money between them. \\n\\nOn XX/XX/XXXX, I opened my personal account online. Though I successfully opened online, I did not have online access as I had been promised. Because I was traveling in an area where there were no BB & T branches, I could not go into a branch until XX/XX/2019. In the intervening time, my business account became overdrawn. I had the money in my personal account to bring it back into the black, but BB & T could not make the transfer until I went into a branch. During this time, I incurred an astonishing {$320.00} in overdraft fees in my business account because I had no way of transferring money between the two accounts. \\n\\nWhen I went into the branch, I met with XXXX XXXX in XXXX XXXX County, Florida. She investigated the accounts and told me she would link them and that I would have online access in XXXX hours. The online access still never material, I was not able to transfer money and I received an additional {$36.00} overdraft fee. This brought the total to {$360.00} in overdraft fees. \\n\\nI had only opened the second account on BB & Ts advice ; I could have had my customer send a bank wire directly into business account in the first week of XXXX to keep the account positive. My TOTAL deposits between the two accounts was always positive. \\n\\nI requested a refund and was told they would not refund any of the fees.', Target: b'Checking or savings account'\n", 677 | "Complaint: b'To who it may concern, My concern is regarding Shellpoint Mortgage Servicing Company. This company has received my monthly mortgage payments and have failed to account it as payments received. My bank has sent me proof the account was cleared and paid. This company is trying to foreclosed on my house and has sent me a letter indicating they sent my file to their Loss Mitigation dept. The person who they assigned it to is XXXX XXXX XXXX x XXXX. Their corporate number is XXXX. \\n\\nI have can send proof of my claim from above should you need it. Please assist.', Target: b'Mortgage'\n", 678 | "Complaint: b'I contacted XXXX about fraudulent charges that were made on my account and the customer service representative told me that they wouldnt be able to issue anew card or remove my fraudulent charges since the account was closed due to non-payment. I was unaware of this these charging that were made.. To my knowledge I didnt owe a payment because the account wasnt being used.', Target: b'Credit card or prepaid card'\n", 679 | "Complaint: b'I first applied for the Fedloan Serving program in XXXX in hopes of getting loan forgiveness since I\\'ve been paying on my student loans since late XXXX or early XXXX and I have been a public servant since XXXX, XXXX. I have never missed a payment to any of the various loan companies that owned my loans. The Fedloan Program turned me down in XXXX, saying my loans, which were originally Federal Stafford Loans, did not qualify me for the Program. In XXXX, XXXX, I was solicited by XXXX XXXX and told I could get into this program to reduce my loan payments. I was charged {$690.00} by XXXX XXXX to get me into the Fedloan Serving program. My loan payments went down to $ XXXX/month for the first year. In XXXX, XXXX, Fedloan Servicing informed me via email that I needed to recertify my \" income-driven repayment plan. Their customer service helped me submit the form XXXX XXXX ) via the internet and it involved the IRS. For reasons I don\\'t understand, Fedloan is now increasing my monthly payments to {$380.00}, effective XX/XX/XXXX. This is a 60 % increase. On XX/XX/XXXX, I called Fedloan regarding this issue. The customer service person suggested I ask for a recalculation and provide pay-stubs rather than IRS information. On the same call, I was transferred to a second agent who listened to my concern and suggested I get out of the Fedloan Program since I really didn\\'t qualify for it anyway and I could save money by going to a regular payment plan with a different servicer such as XXXX which had serviced my loan previously. I feel like I\\'ve been miss-lead by the Fedloan Serving Program and by Mr. XXXX XXXX, the case manager at XXXX XXXX ( http : //www.nexum-servicing.com ). After receiving my {$690.00}, I was never able to talk to XXXX on the phone again. He had convinced me I could save money with Fedloan and he told me my payments would go down to {$0.00} when I retire from State Service in XXXX. He told me I would receive loan forgiveness once my payments went to {$0.00}. I have concluded his advise was incorrect and or miss-leading. I regret having my loan transferred to the Fedloan Program because its representatives have indicated I will not receive loan forgiveness for my 20 years of public service. I am very concerned about the cost of my student loan debt, especially since I intend to retire from State service in XXXX. I am also concerned about how I will be able to afford these student loan payments once I am receiving a pension. I am also very disappointed that I haven\\'t been able to \" qualify \\'\\' for loan forgiveness based on my long years of public service. I think this whole Fedloan Program is complete scam and I have been duped.', Target: b'Student loan'\n", 680 | "Complaint: b'On several occasions ( XXXX ) I have tried to reach someone in costumer service today XX/XX/2020 I tried again to get through and was on hold for over 20 minutes and hung up. \\n\\n3 Years ago I have made no more than {$600.00} in purchases, and while making payments on my account with a {$9000.00} limit the interest charges are deducted from the credit limit and the interest was based on the balance each month. this left my interest and charge fess higher than my monthly payment which amounted to around {$240.00} each month. \\n\\nIn all of this time the interest was so big that it completely eat up the limit balance on the card, which left in me in a vicious cycle of never paying down the money owed. with in 2 years I was able to get the balance down {$2000.00} and I asked Walmart Capital One to reduce the balance down. Now it is back up to the high bank fees and interest charges that have again gone beyond what I can afford monthly the {$240.00}. This is a unfair and infantile game that is forced on me as an consumer.', Target: b'Credit card or prepaid card'\n" 681 | ], 682 | "name": "stdout" 683 | } 684 | ] 685 | }, 686 | { 687 | "cell_type": "code", 688 | "metadata": { 689 | "id": "posXzJ1PvHZl", 690 | "colab_type": "code", 691 | "colab": {} 692 | }, 693 | "source": [ 694 | "table = tf.lookup.StaticHashTable(\n", 695 | " initializer=tf.lookup.KeyValueTensorInitializer(\n", 696 | " keys=tf.constant(['Debt collection', 'Credit card or prepaid card', 'Mortgage', 'Checking or savings account', 'Student loan', 'Vehicle loan or lease']),\n", 697 | " values=tf.constant([0, 1, 2, 3, 4, 5]),\n", 698 | " ),\n", 699 | " default_value=tf.constant(-1),\n", 700 | " name=\"target_encoding\"\n", 701 | ")\n", 702 | "\n", 703 | "@tf.function\n", 704 | "def target(x):\n", 705 | " return table.lookup(x)" 706 | ], 707 | "execution_count": null, 708 | "outputs": [] 709 | }, 710 | { 711 | "cell_type": "code", 712 | "metadata": { 713 | "id": "dDr8nLr8vIe-", 714 | "colab_type": "code", 715 | "colab": {} 716 | }, 717 | "source": [ 718 | "def show_batch(dataset, size=5):\n", 719 | " for batch, label in dataset.take(size):\n", 720 | " print(batch.numpy())\n", 721 | " print(target(label).numpy())" 722 | ], 723 | "execution_count": null, 724 | "outputs": [] 725 | }, 726 | { 727 | "cell_type": "code", 728 | "metadata": { 729 | "id": "YbJgzzAmIqTp", 730 | "colab_type": "code", 731 | "colab": { 732 | "base_uri": "https://localhost:8080/", 733 | "height": 251 734 | }, 735 | "outputId": "62fbced7-57fc-4cd6-8645-366d529a7a98" 736 | }, 737 | "source": [ 738 | "show_batch(dataset_test,6)" 739 | ], 740 | "execution_count": null, 741 | "outputs": [ 742 | { 743 | "output_type": "stream", 744 | "text": [ 745 | "b'I have a business checking account at BB & T. On XX/XX/2019, I attempted to deposit a check into my account and I received a message stating that I was over my monthly mobile deposit limit. I was confused because it was the first of the month and I had not deposited any checks since the previous month. I called BB & T and they said that I couldnt deposit checks into business accounts via the mobile app even though I had done that before. \\n\\nI was instructed to open a personal account, into which I could deposit checks via the mobile app. I was told that if I opened the account online I would have immediate access, that I could link my personal and business accounts, and immediately be able to transfer money between them. \\n\\nOn XX/XX/XXXX, I opened my personal account online. Though I successfully opened online, I did not have online access as I had been promised. Because I was traveling in an area where there were no BB & T branches, I could not go into a branch until XX/XX/2019. In the intervening time, my business account became overdrawn. I had the money in my personal account to bring it back into the black, but BB & T could not make the transfer until I went into a branch. During this time, I incurred an astonishing {$320.00} in overdraft fees in my business account because I had no way of transferring money between the two accounts. \\n\\nWhen I went into the branch, I met with XXXX XXXX in XXXX XXXX County, Florida. She investigated the accounts and told me she would link them and that I would have online access in XXXX hours. The online access still never material, I was not able to transfer money and I received an additional {$36.00} overdraft fee. This brought the total to {$360.00} in overdraft fees. \\n\\nI had only opened the second account on BB & Ts advice ; I could have had my customer send a bank wire directly into business account in the first week of XXXX to keep the account positive. My TOTAL deposits between the two accounts was always positive. \\n\\nI requested a refund and was told they would not refund any of the fees.'\n", 746 | "3\n", 747 | "b'To who it may concern, My concern is regarding Shellpoint Mortgage Servicing Company. This company has received my monthly mortgage payments and have failed to account it as payments received. My bank has sent me proof the account was cleared and paid. This company is trying to foreclosed on my house and has sent me a letter indicating they sent my file to their Loss Mitigation dept. The person who they assigned it to is XXXX XXXX XXXX x XXXX. Their corporate number is XXXX. \\n\\nI have can send proof of my claim from above should you need it. Please assist.'\n", 748 | "2\n", 749 | "b'I contacted XXXX about fraudulent charges that were made on my account and the customer service representative told me that they wouldnt be able to issue anew card or remove my fraudulent charges since the account was closed due to non-payment. I was unaware of this these charging that were made.. To my knowledge I didnt owe a payment because the account wasnt being used.'\n", 750 | "1\n", 751 | "b'I first applied for the Fedloan Serving program in XXXX in hopes of getting loan forgiveness since I\\'ve been paying on my student loans since late XXXX or early XXXX and I have been a public servant since XXXX, XXXX. I have never missed a payment to any of the various loan companies that owned my loans. The Fedloan Program turned me down in XXXX, saying my loans, which were originally Federal Stafford Loans, did not qualify me for the Program. In XXXX, XXXX, I was solicited by XXXX XXXX and told I could get into this program to reduce my loan payments. I was charged {$690.00} by XXXX XXXX to get me into the Fedloan Serving program. My loan payments went down to $ XXXX/month for the first year. In XXXX, XXXX, Fedloan Servicing informed me via email that I needed to recertify my \" income-driven repayment plan. Their customer service helped me submit the form XXXX XXXX ) via the internet and it involved the IRS. For reasons I don\\'t understand, Fedloan is now increasing my monthly payments to {$380.00}, effective XX/XX/XXXX. This is a 60 % increase. On XX/XX/XXXX, I called Fedloan regarding this issue. The customer service person suggested I ask for a recalculation and provide pay-stubs rather than IRS information. On the same call, I was transferred to a second agent who listened to my concern and suggested I get out of the Fedloan Program since I really didn\\'t qualify for it anyway and I could save money by going to a regular payment plan with a different servicer such as XXXX which had serviced my loan previously. I feel like I\\'ve been miss-lead by the Fedloan Serving Program and by Mr. XXXX XXXX, the case manager at XXXX XXXX ( http : //www.nexum-servicing.com ). After receiving my {$690.00}, I was never able to talk to XXXX on the phone again. He had convinced me I could save money with Fedloan and he told me my payments would go down to {$0.00} when I retire from State Service in XXXX. He told me I would receive loan forgiveness once my payments went to {$0.00}. I have concluded his advise was incorrect and or miss-leading. I regret having my loan transferred to the Fedloan Program because its representatives have indicated I will not receive loan forgiveness for my 20 years of public service. I am very concerned about the cost of my student loan debt, especially since I intend to retire from State service in XXXX. I am also concerned about how I will be able to afford these student loan payments once I am receiving a pension. I am also very disappointed that I haven\\'t been able to \" qualify \\'\\' for loan forgiveness based on my long years of public service. I think this whole Fedloan Program is complete scam and I have been duped.'\n", 752 | "4\n", 753 | "b'On several occasions ( XXXX ) I have tried to reach someone in costumer service today XX/XX/2020 I tried again to get through and was on hold for over 20 minutes and hung up. \\n\\n3 Years ago I have made no more than {$600.00} in purchases, and while making payments on my account with a {$9000.00} limit the interest charges are deducted from the credit limit and the interest was based on the balance each month. this left my interest and charge fess higher than my monthly payment which amounted to around {$240.00} each month. \\n\\nIn all of this time the interest was so big that it completely eat up the limit balance on the card, which left in me in a vicious cycle of never paying down the money owed. with in 2 years I was able to get the balance down {$2000.00} and I asked Walmart Capital One to reduce the balance down. Now it is back up to the high bank fees and interest charges that have again gone beyond what I can afford monthly the {$240.00}. This is a unfair and infantile game that is forced on me as an consumer.'\n", 754 | "1\n", 755 | "b'Hi, If i am writing today, is to bring to your attention something that happened between myself and XXXX dealership of XXXX XXXX FL. \\n\\nOn XX/XX/2019, date of my end of lease experience, i headed out to the XXXX dealership of XXXX XXXX to return my vehicle and try to negotiate to buy or lease another vehicle. \\nAs soon as i walked in with my wife, we have been introduced to the salesman and the sales manager of this dealership. We then started to negotiate the return of our leased vehicle and asked the team there to please help us getting an interesting deal on another vehicle and explaining our difficult credit situation of my wife and myself. \\nThe leased car we were returning had a that time about {$2800.00} dollar amount of excess millage on the lease terms, and we were assured by the sales manager that by purchasing a new XXXX that day at the dealership that we will be able to negotiate that bill with the financial department of the company later on. Also, when you return a lease, you must pay a excess wear and use of the car but can be waived that fee again by purchasing a new vehicle. \\nAfter a couple of hours of negotiation and a lot of persuasion from the sales team who promised us a lot of benefits, we ended up returning the lease and purchasing a brand new XXXX vehicle. \\nDue to our bad credit history, we got a the new car financed with an APR of 8.39 %. \\n\\nA couple days following our purchase, me and my wife got very surprised about 2 things. \\n\\nFirst of all, as we both checked our credit on XXXX XXXX, we realized that the dealership submitted a lot of credit check to our accounts, not even telling us that will happen. This really affected both our credit history and score. Knowing our credit situation at the dealership, i really do believe that we got kind of scammed that time. \\n\\nSecond, after receiving the end of lease bill by mail, i have contacted the financial department like i was instructed by the sales manager at the dealership in order to discuss it, knowing that he promised me since i have bought a new XXXX vehicle. \\nover the phone with the financial consultant, i was very surprised to hear that nothing was possible, no negotiation on the total amount and no waiver for the excess wear as well, since that apparently we did not get the new car financed with the in-house XXXX financing agency. thing that nor the salesman, or the sales manager told us upon signing the new car purchasing contract. \\n\\ni really need your help in that matter, i really believe we got scammed by the XXXX team, pursuing us to buy a brand new XXXX vehicle in order to get all the benefits that we will never get at the end.'\n", 756 | "5\n" 757 | ], 758 | "name": "stdout" 759 | } 760 | ] 761 | }, 762 | { 763 | "cell_type": "code", 764 | "metadata": { 765 | "id": "d6D4lGAezmjL", 766 | "colab_type": "code", 767 | "colab": {} 768 | }, 769 | "source": [ 770 | "def fetch(text, labels):\n", 771 | " return text, tf.one_hot(target(labels),6)" 772 | ], 773 | "execution_count": null, 774 | "outputs": [] 775 | }, 776 | { 777 | "cell_type": "code", 778 | "metadata": { 779 | "id": "DQX8hZl60WaK", 780 | "colab_type": "code", 781 | "colab": {} 782 | }, 783 | "source": [ 784 | "train_data_f=dataset_train.map(fetch)\n", 785 | "test_data_f=dataset_test.map(fetch)" 786 | ], 787 | "execution_count": null, 788 | "outputs": [] 789 | }, 790 | { 791 | "cell_type": "code", 792 | "metadata": { 793 | "id": "xOzA_Tz4vIcV", 794 | "colab_type": "code", 795 | "colab": { 796 | "base_uri": "https://localhost:8080/", 797 | "height": 73 798 | }, 799 | "outputId": "7c28c8e5-53b5-46d2-b174-51e2ac826b6f" 800 | }, 801 | "source": [ 802 | "next(iter(train_data_f))" 803 | ], 804 | "execution_count": null, 805 | "outputs": [ 806 | { 807 | "output_type": "execute_result", 808 | "data": { 809 | "text/plain": [ 810 | "(,\n", 811 | " )" 812 | ] 813 | }, 814 | "metadata": { 815 | "tags": [] 816 | }, 817 | "execution_count": 21 818 | } 819 | ] 820 | }, 821 | { 822 | "cell_type": "code", 823 | "metadata": { 824 | "id": "Zad9I-x19Vvo", 825 | "colab_type": "code", 826 | "colab": { 827 | "base_uri": "https://localhost:8080/", 828 | "height": 251 829 | }, 830 | "outputId": "08038420-f188-4873-9c9f-0e167155a8f9" 831 | }, 832 | "source": [ 833 | "train_data, train_labels = next(iter(train_data_f.batch(5)))\n", 834 | "train_data, train_labels" 835 | ], 836 | "execution_count": null, 837 | "outputs": [ 838 | { 839 | "output_type": "execute_result", 840 | "data": { 841 | "text/plain": [ 842 | "(, )" 854 | ] 855 | }, 856 | "metadata": { 857 | "tags": [] 858 | }, 859 | "execution_count": 22 860 | } 861 | ] 862 | }, 863 | { 864 | "cell_type": "code", 865 | "metadata": { 866 | "id": "ifU5cdUp9VnZ", 867 | "colab_type": "code", 868 | "colab": { 869 | "base_uri": "https://localhost:8080/", 870 | "height": 802 871 | }, 872 | "outputId": "d439a3c2-d3cf-4d75-9daa-0f9dfb73ec07" 873 | }, 874 | "source": [ 875 | "embedding = \"https://tfhub.dev/google/tf2-preview/nnlm-en-dim128/1\"\n", 876 | "hub_layer = hub.KerasLayer(embedding, output_shape=[128], input_shape=[], \n", 877 | " dtype=tf.string, trainable=True)\n", 878 | "hub_layer(train_data[:1])" 879 | ], 880 | "execution_count": null, 881 | "outputs": [ 882 | { 883 | "output_type": "execute_result", 884 | "data": { 885 | "text/plain": [ 886 | "" 930 | ] 931 | }, 932 | "metadata": { 933 | "tags": [] 934 | }, 935 | "execution_count": 23 936 | } 937 | ] 938 | }, 939 | { 940 | "cell_type": "code", 941 | "metadata": { 942 | "id": "1AI7BhDe9Vif", 943 | "colab_type": "code", 944 | "colab": { 945 | "base_uri": "https://localhost:8080/", 946 | "height": 517 947 | }, 948 | "outputId": "12c70379-9b0f-4d25-a95e-910ca903e85d" 949 | }, 950 | "source": [ 951 | "model = tf.keras.Sequential()\n", 952 | "model.add(hub_layer)\n", 953 | "for units in [128, 128, 64 , 32]:\n", 954 | " model.add(tf.keras.layers.Dense(units, activation='relu'))\n", 955 | " model.add(tf.keras.layers.Dropout(0.3))\n", 956 | "model.add(tf.keras.layers.Dense(6, activation='softmax'))\n", 957 | "\n", 958 | "model.summary()" 959 | ], 960 | "execution_count": null, 961 | "outputs": [ 962 | { 963 | "output_type": "stream", 964 | "text": [ 965 | "Model: \"sequential\"\n", 966 | "_________________________________________________________________\n", 967 | "Layer (type) Output Shape Param # \n", 968 | "=================================================================\n", 969 | "keras_layer (KerasLayer) (None, 128) 124642688 \n", 970 | "_________________________________________________________________\n", 971 | "dense (Dense) (None, 128) 16512 \n", 972 | "_________________________________________________________________\n", 973 | "dropout (Dropout) (None, 128) 0 \n", 974 | "_________________________________________________________________\n", 975 | "dense_1 (Dense) (None, 128) 16512 \n", 976 | "_________________________________________________________________\n", 977 | "dropout_1 (Dropout) (None, 128) 0 \n", 978 | "_________________________________________________________________\n", 979 | "dense_2 (Dense) (None, 64) 8256 \n", 980 | "_________________________________________________________________\n", 981 | "dropout_2 (Dropout) (None, 64) 0 \n", 982 | "_________________________________________________________________\n", 983 | "dense_3 (Dense) (None, 32) 2080 \n", 984 | "_________________________________________________________________\n", 985 | "dropout_3 (Dropout) (None, 32) 0 \n", 986 | "_________________________________________________________________\n", 987 | "dense_4 (Dense) (None, 6) 198 \n", 988 | "=================================================================\n", 989 | "Total params: 124,686,246\n", 990 | "Trainable params: 124,686,246\n", 991 | "Non-trainable params: 0\n", 992 | "_________________________________________________________________\n" 993 | ], 994 | "name": "stdout" 995 | } 996 | ] 997 | }, 998 | { 999 | "cell_type": "code", 1000 | "metadata": { 1001 | "id": "Z_HPHq3W9VeT", 1002 | "colab_type": "code", 1003 | "colab": {} 1004 | }, 1005 | "source": [ 1006 | "model.compile(optimizer='adam',\n", 1007 | " loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True),\n", 1008 | " metrics=['accuracy'])" 1009 | ], 1010 | "execution_count": null, 1011 | "outputs": [] 1012 | }, 1013 | { 1014 | "cell_type": "code", 1015 | "metadata": { 1016 | "id": "jSCeGUYF9TlL", 1017 | "colab_type": "code", 1018 | "colab": {} 1019 | }, 1020 | "source": [ 1021 | "train_data_f=train_data_f.shuffle(70000).batch(512)\n", 1022 | "test_data_f=test_data_f.batch(512)" 1023 | ], 1024 | "execution_count": null, 1025 | "outputs": [] 1026 | }, 1027 | { 1028 | "cell_type": "code", 1029 | "metadata": { 1030 | "id": "E_h5I4StQj5E", 1031 | "colab_type": "code", 1032 | "colab": { 1033 | "base_uri": "https://localhost:8080/", 1034 | "height": 180 1035 | }, 1036 | "outputId": "98f61cb1-2e0c-4a15-9dbc-9a0c1b375d75" 1037 | }, 1038 | "source": [ 1039 | "history = model.fit(train_data_f,\n", 1040 | " epochs=4,\n", 1041 | " validation_data=test_data_f,\n", 1042 | " verbose=1,\n", 1043 | " class_weight=weights)" 1044 | ], 1045 | "execution_count": null, 1046 | "outputs": [ 1047 | { 1048 | "output_type": "stream", 1049 | "text": [ 1050 | "Epoch 1/4\n", 1051 | "90/90 [==============================] - 9s 100ms/step - loss: 1.6476 - accuracy: 0.4482 - val_loss: 1.2779 - val_accuracy: 0.7771\n", 1052 | "Epoch 2/4\n", 1053 | "90/90 [==============================] - 9s 100ms/step - loss: 1.3280 - accuracy: 0.7920 - val_loss: 1.1924 - val_accuracy: 0.8509\n", 1054 | "Epoch 3/4\n", 1055 | "90/90 [==============================] - 9s 101ms/step - loss: 1.1963 - accuracy: 0.8554 - val_loss: 1.1780 - val_accuracy: 0.8651\n", 1056 | "Epoch 4/4\n", 1057 | "90/90 [==============================] - 9s 101ms/step - loss: 1.1556 - accuracy: 0.8848 - val_loss: 1.1696 - val_accuracy: 0.8739\n" 1058 | ], 1059 | "name": "stdout" 1060 | } 1061 | ] 1062 | }, 1063 | { 1064 | "cell_type": "code", 1065 | "metadata": { 1066 | "id": "hy55ceBpjL7E", 1067 | "colab_type": "code", 1068 | "colab": { 1069 | "base_uri": "https://localhost:8080/", 1070 | "height": 35 1071 | }, 1072 | "outputId": "4141c279-216d-4e36-e291-ffa0d7de14f6" 1073 | }, 1074 | "source": [ 1075 | "len(list(dataset_test))" 1076 | ], 1077 | "execution_count": null, 1078 | "outputs": [ 1079 | { 1080 | "output_type": "execute_result", 1081 | "data": { 1082 | "text/plain": [ 1083 | "11491" 1084 | ] 1085 | }, 1086 | "metadata": { 1087 | "tags": [] 1088 | }, 1089 | "execution_count": 28 1090 | } 1091 | ] 1092 | }, 1093 | { 1094 | "cell_type": "code", 1095 | "metadata": { 1096 | "id": "MwG1bP-TC5fE", 1097 | "colab_type": "code", 1098 | "colab": { 1099 | "base_uri": "https://localhost:8080/", 1100 | "height": 53 1101 | }, 1102 | "outputId": "244428b1-c662-41ff-96b6-aeb19095e49f" 1103 | }, 1104 | "source": [ 1105 | "results = model.evaluate(dataset_test.map(fetch).batch(11491), verbose=2)\n", 1106 | "\n", 1107 | "print(results)" 1108 | ], 1109 | "execution_count": null, 1110 | "outputs": [ 1111 | { 1112 | "output_type": "stream", 1113 | "text": [ 1114 | "1/1 - 0s - loss: 1.1696 - accuracy: 0.8739\n", 1115 | "[1.1696072816848755, 0.8739013075828552]\n" 1116 | ], 1117 | "name": "stdout" 1118 | } 1119 | ] 1120 | }, 1121 | { 1122 | "cell_type": "code", 1123 | "metadata": { 1124 | "id": "-nQdChwqbFer", 1125 | "colab_type": "code", 1126 | "colab": {} 1127 | }, 1128 | "source": [ 1129 | "test_data, test_labels = next(iter(dataset_test.map(fetch).batch(45963)))" 1130 | ], 1131 | "execution_count": null, 1132 | "outputs": [] 1133 | }, 1134 | { 1135 | "cell_type": "code", 1136 | "metadata": { 1137 | "id": "nZ9qnGJ7cHlc", 1138 | "colab_type": "code", 1139 | "colab": {} 1140 | }, 1141 | "source": [ 1142 | "y_pred=model.predict(test_data)" 1143 | ], 1144 | "execution_count": null, 1145 | "outputs": [] 1146 | }, 1147 | { 1148 | "cell_type": "code", 1149 | "metadata": { 1150 | "id": "ZzzDvHTAcnIv", 1151 | "colab_type": "code", 1152 | "colab": {} 1153 | }, 1154 | "source": [ 1155 | "from sklearn.metrics import classification_report" 1156 | ], 1157 | "execution_count": null, 1158 | "outputs": [] 1159 | }, 1160 | { 1161 | "cell_type": "code", 1162 | "metadata": { 1163 | "id": "Vz8L4sgJcTqI", 1164 | "colab_type": "code", 1165 | "colab": { 1166 | "base_uri": "https://localhost:8080/", 1167 | "height": 249 1168 | }, 1169 | "outputId": "ad67bc27-14ce-42dc-d46b-7dcd82b60093" 1170 | }, 1171 | "source": [ 1172 | "print(classification_report(test_labels.numpy().argmax(axis=1), y_pred.argmax(axis=1)))" 1173 | ], 1174 | "execution_count": null, 1175 | "outputs": [ 1176 | { 1177 | "output_type": "stream", 1178 | "text": [ 1179 | " precision recall f1-score support\n", 1180 | "\n", 1181 | " 0 0.94 0.89 0.91 4295\n", 1182 | " 1 0.85 0.86 0.86 2583\n", 1183 | " 2 0.93 0.92 0.92 2015\n", 1184 | " 3 0.87 0.82 0.85 1461\n", 1185 | " 4 0.81 0.84 0.82 611\n", 1186 | " 5 0.55 0.84 0.66 526\n", 1187 | "\n", 1188 | " accuracy 0.87 11491\n", 1189 | " macro avg 0.82 0.86 0.84 11491\n", 1190 | "weighted avg 0.88 0.87 0.88 11491\n", 1191 | "\n" 1192 | ], 1193 | "name": "stdout" 1194 | } 1195 | ] 1196 | }, 1197 | { 1198 | "cell_type": "markdown", 1199 | "metadata": { 1200 | "id": "rduQJeGyVbA5", 1201 | "colab_type": "text" 1202 | }, 1203 | "source": [ 1204 | "Classification Report with no class weights assigned\n", 1205 | " \n", 1206 | "\n", 1207 | "\n", 1208 | "```\n", 1209 | " precision recall f1-score support\n", 1210 | "\n", 1211 | " 0 0.92 0.91 0.92 4295\n", 1212 | " 1 0.84 0.88 0.86 2583\n", 1213 | " 2 0.90 0.94 0.92 2015\n", 1214 | " 3 0.86 0.84 0.85 1461\n", 1215 | " 4 0.86 0.78 0.81 611\n", 1216 | " 5 0.69 0.62 0.65 526\n", 1217 | "\n", 1218 | " accuracy 0.88 11491\n", 1219 | " macro avg 0.85 0.83 0.84 11491\n", 1220 | "weighted avg 0.88 0.88 0.88 11491\n", 1221 | "```\n", 1222 | "\n", 1223 | "\n" 1224 | ] 1225 | }, 1226 | { 1227 | "cell_type": "code", 1228 | "metadata": { 1229 | "id": "KGQ59jwIQjgX", 1230 | "colab_type": "code", 1231 | "colab": { 1232 | "base_uri": "https://localhost:8080/", 1233 | "height": 124 1234 | }, 1235 | "outputId": "7fb0c5b8-d47b-43b7-d330-1442db4b9376" 1236 | }, 1237 | "source": [ 1238 | "from sklearn.metrics import confusion_matrix\n", 1239 | "confusion_matrix(test_labels.numpy().argmax(axis=1), y_pred.argmax(axis=1))" 1240 | ], 1241 | "execution_count": null, 1242 | "outputs": [ 1243 | { 1244 | "output_type": "execute_result", 1245 | "data": { 1246 | "text/plain": [ 1247 | "array([[3815, 167, 76, 32, 80, 125],\n", 1248 | " [ 125, 2222, 13, 109, 10, 104],\n", 1249 | " [ 37, 21, 1848, 23, 21, 65],\n", 1250 | " [ 37, 162, 30, 1204, 5, 23],\n", 1251 | " [ 18, 18, 11, 4, 511, 49],\n", 1252 | " [ 29, 21, 17, 10, 7, 442]])" 1253 | ] 1254 | }, 1255 | "metadata": { 1256 | "tags": [] 1257 | }, 1258 | "execution_count": 34 1259 | } 1260 | ] 1261 | }, 1262 | { 1263 | "cell_type": "markdown", 1264 | "metadata": { 1265 | "id": "6ixm_2WMmHHt", 1266 | "colab_type": "text" 1267 | }, 1268 | "source": [ 1269 | "Confusion matrix without weights assigned\n", 1270 | "\n", 1271 | "```\n", 1272 | "array([[3910, 165, 80, 34, 50, 56],\n", 1273 | " [ 128, 2274, 20, 128, 3, 30],\n", 1274 | " [ 36, 27, 1893, 18, 16, 25],\n", 1275 | " [ 41, 149, 29, 1227, 5, 10],\n", 1276 | " [ 41, 35, 30, 6, 474, 25],\n", 1277 | " [ 72, 50, 60, 14, 5, 325]])\n", 1278 | "```\n", 1279 | "\n" 1280 | ] 1281 | }, 1282 | { 1283 | "cell_type": "code", 1284 | "metadata": { 1285 | "id": "wC7ymBCknK98", 1286 | "colab_type": "code", 1287 | "colab": {} 1288 | }, 1289 | "source": [ 1290 | "" 1291 | ], 1292 | "execution_count": null, 1293 | "outputs": [] 1294 | }, 1295 | { 1296 | "cell_type": "code", 1297 | "metadata": { 1298 | "id": "bo6sh1pGnK6B", 1299 | "colab_type": "code", 1300 | "colab": {} 1301 | }, 1302 | "source": [ 1303 | "" 1304 | ], 1305 | "execution_count": null, 1306 | "outputs": [] 1307 | }, 1308 | { 1309 | "cell_type": "code", 1310 | "metadata": { 1311 | "id": "vhtjA7qGnK07", 1312 | "colab_type": "code", 1313 | "colab": {} 1314 | }, 1315 | "source": [ 1316 | "" 1317 | ], 1318 | "execution_count": null, 1319 | "outputs": [] 1320 | }, 1321 | { 1322 | "cell_type": "code", 1323 | "metadata": { 1324 | "id": "BQqC8MAknJD4", 1325 | "colab_type": "code", 1326 | "colab": {} 1327 | }, 1328 | "source": [ 1329 | "" 1330 | ], 1331 | "execution_count": null, 1332 | "outputs": [] 1333 | }, 1334 | { 1335 | "cell_type": "code", 1336 | "metadata": { 1337 | "id": "cMjeT_DkpPQ2", 1338 | "colab_type": "code", 1339 | "colab": {} 1340 | }, 1341 | "source": [ 1342 | "" 1343 | ], 1344 | "execution_count": null, 1345 | "outputs": [] 1346 | }, 1347 | { 1348 | "cell_type": "code", 1349 | "metadata": { 1350 | "id": "9nWmBBwIpPMx", 1351 | "colab_type": "code", 1352 | "colab": {} 1353 | }, 1354 | "source": [ 1355 | "" 1356 | ], 1357 | "execution_count": null, 1358 | "outputs": [] 1359 | }, 1360 | { 1361 | "cell_type": "code", 1362 | "metadata": { 1363 | "id": "eSGPqXKcpPI1", 1364 | "colab_type": "code", 1365 | "colab": {} 1366 | }, 1367 | "source": [ 1368 | "" 1369 | ], 1370 | "execution_count": null, 1371 | "outputs": [] 1372 | }, 1373 | { 1374 | "cell_type": "code", 1375 | "metadata": { 1376 | "id": "tjVDPmZDpPEo", 1377 | "colab_type": "code", 1378 | "colab": {} 1379 | }, 1380 | "source": [ 1381 | "" 1382 | ], 1383 | "execution_count": null, 1384 | "outputs": [] 1385 | }, 1386 | { 1387 | "cell_type": "code", 1388 | "metadata": { 1389 | "id": "YfAACV1ipO-d", 1390 | "colab_type": "code", 1391 | "colab": {} 1392 | }, 1393 | "source": [ 1394 | "" 1395 | ], 1396 | "execution_count": null, 1397 | "outputs": [] 1398 | }, 1399 | { 1400 | "cell_type": "code", 1401 | "metadata": { 1402 | "id": "xM7snwiBpO4v", 1403 | "colab_type": "code", 1404 | "colab": {} 1405 | }, 1406 | "source": [ 1407 | "" 1408 | ], 1409 | "execution_count": null, 1410 | "outputs": [] 1411 | }, 1412 | { 1413 | "cell_type": "code", 1414 | "metadata": { 1415 | "id": "JzfPjub9pOxl", 1416 | "colab_type": "code", 1417 | "colab": {} 1418 | }, 1419 | "source": [ 1420 | "" 1421 | ], 1422 | "execution_count": null, 1423 | "outputs": [] 1424 | } 1425 | ] 1426 | } --------------------------------------------------------------------------------