This commit is contained in:
yinkanglong_lab
2021-03-19 23:27:00 +08:00
parent 9cd1fe4b4f
commit f73f47e46e
38 changed files with 123 additions and 569 deletions

View File

@@ -8,50 +8,14 @@ NumPy 数组的维数称为秩rank秩就是轴的数量即数组的
* 第一维是高维,最后一维是低维。
## 数组属性
<table class="reference">
<thead>
<tr class="header">
<th>属性</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>ndarray.ndim</td>
<td>秩,即轴的数量或维度的数量</td>
</tr>
<tr>
<td>ndarray.shape</td>
<td>数组的维度对于矩阵n 行 m 列</td>
</tr>
<tr>
<td>ndarray.size</td>
<td>数组元素的总个数,相当于 .shape 中 n*m 的值</td>
</tr>
<tr>
<td>ndarray.dtype</td>
<td>ndarray 对象的元素类型</td>
</tr>
<tr>
<td>ndarray.itemsize</td>
<td>ndarray 对象中每个元素的大小,以字节为单位</td>
</tr>
<tr>
<td>ndarray.flags</td>
<td>ndarray 对象的内存信息</td>
</tr>
<tr>
<td>ndarray.real</td>
<td>ndarray元素的实部</td>
</tr>
<tr>
<td>ndarray.imag</td>
<td>ndarray 元素的虚部</td>
</tr>
<tr>
<td>ndarray.data</td>
<td>包含实际数组元素的缓冲区,由于一般通过数组的索引获取元素,所以通常不需要使用这个属性。</td>
</tr>
</tbody>
</table>
| 属性 | 说明 |
|------------------|---------------------------------------------|
| `ndarray.ndim` | 秩,即轴的数量或维度的数量 |
| `ndarray.shape` | 数组的维度对于矩阵n 行 m 列 |
| `ndarray.size` | 数组元素的总个数,相当于 .shape 中 n*m 的值 |
| `ndarray.dtype` | ndarray 对象的元素类型 |
| `ndarray.itemsize` | ndarray 对象中每个元素的大小,以字节为单位 |
| `ndarray.flags` | ndarray 对象的内存信息 |
| `ndarray.real` | ndarray元素的实部 |
| `ndarray.imag` | ndarray 元素的虚部 |
| `ndarray.data` | 包含实际数组元素的缓冲区,由于一般通过数组的索引获取元素,所以通常不需要使用这个属性。 |

View File

@@ -0,0 +1,26 @@
## 程序设计的基础知识
* 程序的定义:为了完成某项任务解决某个问题,计算机及执行的一定的指令
* 计算机:实现程序的机器,Enia宾夕法尼亚大学-电子管-晶体管-集成电路
* cup构成冯诺依曼的计算机结构输入设备-存储器-输出设备-控制器-计算器
## 人与机器的沟通
* 程序设计语言:汇编语言-低级语言-高级语言python-Java
* 分类编译型语言source code -compiler- object
CODe。解释性语言sourcecode-interpreter-output
* 创始人:吉多·范·罗苏姆蟒蛇
* python解释性语言可移植性强执行效率低设计哲学优雅明确简单
## 第一个程序hello world
* print python
* 命令行Linux系统下)优点:无需创建文件,立即看到裕运行的结果
* 脚本IDE编辑器适合编写大型程序更容易纠错更容易修改和执行

View File

@@ -1,57 +1,56 @@
\>选择结构
\>\>程序流程图:用简单的图形表示问题的解决步骤;起止框,处理匡,判断框,文档框,流程线,圆形,输入输出框
## 选择结构
\>\>语法python中大括号不是分区作用是靠语句块的缩进来体现语句块术语的范围
* 程序流程图:用简单的图形表示问题的解决步骤;起止框,处理匡,判断框,文档框,流程线,圆形,输入输出框
* 语法python中大括号不是分区作用是靠语句块的缩进来体现语句块术语的范围
```
if 条件:
缩进语句块
缩进语句块
其余的语句
if 条件:
缩进语句块
缩进语句块
else
缩进语句块
缩进语句块
```
\>\>if语句支持嵌套
* if语句支持嵌套
\>\>多分支结构elif 条件==else if
* 多分支结构elif 条件==else if
条件,有助于简化缩进,是画面更加清晰,可读性更高
涉及到两个典型的例子elif计算多分支结构领先是否安全的例子
\>循环结构
\>\>while条件判断成立则执行循环体不成立则不执行
## 循环结构
* while条件判断成立则执行循环体不成立则不执行
```
初始化语句
while 条件语句:
循环体
循环体
其它语句
```
* break结束当前循环体
\>\>break结束当前循环
\>\>continue结束这次循环或者说开始新的循环
\>\>for循环
* continue结束这次循环或者说开始新的循环
* for循环
```
for element in object
循环体
循环体
```
\>\>range(startstopstep)生成连续整数
\>\>穷举法的使用-鸡兔同笼问题
\>\>循环的嵌套问题
* range(startstopstep)生成连续整数
\>程序控制结构的练习题

View File

@@ -1,26 +0,0 @@
**\>程序设计的基础知识**
\>\>程序的定义:为了完成某项任务解决某个问题,计算机及执行的一定的指令
\>\>计算机:实现程序的机器,Enia宾夕法尼亚大学-电子管-晶体管-集成电路
\>\>cup构成冯诺依曼的计算机结构输入设备-存储器-输出设备-控制器-计算器
**\>人与机器的沟通**
\>\>程序设计语言:汇编语言-低级语言-高级语言python-Java
\>\>分类编译型语言source code -compiler- object
CODe。解释性语言sourcecode-interpreter-output
\>\>创始人:吉多·范·罗苏姆蟒蛇
\>\>python解释性语言可移植性强执行效率低设计哲学优雅明确简单
**\>第一个程序hello world**
\>\>print python
\>\>命令行Linux系统下)优点:无需创建文件,立即看到裕运行的结果
脚本IDE编辑器适合编写大型程序更容易纠错更容易修改和执行

View File

@@ -1,103 +0,0 @@
\>递归的实现:
**[python]** [view
plain](http://blog.csdn.net/estom_yin/article/details/51892697)
[copy](http://blog.csdn.net/estom_yin/article/details/51892697)
1. \<pre name="code" **class**="python"\>**def** p(n):
2. **if** n ==1 **or** n == 0:
3. **return** 1
\>递归的设计:
> 将问题分解成许多同构的问题,然后以相同的方式解决最终分解的小问题。
> 递归的要素:
> 递归执行的操作
> 递归的结束条件
> 递归的参数传递
\>实例一:兔子序列(菲波那切数列,在自然界一些动植物身上都有体现)
**[python]** [view
plain](http://blog.csdn.net/estom_yin/article/details/51892697)
[copy](http://blog.csdn.net/estom_yin/article/details/51892697)
1. **def** fib(n):
2. **if** n == 1 **or** n == 2:
3. **return** 1
4. **else**:
5. **return** fib(n - 1) + fib(n - 2)
6. **print** fib(20)
\>实例二:汉诺塔问题
**[python]** [view
plain](http://blog.csdn.net/estom_yin/article/details/51892697)
[copy](http://blog.csdn.net/estom_yin/article/details/51892697)
1. **def** hanoi(n, A, B, C):
2. **if** n == 1:
3. **print** "move", n, "from", A, "to", C
4. **else**:
5. hanoi(n - 1, A, C, B)
6. **print** 'move', n, 'from', A, 'to', C
7. hanoi(n - 1, B, A, C)
8.
9. hanoi(10, 'left', 'Mid', 'Right')
\>实例三:停车问题
> 要求:在固定长度的马路上随机停车,根据车身长度以及随机性特点确定,马路长度与停车数量的关系
**[python]** [view
plain](http://blog.csdn.net/estom_yin/article/details/51892697)
[copy](http://blog.csdn.net/estom_yin/article/details/51892697)
1. **import** random
2. \#if the w big enough, lim parking to 3.7472 named Reni constance
3.
4. **def** parking(low, high):
5. **if** high - low \< 1:
6. **return** 0
7. **else**:
8. x = random.uniform(low, high - 1)
9. **return** parking(low, x) + 1 + parking(x + 1, high)
10. **print** parking(0, 5)
\>递归的优劣
\>\>能使一个蕴含递归关系而且结构复杂的程序简洁精练,增强可读性
\>\>嵌套层次深,函数调用开销大,存在大量的重复计算
\>补充琐碎知识
> random.uniform(low, high) 能产生从low到high的随机数

View File

@@ -4,5 +4,6 @@
> python3中所有的数据类型都是对象。包括数值类型int,float,complex)、列表、字典、元组、集合等。包括函数也是对象。
> python3中所有的内建类的对象不具有动态属性。所有的自定义类的对象都有动态属性。

View File

@@ -136,7 +136,7 @@ Python 具有不同的运算符,可让您在程序中执行所需的计算。
在上面的表达式中,将对哪个运算进行第一个加法或乘法运算? 为了回答这样的问题,我们需要在 python 中引用运算符优先级列表。 下图列出了 python 优先级从高到低的顺序。
![python-operator-precedence1.jpg](img/1bd07b9ee86ea977adf3c113fe0e0939.png)
![](image/2021-03-19-21-44-53.png)
如您在上表中所见`*`在`+`之上,因此`*`将首先出现,然后加法。 因此,以上表达式的结果将为`13`。
@@ -150,7 +150,6 @@ Python 具有不同的运算符,可让您在程序中执行所需的计算。
```py
>>> 3 + 4 - 2
```
在以上表达式中,将首先进行加法或减法。 从表`+`和`-`的优先级相同,然后将它们从左到右进行求值,即先加法,然后减法。
@@ -209,8 +208,8 @@ a = b = c
| `+=` | 加法赋值 | `x += 4` | `x = x + 4` |
| `-=` | 减法赋值 | `x -= 2` | `x = x - 2` |
| `*=` | 乘法赋值 | `x *= 5` | `x = x * 5` |
| `/*=` | 除法赋值 | `x /= 5` | `x = x / 5` |
| `//*=` | 整数除法赋值 | `x //= 5` | `x = x // 5` |
| `%*=` | 余数赋值 | `x %= 5` | `x = x % 5` |
| `/=` | 除法赋值 | `x /= 5` | `x = x / 5` |
| `//=` | 整数除法赋值 | `x //= 5` | `x = x // 5` |
| `%=` | 余数赋值 | `x %= 5` | `x = x % 5` |
| `**=` | 指数赋值 | `x **= 5` | `x = x ** 5` |

View File

@@ -5,7 +5,7 @@
* 元组
* 集合
## 5.6. 循环的技巧
## 5.6. 循环的技巧
* 当在字典中循环时,用 items() 方法可将关键字和对应的值同时取出
```py
>>>

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -1,244 +1,17 @@
## 内置函数列表
<table class="docutils align-default">
<colgroup>
<col style="width: 21%">
<col style="width: 18%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 22%">
</colgroup>
<thead>
<tr class="row-odd"><th class="head"></th>
<th class="head"></th>
<th class="head"><p>内置函数</p></th>
<th class="head"></th>
<th class="head"></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><a class="reference internal" href="#abs" title="abs"><code class="xref py py-func docutils literal notranslate"><span class="pre">abs()</span></code></a></p></td>
<td><p><a class="reference internal" href="#delattr" title="delattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">delattr()</span></code></a></p></td>
<td><p><a class="reference internal" href="#hash" title="hash"><code class="xref py py-func docutils literal notranslate"><span class="pre">hash()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-memoryview"><code class="docutils literal notranslate"><span class="pre">memoryview()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-set"><code class="docutils literal notranslate"><span class="pre">set()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#all" title="all"><code class="xref py py-func docutils literal notranslate"><span class="pre">all()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-dict"><code class="docutils literal notranslate"><span class="pre">dict()</span></code></a></p></td>
<td><p><a class="reference internal" href="#help" title="help"><code class="xref py py-func docutils literal notranslate"><span class="pre">help()</span></code></a></p></td>
<td><p><a class="reference internal" href="#min" title="min"><code class="xref py py-func docutils literal notranslate"><span class="pre">min()</span></code></a></p></td>
<td><p><a class="reference internal" href="#setattr" title="setattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">setattr()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#any" title="any"><code class="xref py py-func docutils literal notranslate"><span class="pre">any()</span></code></a></p></td>
<td><p><a class="reference internal" href="#dir" title="dir"><code class="xref py py-func docutils literal notranslate"><span class="pre">dir()</span></code></a></p></td>
<td><p><a class="reference internal" href="#hex" title="hex"><code class="xref py py-func docutils literal notranslate"><span class="pre">hex()</span></code></a></p></td>
<td><p><a class="reference internal" href="#next" title="next"><code class="xref py py-func docutils literal notranslate"><span class="pre">next()</span></code></a></p></td>
<td><p><a class="reference internal" href="#slice" title="slice"><code class="xref py py-func docutils literal notranslate"><span class="pre">slice()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#ascii" title="ascii"><code class="xref py py-func docutils literal notranslate"><span class="pre">ascii()</span></code></a></p></td>
<td><p><a class="reference internal" href="#divmod" title="divmod"><code class="xref py py-func docutils literal notranslate"><span class="pre">divmod()</span></code></a></p></td>
<td><p><a class="reference internal" href="#id" title="id"><code class="xref py py-func docutils literal notranslate"><span class="pre">id()</span></code></a></p></td>
<td><p><a class="reference internal" href="#object" title="object"><code class="xref py py-func docutils literal notranslate"><span class="pre">object()</span></code></a></p></td>
<td><p><a class="reference internal" href="#sorted" title="sorted"><code class="xref py py-func docutils literal notranslate"><span class="pre">sorted()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#bin" title="bin"><code class="xref py py-func docutils literal notranslate"><span class="pre">bin()</span></code></a></p></td>
<td><p><a class="reference internal" href="#enumerate" title="enumerate"><code class="xref py py-func docutils literal notranslate"><span class="pre">enumerate()</span></code></a></p></td>
<td><p><a class="reference internal" href="#input" title="input"><code class="xref py py-func docutils literal notranslate"><span class="pre">input()</span></code></a></p></td>
<td><p><a class="reference internal" href="#oct" title="oct"><code class="xref py py-func docutils literal notranslate"><span class="pre">oct()</span></code></a></p></td>
<td><p><a class="reference internal" href="#staticmethod" title="staticmethod"><code class="xref py py-func docutils literal notranslate"><span class="pre">staticmethod()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#bool" title="bool"><code class="xref py py-func docutils literal notranslate"><span class="pre">bool()</span></code></a></p></td>
<td><p><a class="reference internal" href="#eval" title="eval"><code class="xref py py-func docutils literal notranslate"><span class="pre">eval()</span></code></a></p></td>
<td><p><a class="reference internal" href="#int" title="int"><code class="xref py py-func docutils literal notranslate"><span class="pre">int()</span></code></a></p></td>
<td><p><a class="reference internal" href="#open" title="open"><code class="xref py py-func docutils literal notranslate"><span class="pre">open()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-str"><code class="docutils literal notranslate"><span class="pre">str()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#breakpoint" title="breakpoint"><code class="xref py py-func docutils literal notranslate"><span class="pre">breakpoint()</span></code></a></p></td>
<td><p><a class="reference internal" href="#exec" title="exec"><code class="xref py py-func docutils literal notranslate"><span class="pre">exec()</span></code></a></p></td>
<td><p><a class="reference internal" href="#isinstance" title="isinstance"><code class="xref py py-func docutils literal notranslate"><span class="pre">isinstance()</span></code></a></p></td>
<td><p><a class="reference internal" href="#ord" title="ord"><code class="xref py py-func docutils literal notranslate"><span class="pre">ord()</span></code></a></p></td>
<td><p><a class="reference internal" href="#sum" title="sum"><code class="xref py py-func docutils literal notranslate"><span class="pre">sum()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#func-bytearray"><code class="docutils literal notranslate"><span class="pre">bytearray()</span></code></a></p></td>
<td><p><a class="reference internal" href="#filter" title="filter"><code class="xref py py-func docutils literal notranslate"><span class="pre">filter()</span></code></a></p></td>
<td><p><a class="reference internal" href="#issubclass" title="issubclass"><code class="xref py py-func docutils literal notranslate"><span class="pre">issubclass()</span></code></a></p></td>
<td><p><a class="reference internal" href="#pow" title="pow"><code class="xref py py-func docutils literal notranslate"><span class="pre">pow()</span></code></a></p></td>
<td><p><a class="reference internal" href="#super" title="super"><code class="xref py py-func docutils literal notranslate"><span class="pre">super()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#func-bytes"><code class="docutils literal notranslate"><span class="pre">bytes()</span></code></a></p></td>
<td><p><a class="reference internal" href="#float" title="float"><code class="xref py py-func docutils literal notranslate"><span class="pre">float()</span></code></a></p></td>
<td><p><a class="reference internal" href="#iter" title="iter"><code class="xref py py-func docutils literal notranslate"><span class="pre">iter()</span></code></a></p></td>
<td><p><a class="reference internal" href="#print" title="print"><code class="xref py py-func docutils literal notranslate"><span class="pre">print()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-tuple"><code class="docutils literal notranslate"><span class="pre">tuple()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#callable" title="callable"><code class="xref py py-func docutils literal notranslate"><span class="pre">callable()</span></code></a></p></td>
<td><p><a class="reference internal" href="#format" title="format"><code class="xref py py-func docutils literal notranslate"><span class="pre">format()</span></code></a></p></td>
<td><p><a class="reference internal" href="#len" title="len"><code class="xref py py-func docutils literal notranslate"><span class="pre">len()</span></code></a></p></td>
<td><p><a class="reference internal" href="#property" title="property"><code class="xref py py-func docutils literal notranslate"><span class="pre">property()</span></code></a></p></td>
<td><p><a class="reference internal" href="#type" title="type"><code class="xref py py-func docutils literal notranslate"><span class="pre">type()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#chr" title="chr"><code class="xref py py-func docutils literal notranslate"><span class="pre">chr()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-frozenset"><code class="docutils literal notranslate"><span class="pre">frozenset()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-list"><code class="docutils literal notranslate"><span class="pre">list()</span></code></a></p></td>
<td><p><a class="reference internal" href="#func-range"><code class="docutils literal notranslate"><span class="pre">range()</span></code></a></p></td>
<td><p><a class="reference internal" href="#vars" title="vars"><code class="xref py py-func docutils literal notranslate"><span class="pre">vars()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#classmethod" title="classmethod"><code class="xref py py-func docutils literal notranslate"><span class="pre">classmethod()</span></code></a></p></td>
<td><p><a class="reference internal" href="#getattr" title="getattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">getattr()</span></code></a></p></td>
<td><p><a class="reference internal" href="#locals" title="locals"><code class="xref py py-func docutils literal notranslate"><span class="pre">locals()</span></code></a></p></td>
<td><p><a class="reference internal" href="#repr" title="repr"><code class="xref py py-func docutils literal notranslate"><span class="pre">repr()</span></code></a></p></td>
<td><p><a class="reference internal" href="#zip" title="zip"><code class="xref py py-func docutils literal notranslate"><span class="pre">zip()</span></code></a></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#compile" title="compile"><code class="xref py py-func docutils literal notranslate"><span class="pre">compile()</span></code></a></p></td>
<td><p><a class="reference internal" href="#globals" title="globals"><code class="xref py py-func docutils literal notranslate"><span class="pre">globals()</span></code></a></p></td>
<td><p><a class="reference internal" href="#map" title="map"><code class="xref py py-func docutils literal notranslate"><span class="pre">map()</span></code></a></p></td>
<td><p><a class="reference internal" href="#reversed" title="reversed"><code class="xref py py-func docutils literal notranslate"><span class="pre">reversed()</span></code></a></p></td>
<td><p><a class="reference internal" href="#__import__" title="__import__"><code class="xref py py-func docutils literal notranslate"><span class="pre">__import__()</span></code></a></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#complex" title="complex"><code class="xref py py-func docutils literal notranslate"><span class="pre">complex()</span></code></a></p></td>
<td><p><a class="reference internal" href="#hasattr" title="hasattr"><code class="xref py py-func docutils literal notranslate"><span class="pre">hasattr()</span></code></a></p></td>
<td><p><a class="reference internal" href="#max" title="max"><code class="xref py py-func docutils literal notranslate"><span class="pre">max()</span></code></a></p></td>
<td><p><a class="reference internal" href="#round" title="round"><code class="xref py py-func docutils literal notranslate"><span class="pre">round()</span></code></a></p></td>
<td></td>
</tr>
</tbody>
</table>
abs()
delattr()
hash()
memoryview()
set()
all()
dict()
help()
min()
setattr()
any()
dir()
hex()
next()
slice()
ascii()
divmod()
id()
object()
sorted()
bin()
enumerate()
input()
oct()
staticmethod()
bool()
eval()
int()
open()
str()
breakpoint()
exec()
isinstance()
ord()
sum()
bytearray()
filter()
issubclass()
pow()
super()
bytes()
float()
iter()
print()
tuple()
callable()
format()
len()
property()
type()
chr()
frozenset()
list()
range()
vars()
classmethod()
getattr()
locals()
repr()
zip()
compile()
globals()
map()
reversed()
__import__()
complex()
hasattr()
max()
round()
| | | 内置函数 | | |
|---------------|-------------|--------------|--------------|----------------|
| abs() | delattr() | hash() | memoryview() | set() |
| all() | dict() | help() | min() | setattr() |
| any() | dir() | hex() | next() | slice() |
| ascii() | divmod() | id() | object() | sorted() |
| bin() | enumerate() | input() | oct() | staticmethod() |
| bool() | eval() | int() | open() | str() |
| breakpoint() | exec() | isinstance() | ord() | sum() |
| bytearray() | filter() | issubclass() | pow() | super() |
| bytes() | float() | iter() | print() | tuple() |
| callable() | format() | len() | property() | type() |
| chr() | frozenset() | list() | range() | vars() |
| classmethod() | getattr() | locals() | repr() | zip() |
| compile() | globals() | map() | reversed() | \_\_import\_\_() |
| complex() | hasattr() | max() | round() | |

View File

@@ -1,5 +1,5 @@
## 内置常量
### False
### `False`
bool 类型的假值。 给 False 赋值是非法的并会引发 SyntaxError。
### `True`

View File

@@ -1,22 +1,22 @@
## datetime
有效的类型
class datetime.date
### `class datetime.date`
一个理想化的简单型日期,它假设当今的公历在过去和未来永远有效。 属性: year, month, and day。
class datetime.time
### `class datetime.time`
一个独立于任何特定日期的理想化时间,它假设每一天都恰好等于 24*60*60 秒。 (这里没有“闰秒”的概念。) 包含属性: hour, minute, second, microsecond 和 tzinfo。
class datetime.datetime
### `class datetime.datetime`
日期和时间的结合。属性year, month, day, hour, minute, second, microsecond, and tzinfo.
class datetime.timedelta
### `class datetime.timedelta`
表示两个 date 对象或者 time 对象,或者 datetime 对象之间的时间间隔,精确到微秒。
class datetime.tzinfo
### `class datetime.tzinfo`
一个描述时区信息对象的抽象基类。 用来给 datetime 和 time 类提供自定义的时间调整概念(例如处理时区和/或夏令时)。
class datetime.timezone
### `class datetime.timezone`
一个实现了 tzinfo 抽象基类的子类,用于表示相对于 世界标准时间UTC的偏移量。
@@ -26,49 +26,24 @@ class datetime.timezone
### `class calendar.TextCalendar(firstweekday=0)`
### `class calendar.HTMLCalendar(firstweekday=0)`
### `class calendar.LocaleTextCalendar(firstweekday=0, locale=None)`
### `class calendar.LocaleHTMLCalendar(firstweekday=0, locale=None)```
### `class calendar.LocaleHTMLCalendar(firstweekday=0, locale=None)`
## collections --- 容器数据类型
这个模块实现了特定目标的容器以提供Python标准内建容器 dict , list , set , 和 tuple 的替代选择。
<table class="docutils align-default">
<colgroup>
<col style="width: 24%">
<col style="width: 76%">
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a></p></td>
<td><p>创建命名元组子类的工厂函数</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#collections.deque" title="collections.deque"><code class="xref py py-class docutils literal notranslate"><span class="pre">deque</span></code></a></p></td>
<td><p>类似列表(list)的容器,实现了在两端快速添加(append)和弹出(pop)</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#collections.ChainMap" title="collections.ChainMap"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChainMap</span></code></a></p></td>
<td><p>类似字典(dict)的容器类,将多个映射集合到一个视图里面</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#collections.Counter" title="collections.Counter"><code class="xref py py-class docutils literal notranslate"><span class="pre">Counter</span></code></a></p></td>
<td><p>字典的子类,提供了可哈希对象的计数功能</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#collections.OrderedDict" title="collections.OrderedDict"><code class="xref py py-class docutils literal notranslate"><span class="pre">OrderedDict</span></code></a></p></td>
<td><p>字典的子类,保存了他们被添加的顺序</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#collections.defaultdict" title="collections.defaultdict"><code class="xref py py-class docutils literal notranslate"><span class="pre">defaultdict</span></code></a></p></td>
<td><p>字典的子类,提供了一个工厂函数,为字典查询提供一个默认值</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#collections.UserDict" title="collections.UserDict"><code class="xref py py-class docutils literal notranslate"><span class="pre">UserDict</span></code></a></p></td>
<td><p>封装了字典对象,简化了字典子类化</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#collections.UserList" title="collections.UserList"><code class="xref py py-class docutils literal notranslate"><span class="pre">UserList</span></code></a></p></td>
<td><p>封装了列表对象,简化了列表子类化</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#collections.UserString" title="collections.UserString"><code class="xref py py-class docutils literal notranslate"><span class="pre">UserString</span></code></a></p></td>
<td><p>封装了列表对象,简化了字符串子类化</p></td>
</tr>
</tbody>
</table>
| 容器| 作用|
|--------------|------------------------------------------|
| `namedtuple()` | 创建命名元组子类的工厂函数 |
| `deque` | 类似列表(list)的容器,实现了在两端快速添加(append)和弹出(pop) |
| `ChainMap` | 类似字典(dict)的容器类,将多个映射集合到一个视图里面 |
| `Counter` | 字典的子类,提供了可哈希对象的计数功能 |
| `OrderedDict` | 字典的子类,保存了他们被添加的顺序 |
| `defaultdict` | 字典的子类,提供了一个工厂函数,为字典查询提供一个默认值 |
| `UserDict` | 封装了字典对象,简化了字典子类化 |
| `UserList` | 封装了列表对象,简化了列表子类化 |
| `UserString` | 封装了列表对象,简化了字符串子类化 |
## collections.abc --- 容器的抽象基类

View File

@@ -271,46 +271,17 @@ def phi(x):
该模块提供了用于计算数字 (Real-valued) 数据的数理统计量的函数。
## 平均值以及对中心位置的评估
<table class="docutils align-default">
<colgroup>
<col style="width: 27%">
<col style="width: 73%">
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.mean" title="statistics.mean"><code class="xref py py-func docutils literal notranslate"><span class="pre">mean()</span></code></a></p></td>
<td><p>数据的算术平均数(“平均数”)。</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#statistics.fmean" title="statistics.fmean"><code class="xref py py-func docutils literal notranslate"><span class="pre">fmean()</span></code></a></p></td>
<td><p>快速的,浮点算数平均数。</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.geometric_mean" title="statistics.geometric_mean"><code class="xref py py-func docutils literal notranslate"><span class="pre">geometric_mean()</span></code></a></p></td>
<td><p>数据的几何平均数</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#statistics.harmonic_mean" title="statistics.harmonic_mean"><code class="xref py py-func docutils literal notranslate"><span class="pre">harmonic_mean()</span></code></a></p></td>
<td><p>数据的调和均值</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.median" title="statistics.median"><code class="xref py py-func docutils literal notranslate"><span class="pre">median()</span></code></a></p></td>
<td><p>数据的中位数(中间值)</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#statistics.median_low" title="statistics.median_low"><code class="xref py py-func docutils literal notranslate"><span class="pre">median_low()</span></code></a></p></td>
<td><p>数据的低中位数</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.median_high" title="statistics.median_high"><code class="xref py py-func docutils literal notranslate"><span class="pre">median_high()</span></code></a></p></td>
<td><p>数据的高中位数</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#statistics.median_grouped" title="statistics.median_grouped"><code class="xref py py-func docutils literal notranslate"><span class="pre">median_grouped()</span></code></a></p></td>
<td><p>分组数据的中位数即第50个百分点。</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.mode" title="statistics.mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">mode()</span></code></a></p></td>
<td><p>离散的或标称的数据的单个众数(出现最多的值)。</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#statistics.multimode" title="statistics.multimode"><code class="xref py py-func docutils literal notranslate"><span class="pre">multimode()</span></code></a></p></td>
<td><p>离散的或标称的数据的众数列表(出现最多的值)。</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#statistics.quantiles" title="statistics.quantiles"><code class="xref py py-func docutils literal notranslate"><span class="pre">quantiles()</span></code></a></p></td>
<td><p>将数据以相等的概率分为多个间隔。</p></td>
</tr>
</tbody>
</table>
| 函数 | 说明 |
|------------------|-------------------------|
| `mean()` | 数据的算术平均数(“平均数”)。 |
| `fmean()` | 快速的,浮点算数平均数。 |
| `geometric_mean()` | 数据的几何平均数 |
| `harmonic_mean()` | 数据的调和均值 |
| `median()` | 数据的中位数(中间值) |
| `median_low()` | 数据的低中位数 |
| `median_high()` | 数据的高中位数 |
| `median_grouped()` | 分组数据的中位数即第50个百分点。 |
| `mode()` | 离散的或标称的数据的单个众数(出现最多的值)。 |
| `multimode()` | 离散的或标称的数据的众数列表(出现最多的值)。 |
| `quantiles()` | 将数据以相等的概率分为多个间隔。 |

View File

@@ -5,8 +5,9 @@
1. 每天sklearn一个机器学习小算法
- [ ] k-近邻算法
- [ ] 复习吴恩达机器学习笔记
- [ ] 复习吴恩达深度学习笔记
- [x] 复习吴恩达机器学习笔记
- [x] 复习吴恩达深度学习笔记
- [x] 复习Python-numpy-scipy那一套
2. 每天一个联邦学习框架
- [ ] pysyft
3. 每天一篇联邦学习的文章。
@@ -15,4 +16,5 @@
- [X] 获取2020年的两个超大型数据集并存到云盘当中
- [X] 获取CIC关于恶意软件分析的论文
## 收获
## 收获

View File

@@ -11,7 +11,7 @@
> jtrain训练集的代价函数。jcv交叉验证集的代价函数。jtrain能够通过训练过程将样本随机性引起的误差降到最低。jcv没有经过训练过程会最大化样本的随机性方差和模型本身的偏差。
* 高偏差Jtrain和Jcv都很大并且Jtrain≈Jcv。对应欠拟合。欠拟合的时候由模型本身和样本的随机性引起的误差都很大。
* 高方差Jtrain较小Jcv远大于Jtrain。对应过拟合。过拟合后由样本随机性引起的误差会非常大。
* 具有低方差,高偏差。变量过多的时候出现的,训练得到的假设函数能够很好的拟合训练集,代价函数非常小。但是无法泛化到新的样本当中。
* 低方差,高偏差。变量过多的时候出现的,训练得到的假设函数能够很好的拟合训练集,代价函数非常小。但是无法泛化到新的样本当中。
### 解决办法

View File

@@ -50,7 +50,7 @@ $$
h(\theta)=\theta_0+\theta_1*f_1+\theta_2*f_2+\theta_3*f_3+\dots
$$
* f用来代理数据集的某个特征这个特征可能是多项式一个项也可能是更复杂的函数。
* f描述的特征可能是没有必要的此时\theta可能是0
* f描述的特征可能是没有必要的此时$\theta$可能是0
### 高斯核函数描述特征向量

View File

@@ -2,7 +2,7 @@
## 1 计算机视觉
* **计算机视觉Computer Vision**的高速发展标志着新型应用产生的可能,例如自动驾驶、人脸识别、创造新的艺术风格。人们对于计算机视觉的研究也催生了很多机算机视觉与其他领域的交叉成果。一般的计算机视觉问题包括以下几类:
* **计算机视觉Computer Vision** 的高速发展标志着新型应用产生的可能,例如自动驾驶、人脸识别、创造新的艺术风格。人们对于计算机视觉的研究也催生了很多机算机视觉与其他领域的交叉成果。一般的计算机视觉问题包括以下几类:
* 图片分类Image Classification
* 目标检测Object detection
* 神经风格转换Neural Style Transfer

View File

@@ -49,11 +49,11 @@
## 3 残差网络
* 因为存在梯度消失和梯度爆炸问题,网络越深,就越难以训练成功。**残差网络Residual Networks简称为 ResNets**可以有效解决这个问题。
* 因为存在梯度消失和梯度爆炸问题,网络越深,就越难以训练成功。**残差网络Residual Networks简称为 ResNets** 可以有效解决这个问题。
![Residual-block](Residual-block.jpg)
* 上图的结构被称为**残差块Residual block**。通过**捷径Short cut或者称跳远连接Skip connections**可以将 $a^{[l]}$添加到第二个 ReLU 过程中,直接建立 $a^{[l]}$与 $a^{[l+2]}$之间的隔层联系。表达式如下:
* 上图的结构被称为**残差块Residual block**。通过**捷径Short cut或者称跳远连接Skip connections** 可以将 $a^{[l]}$添加到第二个 ReLU 过程中,直接建立 $a^{[l]}$与 $a^{[l+2]}$之间的隔层联系。表达式如下:
$$z^{[l+1]} = W^{[l+1]}a^{[l]} + b^{[l+1]}$$

View File

@@ -1,7 +1,5 @@
# 第 10 章 K-MeansK-均值)聚类算法
![K-MeansK-均值聚类算法_首页](http://data.apachecn.org/img/AiLearning/ml/10.KMeans/K-Means_首页.jpg)
## 聚类
聚类,简单来说,就是将一个庞杂数据集中具有相似特征的数据自动归类到一起,称为一个簇,簇内的对象越相似,聚类的效果越好。它是一种无监督的学习(Unsupervised Learning)方法,不需要预先标注好的训练集。聚类与分类最大的区别就是分类的目标事先已知,例如猫狗识别,你在分类之前已经预先知道要将它分为猫、狗两个种类;而在你聚类之前,你对你的目标是未知的,同样以动物为例,对于一个动物集来说,你并不清楚这个数据集内部有多少种类的动物,你能做的只是利用聚类方法将它自动按照特征分为多类,然后人为给出这个聚类结果的定义(即簇识别)。例如,你将一个动物集分为了三簇(类),然后通过观察这三类动物的特征,你为每一个簇起一个名字,如大象、狗、猫等,这就是聚类的基本思想。

View File

@@ -1,7 +1,5 @@
# 第 11 章 使用 Apriori 算法进行关联分析
![](http://data.apachecn.org/img/AiLearning/ml/11.Apriori/apachecn_apriori_homepage.jpg)
## 关联分析
关联分析是一种在大规模数据集中寻找有趣关系的任务。

View File

@@ -1,8 +1,6 @@
# 第12章 使用FP-growth算法来高效发现频繁项集
![](http://data.apachecn.org/img/AiLearning/ml/12.FP-growth/apachecn_fp_growth_homepage.png)
## 前言
在 [第11章]() 时我们已经介绍了用 `Apriori` 算法发现 `频繁项集``关联规则`
本章将继续关注发现 `频繁项集` 这一任务,并使用 `FP-growth` 算法更有效的挖掘 `频繁项集`

View File

@@ -1,7 +1,5 @@
# 第13章 利用 PCA 来简化数据
![利用PCA简化数据_首页](http://data.apachecn.org/img/AiLearning/ml/13.PCA/利用PCA简化数据_首页.jpg)
## 降维技术
> 场景

View File

@@ -1,7 +1,4 @@
# 第14章 利用SVD简化数据
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![利用SVD简化数据首页](http://data.apachecn.org/img/AiLearning/ml/14.SVD/svd_headPage.jpg "利用SVD简化数据首页")
## SVD 概述

View File

@@ -1,6 +1,5 @@
# 第15章 大数据与MapReduce
![大数据与MapReduce首页](http://data.apachecn.org/img/AiLearning/ml/15.BigData_MapReduce/mr_headPage.jpg "大数据与MapReduce首页")
## 大数据 概述

View File

@@ -1,7 +1,5 @@
# 第2章 k-近邻算法
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![k-近邻算法_首页](http://data.apachecn.org/img/AiLearning/ml/2.KNN/knn_headPage_xy.png "k-近邻算法首页")
## KNN 概述

View File

@@ -1,8 +1,6 @@
# 第3章 决策树
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![决策树_首页](http://data.apachecn.org/img/AiLearning/ml/3.DecisionTree/DecisionTree_headPage_xy.png "决策树首页")
## 决策树 概述

View File

@@ -1,8 +1,5 @@
# 第4章 基于概率论的分类方法: 朴素贝叶斯
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![朴素贝叶斯_首页](http://data.apachecn.org/img/AiLearning/ml/4.NaiveBayesian/NavieBayesian_headPage_xy.png "朴素贝叶斯首页")
## 朴素贝叶斯 概述

View File

@@ -1,7 +1,5 @@
# 第5章 Logistic回归
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![朴素贝叶斯_首页](http://data.apachecn.org/img/AiLearning/ml/5.Logistic/LogisticRegression_headPage_xy.png "Logistic回归首页")
## Logistic 回归 概述

View File

@@ -1,7 +1,5 @@
# 第6章 支持向量机
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![支持向量机_首页](http://data.apachecn.org/img/AiLearning/ml/6.SVM/SVM_1.jpg)
## 支持向量机 概述

View File

@@ -1,6 +1,5 @@
# 第7章 集成方法 ensemble method
![利用AdaBoost元算法提高分类](http://data.apachecn.org/img/AiLearning/ml/7.AdaBoost/adaboost_headPage.jpg "利用AdaBoost元算法提高分类")
## 集成方法: ensemble method元算法: meta algorithm 概述

View File

@@ -1,7 +1,4 @@
# 第8章 预测数值型数据: 回归
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>
![预测数值型数据回归首页](http://data.apachecn.org/img/AiLearning/ml/8.Regression/预测数值型数据回归首页.png "回归Regression首页")
## 回归Regression 概述