Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c7ff283d
提交
c7ff283d
authored
10月 14, 2022
作者:
Rémi Louf
提交者:
Brandon T. Willard
10月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove primers for Python and NumPy from the documentation
上级
032fc271
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
0 行增加
和
91 行删除
+0
-91
index.rst
doc/tutorial/index.rst
+0
-7
numpy.rst
doc/tutorial/numpy.rst
+0
-70
python.rst
doc/tutorial/python.rst
+0
-14
没有找到文件。
doc/tutorial/index.rst
浏览文件 @
c7ff283d
...
@@ -22,13 +22,6 @@ Throughout the tutorial, bear in mind that there is a :ref:`glossary` as well
...
@@ -22,13 +22,6 @@ Throughout the tutorial, bear in mind that there is a :ref:`glossary` as well
as *index* and *modules* links in the upper-right corner of each page to help
as *index* and *modules* links in the upper-right corner of each page to help
you out.
you out.
Prerequisites
-------------
.. toctree::
python
numpy
Basics
Basics
------
------
...
...
doc/tutorial/numpy.rst
deleted
100644 → 0
浏览文件 @
032fc271
.. _numpy:
.. testsetup::
import numpy
***************
NumPy refresher
***************
Here are some quick guides to NumPy:
* `NumPy for MATLAB users <https://numpy.org/doc/stable/user/numpy-for-matlab-users.html>`__
* `Numpy User Guide <http://docs.scipy.org/doc/numpy/user/index.html>`__
* `More detailed Numpy tutorial <https://scipy.github.io/old-wiki/pages/Tentative_NumPy_Tutorial>`__
* `100 NumPy exercises <https://github.com/rougier/numpy-100>`__
* `From Python to Numpy free book <https://www.labri.fr/perso/nrougier/from-python-to-numpy/>`__
.. [TODO: More doc, e.g. see _test_tensor.py]
Matrix conventions for machine learning
=======================================
Rows are horizontal and columns are vertical.
Every row is an example. Therefore, inputs[10,5] is a matrix of 10 examples
where each example has dimension 5. If this would be the input of a
neural network then the weights from the input to the first hidden
layer would represent a matrix of size (5, #hid).
Consider this array:
>>> numpy.asarray([[1., 2], [3, 4], [5, 6]])
array([[ 1., 2.],
[ 3., 4.],
[ 5., 6.]])
>>> numpy.asarray([[1., 2], [3, 4], [5, 6]]).shape
(3, 2)
This is a 3x2 matrix, i.e. there are 3 rows and 2 columns.
To access the entry in the 3rd row (row #2) and the 1st column (column #0):
>>> numpy.asarray([[1., 2], [3, 4], [5, 6]])[2, 0]
5.0
To remember this, keep in mind that we read left-to-right, top-to-bottom,
so each thing that is contiguous is a row. That is, there are 3 rows
and 2 columns.
Broadcasting
============
Numpy does *broadcasting* of arrays of different shapes during
arithmetic operations. What this means in general is that the smaller
array (or scalar) is *broadcasted* across the larger array so that they have
compatible shapes. The example below shows an instance of
*broadcasting*:
>>> a = numpy.asarray([1.0, 2.0, 3.0])
>>> b = 2.0
>>> a * b
array([ 2., 4., 6.])
The smaller array ``b`` (actually a scalar here, which works like a 0-d array) in this case is *broadcasted* to the same size
as ``a`` during the multiplication. This trick is often useful in
simplifying how expression are written. More detail about *broadcasting*
can be found in the `numpy user guide <http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html>`__.
doc/tutorial/python.rst
deleted
100644 → 0
浏览文件 @
032fc271
.. _python:
***************
Python tutorial
***************
In this documentation, we suppose that the reader knows Python. Here is a small list of Python
tutorials/exercises if you need to learn it or only need a refresher:
* `Python Challenge <http://www.pythonchallenge.com/>`__
* `Dive into Python <http://diveintopython.net/>`__
* `Google Python Class <https://developers.google.com/edu/python/>`__
* `Enthought Python course <https://training.enthought.com/?utm_source=academic&utm_medium=email&utm_campaign=EToD-Launch#/courses>`__ (free for academics)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论