Summer Review: Data structure and algorithm

July 27:

Basic algorithms and data structure

##O(n) selection algorithm

 

[Quick recap]Deep learning 4 Regularization

What is regularization?
Any aspect of a learning algorithm that is intended to lower the generalization erro but not the training error.

Norm-based Regularization

Standard regularization method (convex models) is:
[math]J_\Omega (\theta;S)=J(\theta;S)+\Omega(\theta)[/math],
where [math]\Omega[/math] is independent on training data. A common choice is the L2/Frobenius-norm penalty for deep networks,
[math]\Omega(\theta) = \frac{1}{2}\sum_{l=1}^{L}\mu^l||\mathbb{W}^l||_F^2, \mu^l\geq0[/math]
Here we usually
* only penalize weights, not biases.
* one [math]\mu^l[/math] per layer.

Weight Decay

Regularization based on L2-norm is also called weight-decay as [math]\frac{\partial\Omega}{\partial{w_ij^l}}=\mu^lw_{ij}^l[/math]
Gradient descent gets modified as [math]\theta(t+1)=(1-\mu)\theta(t)-n * \triangledown_{\theta}J[/math]
New_Theta = weight_decayed_theta – step_size * original_gradient
*Quadratic (Taylor) approxiamation of J around J-optimal:
[math]J(\theta) \approx{} J(\theta^\ast)+\frac{1}{2}(\theta – \theta^\ast)^T\mathbb{H}(\theta – \theta^\ast)[/math], where H is the Hessian Matrix.

[latexpage]

This is how we test markdown and

$ \alpha$
some strong

1.简介
最小堆是一棵完全二叉树,非叶子结点的值不大于左孩子和右孩子的值。本文以图解的方式,说明
最小堆的构建、插入、删除的过程。搞懂最小堆的相应知识后,最大堆与此类似。
2.最小堆示例

3.最小堆的构建
初始数组为:9,3,7,6,5,1,10,2
按照完全二叉树,将数字依次填入。
填入后,找到最后一个结点(本示例为数字2的节点),从它的父节点(本示例为数字6的节点)
开始调整。根据性质,小的数字往上移动;至此,第1次调整完成。
注意,被调整的节点,还有子节点的情况,需要递归进行调整。
第二次调整,是数字6的节点数组下标小1的节点(比数字6的下标小1的节点是数字7的节点),
用刚才的规则进行调整。以此类推,直到调整到根节点。
以下是本示例的图解:

注意:数字9的节点 将和 数字1的节点 发生对调,对调后,需要递归进行调整,请一定注意。

4.最小堆的元素插入
以上个最小堆为例,插入数字0。
数字0的节点首先加入到该二叉树最后的一个节点,依据最小堆的定义,自底向上,递归调整。
以下是插入操作的图解:

5.最小堆的节点删除
对于最小堆和最大堆而言,删除是针对于根节点而言。
对于删除操作,将二叉树的最后一个节点替换到根节点,然后自顶向下,递归调整。
以下是图解:

Ubuntu setup

http://askubuntu.com/questions/694503/how-do-i-use-a-microsoft-designer-mouse-with-ubuntu-15-10

shsdadsa

02/30 Stack: Leetcode Diaries

300. Longest Increasing Subsequence

Description

Given an unsorted array of integers, find the length of longest increasing subsequence.
For example,
Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101], therefore the length is 4. Note that there may be more than one LIS combination, it is only necessary for you to return the length. Your algorithm should run in O(n2) complexity.

Solution

  1. O(n^2): save length in a second list
  2. O(nlogn): Binary search. We maintain a list, which contains the longest sublist. For each step, we do binary search on the left if current num is smaller than the right most element of the list.

Russian Doll Envelopes

Descripton

You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope.
What is the maximum number of envelopes can you Russian doll? (put one inside other)

Solution

  1. Similar to 300, there are two ways to solve the problem. An O(n^2) brute force one and O(nlogn). O(n^2) solution is simple.
  2. O(nlogn) solution needs binary search as well as special sort for sequences. We need to sort in ascending width and decreasing height. Then redo the

Burndown chart

Work remaining over time.

Daily Scrum Meeting

15 min, three questions

Impediments

Obstacles

Product Backlog

requirements for a system, prioritized list of product backlog items

Product backlog item

A unit f work small enough to be completed by a team in one Sprint iteration. They are decomposed into one or more tasks.

Task in 30 days

  • Finish everything on the thesis
  • Finish first round Leetcode
    5.19 Deadline

Three Years in Zurich