Decorators (identified by @ in line above function definition) allow code to be run before and after the function (hence ‘decorating’ it). An example of use of a decorator is shown below when a decorator function is used to time two different functions. This removes the need for duplicating code in different functions, and also keeps the functions focussed on their primary objective. Continue reading “84. Function decorators”

# Author: Michael Allen

# Zipped files for jupyter notebook, pdf, and py files

# 83. Automatically passing unpacked lists or tuples to a function (or why do you see * before lists and tuples)

This post is also available as a PDF, a Jupyter Notebook, and a py file. Continue reading “83. Automatically passing unpacked lists or tuples to a function (or why do you see * before lists and tuples)”

# 82. The travelling community nurse problem (aka the Travelling Salesman Problem)

This post is also available as a pdf, a Jupyter Notebook, and a py file. Continue reading “82. The travelling community nurse problem (aka the Travelling Salesman Problem)”

# 81. Distribution fitting to data

This post is also available as a PDF, a Jupyter Notebook and a py file.

# 80. Grouping unlabelled data with k-means clustering

This post is also available as a PDF, a Jupyter Notebook and as a py file.¶ Continue reading “80. Grouping unlabelled data with k-means clustering”

# 79. Reducing data complexity, and eliminating covariance, with principal component analysis

This post is available as a PDF, a Jupyter Notebook and a as Py file.

Principal component analysis (PCA) may be used for two purposes: Continue reading “79. Reducing data complexity, and eliminating covariance, with principal component analysis”