First Edition coverSecond edition cover
This webpage contains the code and other supporting material for the textbook "Machine Learning: An Algorithmic Perspective" by Stephen Marsland, published by CRC Press, part of the Taylor and Francis group. The first edition was published in 2009, and a revised and updated second edition is due out towards the end of 2014.

The book is aimed at computer science and engineering undergraduates studing machine learning and artificial intelligence.

The table of contents for the second edition can be found here.

There are lots of Python/NumPy code examples in the book, and the code is available here. Datasets (either the actual data, or links to the appropriate resources) are given at the bottom of the page.

Note that the chapter headings and order below refer to the second edition. However, the titles of the chapters should enable users of the first edition to find the relevant sections.

All of the code is freely available to use (with appropriate attribution), but comes with no warranty of any kind.

Option 1: Zip file of all code, arranged into chapters
Option 2: Choose what you want from here:


Many of the datasets used in the book are available from the UCI Machine Learning Repository. In particular, look for the Iris data, the Pima Indian data, the car safety data, the auto-mpg data, the wine data, and the mushroom data.

Two of the most popular machine learning demonstration datasets are the MNIST set of zip code digits, which is available here, and the binary alpha digits dataset, which can be downloaded here. Finally, there are a couple of smaller datasets that are not available elsewhere, at least in their current form, and so should be downloaded from this website: