diff --git a/tf_2.x/lab-05-1-logistic_regression-eager.ipynb b/tf_2.x/lab-05-1-logistic_regression-eager.ipynb index bf25208..713126a 100644 --- a/tf_2.x/lab-05-1-logistic_regression-eager.ipynb +++ b/tf_2.x/lab-05-1-logistic_regression-eager.ipynb @@ -12,14 +12,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2.1.0\n" + "2.0.0-alpha0\n" ] } ], @@ -45,14 +45,14 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 11, "metadata": { "scrolled": true }, "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEGCAYAAAB/+QKOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAXEUlEQVR4nO3df5BdZZ3n8fcnPxAIKCo96vLDOLvOrj9KftjGsbAUHAdhVpedKWsXykXLwU2VpTsya7mrUAMrs1qrzrI7M6tSUTIoBtAVosyUILjqIlIgHYbfwZEClFSYTWOQJASSdPLdP+6NXjpPdxLok0u636+qW33v8zzn3O8pSH/6ec6596SqkCRpsnnDLkCS9NxkQEiSmgwISVKTASFJajIgJElNC4ZdwEw6/PDDa/HixcMuQ5L2G6tWrXq0qkZafbMqIBYvXszY2Niwy5Ck/UaSn0/V5xKTJKnJgJAkNRkQkqQmA0KS1GRASJKaDAhJUlNnAZHkwCQ/SXJHknuSfLIx5nlJvp7k/iS3JFk80PeJfvtPk7yjqzrnqhWfupKvf/Zbwy5DHaptd7Fj/VlU7Rh2KfvMjo3/gx1PfHXYZcwaXX4OYgvwtqralGQhcGOSa6rq5oExZwGPVdU/S3I68Bng3yZ5NXA68BrgnwDfS/I7VbW9w3rnjMcf3cBln76KeQl/8O/fzqEvPGT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kIOBo4KMla4MyqOne0VfXuKOBk4NZuXh/gtKq6fIQ19enlwNeSLGDwj6RvV9W8uM10nnkpcOng30MsBC6sqitHW1Lv/j2wsrtD6m7gQ32ebN7fVitJauOUlCSpiYEhSWpiYEiSmhgYkqQmBoYkqYmBIe0FSa5M8pv58quxmpsMDGnv+AKD775Is5aBIc2gJG9Mcku3Bsfibv2N11bV/wE2jro+6ZmY99/0lmZSVd2Y5DLgvwD7Ad+oqjn78xSaXwwMaeadBdwIPA786YhrkWaMU1LSzHsRcABwILDviGuRZoyBIc28FcCfAyuBz424FmnGOCUlzaAkHwC2V9WF3a/jXpfkHcCngX8GHND9KvIpVfX9UdYqPVX+Wq0kqYlTUpKkJgaGJKmJgSFJamJgSJKaGBiSpCYGhiSpiYEhSWpiYEiSmvx/6n+mHOfPhngAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] @@ -105,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -148,12 +148,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "def logistic_regression(features):\n", - " hypothesis = tf.divide(1., 1. + tf.exp(tf.matmul(features, W) + b))\n", + " hypothesis = tf.divide(1., 1.+tf.exp(tf.matmul(features, W) + b))\n", " return hypothesis" ] }, @@ -184,15 +184,14 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "def loss_fn(hypothesis, features, labels):\n", - " cost = -tf.reduce_mean(labels * tf.math.log(logistic_regression(features)) + (1 - labels) * tf.math.log(1 - hypothesis))\n", + " cost = tf.reduce_mean(-labels * tf.math.log(logistic_regression(features)) - (1- labels) * tf.math.log(1 - logistic_regression(features))) # logistic_regression(features) = hypothesis 다.\n", " return cost\n", - "\n", - "optimizer = tf.keras.optimizers.SGD(learning_rate=0.01)" + "optimizer = tf.keras.optimizers.SGD(learning_rate = 0.01) " ] }, { @@ -206,13 +205,13 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "def accuracy_fn(hypothesis, labels):\n", - " predicted = tf.cast(hypothesis > 0.5, dtype=tf.float32)\n", - " accuracy = tf.reduce_mean(tf.cast(tf.equal(predicted, labels), dtype=tf.int32))\n", + " predicted = tf.cast(hypothesis > 0.5, dtype = tf.float32) \n", + " accuracy = tf.reduce_mean(tf.cast(tf.equal(predicted, labels), dtype = tf.int32)) \n", " return accuracy" ] }, @@ -225,14 +224,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ - "def grad(features, labels):\n", + "def grad(hypothesis, features, labels):\n", " with tf.GradientTape() as tape:\n", - " loss_value = loss_fn(logistic_regression(features),features,labels)\n", - " return tape.gradient(loss_value, [W,b])" + " loss_value = loss_fn(logistic_regression(features), features, labels)\n", + " return tape.gradient(loss_value, [W, b])" ] }, { @@ -246,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 38, "metadata": {}, "outputs": [ { @@ -263,8 +262,7 @@ "Iter: 700, Loss: 0.4420\n", "Iter: 800, Loss: 0.4319\n", "Iter: 900, Loss: 0.4228\n", - "Iter: 1000, Loss: 0.4144\n", - "Testset Accuracy: 1.0000\n" + "Iter: 1000, Loss: 0.4144\n" ] } ], @@ -272,13 +270,12 @@ "EPOCHS = 1001\n", "\n", "for step in range(EPOCHS):\n", - " for features, labels in iter(dataset):\n", + " for features, labels in iter(dataset):\n", " grads = grad(logistic_regression(features), features, labels)\n", - " optimizer.apply_gradients(grads_and_vars=zip(grads,[W,b]))\n", + " optimizer.apply_gradients(grads_and_vars = zip(grads, [W, b]))\n", + " \n", " if step % 100 == 0:\n", - " print(\"Iter: {}, Loss: {:.4f}\".format(step, loss_fn(logistic_regression(features),features,labels)))\n", - "test_acc = accuracy_fn(logistic_regression(x_test),y_test)\n", - "print(\"Testset Accuracy: {:.4f}\".format(test_acc))" + " print(\"Iter: {}, Loss: {:.4f}\".format(step, loss_fn(logistic_regression(features),features,labels)))" ] }, {