python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
2018-03-20 14:34
435 查看
【[b]numpy.random.normal( )】[/b]
对应于numpy中numpy.random.normal(loc=0.0, scale=1.0, size=None)参数的意义为:
【numpy.dot( )】如果参数是一维数组,返回两个数组的点乘,即内积如果参数是二维数组(矩阵),返回矩阵相乘之积。(1)一维数组:
(2)二维数组:(矩阵相乘,第i行依次乘以第i列然后相加)
【numpy.where( )】参考:https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html"the output array contains elements of x where condition is True, and elements from y elsewhere.If only condition is given, return the tuple
[condition , x , y] ——> 如果condition为TRUE,返回x对应位置的值;为FALSE,返回y对应位置的值
【numpy.linalg.norm( )】求范数norm(x, ord=None, axis=None, keepdims=False)
默认为求二范数。 order = 2 二范数; order = 1 ,L1范数 ;order = np.inf 无穷范数【ListedColormap()】参考文章 https://matplotlib.org/api/_as_gen/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap【meshgrid( )】[X,Y] = meshgrid(x,y) 将向量x和y定义的区域转换成矩阵X和Y,其中矩阵X的行向量是向量x的简单复制,而矩阵Y的列向量是向量y的简单复制。
【ravel( ) 和 flatten( )】将数组平铺展开,ravel()返回view,对原始数组进行了改变;flatten()返回copy数组,不影响原始数组参考 http://blog.csdn.net/liuweiyuxiang/article/details/78220080
【plt.contourf( )】 参考 http://blog.csdn.net/quincuntial/article/details/71104405 https://www.cnblogs.com/huanggen/p/7533088.html
contour(X,Y,Z) 需要三维数据,X,Y代表二维坐标,在二维面上生成对应的网格,z代表高度,高度Z相等的颜色相同
对应于numpy中numpy.random.normal(loc=0.0, scale=1.0, size=None)参数的意义为:
loc:float 此概率分布的均值(对应着整个分布的中心centre) scale:float 此概率分布的标准差(对应于分布的宽度,scale越大越矮胖,scale越小,越瘦高) size:int or tuple of ints 输出的shape,默认为None,只输出一个值
np.random.randn(size)所谓标准正态分布(μ=0,σ=1μ=0,σ=11 ), 对应于
np.random.normal(loc=0, scale=1, size)。 【zip() 】参考 http://www.runoob.com/python/python-func-zip.htmlzip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。如果各个迭代器的元素个数不一致,则返回列表长度与最短的对象相同,利用 * 号操作符,可以将元组解压为列表。
【numpy.dot( )】如果参数是一维数组,返回两个数组的点乘,即内积如果参数是二维数组(矩阵),返回矩阵相乘之积。(1)一维数组:
(2)二维数组:(矩阵相乘,第i行依次乘以第i列然后相加)
【numpy.where( )】参考:https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html"the output array contains elements of x where condition is True, and elements from y elsewhere.If only condition is given, return the tuple
condition.nonzero(), the indices where condition is True."
[condition , x , y] ——> 如果condition为TRUE,返回x对应位置的值;为FALSE,返回y对应位置的值
【numpy.linalg.norm( )】求范数norm(x, ord=None, axis=None, keepdims=False)
默认为求二范数。 order = 2 二范数; order = 1 ,L1范数 ;order = np.inf 无穷范数【ListedColormap()】参考文章 https://matplotlib.org/api/_as_gen/matplotlib.colors.ListedColormap.html#matplotlib.colors.ListedColormap【meshgrid( )】[X,Y] = meshgrid(x,y) 将向量x和y定义的区域转换成矩阵X和Y,其中矩阵X的行向量是向量x的简单复制,而矩阵Y的列向量是向量y的简单复制。
【ravel( ) 和 flatten( )】将数组平铺展开,ravel()返回view,对原始数组进行了改变;flatten()返回copy数组,不影响原始数组参考 http://blog.csdn.net/liuweiyuxiang/article/details/78220080
【plt.contourf( )】 参考 http://blog.csdn.net/quincuntial/article/details/71104405 https://www.cnblogs.com/huanggen/p/7533088.html
contour(X,Y,Z) 需要三维数据,X,Y代表二维坐标,在二维面上生成对应的网格,z代表高度,高度Z相等的颜色相同
相关文章推荐
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- python 实现 Peceptron Learning Algorithm ( 一) 几个函数的记录
- 记录几个小函数!
- 详细记录python的range()函数用法
- 实现CADOConn类的获取记录集数函数: UINT GetRecordsetCount(_RecordsetPtr pRecordset)
- python的几个小实现
- Python初学好的函数记录一笔
- 请编写实现malloc()内存分配函数功能一样的代码。给出一个函数来复制两个字符串A和B。字符串A的后几个字节和字符串B的前几个字节重叠。
- python的几个内建函数:apply,filter,map,reduce