250313
This commit is contained in:
		@@ -24,7 +24,7 @@
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 7,
 | 
			
		||||
   "execution_count": 1,
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
@@ -37,98 +37,9 @@
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 10,
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/html": [
 | 
			
		||||
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential_2\"</span>\n",
 | 
			
		||||
       "</pre>\n"
 | 
			
		||||
      ],
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "\u001b[1mModel: \"sequential_2\"\u001b[0m\n"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/html": [
 | 
			
		||||
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
 | 
			
		||||
       "┃<span style=\"font-weight: bold\"> Layer (type)                    </span>┃<span style=\"font-weight: bold\"> Output Shape           </span>┃<span style=\"font-weight: bold\">       Param # </span>┃\n",
 | 
			
		||||
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
 | 
			
		||||
       "│ dense_4 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                 │ ?                      │   <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (unbuilt) │\n",
 | 
			
		||||
       "├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
 | 
			
		||||
       "│ dense_5 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                 │ ?                      │   <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (unbuilt) │\n",
 | 
			
		||||
       "├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
 | 
			
		||||
       "│ dense_6 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                 │ ?                      │   <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (unbuilt) │\n",
 | 
			
		||||
       "└─────────────────────────────────┴────────────────────────┴───────────────┘\n",
 | 
			
		||||
       "</pre>\n"
 | 
			
		||||
      ],
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
 | 
			
		||||
       "┃\u001b[1m \u001b[0m\u001b[1mLayer (type)                   \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape          \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m      Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
 | 
			
		||||
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
 | 
			
		||||
       "│ dense_4 (\u001b[38;5;33mDense\u001b[0m)                 │ ?                      │   \u001b[38;5;34m0\u001b[0m (unbuilt) │\n",
 | 
			
		||||
       "├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
 | 
			
		||||
       "│ dense_5 (\u001b[38;5;33mDense\u001b[0m)                 │ ?                      │   \u001b[38;5;34m0\u001b[0m (unbuilt) │\n",
 | 
			
		||||
       "├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
 | 
			
		||||
       "│ dense_6 (\u001b[38;5;33mDense\u001b[0m)                 │ ?                      │   \u001b[38;5;34m0\u001b[0m (unbuilt) │\n",
 | 
			
		||||
       "└─────────────────────────────────┴────────────────────────┴───────────────┘\n"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/html": [
 | 
			
		||||
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
 | 
			
		||||
       "</pre>\n"
 | 
			
		||||
      ],
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/html": [
 | 
			
		||||
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
 | 
			
		||||
       "</pre>\n"
 | 
			
		||||
      ],
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/html": [
 | 
			
		||||
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
 | 
			
		||||
       "</pre>\n"
 | 
			
		||||
      ],
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "None\n"
 | 
			
		||||
     ]
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# TEST\n",
 | 
			
		||||
    "model = Sequential([Dense(units=25,activation='relu'),\n",
 | 
			
		||||
@@ -141,50 +52,9 @@
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 8,
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Epoch 1/5\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stderr",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "2025-01-21 11:03:07.974903: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:117] Plugin optimizer for device_type GPU is enabled.\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m16s\u001b[0m 8ms/step - accuracy: 0.8340 - loss: 0.5514\n",
 | 
			
		||||
      "Epoch 2/5\n",
 | 
			
		||||
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m16s\u001b[0m 8ms/step - accuracy: 0.8933 - loss: 0.3836\n",
 | 
			
		||||
      "Epoch 3/5\n",
 | 
			
		||||
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m15s\u001b[0m 8ms/step - accuracy: 0.8902 - loss: 0.4045\n",
 | 
			
		||||
      "Epoch 4/5\n",
 | 
			
		||||
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m15s\u001b[0m 8ms/step - accuracy: 0.8889 - loss: 0.4049\n",
 | 
			
		||||
      "Epoch 5/5\n",
 | 
			
		||||
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m15s\u001b[0m 8ms/step - accuracy: 0.8840 - loss: 0.4177\n",
 | 
			
		||||
      "\u001b[1m313/313\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 4ms/step - accuracy: 0.9039 - loss: 0.3451\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "[0.30404922366142273, 0.9150999784469604]"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "execution_count": 8,
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "execute_result"
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# 官方实例\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
@@ -211,22 +81,9 @@
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 9,
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Epoch 1/5 - Loss: 0.4415533185513543\n",
 | 
			
		||||
      "Epoch 2/5 - Loss: 0.24540251612599726\n",
 | 
			
		||||
      "Epoch 3/5 - Loss: 0.19663310029716696\n",
 | 
			
		||||
      "Epoch 4/5 - Loss: 0.17048093510557338\n",
 | 
			
		||||
      "Epoch 5/5 - Loss: 0.16070798563876196\n",
 | 
			
		||||
      "Accuracy: 95.38%\n"
 | 
			
		||||
     ]
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# 用torch实现\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user