Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
The «Python Machine Learning (1st edition)» book code repository and info resource
License
rasbt/python-machine-learning-book
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Python Machine Learning book code repository
This GitHub repository contains the code examples of the 1st Edition of Python Machine Learning book. If you are looking for the code examples of the 2nd Edition, please refer to this repository instead.
What you can expect are 400 pages rich in useful material just about everything you need to know to get started with machine learning . from theory to the actual code that you can directly put into action! This is not yet just another «this is how scikit-learn works» book. I aim to explain all the underlying concepts, tell you everything you need to know in terms of best practices and caveats, and we will put those concepts into action mainly using NumPy, scikit-learn, and Theano.
You are not sure if this book is for you? Please checkout the excerpts from the Foreword and Preface, or take a look at the FAQ section for further information.
1st edition, published September 23rd 2015
Paperback: 454 pages
Publisher: Packt Publishing
Language: English
ISBN-10: 1783555130
ISBN-13: 978-1783555130
Kindle ASIN: B00YSILNL0
German ISBN-13: 978-3958454224
Japanese ISBN-13: 978-4844380603
Italian ISBN-13: 978-8850333974
Chinese (traditional) ISBN-13: 978-9864341405
Chinese (mainland) ISBN-13: 978-7111558804
Korean ISBN-13: 979-1187497035
Russian ISBN-13: 978-5970604090
Table of Contents and Code Notebooks
Simply click on the ipynb / nbviewer links next to the chapter headlines to view the code examples (currently, the internal document links are only supported by the NbViewer version). Please note that these are just the code examples accompanying the book, which I uploaded for your convenience; be aware that these notebooks may not be useful without the formulae and descriptive text.
- Excerpts from the Foreword and Preface
- Instructions for setting up Python and the Jupiter Notebook
- Machine Learning — Giving Computers the Ability to Learn from Data [dir] [ipynb] [nbviewer]
- Training Machine Learning Algorithms for Classification [dir] [ipynb] [nbviewer]
- A Tour of Machine Learning Classifiers Using Scikit-Learn [dir] [ipynb] [nbviewer]
- Building Good Training Sets – Data Pre-Processing [dir] [ipynb] [nbviewer]
- Compressing Data via Dimensionality Reduction [dir] [ipynb] [nbviewer]
- Learning Best Practices for Model Evaluation and Hyperparameter Optimization [dir] [ipynb] [nbviewer]
- Combining Different Models for Ensemble Learning [dir] [ipynb] [nbviewer]
- Applying Machine Learning to Sentiment Analysis [dir] [ipynb] [nbviewer]
- Embedding a Machine Learning Model into a Web Application [dir] [ipynb] [nbviewer]
- Predicting Continuous Target Variables with Regression Analysis [dir] [ipynb] [nbviewer]
- Working with Unlabeled Data – Clustering Analysis [dir] [ipynb] [nbviewer]
- Training Artificial Neural Networks for Image Recognition [dir] [ipynb] [nbviewer]
- Parallelizing Neural Network Training via Theano [dir] [ipynb] [nbviewer]
A big thanks to Dmitriy Dligach for sharing his slides from his machine learning course that is currently offered at Loyola University Chicago.
Additional Math and NumPy Resources
Some readers were asking about Math and NumPy primers, since they were not included due to length limitations. However, I recently put together such resources for another book, but I made these chapters freely available online in hope that they also serve as helpful background material for this book:
- Algebra Basics [PDF] [EPUB]
- A Calculus and Differentiation Primer [PDF] [EPUB]
- Introduction to NumPy [PDF] [EPUB] [Code Notebook]
You are very welcome to re-use the code snippets or other contents from this book in scientific publications and other works; in this case, I would appreciate citations to the original source:
@Book, title = , publisher = , year = , address = , isbn = >
Raschka, Sebastian. Python machine learning. Birmingham, UK: Packt Publishing, 2015. Print.
Sebastian Raschka’s new book, Python Machine Learning, has just been released. I got a chance to read a review copy and it’s just as I expected — really great! It’s well organized, super easy to follow, and it not only offers a good foundation for smart, non-experts, practitioners will get some ideas and learn new tricks here as well.
– Lon Riesberg at Data Elixir
Superb job! Thus far, for me it seems to have hit the right balance of theory and practice…math and code!
– Brian Thomas
I’ve read (virtually) every Machine Learning title based around Scikit-learn and this is hands-down the best one out there.
– Jason Wolosonovich
The best book I’ve seen to come out of PACKT Publishing. This is a very well written introduction to machine learning with Python. As others have noted, a perfect mixture of theory and application.
– Josh D.
A book with a blend of qualities that is hard to come by: combines the needed mathematics to control the theory with the applied coding in Python. Also great to see it doesn’t waste paper in giving a primer on Python as many other books do just to appeal to the greater audience. You can tell it’s been written by knowledgeable writers and not just DIY geeks.
– Amazon Customer
Sebastian Raschka created an amazing machine learning tutorial which combines theory with practice. The book explains machine learning from a theoretical perspective and has tons of coded examples to show how you would actually use the machine learning technique. It can be read by a beginner or advanced programmer.
If you need help to decide whether this book is for you, check out some of the «longer» reviews linked below. (If you wrote a review, please let me know, and I’d be happy to add it to the list).
- ebook and paperback at Amazon.com, Amazon.co.uk, Amazon.de
- ebook and paperback from Packt (the publisher)
- at other book stores: Google Books, O’Reilly, Safari, Barnes & Noble, Apple iBooks, .
- social platforms: Goodreads
- Italian translation via «Apogeo»
- German translation via «mitp Verlag»
- Japanese translation via «Impress Top Gear»
- Chinese translation (traditional Chinese)
- Chinese translation (simple Chinese)
- Korean translation via «Kyobo»
- Polish translation via «Helion»
Bonus Notebooks (not in the book)
- Logistic Regression Implementation [dir] [ipynb] [nbviewer]
- A Basic Pipeline and Grid Search Setup [dir] [ipynb] [nbviewer]
- An Extended Nested Cross-Validation Example [dir] [ipynb] [nbviewer]
- A Simple Barebones Flask Webapp Template [view directory][download as zip-file]
- Reading handwritten digits from MNIST into NumPy arrays [GitHub ipynb] [nbviewer]
- Scikit-learn Model Persistence using JSON [GitHub ipynb] [nbviewer]
- Multinomial logistic regression / softmax regression [GitHub ipynb] [nbviewer]
«Related Content» (not in the book)
We had such a great time at SciPy 2016 in Austin! It was a real pleasure to meet and chat with so many readers of my book. Thanks so much for all the nice words and feedback! And in case you missed it, Andreas Mueller and I gave an Introduction to Machine Learning with Scikit-learn; if you are interested, the video recordings of Part I and Part II are now online!
I attempted the rather challenging task of introducing scikit-learn & machine learning in just 90 minutes at PyData Chicago 2016. The slides and tutorial material are available at «Learning scikit-learn — An Introduction to Machine Learning in Python.»
I have set up a separate library, mlxtend , containing additional implementations of machine learning (and general «data science») algorithms. I also added implementations from this book (for example, the decision region plot, the artificial neural network, and sequential feature selection algorithms) with additional functionality.
Dear readers,
first of all, I want to thank all of you for the great support! I am really happy about all the great feedback you sent me so far, and I am glad that the book has been so useful to a broad audience.
Over the last couple of months, I received hundreds of emails, and I tried to answer as many as possible in the available time I have. To make them useful to other readers as well, I collected many of my answers in the FAQ section (below).
In addition, some of you asked me about a platform for readers to discuss the contents of the book. I hope that this would provide an opportunity for you to discuss and share your knowledge with other readers:
(And I will try my best to answer questions myself if time allows! :))
The only thing to do with good advice is to pass it on. It is never of any use to oneself.
— Oscar Wilde
Examples and Applications by Readers
Once again, I have to say (big!) THANKS for all the nice feedback about the book. I’ve received many emails from readers, who put the concepts and examples from this book out into the real world and make good use of them in their projects. In this section, I am starting to gather some of these great applications, and I’d be more than happy to add your project to this list — just shoot me a quick mail!
Questions about the Machine Learning Field
- How are Artificial Intelligence and Machine Learning related?
- What are some real-world examples of applications of machine learning in the field?
- What are the different fields of study in data mining?
- What are differences in research nature between the two fields: machine learning & data mining?
- How do I know if the problem is solvable through machine learning?
- What are the origins of machine learning?
- How was classification, as a learning machine, developed?
- Which machine learning algorithms can be considered as among the best?
- What are the broad categories of classifiers?
- What is the difference between a classifier and a model?
- What is the difference between a parametric learning algorithm and a nonparametric learning algorithm?
- What is the difference between a cost function and a loss function in machine learning?
Questions about ML Concepts and Statistics
Cost Functions and Optimization
Neural Networks and Deep Learning
- What is the difference between deep learning and usual machine learning?
- Can you give a visual explanation for the back propagation algorithm for neural networks?
- Why did it take so long for deep networks to be invented?
- What are some good books/papers for learning deep learning?
- Why are there so many deep learning libraries?
- Why do some people hate neural networks/deep learning?
- How can I know if Deep Learning works better for a specific problem than SVM or random forest?
- What is wrong when my neural network’s error increases?
- How do I debug an artificial neural network algorithm?
- What is the difference between a Perceptron, Adaline, and neural network model?
- What is the basic idea behind the dropout technique?
Other Algorithms for Supervised Learning
Preprocessing, Feature Selection and Extraction
Programming Languages and Libraries for Data Science and Machine Learning
I am happy to answer questions! Just write me an email or consider asking the question on the Google Groups Email List.
If you are interested in keeping in touch, I have quite a lively twitter stream (@rasbt) all about data science and machine learning. I also maintain a blog where I post all of the things I am particularly excited about.
About
The «Python Machine Learning (1st edition)» book code repository and info resource