Python中类的定义与调用
来源:互联网 发布:网络餐饮服务 编辑:程序博客网 时间:2024/05/23 10:46
#!/usr/bin/pythonimport numpy as np'''define'''class Network: def __init__(self,sizes): self.num_layers=len(sizes) self.sizes=sizes self.biases=[np.random.randn(y,1) for y in sizes[1:]] # 3*1 and 1*1 self.weights=[np.random.randn(x,y) \ for x,y in zip(sizes[1:],sizes[:-1])] # 3*2 and 1*3 def feedforward(self,a): for b,w in zip(self.biases,self.weights): a=sigmoid(np.dot(w,a)+b) return adef sigmoid(z): return 1.0/(1.0+np.exp(-z))'''invoke'''net=Network([2,3,1])net.feedforward([[2],[3]])
阅读全文
0 0
- Python中类的定义与调用
- Python中类的定义与使用
- Python 07 函数的定义与调用
- python中简单的类定义及调用方法
- python 中调用c++定义的函数
- Python类定义、例化与调用
- python基础--调用自己定义的类
- 0047 python中类的定义与用法
- python中类的定义
- python函数的嵌套调用与嵌套定义
- [Python] python中函数的参数定义与可变参数
- C语言中全局变量的定义与调用
- Visual Basic 2008 中函数的定义与调用
- C语言中全局变量的定义与调用
- 函数的定义与调用
- 函数的定义与调用
- Python中类定义的讲解
- python类定义内部调用对象的实例
- dom4j解析xsd
- __cdecl、__clrcall、__stdcall、__fastcall、__thiscall、__vectorcall等含义
- spring 定时 Cron 表达式
- 创新实训6.13
- 避免常见的Android内存泄漏
- Python中类的定义与调用
- 概率图模型8:独立性
- swift 16进制颜色转换
- QT QML初体验随笔之QQuickView(13)
- 62_数组的拷贝_排序_二分法_命令行参数_增强for循环
- 支持向量机SVM
- 【HTTP header】【Content-type】jquery post 时content-type的几种取值
- sublime text3 安装ctags
- segmentation学习记录-经典思路