vault backup: 2023-11-14 10:25:23

This commit is contained in:
2023-11-14 10:25:23 +08:00
parent 1d53fb47de
commit 573de783d6
4 changed files with 65 additions and 20 deletions

View File

@@ -34,9 +34,21 @@
}, },
"pinned": true "pinned": true
} }
},
{
"id": "26dbd5276842579d",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "04. Programming/Machine Learning.md",
"mode": "source",
"source": true
}
}
} }
], ],
"currentTab": 1 "currentTab": 2
} }
], ],
"direction": "vertical" "direction": "vertical"
@@ -65,7 +77,7 @@
"state": { "state": {
"type": "search", "type": "search",
"state": { "state": {
"query": "numpy ", "query": "softma",
"matchingCase": false, "matchingCase": false,
"explainSearch": false, "explainSearch": false,
"collapseAll": false, "collapseAll": false,
@@ -82,7 +94,8 @@
"state": {} "state": {}
} }
} }
] ],
"currentTab": 1
} }
], ],
"direction": "horizontal", "direction": "horizontal",
@@ -102,7 +115,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "00. Inbox/01. TODO.md", "file": "04. Programming/Machine Learning.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@@ -127,7 +140,7 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "00. Inbox/01. TODO.md" "file": "04. Programming/Machine Learning.md"
} }
} }
}, },
@@ -155,12 +168,12 @@
"state": { "state": {
"type": "file-properties", "type": "file-properties",
"state": { "state": {
"file": "00. Inbox/01. TODO.md" "file": "04. Programming/Machine Learning.md"
} }
} }
} }
], ],
"currentTab": 5 "currentTab": 3
}, },
{ {
"id": "ae4bf98badbfc7ee", "id": "ae4bf98badbfc7ee",
@@ -198,13 +211,16 @@
"periodic-notes:Open today": false "periodic-notes:Open today": false
} }
}, },
"active": "3b4577823cedf427", "active": "26dbd5276842579d",
"lastOpenFiles": [ "lastOpenFiles": [
"04. Programming/categorical_crossentropy.md",
"05. 資料收集/An example that use categorical_crossentropy and softmax.md",
"04. Programming/Machine Learning.md",
"00. Inbox/01. TODO.md",
"01. 個人/01. Daily/2023-11-13(週一).md", "01. 個人/01. Daily/2023-11-13(週一).md",
"05. 資料收集/讀書筆記/20231113 - 戰爭裡的世界史.md", "05. 資料收集/讀書筆記/20231113 - 戰爭裡的世界史.md",
"05. 資料收集/讀書筆記/20230801 - 蘇格拉底哲學特快車.md", "05. 資料收集/讀書筆記/20230801 - 蘇格拉底哲學特快車.md",
"01. 個人/01. Daily/2023-11-12(週日).md", "01. 個人/01. Daily/2023-11-12(週日).md",
"00. Inbox/01. TODO.md",
"00. Inbox/除草劑.md", "00. Inbox/除草劑.md",
"05. 資料收集/Tool Setup/Software/Visual Studio Code.md", "05. 資料收集/Tool Setup/Software/Visual Studio Code.md",
"01. 個人/01. Daily/2023-11-11(週六).md", "01. 個人/01. Daily/2023-11-11(週六).md",
@@ -224,10 +240,7 @@
"01. 個人/01. Daily/2023-10-26(週四).md", "01. 個人/01. Daily/2023-10-26(週四).md",
"未命名.canvas", "未命名.canvas",
"04. Programming/Python/matplotlib.md", "04. Programming/Python/matplotlib.md",
"01. 個人/01. Daily/2023/08/2023-08-01(週二).md",
"01. 個人/01. Daily/2023/09", "01. 個人/01. Daily/2023/09",
"01. 個人/01. Daily/2023-10-24(週二).md",
"01. 個人/01. Daily/2023/09/2023-09-04(週一).md",
"01. 個人/01. Daily/2023/08", "01. 個人/01. Daily/2023/08",
"01. 個人/01. Daily/2023/05", "01. 個人/01. Daily/2023/05",
"00. Inbox/My Mindmap.canvas", "00. Inbox/My Mindmap.canvas",

View File

@@ -1,11 +1,11 @@
## 問題分類 ## 問題分類
| 問題類型 | 啟動函數 | 損失函數 | | 問題類型 | 啟動函數 | 損失函數 | 範例 |
|:-----------:|:--------:|:--------------------------------------:| |:--------------:|:--------:|:------------------------------------------------------------------------------:|:------------------------------------------------------------------:|
| 二元分類 | sigmoid | binary_crossentropy二元交叉熵 | | 二元分類 | sigmoid | binary_crossentropy二元交叉熵 | |
| 單標籤多元分類 | softmax | [[categorical_crossentropy]](分類交叉熵)<br> sparse_categorical_crossentropy | | 單標籤多元分類 | softmax | [[categorical_crossentropy]](分類交叉熵)<br> sparse_categorical_crossentropy | 範例:[[An example that use categorical_crossentropy and softmax]] |
| 多標籤分類 | sigmoid | binary_crossentropy | | 多標籤分類 | sigmoid | binary_crossentropy | |
| 回歸求值 | None | mse均方誤差 | | 回歸求值 | None | mse均方誤差 | |
| 回歸求0~1值 | sigmoid | mse或binary_crossentropy | | 回歸求0~1值 | sigmoid | mse或binary_crossentropy | |

View File

@@ -1,2 +1,3 @@
- 僅適用於 one-hot 編碼。 - 僅適用於 one-hot 編碼。
- 如果輸出不是 one-hot而是整數標籤也就是直接輸出 0、1、2而不是一個array`[0, 0, 0, 1, 0]` 之類),那就需要 sparse_categorical_crossentropy。 - 如果輸出不是 one-hot而是整數標籤也就是直接輸出 0、1、2而不是一個array`[0, 0, 0, 1, 0]` 之類),那就需要 sparse_categorical_crossentropy。
- 範例:[[An example that use categorical_crossentropy and softmax]]

View File

@@ -0,0 +1,31 @@
An example that use [[categorical_crossentropy]] and softmax
```python
dropRatio = 0.1
model = Sequential()
model.add(Conv1D(filters=32, kernel_size=3, activation='relu', input_shape=(self.DATA_LEN, 1)))
model.add(Dropout(dropRatio))
model.add(MaxPooling1D(pool_size=2))
model.add(Conv1D(filters=64, kernel_size=3, activation='relu'))
model.add(Dropout(dropRatio))
model.add(MaxPooling1D(pool_size=2))
model.add(Conv1D(filters=64, kernel_size=3, activation='relu'))
model.add(Dropout(dropRatio))
model.add(MaxPooling1D(pool_size=2))
model.add(Conv1D(filters=128, kernel_size=3, activation='relu'))
model.add(MaxPooling1D(pool_size=2))
model.add(Dropout(dropRatio))
model.add(Conv1D(filters=256, kernel_size=3, activation='relu'))
model.add(MaxPooling1D(pool_size=2))
model.add(Dropout(dropRatio))
model.add(Flatten())
model.add(Dropout(dropRatio))
model.add(Dense(units=128, activation='relu'))
model.add(Dropout(dropRatio))
model.add(Dense(units=64, activation='relu'))
model.add(Dropout(dropRatio))
model.add(Dense(units=32, activation='relu'))
model.add(Dense(units=len(self.DEVICE_LABEL), activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer=Adam(learning_rate=0.01), metrics=['accuracy'])
```