In your hiding, you're alone. Kept your treasures with my bones.crawl somewhere bettermore quotes

# circles: beautiful

In Silico Flurries: Computing a world of snow. Scientific American. 23 December 2017

# visualization + design

The 2017 Pi Day art imagines the digits of Pi as a star catalogue with constellations of extinct animals and plants. The work is featured in the article Pi in the Sky at the Scientific American SA Visual blog.

# $\pi$ Approximation Day Art Posters

2017 $\pi$ day
2016 $\pi$ approximation day
2016 $\pi$ day
2015 $\pi$ day
2014 $\pi$ approx day
2014 $\pi$ day
2013 $\pi$ day
Circular $\pi$ art

The never-repeating digits of $\pi$ can be approximated by $22/7 = 3.142857$ to within 0.04%. These pages artistically and mathematically explore rational approximations to $\pi$. This 22/7 ratio is celebrated each year on July 22nd. If you like hand waving or back-of-envelope mathematics, this day is for you: $\pi$ approximation day!

Want more math + art? Discover the Accidental Similarity Number. Find humor in my poster of the first 2,000 4s of $\pi$.

There are two kinds of $\pi$ Approximation Day posters.

The first uses the Archimedean spiral for its design, which I've used before for other numerical art. The second packs warped circles, whose ratio of circumference to average diameter is $22/7$ into what I call $\pi$-approximate circular packing.

As you probably know, the ratio of the circumference of a circle to its diameter is $\pi$. $$C / d = \pi$$

For $\pi$ approximation day, let's ask what would happen if $$C / d = 22/7$$

where now $C$ is the circumference of some shape other than a circle. What could this shape be?

A good place to start is to think about an ellipse. I've done this before in the 22/7 Universe article, in which I considered an ellipse with a major axis of $r+\delta$ and a minor axis of $r$ and solved for $\delta$ such that the circumference of the ellipse divided by $2 r$ would be $22/7$. Doing so means numerically solving the equation $$\frac{C(r,r+\delta)}{2r} = 22/7$$

where $r + \delta$ is the major axis, $r$ is the minor axis and $C(r,r+\delta)$ is the circumference of the ellipse. Substituting the expression for the circumference, $$4(r+\delta) \int_0^{\pi/2} \sqrt { 1 - \left(1-\frac{r}{(r+\delta)^2}\right)\sin^2 \theta } d \theta = 2 r \frac{22}{7}$$

If we set $r=1$ and solve it turns out that only a very minor deformation is required and $\delta = 0.0008$. You can verify this at Wolfram Alpha.

I wanted to make some art based on the shape of the this ellipse, but a deformation of 0.08% is not perceptible. So I came up with a slightly different approach to how I define the original circumference-to-diameter ratio.

Instead of treating the diameter as $r$ and using $r + \delta$ as the major axis, I now define the diameter as twice the average radius, or $2r + \delta$. This means that the equation to solve is $$\frac{C(r,r+\delta)}{2r+\delta} = 22/7$$

As before, setting $r=1$ and substituting the expression for the circumference of an ellipse, we get $$4(1+\delta) \int_0^{\pi/2} \sqrt { 1 - \left(1-\frac{1}{(1+\delta)^2}\right)\sin^2 \theta } d \theta = (2+\delta) \frac{22}{7}$$

and solving this for $\delta$ find $$\delta = 0.083599769...$$

You can verify this at Wolfram Alpha.

This is a more useable approach since an 8% warping of a circle can be easily perceived.

The ratio of the circumference of a circle, $C(r)$, to its dimameter, $2r$, is $\pi$. If we warp the circle by 8%, the corresponding ratio, if we use twice the average radius as the diameter, is 22/7. This deformation can be easily identified.

Below is matrix of perfect circles along side the 8% deformed circles.

A matrix of perfect circles and ones which have been stretched by 8% along one axis and then randomly rotated. The deformed circles embody the $\pi$ approximation of 22/7.

The art posters are based on a packing of these deformed circles.

Warped circles, packed.
Even more warped circles, packed.

By superimposing perfect circles on the warped circles, fun patterns appear.

Superposition of perfect and warped circles, packed.

## perfect vs approximate packing

If you pack perfect circles perfectly, the area occupied by the circles is $\pi/4 = 78.5%$.

What is the area occupied by perfect packing of warped and randomly rotated (like in the posters) circles?

## color scheme

To motivate choice of colors, I chose images with a 1970's feel.

Images used for color schemes. The colors of each image were grouped into clusters—8 for the first two images and 6 for the third—to obtain proportions of representative colors.

Using my color summarizer, I analyzed each image for its representative colors. Using these colors and their proportions, I colored the perfect and warped circles.

Packed warped circles colored in proportion to color schemes derived from the images above.

For each poster of these color schemes, two poster versions are available. In one, the perfect cirlces are shown with warped circles as a clip mask. In the other, warped circles are shown, clipped by perfect circles.

VIEW ALL

# Machine learning: supervised methods (SVM & kNN)

Thu 18-01-2018
Supervised learning algorithms extract general principles from observed examples guided by a specific prediction objective.

We examine two very common supervised machine learning methods: linear support vector machines (SVM) and k-nearest neighbors (kNN).

SVM is often less computationally demanding than kNN and is easier to interpret, but it can identify only a limited set of patterns. On the other hand, kNN can find very complex patterns, but its output is more challenging to interpret.

Nature Methods Points of Significance column: Machine learning: supervised methods (SVM & kNN). (read)

We illustrate SVM using a data set in which points fall into two categories, which are separated in SVM by a straight line "margin". SVM can be tuned using a parameter that influences the width and location of the margin, permitting points to fall within the margin or on the wrong side of the margin. We then show how kNN relaxes explicit boundary definitions, such as the straight line in SVM, and how kNN too can be tuned to create more robust classification.

Bzdok, D., Krzywinski, M. & Altman, N. (2018) Points of Significance: Machine learning: a primer. Nature Methods 15:5–6.

### Background reading

Bzdok, D., Krzywinski, M. & Altman, N. (2017) Points of Significance: Machine learning: a primer. Nature Methods 14:1119–1120.

# Human Versus Machine

Tue 16-01-2018
Balancing subjective design with objective optimization.

In a Nature graphics blog article, I present my process behind designing the stark black-and-white Nature 10 cover.

Nature 10, 18 December 2017

# Machine learning: a primer

Thu 18-01-2018
Machine learning extracts patterns from data without explicit instructions.

In this primer, we focus on essential ML principles— a modeling strategy to let the data speak for themselves, to the extent possible.

The benefits of ML arise from its use of a large number of tuning parameters or weights, which control the algorithm’s complexity and are estimated from the data using numerical optimization. Often ML algorithms are motivated by heuristics such as models of interacting neurons or natural evolution—even if the underlying mechanism of the biological system being studied is substantially different. The utility of ML algorithms is typically assessed empirically by how well extracted patterns generalize to new observations.

Nature Methods Points of Significance column: Machine learning: a primer. (read)

We present a data scenario in which we fit to a model with 5 predictors using polynomials and show what to expect from ML when noise and sample size vary. We also demonstrate the consequences of excluding an important predictor or including a spurious one.

Bzdok, D., Krzywinski, M. & Altman, N. (2017) Points of Significance: Machine learning: a primer. Nature Methods 14:1119–1120.

# Snowflake simulation

Tue 16-01-2018
Symmetric, beautiful and unique.

Just in time for the season, I've simulated a snow-pile of snowflakes based on the Gravner-Griffeath model.

A few of the beautiful snowflakes generated by the Gravner-Griffeath model. (explore)

The work is described as a wintertime tale in In Silico Flurries: Computing a world of snow and co-authored with Jake Lever in the Scientific American SA Blog.

Gravner, J. & Griffeath, D. (2007) Modeling Snow Crystal Growth II: A mesoscopic lattice map with plausible dynamics.

# Genes that make us sick

Wed 22-11-2017
Where disease hides in the genome.

My illustration of the location of genes in the human genome that are implicated in disease appears in The Objects that Power the Global Economy, a book by Quartz.

The location of genes implicated in disease in the human genome, shown here as a spiral. (more...)

# Ensemble methods: Bagging and random forests

Wed 22-11-2017
Many heads are better than one.

We introduce two common ensemble methods: bagging and random forests. Both of these methods repeat a statistical analysis on a bootstrap sample to improve the accuracy of the predictor. Our column shows these methods as applied to Classification and Regression Trees.

Nature Methods Points of Significance column: Ensemble methods: Bagging and random forests. (read)

For example, we can sample the space of values more finely when using bagging with regression trees because each sample has potentially different boundaries at which the tree splits.

Random forests generate a large number of trees by not only generating bootstrap samples but also randomly choosing which predictor variables are considered at each split in the tree.

Krzywinski, M. & Altman, N. (2017) Points of Significance: Ensemble methods: bagging and random forests. Nature Methods 14:933–934.

### Background reading

Krzywinski, M. & Altman, N. (2017) Points of Significance: Classification and regression trees. Nature Methods 14:757–758.