[Theano] Theano初探
2016-03-03 11:28
309 查看
1. Theano用来干嘛的?
Theano was written at the LISA lab to support rapid development of efficient machine learning algorithms. Theano is named after the Greek mathematician, who may have been Pythagoras’ wife. Theano is released under a BSD license (link).
加快处理多维数组计算。Theano is a Python library that lets you to define, optimize, and evaluate mathematical expressions, especially ones with multi-dimensional arrays (numpy.ndarray). Using Theano it is possible to attain speeds rivaling hand-crafted C implementations for problems involving large amounts of data. It can also surpass C on a CPU by many orders of magnitude by taking advantage of recent GPUs.
Theano’s compiler applies many optimizations of varying complexity to these symbolic expressions. These optimizations include, but are not limited to:
use of GPU for computations
constant folding
merging of similar subgraphs, to avoid redundant calculation
arithmetic simplification (e.g.
inserting efficient BLAS operations (e.g.
using memory aliasing to avoid calculation
using inplace operations wherever it does not interfere with aliasing
loop fusion for elementwise sub-expressions
improvements to numerical stability (e.g.
and
)
for a complete list, see Optimizations
2. 安装Theano
我用的是Ubuntu,所以戳Easy Installation of an Optimized Theano on Current Ubuntu. (其它系统见Installing Theano)
直接用下面指令就安装完成了
For Ubuntu 11.10 through 14.04:
3. 测试一下logistic function
如果没有报错就完成了
Theano was written at the LISA lab to support rapid development of efficient machine learning algorithms. Theano is named after the Greek mathematician, who may have been Pythagoras’ wife. Theano is released under a BSD license (link).
加快处理多维数组计算。Theano is a Python library that lets you to define, optimize, and evaluate mathematical expressions, especially ones with multi-dimensional arrays (numpy.ndarray). Using Theano it is possible to attain speeds rivaling hand-crafted C implementations for problems involving large amounts of data. It can also surpass C on a CPU by many orders of magnitude by taking advantage of recent GPUs.
Theano’s compiler applies many optimizations of varying complexity to these symbolic expressions. These optimizations include, but are not limited to:
use of GPU for computations
constant folding
merging of similar subgraphs, to avoid redundant calculation
arithmetic simplification (e.g.
x*y/x -> y,
--x -> x)
inserting efficient BLAS operations (e.g.
GEMM) in a variety of contexts
using memory aliasing to avoid calculation
using inplace operations wherever it does not interfere with aliasing
loop fusion for elementwise sub-expressions
improvements to numerical stability (e.g.
and
)
for a complete list, see Optimizations
2. 安装Theano
我用的是Ubuntu,所以戳Easy Installation of an Optimized Theano on Current Ubuntu. (其它系统见Installing Theano)
直接用下面指令就安装完成了
For Ubuntu 11.10 through 14.04:
#sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git #sudo pip install Theano
3. 测试一下logistic function
import theano import theano.tensor as T x = T.dmatrix('x') s = 1 / (1 + T.exp(-x)) logistic = theano.function([x], s) logistic([[0, 1], [-1, -2]])
如果没有报错就完成了
相关文章推荐
- ECLIPSE下SVN的创建分支/合并/切换使用
- Spark Streaming和Kafka整合是如何保证数据零丢失
- Swift2.0(14)引用类型与数值类型
- logistic回归(机器学习)
- Home Screen Quick Actions
- memcached安装
- c语言二叉树的存储表示与实现
- 笔记:Linux常用命令(五)关机重启用户登录查看命令
- 设计模式(9)——装饰者模式(Decorator Pattern)
- 设计模式(8)——桥接模式(Bridge Pattern)
- 常用socket函数详解
- LeetCode Graph Valid Tree
- 超出TCP连接端口数限制(MaxUserPort)引起的服务器问题
- Android开发Can't create handler inside thread that has not called Looper.prepare()
- ABP总体介绍
- win7上使用eclipse阅读hadoop源码准备
- iOS- "unacceptable content-type: text/plain"等content-type bug解决方案
- dict中的“深拷贝”和“浅拷贝”
- Swift2.0(13)构造方法
- 虚函数 纯虚函数 抽象类