This is a personal homework for meachine learning on coursera. Any suggestion or discussion is welcome. However, do follow the honor code of coursera!