write source code by myself for book of Machine Leaning