# Month: April 2012

## TEDxUW Why you will fail to have a great career

TEDxUW是本地的TED类似的组织，Larry Smith是UW的老师。

Why you will fail to have a great career

I asked, do you have passion? You say, I have interest. … Passion, Interest is not the same thing, are you really gonna go to your sweetie to say, Marry me! You are interesting 囧…

## Good Friday

“耶穌受難節，是基督教信徒纪念耶稣基督被钉在十字架上受难的日子，是復活節前一个星期五。据圣经记载，耶稣于公元33年猶太曆尼散月十四日上午九时左右被钉在十字架上，于下午三时左右死去。耶穌唯獨吩咐門徒要紀念他的死亡。（路加福音22：19，20）”

## PCA的实现

PCA，全称是Principal component analysis，中文叫做主成分分析，是一种常用的数据处理手段。

PCA可以保证，在降维之后，数据表示的信息损失最小。

“损失最小”具体怎么定义？

SVD分解, matlab

```    sub_input_data = (input_data - repmat(mean(input_data),count,1))/sqrt(count-1);
[U,S,V] = svd(sub_input_data);
% First out_dim columns as PCA bases
pcaV = V(:,1:out_dim);
output_data = input_data * pcaV;
```

EIG分解, matlab

```    mean_input_data = mean(input_data);
sub_input_data = input_data - repmat(mean_input_data, count,1);
mean_mat = sub_input_data' * sub_input_data ./ (count - 1);
cov_mat = mean_mat;
[V D] = eig(cov_mat);
% Last out_dim columns as PCA bases
pcaV = V(:,in_dim - out_dim + 1: in_dim);
output_data = input_data * pcaV;
```

OpenCV下可以用这个方法做EIG分解。

```cv::eigen(covMat, eigenValues, eigenVectors);
```

MatlabPCA

PCA之后：