## Linear models

matrix multiplication: fast with GPU
numerically stable
cannot cocatenate linear units → equivalent to one big matrix...

⇒ add non-linear units in between

## rectified linear units (RELU)

chain rule: efficient computationally

## back propagation

easy to compute the gradient as long as the function Y(X) is made of simple blocks ...

## Softmax function

socres `yi` ⇒ probabilities `pi`

property: smaller scores ⇒ less certain about result

## Cross entropy

measure how well the probability vector `S` corresponds to the label vector `L`. ⇒ cross entropy `D(S,L)`( D>=0, the smaller the better ...

# collections

py自带的一些好用的数据结构...
https://docs.python.org/2/library/collections.html

`from collections import Counter, deque, defaultdict`

# itertools

```>>> from itertools import product, combinations
>>> a = 'ABCD'; b='EFG'
>>> for p in product(a,b):
print ...```

Elliot's parents speak French and English to him at home. He has heard a lot of words, but it isn't always clear to him which word comes from which language! Elliot knows one sentence ...

# 1. Include jars into project

weka官网的下载链接里选择linux版本的weka压缩包即可, 下载以后找到weka.jar文件, 在工程里将其include一下就可以使用了(btw, 现在开始放弃eclipse, 进入IDEA的怀抱了...).

weka的文档在解压缩的文件里有, 另外在线文档在: http://weka.sourceforge.net/doc.stable-3-8/

# 1. Introduction to Intractability

recall model of computation: DFA
a univeral model of computation: turing machine
→ no more powerful model of computation.
Turing machine can compute any function that can be computed by a physically harnessable process of the natural world.

bottom line: turing machine is a simple and universal ...

simplex algo: top 10 algo of the 20th century (ever?).

what is linear programming:
a general problem-solving model that works for:
shortest-path, maxflow, MST, matching, assignment, ...

# 1. Brewer-'s Problem

toy example: choose products to maximize profit.
...
feasible region: a convex polygon.

⇒ optimum solution appears at an extreme point.

standard ...

http://www.imooc.com/learn/317

# 模块和包

: 文件夹 (可以有多级), 且包含`__init__.py`文件(每层都要有) 模块: py文件

### 导入模块

```from math import log
from logging import log as logger
```

### 动态导入模块

```try:
from cStringIO import ...```

Goal: classify problems according to computational requirements.
bad new: for huge number of pbs we don't know...

# 1. Introduction to Reductions

shifing gears:

• from individual problems to problem-solving models.
• from linear/quard to polynomial/exponential pbs
• from implementation details to conceptual framwork

suppose we could (not) solve pb X ...

http://www.imooc.com/learn/317

• 不需要变量 (python允许有变量, 所以python非纯函数式)
• 高阶函数
• 闭包: 返回函数
• 匿名函数

## 高阶函数

• 变量可以指向函数 `f=abs; f(-10)`
• 函数名: 就是指向函数的变量 `abs=len`
• 高阶函数: 接收函数作为参数的函数

`map()`是 Python 内置的高阶函数 ...