Published by Packt, Hands-on Supervised Machine Learning with Python
 
 
Go to file
tgsmith61591 fd19565378 Bump patch version 2019-05-15 06:40:38 -05:00
build_tools Add after_success script for coverage upload 2018-05-31 16:05:29 -05:00
examples Update comments and KNN example 2018-07-19 11:48:06 -05:00
img Update to work with new versions of scipy and scikit 2019-05-10 07:32:44 -05:00
packtml Bump patch version 2019-05-15 06:40:38 -05:00
.coveragerc Initial commit to fork 2018-05-31 15:45:00 -05:00
.gitignore Initial commit to fork 2018-05-31 15:45:00 -05:00
.travis.yml Add after_success script for coverage upload 2018-05-31 16:05:29 -05:00
LICENSE Initial commit 2018-05-31 14:26:33 +05:30
MANIFEST.in Initial commit to fork 2018-05-31 15:45:00 -05:00
README.md [ci skip][DOC] 📚 Remove old tag from README 2018-05-31 16:51:58 -05:00
appveyor.yml [CI] 🐛 Appveyor bug on Miniconda 3.6? 2018-05-31 16:54:27 -05:00
curriculum.docx Update typo in curriculum 2018-06-14 12:25:07 -05:00
environment.yml Initial commit to fork 2018-05-31 15:45:00 -05:00
requirements.txt Update to work with new versions of scipy and scikit 2019-05-10 07:32:44 -05:00
setup.py Force python version >= 3.5 2018-05-31 15:51:02 -05:00

README.md

Build Status Build status codecov Supported versions

Hands-on-Supervised-Machine-Learning-with-Python

Published by Packt, Hands-on Supervised Machine Learning with Python

Learn the underpinning os many supervised learning algorithms, and develop rich python coding practices in the process.

Supervised learning—help teach a machine to think for itself!

Overview

These days machine learning is everywhere, and its here to stay. Understanding the core principles that drive how a machine “learns” is a critical skill for any would-be practitioner or consumer alike. This course will introduce you to supervised machine learning, guiding you through the implementation and nuances of many popular machine learning algorithms while facilitating a deep understanding along the way.

In this course, well cover parametric models such as linear and logistic regression, non-parametric methods such as decision trees & various clustering techniques, and well wrap up with a brief foray into neural networks.

This video course highlights clean coding techniques, object-oriented class design, and general best practices in machine learning

Target audience

This course is designed for those who would like to understand supervised machine learning algorithms at a deeper level. If youre interested in understanding how and why an algorithm works rather than simply how to call its API, this course might be for you. Intermediate Python knowledge and at least an intermediate understanding of mathematical concepts is assumed. While notions in this course will be broken down into bits as granular as absolutely possible, terms and ideas such as “matrix transposition,” “gradient,” “dot product,” and “time complexity” are assumed to be understood without further explanation.

What you will learn

  • Understand the fundamental and theoretical differences between parametric and non-parametric models, and why you might opt for one over the other.
  • Discover how a machine can learn a concept and generalize its understanding to new data
  • Implement and grok several well-known supervised learning algorithms from scratch; build out your github portfolio and show off what youre capable of!
  • Learn about model families like recommender systems, which are immediately applicable in domains such as ecommerce and marketing.
  • Become a much stronger python developer

Project layout

All source code is within the packtml folder, which serves as the python package for this course. Within the examples directory, youll find a number of short Python scripts that serve to demonstrate how various classes in the packtml submodules work. Each respective folder inside the examples/ directory corresponds to a submodule inside of the packtml python package.

Getting started

To get your environment set up, make sure you have Anaconda installed and on your path. Then simply run the following:

To activate your environment in a Unix environment:

In a Windows environment:

activate packt-sml

Set up the python package (in your activated environment):

What youll learn

In this course and within this package, youll learn to implement a number of commonly-used supervised learning algorithms, and when best to use one type of model over another. Below youll find in-action examples of the various algorithms we implement within this package.

Regression

The classic introduction to machine learning, not only will we learn about linear regression, well code one from scratch so you really understand whats happening under the hood. Then well apply one in practice so you can see how you might use it.

KNN

Next, well dive into logistic regression, which is linear regressions classification cousin. See the full logistic regression example here or the algorithms source code if youre interested.

KNN

KNN clustering

During our exploration of non-parametric models, well explore clustering. The packtml package implements a simple, but effective k-Nearest Neighbor classifier. Here is its output on the iris dataset. For the full code example, head to the examples directory and then to the source code to see how its implemented.

KNN

Decision trees

In this course, well also implement a CART decision tree from scratch (for both regression and classification). Our classification trees performance and potential is shown at varying tree depths in the images below. The classification tree example is located here, and the source code can be found here.

CART clf

In addition to classification, we can build a tree as a non-linear regression model, as shown below. The regression tree example is located here. Check out the source code to understand how it works.

CART reg

Deep learning

One of the hottest topics of machine learning right now is deep learning and neural networks. In this course, well learn how to code a multi-layer perceptron classifier from scratch. The full example code is located here and this is the source code.

MLP

Next, well show how we can use the weights the MLP has learned on previous data to learn new classification labels via transfer learning. For further implementation details, check out the example code or the source code.

MLP transfer

Recommendation algorithms

These days, everything is available for purchase online. E-commerce sites have devoted lots of research to algorithms that can learn your preferences. In this course, well learn two such algorithms:

The example ALS code shows how train error decreases by iteration:

ALS