Wednesday, December 19, 2012

Learning Networks (0): Open Course "Networks: Friend, Money and Bytes"

I'm gonna jump into Networks area. To broaden my horizons, I decide first to take the course "Networks: Friend, Money and Bytes", taught by Mung Chiang from Princeton University. The course attracts me by its interesting 20 Questions. Its goal is to teach students some important models and methods used in different areas.

Q1: What makes CDMA work for my smartphone

This question is not so interesting to me, perhaps because I don't use smartphone. The methods used to solve the problem is familiar to me. We will see what these methods are soon.

Problem Statement

The problem is CDMA performs frequency reuse, but it is non-orthogonal so that it suffers from interference. The goal is to achieve a target signal quality for each user.

Model

First to evaluate the signal quality, we define Signal-to-Interference-noise-Ratio (SIR) associated with $i$-th user:
\[SIR_i = \frac{P_iG_{ii}}{\sum_{j \neq i}{P_jG_{ij}} + n_i},\]
where $P_i$ denotes power at the transmitter side $i$, $G_{ij}$ represents the channel gain from the transmitter of the logical transceiver pair $j$ to the receiver of logical transceiver pair $i$, and $n_i$ is the noise at the $i$-th receiver.
The above formula is quite straightforward, $P_iG_{ii}$ is the signal power at the $i$-th receiver side. The denominator contains signal interference from other transmitters plus the noise. In this course, $G_{ij}$ and $n_i$ is considered as constants. We only need to decide the value of $P_i$ to achieve target SIR.

Methods
View1: Optimization
\[\min\sum_{i=1}^{N}P_i\]
\[s.t. STR_i(\vec{p}) \geq \beta_i, i = 1, 2, \ldots, N\]
where $\beta_i$ is the target SIR. After simple conversion of the constrains, we can find it is a linear programming.

About linear programming, I just know how to write down a LP formula, but don't know how to analyze its convexity and how to solve it. These questions left for future study.

View2: Game Theory
In my point of view, if optimization considers the problem from the perspective of overall performance, game theory is from the perspective of individual benefit when we think players are competing with each other. In the lecture, the professor talked about dominant action and Nash equilibrium, which reminds me of the course I took from coursera this spring. The professor gave the conclusion without proof that is the best strategy is Distributed power control (DPC).

DPC
This simple algorithm goes as follows:
\[P_i[t+1] = \frac{\beta_i}{STR_i[t]}P_i[t]\]
where $P_i[t]$ is current power, $STR_i[t]$ is the feedback.

Assignment

Learning Python (1): Reading Book "Dive into Python 3"

I am reading the book "Dive into Python 3" now, which has HTML version for free. This is an advanced book, and actually the first two chapters almost cover all the syntax talked in "Learn to Program". One of the book's drawback is it doesn't have exercise, so I have to find some interesting projects from other places.

Comprehension

The first special thing I learn from the book is comprehension. It's like a filter that can select elements from list, dictionary or set. It's pretty much like for-if-else loop, but more compact.

Example
Replace each lowercase letter in a string by the letter two places after it. It can be achieved by one-line code in Python:

a = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
print(''.join([chr(ord('a') + (ord(x) - ord('a') + 2) % 26) if x in string.ascii_lowercase else x for x in a]))

Another way is to use maketrans and translate function:
table = a.maketrans(string.ascii_lowercase, string.ascii_lowercase[2:] + string.ascii_lowercase[:2])
print(a.translate(table))


This example is from level 1 of Python Challenge, which I'm currently using and enjoying as exercise.


Monday, December 3, 2012

Learning Python (0): Open Course "Learn to Program"

Next semester, I will have information storage and retrieval class, which request students to use Python to do some projects. So I plan to obtain some practical experience in Python before the class. What I first want to do is to learn the basic knowledge from online course and finish its assignments and projects. The next step is to read books about advance programming on Python.

Previously, I learned machine learning course on coursera which impressed my a lot. So this time I also choose the course on the coursera, which is "Learn to Program" taught by University of Toronto . The course is very basic, so I usually use 1.5x-2x speed to watch the lecture. Now I have watched 4/7 lectures. I'm not going to type any syntax of Python here because it's kind of waste of time and meaningless. Instead, I'm gonna to write down something about the assignments that is interesting to me.

12/08/2012
I finished watching all the lectures.

12/13/2012
I finished the programming assignments, which seem very basic. It's helpful for beginners especially those who do not have experience in programming to take this course. One of the motivation of the course I think is to teach the fundamental idea of programming. For experienced guys, advanced course is needed. Anyway, it's a good start. Next, I'm probably going to find a book and do some practice.

Learning Guitar

Since September 2012, I began to learn to play guitar from my roommate Xiaoxi Bi and also from videos online. Here is some record for my learning. Hope one day I can post some audios record by myself.

What I have learned:
Wonderful tonight by Eric Clapton: finger pick, part of it, solo part to be learned
小手拉大手 by 梁静茹: basic folk strum, almost the whole song
恋爱ing by 五月天: the cord is similar to 小手拉大手
恰似你的温柔 by 蔡琴: learn from Ma.shushu, chord: Dm, G7
Happy birthday song: learn from Ma.shushu, combine single-tone and chord
Anonymity: first song of classic guitar that Xiaoxi learned
老男孩 by 筷子兄弟: the whole song, learn from Ma.shushu
晴天 by 周杰伦: prelude and simple strum version, learn from Ma.shushu. Although the song is simple, it's hard for me to sing when playing guitar. One day when I waited for the train at the subway in New York, I suddenly realized how to sing with the strum. What I do is understanding the beat of lyric and strum first and then combine them together. When I got it, the train arrived at the station "Jay", the English name of 周杰伦.
米店 by 张玮玮: three fingers
拥抱 by 五月天: slow soul, 4 chords, learn from Guitar Handbook
彩虹 by 周杰伦: just the prelude, learn from Ma.shushu
南方 by 达达乐队: slow soul, learn from Xiaoxi

What I am learning:
Tears in heaven by Eric Clapton, learn from Youtube.
1984 by 梁晓雪: first impressed by its beautiful prelude, recommended and taught by Xiaoxi
爱很简单 by 陶喆: learn from Guitar Handbook and Ma.shushu.
我的心真的受伤了 by 张学友: practice Bm cord, learn from Guitar Handbook

What I am going to learn
遇见 by 孙燕姿: the hardest song I heard so far