Skip to content

Commit 5320636

Browse files
committed
添加了线性代数和THEANO的卷积神经网络部分,修复了第一节显示的问题
Former-commit-id: 166b729
1 parent 19483c2 commit 5320636

9 files changed

+1608
-304
lines changed

01. python tools/01.01 python overview.ipynb

Lines changed: 243 additions & 282 deletions
Large diffs are not rendered by default.

04. scipy/04.09 linear algbra.ipynb

Lines changed: 863 additions & 9 deletions
Large diffs are not rendered by default.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# 稀疏矩阵的线性代数"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"对于稀疏矩阵来说,其线性代数操作可以使用 `scipy.sparse.linalg` 实现:"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 1,
20+
"metadata": {
21+
"collapsed": true
22+
},
23+
"outputs": [],
24+
"source": [
25+
"import scipy.sparse.linalg"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"metadata": {},
31+
"source": [
32+
"## 矩阵操作"
33+
]
34+
},
35+
{
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"- `scipy.sparse.linalg.inv`\n",
40+
" - 稀疏矩阵求逆\n",
41+
"- `scipy.sparse.linalg.expm`\n",
42+
" - 求稀疏矩阵的指数函数"
43+
]
44+
},
45+
{
46+
"cell_type": "markdown",
47+
"metadata": {},
48+
"source": [
49+
"## 矩阵范数"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"- `scipy.sparse.linalg.norm`\n",
57+
" - 稀疏矩阵求范数"
58+
]
59+
},
60+
{
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"## 线性方程组求解"
65+
]
66+
},
67+
{
68+
"cell_type": "markdown",
69+
"metadata": {},
70+
"source": [
71+
"提供了一系列求解方法:\n",
72+
"http://docs.scipy.org/doc/scipy/reference/sparse.linalg.html#solving-linear-problems\n",
73+
"\n",
74+
"主要使用的是迭代方法求解。"
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"## 特征值分解和奇异值分解"
82+
]
83+
},
84+
{
85+
"cell_type": "markdown",
86+
"metadata": {},
87+
"source": [
88+
"对于特别大的矩阵,原来的方法可能需要太大的内存,考虑使用这两个方法替代:\n",
89+
"\n",
90+
"- `scipy.sparse.linalg.eigs`\n",
91+
" - 返回前 k 大的特征值和特征向量\n",
92+
"- `scipy.sparse.linalg.svds`\n",
93+
" - 返回前 k 大的奇异值和奇异向量"
94+
]
95+
},
96+
{
97+
"cell_type": "markdown",
98+
"metadata": {},
99+
"source": [
100+
"## <font color=\"red\">所有的这些操作既可以在稀疏矩阵上使用,也可以在普通矩阵上使用。</font>"
101+
]
102+
}
103+
],
104+
"metadata": {
105+
"kernelspec": {
106+
"display_name": "Python 2",
107+
"language": "python",
108+
"name": "python2"
109+
},
110+
"language_info": {
111+
"codemirror_mode": {
112+
"name": "ipython",
113+
"version": 2
114+
},
115+
"file_extension": ".py",
116+
"mimetype": "text/x-python",
117+
"name": "python",
118+
"nbconvert_exporter": "python",
119+
"pygments_lexer": "ipython2",
120+
"version": "2.7.6"
121+
}
122+
},
123+
"nbformat": 4,
124+
"nbformat_minor": 0
125+
}

09. theano/09.03 gpu on windows.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"name": "stdout",
171171
"output_type": "stream",
172172
"text": [
173-
"Using gpu device 0: Tesla K10.G2.8GB (CNMeM is disabled)\n",
173+
"Using gpu device 0: Tesla C2075 (CNMeM is disabled)\n",
174174
"using device: gpu\n"
175175
]
176176
}
@@ -242,7 +242,7 @@
242242
"name": "stdout",
243243
"output_type": "stream",
244244
"text": [
245-
"Looping 1000 times took 3.730786 seconds\r\n",
245+
"Looping 1000 times took 3.498123 seconds\r\n",
246246
"Result is [ 1.23178029 1.61879337 1.52278066 ..., 2.20771813 2.29967761\r\n",
247247
" 1.62323284]\r\n",
248248
"Used the cpu\r\n"
@@ -267,8 +267,8 @@
267267
"name": "stdout",
268268
"output_type": "stream",
269269
"text": [
270-
"Using gpu device 0: Tesla K10.G2.8GB (CNMeM is disabled)\n",
271-
"Looping 1000 times took 1.214745 seconds\n",
270+
"Using gpu device 0: Tesla C2075 (CNMeM is disabled)\n",
271+
"Looping 1000 times took 0.847006 seconds\n",
272272
"Result is [ 1.23178029 1.61879349 1.52278066 ..., 2.20771813 2.29967761\n",
273273
" 1.62323296]\n",
274274
"Used the gpu\n"
@@ -346,9 +346,9 @@
346346
"name": "stdout",
347347
"output_type": "stream",
348348
"text": [
349-
"Using gpu device 0: Tesla K10.G2.8GB (CNMeM is disabled)\n",
350-
"Looping 1000 times took 0.586156 seconds\n",
351-
"Result is <CudaNdarray object at 0x7f86ef3ad8b0>\n",
349+
"Using gpu device 0: Tesla C2075 (CNMeM is disabled)\n",
350+
"Looping 1000 times took 0.318359 seconds\n",
351+
"Result is <CudaNdarray object at 0x7f7bb701fb70>\n",
352352
"Numpy result is [ 1.23178029 1.61879349 1.52278066 ..., 2.20771813 2.29967761\n",
353353
" 1.62323296]\n",
354354
"Used the gpu\n"

0 commit comments

Comments
 (0)