內容簡介
全書分為 4 篇,共 19 章:微積分篇(第 1~5 章),主要介紹極限、導數、極值、多元函式導數與極值、梯度下降法等;線性代數篇(第 6~10 章),主要介紹向量、矩陣、行列式、線性方程組、特徵值和特徵向量等,並介紹這些數學知識在人工智慧中的套用;機率統計篇(第 11~17 章),主要介紹機率、隨機變數、數字特徵、相關分析和回歸分析,並介紹數據處理的基本方法和 Pandas 在數據處理中的套用;套用篇(第18 章和第 19 章),主要介紹人工智慧中典型的全連線神經網路和卷積神經網路。
圖書目錄
目 錄
微 積 分 篇
第1 章 函式與極限 ······················································································· 2
1.1 函式 ······························································································· 2
1.1.1 函式的定義 ·············································································· 2
1.1.2 函式的表達形式 ········································································ 3
1.1.3 分段函式 ················································································· 5
1.1.4 函式的運算 ·············································································· 6
1.1.5 基本初等函式與初等函式 ··························································· 7
1.1.6 使用SymPy 進行函式運算 ························································· 12
1.2 極限的概念 ····················································································· 15
1.2.1 數列的極限 ············································································· 15
1.2.2 函式的極限 ············································································· 17
1.3 無窮小量和無窮大量 ········································································· 22
1.3.1 無窮小量的定義 ······································································· 22
1.3.2 無窮小量的性質 ······································································· 23
1.3.3 無窮大量 ················································································ 24
1.3.4 無窮小量與無窮大量的關係 ······················································· 24
1.4 極限的計算 ····················································································· 25
1.4.1 極限的四則運算法則 ································································· 26
1.4.2 複合函式的極限運算法則 ·························································· 28
1.4.3 使用SymPy 求極限 ··································································· 28
習題1 ··································································································· 30
第2 章 導數 ······························································································· 32
2.1 導數的概念 ····················································································· 32
2.1.1 平均變化率 ············································································· 33
2.1.2 瞬時變化率 ············································································· 33
2.1.3 導數的定義 ············································································· 35
2.1.4 導數的幾何意義 ······································································· 36
2.1.5 不可導的三種情形 ···································································· 37
2.2 導數的運算 ····················································································· 38
2.2.1 基本導數公式 ·········································································· 38
2.2.2 導數的四則運算法則 ································································· 38
2.2.3 複合函式求導法 ······································································· 39
2.2.4 使用SymPy 求導數 ··································································· 41
2.3 高階導數 ························································································ 41
2.3.1 高階導數的定義 ······································································· 41
2.3.2 使用SymPy 求高階導數 ···························································· 42
習題2 ··································································································· 43
第3 章 極值與最值 ······················································································ 44
3.1 函式的單調性 ·················································································· 44
3.2 函式的極值 ····················································································· 46
3.2.1 極值的定義 ············································································· 46
3.2.2 可能的極值點 ·········································································· 47
3.2.3 極值的判定定理 ······································································· 49
3.2.4 使用SymPy 求函式的極值 ························································· 50
3.3 函式的最值 ····················································································· 51
習題3 ··································································································· 52
第4 章 二元函式的導數與極值 ······································································· 53
4.1 二元函式的概念 ··············································································· 53
4.1.1 二元函式的定義 ······································································· 53
4.1.2 二元函式的定義域 ···································································· 54
4.1.3 二元函式的幾何意義 ································································· 55
4.1.4 使用SymPy 求多元函式的函式值 ················································ 55
4.2 二元函式的偏導數 ············································································ 56
4.2.1 偏導數的概念 ·········································································· 56
4.2.2 偏導數的計算 ·········································································· 56
4.2.3 偏導數的幾何意義 ···································································· 57
4.2.4 使用SymPy 求偏導數································································ 58
4.3 二元函式的極值 ··············································································· 58
習題4 ··································································································· 60
第5 章 最最佳化基礎:梯度下降法 ···································································· 61
5.1 梯度的定義 ····················································································· 61
5.2 梯度下降法 ····················································································· 62
5.2.1 一元函式的梯度下降法······························································ 62
5.2.2 二元函式的梯度下降法······························································ 63
5.3 使用Python 實現梯度下降法求函式極值 ················································ 66
習題5 ··································································································· 67
線性代數篇
第6 章 向量與編碼 ······················································································ 70
6.1 向量的概念與運算 ············································································ 70
6.1.1 向量的概念 ············································································· 70
6.1.2 使用NumPy 建立向量 ······························································· 72
6.1.3 向量的運算 ············································································· 73
6.1.4 使用NumPy 實現向量的運算 ······················································ 74
6.2 向量的範數與相似度 ········································································· 75
6.2.1 範數的定義與NumPy 實現 ························································· 75
6.2.2 向量的相似度 ·········································································· 77
6.2.3 使用NumPy 計算向量相似性 ······················································ 80
6.3 向量間的線性關係 ············································································ 81
6.3.1 線性組合 ················································································ 81
6.3.2 線性相關與線性無關 ································································· 81
6.4 實戰案例:K-means 聚類算法解決鳶尾花歸類問題 ··································· 83
6.4.1 鳶尾花數據集Iris ····································································· 83
6.4.2 K-means 聚類算法 ···································································· 84
6.4.3 使用K-means 聚類算法求解Iris 分類問題 ······································ 85
習題6 ··································································································· 87
第7 章 矩陣與數字圖像處理 ·········································································· 88
7.1 矩陣的基本知識 ··············································································· 88
7.1.1 矩陣的概念 ············································································· 88
7.1.2 幾種特殊矩陣 ·········································································· 92
7.1.3 使用NumPy 建立矩陣 ······························································· 93
7.2 矩陣的運算 ··················································································· 100
7.2.1 矩陣的基本運算 ····································································· 100
7.2.2 使用NumPy 進行矩陣運算 ······················································· 106
7.3 實戰案例:矩陣在數字圖像處理中的套用 ············································ 109
7.3.1 圖像基礎 ·············································································· 109
7.3.2 數字圖像的矩陣表示 ······························································· 111
7.3.3 矩陣運算實現圖像處理···························································· 112
7.4 矩陣的初等變換 ············································································· 116
7.5 階梯形矩陣與矩陣的秩 ···································································· 117
7.5.1 階梯形矩陣 ··········································································· 117
7.5.2 矩陣的秩 ·············································································· 119
7.5.3 使用NumPy 和SymPy 求行最簡階梯形矩陣及矩陣的秩 ·················· 120
習題7 ································································································· 121
第8 章 行列式 ·························································································· 123
8.1 行列式的概念 ················································································ 123
8.1.1 二階與三階行列式 ·································································· 123
8.1.2 n 階行列式 ··········································································· 126
8.2 方陣的行列式 ················································································ 128
8.3 使用NumPy 求行列式 ······································································ 129
習題8 ································································································· 130
第9 章 線性方程組 ···················································································· 132
9.1 線性方程組的概念 ·········································································· 132
9.2 消元法解線性方程組 ······································································· 133
9.3 齊次線性方程組 ············································································· 140
9.4 非齊次線性方程組 ·········································································· 144
9.5 使用NumPy 和SymPy 求解線性方程組 ··············································· 146
9.5.1 使用numpy.linalg.solve()求解線性方程組 ····································· 146
9.5.2 使用NumPy 和SymPy 求解一般線性方程組 ································· 147
習題9 ································································································· 148
第10 章 矩陣的特徵值與特徵向量 ································································ 150
10.1 特徵值與特徵向量的概念 ································································ 150
10.2 使用NumPy 求特徵值與特徵向量 ····················································· 153
習題10 ······························································································· 153
機率統計篇
第11 章 Pandas 基礎 ················································································· 156
11.1 建立DataFrame 對象 ······································································ 156
11.2 打開CSV 檔案 ············································································· 158
11.3 查看DataFrame 對象的屬性 ····························································· 159
11.4 選擇數據 ····················································································· 161
11.4.1 使用df[]運算符選擇某列數據 ·················································· 161
11.4.2 使用df.iloc[]選擇數據 ···························································· 164
習題11 ······························································································· 165
第12 章 數據的整理與展示 ········································································· 167
12.1 數據的屬性 ·················································································· 168
12.2 數據的預處理 ··············································································· 169
12.2.1 缺失值處理 ········································································· 169
12.2.2 歸一化 ··············································································· 171
12.2.3 規範化 ··············································································· 172
12.3 數據整理與展示 ············································································ 172
12.3.1 分布數列 ············································································ 172
12.3.2 數據可視化 ········································································· 174
習題12 ······························································································· 177
第13 章 描述統計 ····················································································· 178
13.1 數據位置的描述 ············································································ 179
13.2 數據集中趨勢的度量 ······································································ 179
13.3 數據離散趨勢的度量 ······································································ 181
13.4 數據分布形態的度量 ······································································ 184
習題13 ······························································································· 185
第14 章 機率的定義與運算 ········································································· 186
14.1 隨機事件 ····················································································· 186
14.1.1 隨機現象 ············································································ 186
14.1.2 隨機事件 ············································································ 187
14.1.3 樣本空間 ············································································ 188
14.1.4 隨機事件的關係與運算 ·························································· 188
14.1.5 使用NumPy 模擬隨機事件 ····················································· 191
14.2 機率的定義 ·················································································· 192
14.2.1 機率的統計定義 ··································································· 192
14.2.2 機率的古典定義 ··································································· 193
14.2.3 使用NumPy 模擬計算機率 ····················································· 195
14.3 機率的加法公式 ············································································ 197
14.3.1 互斥事件機率的加法公式 ······················································· 197
14.3.2 任意事件機率的加法公式 ······················································· 199
14.4 機率的乘法公式 ············································································ 199
14.4.1 條件機率 ············································································ 199
14.4.2 機率的乘法公式 ··································································· 202
14.4.3 獨立事件的機率乘法公式 ······················································· 203
14.5 全機率公式 ·················································································· 203
14.6 貝葉斯公式 ·················································································· 205
習題14 ······························································································· 206
第15 章 隨機變數 ····················································································· 208
15.1 隨機變數的概念 ············································································ 208
15.2 離散型隨機變數機率分布 ································································ 209
15.2.1 分布列 ··············································································· 209
15.2.2 兩點分布 ············································································ 211
15.2.3 二項分布 ············································································ 211
15.3 連續型隨機變數及其分布 ································································ 212
15.3.1 機率密度函式 ······································································ 212
15.3.2 均勻分布 ············································································ 213
15.3.3 常態分配 ············································································ 213
15.4 使用NumPy 生成指定分布的隨機數 ·················································· 217
習題15 ······························································································· 219
第16 章 隨機變數的數字特徵 ······································································ 220
16.1 數學期望 ····················································································· 221
16.1.1 離散型隨機變數的數學期望 ···················································· 221
16.1.2 連續型隨機變數的數學期望 ···················································· 223
16.1.3 數學期望的性質 ··································································· 223
16.1.4 使用NumPy 計算均值與期望 ·················································· 224
16.2 方差 ··························································································· 225
16.2.1 離散型隨機變數的方差 ·························································· 226
16.2.2 連續型隨機變數的方差 ·························································· 226
16.2.3 方差的性質 ········································································· 227
16.2.4 使用NumPy 計算方差和標準差 ··············································· 228
16.3 常見分布的數學期望與方差 ····························································· 229
16.4 使用Pandas 進行描述統計 ······························································· 229
習題16 ······························································································· 232
第17 章 相關分析與回歸分析 ······································································ 233
17.1 散點圖 ························································································ 233
17.2 相關關係 ····················································································· 234
17.3 線性相關及其度量 ········································································· 235
17.4 回歸分析 ····················································································· 237
17.4.1 回歸分析的概念 ··································································· 237
17.4.2 回歸分析的分類 ··································································· 237
17.4.3 一元線性回歸分析 ································································ 238
17.4.4 多元線性回歸分析 ································································ 242
17.5 實戰案例:建立線性回歸模型求解波士頓房價問題 ······························ 243
習題17 ······························································································· 246
應 用 篇
第18 章 神經網路 ····················································································· 248
18.1 神經元模型 ·················································································· 249
18.2 神經網路結構 ··············································································· 252
18.2.1 網路結構 ············································································ 252
18.2.2 前向傳播 ············································································ 252
18.2.3 損失函式 ············································································ 254
18.2.4 反向傳播 ············································································ 254
18.3 神經網路的數學公式推導 ································································ 254
18.4 使用Keras 實現神經網路求解波士頓房價預測問題 ······························· 256
習題18 ······························································································· 258
第19 章 卷積神經網路 ··············································································· 259
19.1 AlexNet 卷積神經網路簡介 ······························································ 260
19.2 AlexNet 卷積神經網路技術詳解 ························································ 261
19.2.1 卷積 ·················································································· 261
19.2.2 池化 ·················································································· 273
19.2.3 全連線層與Dropout 技術 ························································ 275
19.3 AlexNet 網路的結構分析 ································································· 277
19.4 AlexNet 網路的Keras 實現 ······························································ 279
19.5 實戰案例:使用AlexNet 求解貓狗圖片分類問題 ·································· 280
習題19 ······························································································· 284
參考文獻 ··································································································· 286
附錄A 標準常態分配函式數值表 ·································································· 287