/*
@Kun Duan
Simple LED sensing
Two LED required:
ledPin connects the output LED
analogPin connects the input LED as a light sensor
Note that the input LED MUST have its +/- legs inversed
*/
int ledPin = 13; // LED '13 pin as output
int analogPin = 0;
int value = LOW;
int val = 0;
long previousMillis = 0;
long interval = 120;
void setup()
{
pinMode(ledPin, OUTPUT); // set pin mode as OUTPUT
Serial.begin(9600); // set baud rate as 9600 bps
}
void loop()
{
if (millis() - previousMillis > interval) // run program every "interval" msec
{
previousMillis = millis();
val = analogRead(analogPin); // read analog input
if(val < 10) // set output led value as HIGH
value = HIGH;
else
{
value = LOW;
}
digitalWrite(ledPin, value); // write value to led pin
Serial.print("DETECT:"); // send back analog input through serial port Serial.println(val);
}
}
%%%%%%%%%%%%%%%%%%%%%
Below is a demo video
%%%%%%%%%%%%%%%%%%%%%
我的心,这只野鸟,在你的双眼中找到了天空。 它们是清晓的摇篮,它们是星辰的王国。 我的诗歌在它们的深处消失。 只让我在这天空中高飞,翱翔在静寂的无限空间里。 只让我冲破它的云层,在它的阳光中展翅吧。
Tuesday, December 28, 2010
Friday, November 26, 2010
FIFA Announces 55-Man Shortlist For 2010 World XI
Fifty-five players shortlisted for FIFA/FIFPro World XI 2010
(FIFA.com) Thursday 25 November 2010
Getty ImagesThe worldwide players’ union FIFPro and FIFA today announced
the 55 players shortlisted for the FIFA/FIPro World XI 2010 (see full list
below), which is to be revealed at the FIFA Ballon d’Or gala in Zurich on
10 January 2011.
The 50,000 professional footballers belonging to the players’ unions across
the world that form FIFPro received voting forms in a secret ballot to
nominate their peers for inclusion in their World XI – choosing the best
four defenders, three midfielders, three forwards and goalkeeper of 2010.
World champions Spain lead the way with the most players in the shortlist
with ten, followed by nine from Brazil, eight from Argentina, six from
England, four from Germany, three each from the Netherlands and Italy, two
from Portugal and one each from Uruguay, Wales, France, Bulgaria, Serbia,
the Czech Republic, Sweden, Ghana, the Ivory Coast and Cameroon.
Spain’s Primera Division attracted the most nominees with 18, followed by
England’s Premier League with 17 and Italy’s Serie A with 15. Four
nominees came from Germany’s Bundesliga and one from France’s Ligue 1.
The final FIFA/FIFPro World XI will be announced at the FIFA Ballon d’Or
gala in the Zurich Kongresshaus on 10 January 2011. During this televised
gala, the winner of the FIFA Ballon d’Or for the best player of 2010 and
the FIFA Women’s World Player of the Year 2010 award will also be revealed.
Meanwhile, the FIFA World Coach of the Year for Men’s Football award and
the FIFA World Coach of the Year for Women’s Football award will be
presented for the first time, while the FIFA Puskas Award for the best goal
of the year will be announced for the second year running. The FIFA
Presidential Award and the FIFA Fair Play Award will also be presented
during the gala.
The 55-player shortlist in full:
Goalkeepers: Gianluigi Buffon (Italy, Juventus FC), Iker Casillas (Spain,
Real Madrid C.F.), Petr Cech (Czech Republic, Chelsea FC), Julio Cesar
(Brazil, F.C. Internazionale), Edwin van der Sar (Netherlands, Manchester
United FC)
Defenders: Daniel Alves (Brazil, FC Barcelona), Gareth Bale (Wales,
Tottenham Hotspur), Michel Bastos (Brazil, Olympique Lyonnais), Ashley Cole
(England, Chelsea FC), Patrice Evra (France, Manchester United FC), Rio
Ferdinand (England, Manchester United FC), Philipp Lahm (Germany, FC Bayern
Munchen), Lucio (Brazil, F.C. Internazionale), Maicon (Brazil, F.C.
Internazionale), Marcelo (Brazil, Real Madrid C.F.), Alessandro Nesta
(Italy, AC Milan), Pepe (Portugal, Real Madrid C.F.), Gerard Pique (Spain,
FC Barcelona), Carles Puyol (Spain, FC Barcelona), Sergio Ramos (Spain, Real
Madrid C.F.), Walter Samuel (Argentina, F.C. Internazionale), John Terry
(England, Chelsea FC), Thiago Silva (Brazil, AC Milan), Nemanja Vidic
(Serbia, Manchester United FC), Javier Zanetti (Argentina, F.C.
Internazionale)
Midfielders: Esteban Cambiasso (Argentina, F.C. Internazionale), Michael
Essien (Ghana, Chelsea FC), Cesc Fabregas (Spain, Arsenal FC), Steven
Gerrard (England, Liverpool FC), Andres Iniesta (Spain, FC Barcelona),
Ricardo Kaka (Brazil, Real Madrid C.F.), Frank Lampard (England, Chelsea
FC), Javier Mascherano (Argentina, FC Barcelona), Thomas Muller (Germany, FC
Bayern Munchen), Mesut Ozil (Germany, Real Madrid C.F.), Andrea Pirlo
(Italy, AC Milan), Bastian Schweinsteiger (Germany, FC Bayern Munchen),
Wesley Sneijder (Netherlands, F.C. Internazionale), Xabi Alonso (Spain, Real
Madrid C.F.), Xavi (Spain, FC Barcelona)
Forwards: Dimitar Berbatov (Bulgaria, Manchester United FC), Didier Drogba
(Ivory Coast, Chelsea FC), Samuel Eto’o (Cameroon, F.C. Internazionale),
Diego Forlán (Uruguay, Atletico Madrid), Gonzalo Higuain (Argentina, Real
Madrid C.F.), Zlatan Ibrahimovic (Sweden, AC Milan), Lionel Messi
(Argentina, FC Barcelona), Diego Milito (Argentina, F.C. Internazionale),
Arjen Robben (Netherlands, FC Bayern München), Ronaldinho (Brazil, AC
Milan), Cristiano Ronaldo (Portugal, Real Madrid C.F.), Wayne Rooney
(England, Manchester United FC), Carlos Tevez (Argentina, Manchester City
FC), Fernando Torres (Spain, Liverpool FC), David Villa (Spain, FC Barcelona)
(FIFA.com) Thursday 25 November 2010
Getty ImagesThe worldwide players’ union FIFPro and FIFA today announced
the 55 players shortlisted for the FIFA/FIPro World XI 2010 (see full list
below), which is to be revealed at the FIFA Ballon d’Or gala in Zurich on
10 January 2011.
The 50,000 professional footballers belonging to the players’ unions across
the world that form FIFPro received voting forms in a secret ballot to
nominate their peers for inclusion in their World XI – choosing the best
four defenders, three midfielders, three forwards and goalkeeper of 2010.
World champions Spain lead the way with the most players in the shortlist
with ten, followed by nine from Brazil, eight from Argentina, six from
England, four from Germany, three each from the Netherlands and Italy, two
from Portugal and one each from Uruguay, Wales, France, Bulgaria, Serbia,
the Czech Republic, Sweden, Ghana, the Ivory Coast and Cameroon.
Spain’s Primera Division attracted the most nominees with 18, followed by
England’s Premier League with 17 and Italy’s Serie A with 15. Four
nominees came from Germany’s Bundesliga and one from France’s Ligue 1.
The final FIFA/FIFPro World XI will be announced at the FIFA Ballon d’Or
gala in the Zurich Kongresshaus on 10 January 2011. During this televised
gala, the winner of the FIFA Ballon d’Or for the best player of 2010 and
the FIFA Women’s World Player of the Year 2010 award will also be revealed.
Meanwhile, the FIFA World Coach of the Year for Men’s Football award and
the FIFA World Coach of the Year for Women’s Football award will be
presented for the first time, while the FIFA Puskas Award for the best goal
of the year will be announced for the second year running. The FIFA
Presidential Award and the FIFA Fair Play Award will also be presented
during the gala.
The 55-player shortlist in full:
Goalkeepers: Gianluigi Buffon (Italy, Juventus FC), Iker Casillas (Spain,
Real Madrid C.F.), Petr Cech (Czech Republic, Chelsea FC), Julio Cesar
(Brazil, F.C. Internazionale), Edwin van der Sar (Netherlands, Manchester
United FC)
Defenders: Daniel Alves (Brazil, FC Barcelona), Gareth Bale (Wales,
Tottenham Hotspur), Michel Bastos (Brazil, Olympique Lyonnais), Ashley Cole
(England, Chelsea FC), Patrice Evra (France, Manchester United FC), Rio
Ferdinand (England, Manchester United FC), Philipp Lahm (Germany, FC Bayern
Munchen), Lucio (Brazil, F.C. Internazionale), Maicon (Brazil, F.C.
Internazionale), Marcelo (Brazil, Real Madrid C.F.), Alessandro Nesta
(Italy, AC Milan), Pepe (Portugal, Real Madrid C.F.), Gerard Pique (Spain,
FC Barcelona), Carles Puyol (Spain, FC Barcelona), Sergio Ramos (Spain, Real
Madrid C.F.), Walter Samuel (Argentina, F.C. Internazionale), John Terry
(England, Chelsea FC), Thiago Silva (Brazil, AC Milan), Nemanja Vidic
(Serbia, Manchester United FC), Javier Zanetti (Argentina, F.C.
Internazionale)
Midfielders: Esteban Cambiasso (Argentina, F.C. Internazionale), Michael
Essien (Ghana, Chelsea FC), Cesc Fabregas (Spain, Arsenal FC), Steven
Gerrard (England, Liverpool FC), Andres Iniesta (Spain, FC Barcelona),
Ricardo Kaka (Brazil, Real Madrid C.F.), Frank Lampard (England, Chelsea
FC), Javier Mascherano (Argentina, FC Barcelona), Thomas Muller (Germany, FC
Bayern Munchen), Mesut Ozil (Germany, Real Madrid C.F.), Andrea Pirlo
(Italy, AC Milan), Bastian Schweinsteiger (Germany, FC Bayern Munchen),
Wesley Sneijder (Netherlands, F.C. Internazionale), Xabi Alonso (Spain, Real
Madrid C.F.), Xavi (Spain, FC Barcelona)
Forwards: Dimitar Berbatov (Bulgaria, Manchester United FC), Didier Drogba
(Ivory Coast, Chelsea FC), Samuel Eto’o (Cameroon, F.C. Internazionale),
Diego Forlán (Uruguay, Atletico Madrid), Gonzalo Higuain (Argentina, Real
Madrid C.F.), Zlatan Ibrahimovic (Sweden, AC Milan), Lionel Messi
(Argentina, FC Barcelona), Diego Milito (Argentina, F.C. Internazionale),
Arjen Robben (Netherlands, FC Bayern München), Ronaldinho (Brazil, AC
Milan), Cristiano Ronaldo (Portugal, Real Madrid C.F.), Wayne Rooney
(England, Manchester United FC), Carlos Tevez (Argentina, Manchester City
FC), Fernando Torres (Spain, Liverpool FC), David Villa (Spain, FC Barcelona)
Thursday, July 1, 2010
如果还在一起
如果当我24岁时,
我们还在一起,
我们牵手去见彼此的家人,
获取他们的认同
如果当我26岁时,
我们还在一起,
我会挽起留了很久的长发,
做你最美的新娘
如果当我28岁时,
我们还在一起,
我们一起期待着迎接那个加入我们小家庭的新生命的降临
如果当我29岁时,
我们还在一起,
我们一起用心经营我们的家,
每天听着宝宝稚嫩的声音叫我们“爸爸”、“妈妈”
如果当我33岁时,
我们还在一起,
不管周围的人如何分分和和,
我们一起携手坚定的走过那3年之痛、7年之痒,
继续着我们的幸福
如果当我40岁时,
我们还在一起,
就算最初的激情已被现实的生活打磨殆尽,
一切归于平淡,
但彼此的目光仍然会追逐着对方的身影,
相视一笑也会觉得安心
如果当我50岁时,
我们还在一起,
孩子离开我们去追寻他的幸福,
虽然想念宝宝,
依然还有你陪在我的身边,
每天傍晚手牵手一起散步
如果当我60岁时,
我们还在一起,
我们都已该休息,
有了大把的时间一起去做彼此曾经想做而没做的事,
去想去而没去过的地方
如果当我70岁时,
我们还在一起,
身边的孩子们都已经称呼我们“爷爷”、“奶奶”,
你还是当我是个不会照顾自己的孩子,
呵护着你眼中的“孩子”
如果当我76岁时,
我们还在一起,
我们要通知所以认识的人,
邀请所有的人来参加我们的金婚纪念日,
分享我们的幸福快乐
如果当我80岁时,
我们还在一起,
我们会每天躺在摇椅上一起晒太阳,
虽然不知道生命会持续到哪一天,
因为身边有彼此的陪伴,
不再恐惧死亡,
享受生命中的每一天
如果当我走到生命的最后一天时,
我希望身边有你陪伴,
我不要做那个留下来的人,
请允许我自私的先离开这个世界,
又或者你坚持不了了,我愿意陪你一同远去...
因为,
没有你的世界是冰冷的,
所以,
亲爱的,
如果到了那一天,
请让我先走,或带上我一起,
因为,
曾经属于
两个人共享的幸福我一个人收纳不了......
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
死生契阔 与子相悦 执子之手 与子偕老 才是幸福
我们还在一起,
我们牵手去见彼此的家人,
获取他们的认同
如果当我26岁时,
我们还在一起,
我会挽起留了很久的长发,
做你最美的新娘
如果当我28岁时,
我们还在一起,
我们一起期待着迎接那个加入我们小家庭的新生命的降临
如果当我29岁时,
我们还在一起,
我们一起用心经营我们的家,
每天听着宝宝稚嫩的声音叫我们“爸爸”、“妈妈”
如果当我33岁时,
我们还在一起,
不管周围的人如何分分和和,
我们一起携手坚定的走过那3年之痛、7年之痒,
继续着我们的幸福
如果当我40岁时,
我们还在一起,
就算最初的激情已被现实的生活打磨殆尽,
一切归于平淡,
但彼此的目光仍然会追逐着对方的身影,
相视一笑也会觉得安心
如果当我50岁时,
我们还在一起,
孩子离开我们去追寻他的幸福,
虽然想念宝宝,
依然还有你陪在我的身边,
每天傍晚手牵手一起散步
如果当我60岁时,
我们还在一起,
我们都已该休息,
有了大把的时间一起去做彼此曾经想做而没做的事,
去想去而没去过的地方
如果当我70岁时,
我们还在一起,
身边的孩子们都已经称呼我们“爷爷”、“奶奶”,
你还是当我是个不会照顾自己的孩子,
呵护着你眼中的“孩子”
如果当我76岁时,
我们还在一起,
我们要通知所以认识的人,
邀请所有的人来参加我们的金婚纪念日,
分享我们的幸福快乐
如果当我80岁时,
我们还在一起,
我们会每天躺在摇椅上一起晒太阳,
虽然不知道生命会持续到哪一天,
因为身边有彼此的陪伴,
不再恐惧死亡,
享受生命中的每一天
如果当我走到生命的最后一天时,
我希望身边有你陪伴,
我不要做那个留下来的人,
请允许我自私的先离开这个世界,
又或者你坚持不了了,我愿意陪你一同远去...
因为,
没有你的世界是冰冷的,
所以,
亲爱的,
如果到了那一天,
请让我先走,或带上我一起,
因为,
曾经属于
两个人共享的幸福我一个人收纳不了......
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
死生契阔 与子相悦 执子之手 与子偕老 才是幸福
Tuesday, June 8, 2010
EP-LDA 0.2 更正版!!!
这次主要debug了一下Gamma函数,原先计算Scaler的时候直接套用Gamma Function的定义计算,容易导致溢出(用Matlab算几个值就知道了),这次改为用log_gamma()进行计算,避开计算Gamma函数的乘积。貌似这次效果要好些,但是应该还是会有bug,以后再慢慢调不着急嘿嘿。
贴个链接:https://www.cs.indiana.edu/~kduan/rsc/2010/lda-ep-0.2.tar
贴个链接:https://www.cs.indiana.edu/~kduan/rsc/2010/lda-ep-0.2.tar
Monday, June 7, 2010
EP-LDA!!!
从开始看LDA到最后初步写完了基于EP的LDA算法!前前后后花了将近三周?忘了,反正很长。。。刚开始时候看LDA的那叫个一头雾水啊。。看到最后才发现,好像不是因为很难,而是自己懂的东西太少了。。Blei的那篇文章从头到尾看下来,发现要是不好好学一下Graphical Model和Machine Learning的话那是基本上在这个方向发展无望的,当然还有最优化相关的知识吧。。。Anyway,今天整理了下代码,感觉还不错嘿嘿。。(狞笑)
废话少说,贴出来几个很有用的reference,算是又一个reading list吧。。。
1. http://research.microsoft.com/en-us/um/people/minka/papers/ep/
这个是Minka所有关于EP的paper list,怎么说的,非常想感慨的一下是,这样的人之所以能有这样好的idea,可能和美国对孩子的教育方式是很有关系的,中国的孩子学习能力超强的,但是又有什么用呢,总是会被别人牵着鼻子走,很难会有很创新的idea。。想到刚刚发布的iphone 4和大陆那么多代工工厂,不禁汗一下,难道中国人生来就是“任劳任怨”的么。。。好像扯淡扯远了,let's make idea!!!
2. http://www.cs.princeton.edu/~blei/.../BleiNgJordan2003.pdf
LDA的开篇之作,没啥可说的,自己写了一个learning notes也一并贴出来,当然写的很简陋,仅仅是这篇paper里边我感觉比较难的地方的推导过程(又一个只会学习的!)请见这里:https://www.cs.indiana.edu/~kduan/rsc/2010/lda-report.pdf
3. http://chasen.org/~daiti-m/dist/lda/
代码框架借鉴的是这位大神,这个是用variational inference也就是原始paper里边的推理方法。代码写的相对来说比较容易懂,所以就没有用Blei自己release的代码,那个应该是写的很完美的,可是比较难理解,对本人这样的菜鸟还是留着以后慢慢研究,哈哈
废话少说,贴出来几个很有用的reference,算是又一个reading list吧。。。
1. http://research.microsoft.com/en-us/um/people/minka/papers/ep/
这个是Minka所有关于EP的paper list,怎么说的,非常想感慨的一下是,这样的人之所以能有这样好的idea,可能和美国对孩子的教育方式是很有关系的,中国的孩子学习能力超强的,但是又有什么用呢,总是会被别人牵着鼻子走,很难会有很创新的idea。。想到刚刚发布的iphone 4和大陆那么多代工工厂,不禁汗一下,难道中国人生来就是“任劳任怨”的么。。。好像扯淡扯远了,let's make idea!!!
2. http://www.cs.princeton.edu/~blei/.../BleiNgJordan2003.pdf
LDA的开篇之作,没啥可说的,自己写了一个learning notes也一并贴出来,当然写的很简陋,仅仅是这篇paper里边我感觉比较难的地方的推导过程(又一个只会学习的!)请见这里:https://www.cs.indiana.edu/~kduan/rsc/2010/lda-report.pdf
3. http://chasen.org/~daiti-m/dist/lda/
代码框架借鉴的是这位大神,这个是用variational inference也就是原始paper里边的推理方法。代码写的相对来说比较容易懂,所以就没有用Blei自己release的代码,那个应该是写的很完美的,可是比较难理解,对本人这样的菜鸟还是留着以后慢慢研究,哈哈
Friday, May 28, 2010
Bias-Variance Tradeoff
Bias(偏差)是指真正的均值和预测值之间的差值;Variance(方差)是指这个预测值作为随机变量的方差(在所有可能的训练样本上平均). 如果用公式表示,就是:
Bias(f^(x_0))=E(f^(x_0))-f(x_0)
Var(f^(x_0))=E[f^(x_0)-E[f^(x_0)]]^2
举个例子,k-NN的方差随着k的上升而下降。这表示了k-NN估计的"稳定性"随着k的上升而提高;而k越高,取的邻域就越大,用这个大邻域中的均值去估计f(x0),偏差就会增大。Bias表示预测的"准确程度";而Variance表示预测的"稳定性".
下边是一个经典的关于Bias-Variance的曲线图:
(model complexity可以理解成这个分类器输入的维度,k-NN中,k越大,复杂度就越低,即分类越粗糙;k越小,复杂度越
高,即分类越细腻)
Bias(f^(x_0))=E(f^(x_0))-f(x_0)
Var(f^(x_0))=E[f^(x_0)-E[f^(x_0)]]^2
举个例子,k-NN的方差随着k的上升而下降。这表示了k-NN估计的"稳定性"随着k的上升而提高;而k越高,取的邻域就越大,用这个大邻域中的均值去估计f(x0),偏差就会增大。Bias表示预测的"准确程度";而Variance表示预测的"稳定性".
下边是一个经典的关于Bias-Variance的曲线图:
(model complexity可以理解成这个分类器输入的维度,k-NN中,k越大,复杂度就越低,即分类越粗糙;k越小,复杂度越
高,即分类越细腻)
Tuesday, May 25, 2010
国史大纲 前言
凡读本书请先具下列诸信念:
一、当信任何一国之国民,尤其是自称知识在水平线以上之国民,对其本国已往历史,应该略有所知。(否则最多只算一有知识的人,不能算一有知识的国民。)
二、所谓对其本国已往历史略有所知者,尤必附随一种对其本国已往历史之温情与敬意。(否则只算知道了一些外国史,不得云对本国史有知识。)
三、所谓对其本国已往历史有一种温情与敬意者,至少不会对其本国历史抱一种偏激的虚无主义,(即视本国已往历史为无一点有价值,亦无一处足以使彼满意。) 亦至少不会感到现在我们是站在已往历史最高之顶点,(此乃一种浅薄狂妄的进化观。)而将我们当身种种罪恶与弱点,一切诿卸于古人。(此乃一种似是而非之文化自谴。)
四、当信每一国家必待其国民具备上列诸条件者比较渐多,其国家乃再有向前发展之希望。(否则其所改进,等于一个被征服国或次殖民地之改进,对其自身国家不发生关系。换言之,此种改进,无异是一种变相的文化征服,乃其文化自身之萎缩与消灭,并非其文化自身之转变与发皇。)
一、当信任何一国之国民,尤其是自称知识在水平线以上之国民,对其本国已往历史,应该略有所知。(否则最多只算一有知识的人,不能算一有知识的国民。)
二、所谓对其本国已往历史略有所知者,尤必附随一种对其本国已往历史之温情与敬意。(否则只算知道了一些外国史,不得云对本国史有知识。)
三、所谓对其本国已往历史有一种温情与敬意者,至少不会对其本国历史抱一种偏激的虚无主义,(即视本国已往历史为无一点有价值,亦无一处足以使彼满意。) 亦至少不会感到现在我们是站在已往历史最高之顶点,(此乃一种浅薄狂妄的进化观。)而将我们当身种种罪恶与弱点,一切诿卸于古人。(此乃一种似是而非之文化自谴。)
四、当信每一国家必待其国民具备上列诸条件者比较渐多,其国家乃再有向前发展之希望。(否则其所改进,等于一个被征服国或次殖民地之改进,对其自身国家不发生关系。换言之,此种改进,无异是一种变相的文化征服,乃其文化自身之萎缩与消灭,并非其文化自身之转变与发皇。)
Subscribe to:
Posts (Atom)