Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
larrymoralez committed Apr 4, 2019
1 parent 4b9cd9e commit dd2346d
Showing 1 changed file with 62 additions and 70 deletions.
132 changes: 62 additions & 70 deletions ML_HW_2_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"metadata": {
"id": "WB2MOX36BTBN",
"colab_type": "code",
"outputId": "f28a102f-18e6-4ae7-dea6-01748ca86623",
"outputId": "57bee917-eb9e-4d75-be44-77ae94daec18",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
"height": 68
}
},
"cell_type": "code",
Expand Down Expand Up @@ -60,6 +60,14 @@
"Using TensorFlow backend.\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz\n",
"170500096/170498071 [==============================] - 53s 0us/step\n"
],
"name": "stdout"
}
]
},
Expand All @@ -81,7 +89,7 @@
"metadata": {
"id": "1kCX5qUQBZ86",
"colab_type": "code",
"outputId": "8daa18e1-0624-43be-ab7f-b047ccd64f60",
"outputId": "167b10e8-2354-4224-8025-c88a2b1bc5e7",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 68
Expand Down Expand Up @@ -128,7 +136,7 @@
"metadata": {
"id": "jMIDxPB5BeqB",
"colab_type": "code",
"outputId": "4341292a-ba57-4ece-828b-a6ade4f34481",
"outputId": "53f5fde8-bf30-49ea-ad4b-9b07f8975dc2",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 799
Expand Down Expand Up @@ -237,7 +245,7 @@
"metadata": {
"id": "eztZhQ-YFO7U",
"colab_type": "code",
"outputId": "2ce211e8-4ee5-446d-cfa9-d5368751833f",
"outputId": "499d2c95-b351-4b30-e0f9-2a820faf06c8",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1683
Expand All @@ -257,99 +265,99 @@
"Use tf.cast instead.\n",
"Train on 40000 samples, validate on 10000 samples\n",
"Epoch 1/100\n",
"40000/40000 [==============================] - 720s 18ms/step - loss: 6.5371 - acc: 0.2164 - val_loss: 1.6667 - val_acc: 0.4150\n",
"40000/40000 [==============================] - 224s 6ms/step - loss: 2.4247 - acc: 0.3053 - val_loss: 1.5202 - val_acc: 0.4547\n",
"Epoch 2/100\n",
"40000/40000 [==============================] - 710s 18ms/step - loss: 1.6442 - acc: 0.4027 - val_loss: 1.4049 - val_acc: 0.5122\n",
"40000/40000 [==============================] - 226s 6ms/step - loss: 1.5222 - acc: 0.4484 - val_loss: 1.3813 - val_acc: 0.5093\n",
"Epoch 3/100\n",
"40000/40000 [==============================] - 713s 18ms/step - loss: 1.4608 - acc: 0.4782 - val_loss: 1.3662 - val_acc: 0.5152\n",
"40000/40000 [==============================] - 227s 6ms/step - loss: 1.3625 - acc: 0.5167 - val_loss: 1.2243 - val_acc: 0.5748\n",
"Epoch 4/100\n",
"40000/40000 [==============================] - 707s 18ms/step - loss: 1.3541 - acc: 0.5222 - val_loss: 1.1795 - val_acc: 0.5875\n",
"40000/40000 [==============================] - 229s 6ms/step - loss: 1.2640 - acc: 0.5518 - val_loss: 1.1529 - val_acc: 0.5974\n",
"Epoch 5/100\n",
"40000/40000 [==============================] - 709s 18ms/step - loss: 1.2819 - acc: 0.5469 - val_loss: 1.1691 - val_acc: 0.5842\n",
"40000/40000 [==============================] - 231s 6ms/step - loss: 1.1966 - acc: 0.5776 - val_loss: 1.1526 - val_acc: 0.5955\n",
"Epoch 6/100\n",
"40000/40000 [==============================] - 699s 17ms/step - loss: 1.2317 - acc: 0.5677 - val_loss: 1.1409 - val_acc: 0.6018\n",
"40000/40000 [==============================] - 225s 6ms/step - loss: 1.1385 - acc: 0.6008 - val_loss: 1.0433 - val_acc: 0.6339\n",
"Epoch 7/100\n",
"40000/40000 [==============================] - 696s 17ms/step - loss: 1.1859 - acc: 0.5841 - val_loss: 1.0585 - val_acc: 0.6277\n",
"40000/40000 [==============================] - 392s 10ms/step - loss: 1.0883 - acc: 0.6205 - val_loss: 1.0250 - val_acc: 0.6447\n",
"Epoch 8/100\n",
"40000/40000 [==============================] - 699s 17ms/step - loss: 1.1604 - acc: 0.5967 - val_loss: 1.0746 - val_acc: 0.6263\n",
"40000/40000 [==============================] - 460s 11ms/step - loss: 1.0565 - acc: 0.6325 - val_loss: 0.9632 - val_acc: 0.6665\n",
"Epoch 9/100\n",
"40000/40000 [==============================] - 697s 17ms/step - loss: 1.1249 - acc: 0.6087 - val_loss: 1.0324 - val_acc: 0.6428\n",
"40000/40000 [==============================] - 463s 12ms/step - loss: 1.0268 - acc: 0.6416 - val_loss: 0.9574 - val_acc: 0.6707\n",
"Epoch 10/100\n",
"40000/40000 [==============================] - 693s 17ms/step - loss: 1.0985 - acc: 0.6210 - val_loss: 0.9962 - val_acc: 0.6594\n",
"40000/40000 [==============================] - 471s 12ms/step - loss: 1.0033 - acc: 0.6550 - val_loss: 0.9774 - val_acc: 0.6651\n",
"Epoch 11/100\n",
"40000/40000 [==============================] - 710s 18ms/step - loss: 1.0774 - acc: 0.6288 - val_loss: 0.9875 - val_acc: 0.6584\n",
"40000/40000 [==============================] - 458s 11ms/step - loss: 0.9847 - acc: 0.6600 - val_loss: 0.9086 - val_acc: 0.6898\n",
"Epoch 12/100\n",
"40000/40000 [==============================] - 706s 18ms/step - loss: 1.0649 - acc: 0.6329 - val_loss: 0.9730 - val_acc: 0.6604\n",
"40000/40000 [==============================] - 469s 12ms/step - loss: 0.9679 - acc: 0.6685 - val_loss: 0.9529 - val_acc: 0.6775\n",
"Epoch 13/100\n",
"40000/40000 [==============================] - 705s 18ms/step - loss: 1.0534 - acc: 0.6415 - val_loss: 1.0045 - val_acc: 0.6612\n",
"40000/40000 [==============================] - 469s 12ms/step - loss: 0.9634 - acc: 0.6715 - val_loss: 0.9064 - val_acc: 0.6882\n",
"Epoch 14/100\n",
"40000/40000 [==============================] - 705s 18ms/step - loss: 1.0438 - acc: 0.6444 - val_loss: 0.9575 - val_acc: 0.6676\n",
"40000/40000 [==============================] - 463s 12ms/step - loss: 0.9459 - acc: 0.6789 - val_loss: 0.9989 - val_acc: 0.6769\n",
"Epoch 15/100\n",
"40000/40000 [==============================] - 703s 18ms/step - loss: 1.0382 - acc: 0.6454 - val_loss: 0.9394 - val_acc: 0.6735\n",
"40000/40000 [==============================] - 464s 12ms/step - loss: 0.9286 - acc: 0.6843 - val_loss: 0.9182 - val_acc: 0.6902\n",
"Epoch 16/100\n",
"40000/40000 [==============================] - 702s 18ms/step - loss: 1.0311 - acc: 0.6509 - val_loss: 1.0250 - val_acc: 0.6591\n",
"40000/40000 [==============================] - 473s 12ms/step - loss: 0.9267 - acc: 0.6869 - val_loss: 0.9028 - val_acc: 0.6955\n",
"Epoch 17/100\n",
"40000/40000 [==============================] - 701s 18ms/step - loss: 1.0275 - acc: 0.6512 - val_loss: 0.9603 - val_acc: 0.6726\n",
"40000/40000 [==============================] - 469s 12ms/step - loss: 0.9299 - acc: 0.6894 - val_loss: 0.8877 - val_acc: 0.7013\n",
"Epoch 18/100\n",
"40000/40000 [==============================] - 711s 18ms/step - loss: 1.0112 - acc: 0.6578 - val_loss: 0.9477 - val_acc: 0.6776\n",
"40000/40000 [==============================] - 465s 12ms/step - loss: 0.9196 - acc: 0.6898 - val_loss: 0.9310 - val_acc: 0.6915\n",
"Epoch 19/100\n",
"40000/40000 [==============================] - 713s 18ms/step - loss: 1.0194 - acc: 0.6569 - val_loss: 0.9195 - val_acc: 0.6836\n",
"40000/40000 [==============================] - 450s 11ms/step - loss: 0.9113 - acc: 0.6950 - val_loss: 0.9180 - val_acc: 0.7027\n",
"Epoch 20/100\n",
"40000/40000 [==============================] - 721s 18ms/step - loss: 1.0014 - acc: 0.6630 - val_loss: 0.9808 - val_acc: 0.6666\n",
"40000/40000 [==============================] - 448s 11ms/step - loss: 0.9074 - acc: 0.6969 - val_loss: 0.8792 - val_acc: 0.7050\n",
"Epoch 21/100\n",
"40000/40000 [==============================] - 721s 18ms/step - loss: 1.0056 - acc: 0.6638 - val_loss: 0.9800 - val_acc: 0.6797\n",
"40000/40000 [==============================] - 452s 11ms/step - loss: 0.8953 - acc: 0.6984 - val_loss: 0.8915 - val_acc: 0.7122\n",
"Epoch 22/100\n",
"40000/40000 [==============================] - 733s 18ms/step - loss: 0.9985 - acc: 0.6635 - val_loss: 0.9318 - val_acc: 0.6959\n",
"40000/40000 [==============================] - 465s 12ms/step - loss: 0.8950 - acc: 0.7032 - val_loss: 0.8589 - val_acc: 0.7156\n",
"Epoch 23/100\n",
"40000/40000 [==============================] - 723s 18ms/step - loss: 0.9941 - acc: 0.6674 - val_loss: 0.9925 - val_acc: 0.6855\n",
"40000/40000 [==============================] - 459s 11ms/step - loss: 0.8865 - acc: 0.7039 - val_loss: 0.8938 - val_acc: 0.7030\n",
"Epoch 24/100\n",
"40000/40000 [==============================] - 720s 18ms/step - loss: 0.9872 - acc: 0.6688 - val_loss: 0.9599 - val_acc: 0.6840\n",
"40000/40000 [==============================] - 457s 11ms/step - loss: 0.8871 - acc: 0.7023 - val_loss: 0.8895 - val_acc: 0.7026\n",
"Epoch 25/100\n",
"40000/40000 [==============================] - 717s 18ms/step - loss: 0.9915 - acc: 0.6697 - val_loss: 0.9281 - val_acc: 0.6909\n",
"40000/40000 [==============================] - 465s 12ms/step - loss: 0.8855 - acc: 0.7039 - val_loss: 0.8575 - val_acc: 0.7170\n",
"Epoch 26/100\n",
"40000/40000 [==============================] - 722s 18ms/step - loss: 0.9791 - acc: 0.6729 - val_loss: 0.9532 - val_acc: 0.6874\n",
"40000/40000 [==============================] - 462s 12ms/step - loss: 0.8838 - acc: 0.7073 - val_loss: 0.8609 - val_acc: 0.7186\n",
"Epoch 27/100\n",
"40000/40000 [==============================] - 718s 18ms/step - loss: 0.9792 - acc: 0.6715 - val_loss: 0.9337 - val_acc: 0.6944\n",
"40000/40000 [==============================] - 462s 12ms/step - loss: 0.8813 - acc: 0.7084 - val_loss: 0.9146 - val_acc: 0.6999\n",
"Epoch 28/100\n",
"40000/40000 [==============================] - 720s 18ms/step - loss: 0.9778 - acc: 0.6771 - val_loss: 0.8871 - val_acc: 0.7069\n",
"40000/40000 [==============================] - 453s 11ms/step - loss: 0.8791 - acc: 0.7083 - val_loss: 0.8731 - val_acc: 0.7197\n",
"Epoch 29/100\n",
"40000/40000 [==============================] - 715s 18ms/step - loss: 0.9736 - acc: 0.6777 - val_loss: 0.8964 - val_acc: 0.6970\n",
"40000/40000 [==============================] - 447s 11ms/step - loss: 0.8807 - acc: 0.7097 - val_loss: 0.9730 - val_acc: 0.7035\n",
"Epoch 30/100\n",
"40000/40000 [==============================] - 718s 18ms/step - loss: 0.9701 - acc: 0.6784 - val_loss: 0.9129 - val_acc: 0.6907\n",
"40000/40000 [==============================] - 448s 11ms/step - loss: 0.8653 - acc: 0.7144 - val_loss: 0.8743 - val_acc: 0.7049\n",
"Epoch 31/100\n",
"40000/40000 [==============================] - 716s 18ms/step - loss: 0.9756 - acc: 0.6801 - val_loss: 0.9537 - val_acc: 0.6941\n",
"40000/40000 [==============================] - 453s 11ms/step - loss: 0.8658 - acc: 0.7128 - val_loss: 0.8846 - val_acc: 0.7207\n",
"Epoch 32/100\n",
"40000/40000 [==============================] - 717s 18ms/step - loss: 0.9657 - acc: 0.6790 - val_loss: 1.0052 - val_acc: 0.6999\n",
"40000/40000 [==============================] - 462s 12ms/step - loss: 0.8668 - acc: 0.7111 - val_loss: 0.8337 - val_acc: 0.7215\n",
"Epoch 33/100\n",
"40000/40000 [==============================] - 718s 18ms/step - loss: 0.9633 - acc: 0.6817 - val_loss: 0.8853 - val_acc: 0.7120\n",
"40000/40000 [==============================] - 455s 11ms/step - loss: 0.8662 - acc: 0.7145 - val_loss: 0.8711 - val_acc: 0.7238\n",
"Epoch 34/100\n",
"40000/40000 [==============================] - 718s 18ms/step - loss: 0.9554 - acc: 0.6863 - val_loss: 0.8867 - val_acc: 0.7048\n",
"40000/40000 [==============================] - 452s 11ms/step - loss: 0.8667 - acc: 0.7135 - val_loss: 0.9023 - val_acc: 0.7112\n",
"Epoch 35/100\n",
"40000/40000 [==============================] - 715s 18ms/step - loss: 0.9631 - acc: 0.6803 - val_loss: 0.9600 - val_acc: 0.7014\n",
"40000/40000 [==============================] - 454s 11ms/step - loss: 0.8644 - acc: 0.7168 - val_loss: 0.8434 - val_acc: 0.7201\n",
"Epoch 36/100\n",
"40000/40000 [==============================] - 713s 18ms/step - loss: 0.9544 - acc: 0.6870 - val_loss: 0.8786 - val_acc: 0.7075\n",
"40000/40000 [==============================] - 455s 11ms/step - loss: 0.8626 - acc: 0.7143 - val_loss: 0.8411 - val_acc: 0.7307\n",
"Epoch 37/100\n",
"40000/40000 [==============================] - 715s 18ms/step - loss: 0.9489 - acc: 0.6867 - val_loss: 0.8864 - val_acc: 0.7087\n",
"40000/40000 [==============================] - 461s 12ms/step - loss: 0.8612 - acc: 0.7170 - val_loss: 0.8618 - val_acc: 0.7170\n",
"Epoch 38/100\n",
"40000/40000 [==============================] - 721s 18ms/step - loss: 0.9537 - acc: 0.6870 - val_loss: 0.8922 - val_acc: 0.7137\n",
"40000/40000 [==============================] - 463s 12ms/step - loss: 0.8663 - acc: 0.7145 - val_loss: 0.8616 - val_acc: 0.7209\n",
"Epoch 39/100\n",
"40000/40000 [==============================] - 715s 18ms/step - loss: 0.9481 - acc: 0.6905 - val_loss: 0.8969 - val_acc: 0.7085\n",
"40000/40000 [==============================] - 467s 12ms/step - loss: 0.8660 - acc: 0.7163 - val_loss: 0.8883 - val_acc: 0.7143\n",
"Epoch 40/100\n",
"40000/40000 [==============================] - 717s 18ms/step - loss: 0.9532 - acc: 0.6854 - val_loss: 0.8767 - val_acc: 0.7092\n",
"40000/40000 [==============================] - 454s 11ms/step - loss: 0.8656 - acc: 0.7156 - val_loss: 0.8550 - val_acc: 0.7138\n",
"Epoch 41/100\n",
"40000/40000 [==============================] - 732s 18ms/step - loss: 0.9449 - acc: 0.6912 - val_loss: 0.9702 - val_acc: 0.6980\n",
"40000/40000 [==============================] - 455s 11ms/step - loss: 0.8596 - acc: 0.7156 - val_loss: 0.8712 - val_acc: 0.7232\n",
"Epoch 42/100\n",
"40000/40000 [==============================] - 770s 19ms/step - loss: 0.9375 - acc: 0.6897 - val_loss: 0.8913 - val_acc: 0.7081\n",
"40000/40000 [==============================] - 454s 11ms/step - loss: 0.8676 - acc: 0.7158 - val_loss: 0.8716 - val_acc: 0.7200\n",
"Epoch 43/100\n",
"40000/40000 [==============================] - 780s 19ms/step - loss: 0.9460 - acc: 0.6902 - val_loss: 0.9397 - val_acc: 0.6975\n",
"40000/40000 [==============================] - 460s 11ms/step - loss: 0.8647 - acc: 0.7164 - val_loss: 0.9207 - val_acc: 0.7142\n",
"Epoch 44/100\n",
"40000/40000 [==============================] - 785s 20ms/step - loss: 0.9468 - acc: 0.6894 - val_loss: 0.8841 - val_acc: 0.7128\n",
"40000/40000 [==============================] - 457s 11ms/step - loss: 0.8680 - acc: 0.7162 - val_loss: 0.8335 - val_acc: 0.7273\n",
"Epoch 45/100\n",
"40000/40000 [==============================] - 809s 20ms/step - loss: 0.9480 - acc: 0.6895 - val_loss: 0.9167 - val_acc: 0.6978\n",
"40000/40000 [==============================] - 482s 12ms/step - loss: 0.8729 - acc: 0.7146 - val_loss: 0.8788 - val_acc: 0.7200\n",
"Epoch 46/100\n",
"40000/40000 [==============================] - 806s 20ms/step - loss: 0.9544 - acc: 0.6898 - val_loss: 0.8929 - val_acc: 0.7079\n",
"40000/40000 [==============================] - 469s 12ms/step - loss: 0.8679 - acc: 0.7165 - val_loss: 0.9046 - val_acc: 0.7049\n",
"Epoch 47/100\n",
"32448/40000 [=======================>......] - ETA: 2:20 - loss: 0.9457 - acc: 0.6891Buffered data was truncated after reaching the output size limit."
"33824/40000 [========================>.....] - ETA: 1:06 - loss: 0.8746 - acc: 0.7155Buffered data was truncated after reaching the output size limit."
],
"name": "stdout"
}
Expand All @@ -359,11 +367,7 @@
"metadata": {
"id": "CSDcW0_dhLt_",
"colab_type": "code",
"outputId": "fde283cd-de19-4c15-ea23-9b0042a8a491",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 231
}
"colab": {}
},
"cell_type": "code",
"source": [
Expand All @@ -381,19 +385,7 @@
"plt.show()"
],
"execution_count": 0,
"outputs": [
{
"output_type": "error",
"ename": "NameError",
"evalue": "ignored",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-846e6e1ab28d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mhistory_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhistory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhistory\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mloss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhistory_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'loss'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mval_loss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mhistory_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'val_loss'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mepochs_range\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mepochs\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'history' is not defined"
]
}
]
"outputs": []
},
{
"metadata": {
Expand Down

0 comments on commit dd2346d

Please sign in to comment.