diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json
index a581526..e69ab8f 100644
--- a/.obsidian/workspace.json
+++ b/.obsidian/workspace.json
@@ -34,9 +34,21 @@
},
"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"
@@ -65,7 +77,7 @@
"state": {
"type": "search",
"state": {
- "query": "numpy ",
+ "query": "softma",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
@@ -82,7 +94,8 @@
"state": {}
}
}
- ]
+ ],
+ "currentTab": 1
}
],
"direction": "horizontal",
@@ -102,7 +115,7 @@
"state": {
"type": "backlink",
"state": {
- "file": "00. Inbox/01. TODO.md",
+ "file": "04. Programming/Machine Learning.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@@ -127,7 +140,7 @@
"state": {
"type": "outline",
"state": {
- "file": "00. Inbox/01. TODO.md"
+ "file": "04. Programming/Machine Learning.md"
}
}
},
@@ -155,12 +168,12 @@
"state": {
"type": "file-properties",
"state": {
- "file": "00. Inbox/01. TODO.md"
+ "file": "04. Programming/Machine Learning.md"
}
}
}
],
- "currentTab": 5
+ "currentTab": 3
},
{
"id": "ae4bf98badbfc7ee",
@@ -198,13 +211,16 @@
"periodic-notes:Open today": false
}
},
- "active": "3b4577823cedf427",
+ "active": "26dbd5276842579d",
"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",
"05. 資料收集/讀書筆記/20231113 - 戰爭裡的世界史.md",
"05. 資料收集/讀書筆記/20230801 - 蘇格拉底哲學特快車.md",
"01. 個人/01. Daily/2023-11-12(週日).md",
- "00. Inbox/01. TODO.md",
"00. Inbox/除草劑.md",
"05. 資料收集/Tool Setup/Software/Visual Studio Code.md",
"01. 個人/01. Daily/2023-11-11(週六).md",
@@ -224,10 +240,7 @@
"01. 個人/01. Daily/2023-10-26(週四).md",
"未命名.canvas",
"04. Programming/Python/matplotlib.md",
- "01. 個人/01. Daily/2023/08/2023-08-01(週二).md",
"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/05",
"00. Inbox/My Mindmap.canvas",
diff --git a/04. Programming/Machine Learning.md b/04. Programming/Machine Learning.md
index 698eed6..01fefda 100644
--- a/04. Programming/Machine Learning.md
+++ b/04. Programming/Machine Learning.md
@@ -1,11 +1,11 @@
## 問題分類
-| 問題類型 | 啟動函數 | 損失函數 |
-|:-----------:|:--------:|:--------------------------------------:|
-| 二元分類 | sigmoid | binary_crossentropy(二元交叉熵) |
-| 單標籤多元分類 | softmax | [[categorical_crossentropy]](分類交叉熵)
sparse_categorical_crossentropy |
-| 多標籤分類 | sigmoid | binary_crossentropy |
-| 回歸求值 | None | mse(均方誤差) |
-| 回歸求0~1值 | sigmoid | mse或binary_crossentropy |
+| 問題類型 | 啟動函數 | 損失函數 | 範例 |
+|:--------------:|:--------:|:------------------------------------------------------------------------------:|:------------------------------------------------------------------:|
+| 二元分類 | sigmoid | binary_crossentropy(二元交叉熵) | |
+| 單標籤多元分類 | softmax | [[categorical_crossentropy]](分類交叉熵)
sparse_categorical_crossentropy | 範例:[[An example that use categorical_crossentropy and softmax]] |
+| 多標籤分類 | sigmoid | binary_crossentropy | |
+| 回歸求值 | None | mse(均方誤差) | |
+| 回歸求0~1值 | sigmoid | mse或binary_crossentropy | |
diff --git a/04. Programming/categorical_crossentropy.md b/04. Programming/categorical_crossentropy.md
index e7526ac..8e20879 100644
--- a/04. Programming/categorical_crossentropy.md
+++ b/04. Programming/categorical_crossentropy.md
@@ -1,2 +1,3 @@
- 僅適用於 one-hot 編碼。
-- 如果輸出不是 one-hot,而是整數標籤,也就是直接輸出 0、1、2,而不是一個array(`[0, 0, 0, 1, 0]` 之類),那就需要 sparse_categorical_crossentropy。
\ No newline at end of file
+- 如果輸出不是 one-hot,而是整數標籤,也就是直接輸出 0、1、2,而不是一個array(`[0, 0, 0, 1, 0]` 之類),那就需要 sparse_categorical_crossentropy。
+- 範例:[[An example that use categorical_crossentropy and softmax]]
\ No newline at end of file
diff --git a/05. 資料收集/An example that use categorical_crossentropy and softmax.md b/05. 資料收集/An example that use categorical_crossentropy and softmax.md
new file mode 100644
index 0000000..ec3aacc
--- /dev/null
+++ b/05. 資料收集/An example that use categorical_crossentropy and softmax.md
@@ -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'])
+```
\ No newline at end of file