rasbt / python-machine-learning-book

The "Python Machine Learning (1st edition)" book code repository and info resource
MIT License
12.18k stars 4.39k forks source link

Add Code Examples #21

Closed andrelip closed 7 years ago

andrelip commented 8 years ago

Just bought this book and I can't find the source code of the examples in the book. I bought on Amazon and gone to Packtpub page as suggested on the book but even the zip I download from them is only a mirror to this repository. Just images, no code for the examples in the book. It's really annoying to have to type every single example by hand.

rasbt commented 8 years ago

Thanks for your interest in my book and sorry for the trouble. But don't worry, there's no need to type everything up manually, the code is all in this github repository in the ./code subdirectory :). So, once you downloaded the .zip version, you have to go inside this code directory, and then go the respective chapter. Inside the e.g., ch01 directory, you will then find an Jupyter notebook with the code. (Alternatively, I provided the code as py script files in the code/_convenience_scripts subdirectory; however, I really recommend the Jupyter notebooks since I also have the chapter headings, a table of contents, and the images in there alongside the code.

screen shot 2016-07-12 at 10 15 18 pm

screen shot 2016-07-12 at 10 15 27 pm

screen shot 2016-07-12 at 10 15 35 pm

Alternatively, you can also view the notebooks online if you don't want to use Jupyter notebooks on your machine. For example, you can simply click on the respective chapter (I provided links in the README.md file):

screen shot 2016-07-12 at 10 20 57 pm

screen shot 2016-07-12 at 10 24 35 pm

Please let me know how it goes, I am more than happy to help you out here :)

andrelip commented 7 years ago

Sorry. It was correct and I get able to see the examples using jupyter-notebook. I never learned python and tried to follow the book as the sintax seems very close to other dynamic languages like Ruby and is very explict while importing modules like it is in Elixir and ES2015. I expected to have a couple .py files and when I opened the notebook archive in vim and saw all the markups I thought it was just a revision for the chapter. Thanks for the awesome book and to spend your time taking those pics!

rasbt commented 7 years ago

You are very welcome! I am glad to hear that you got the Jupyter notebooks to work.

I expected to have a couple .py files

Btw. I recently created these :). They are in the ./code/optional-py-scripts directory in this repo. However, I would really recommend using the Jupyter notebooks instead since they are easier to read (because of the chapter and section headlines, and the inline plots).