Monday, August 12, 2013

What is the Kernel trick?

Kernel trick arises from speeding up the SVM learning. In the dual version of the optimization function for SVM:

Saturday, July 6, 2013

偷得浮生半日闲

竟然有时间读了下 光荣与梦想, 不错。讲述美国从上世纪三四十年代开始的逆袭故事。

Wednesday, March 13, 2013

Basic Plotting One -- y = sqrt(x) * 10

After grading the homework, I realized that a curve on the scores is a must...

The curve function is designed to be y = sqrt(x) * 10, 0 <= x <= 100. What does it look like? 

1) Google is always the best friend: Type y = sqrt(x) * 10 in the search box, you will see the plot.

2) An alternative is to use R plot function and save the plot in eps:

curve_func <- function(x) { return 10 * sqrt(x) }
setEPS()
postscript('curve.eps')
plot(curve_func, 0, 100, main = "curve_func(x) = 10 * sqrt(x)", xlab = 'original score', ylab = 'curved score')
dev.off()





3) Another way of doing it in Python:
import matplotlib.pyplot as plt
x = [0.01 * z for z in range(10000)]
y = [0.1 * sqrt(z) for z in range(10000)]
plt.plot(x, y)
plt.show()

 

Tuesday, January 18, 2011

python learning map /reduce

a = [1, 2, 3]
b = [4, 5, 6, 7]
c = [8, 9, 1, 2, 3]
L = map(lambda x:len(x), [a, b, c])

# L == [3, 4, 5]
N = reduce(lambda x, y: x+y, L)
# N == 12
# Or, if we want to be fancy and do it in one line
N = reduce(lambda x, y: x+y, map(lambda x:len(x), [a, b, c]))


I am going to implement a generic MapReduce framework using Python multiprocess module. This module will exploit the multi-core environment better.
For data exchanges, I will use the tmpfiles.

Saturday, December 25, 2010

Christmas, new hope!

It is Christmas now.
I want to form some new habits in this coming year.

1. sleep early ( set auto-shutdown in both windows and Linux), read books after the computer is closed
2. research and paper reading. form a plan
3. keep positive
4. the accumulation of the confidence and courage

Wednesday, November 24, 2010

cut and gawk

cut is one of the most useful commands for text processing.

cut -d. -f1 file # print out the first column of the file

sed:

Friday, October 29, 2010

grep inside vim

The vim now has built-in grep command. To see all the results, just type :copen