And whatever I do will become forever what I've done.don't rehearsemore quotes

making poetry out of spam is fun

EMBO Practical Course: Bioinformatics and Genome Analysis, 5–17 June 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

Classification and regression trees

Fri 28-07-2017
Decision trees are a powerful but simple prediction method.

Decision trees classify data by splitting it along the predictor axes into partitions with homogeneous values of the dependent variable. Unlike logistic or linear regression, CART does not develop a prediction equation. Instead, data are predicted by a series of binary decisions based on the boundaries of the splits. Decision trees are very effective and the resulting rules are readily interpreted.

Trees can be built using different metrics that measure how well the splits divide up the data classes: Gini index, entropy or misclassification error.

Nature Methods Points of Significance column: Classification and decision trees. (read)

When the predictor variable is quantitative and not categorical, regression trees are used. Here, the data are still split but now the predictor variable is estimated by the average within the split boundaries. Tree growth can be controlled using the complexity parameter, a measure of the relative improvement of each new split.

Individual trees can be very sensitive to minor changes in the data and even better prediction can be achieved by exploiting this variability. Using ensemble methods, we can grow multiple trees from the same data.

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

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Logistic regression. Nature Methods 13:541-542.

Altman, N. & Krzywinski, M. (2015) Points of Significance: Multiple Linear Regression Nature Methods 12:1103-1104.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Classifier evaluation. Nature Methods 13:603-604.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Model Selection and Overfitting. Nature Methods 13:703-704.

Lever, J., Krzywinski, M. & Altman, N. (2016) Points of Significance: Regularization. Nature Methods 13:803-804.

Personal Oncogenomics Program 5 Year Anniversary Art

Wed 26-07-2017

The artwork was created in collaboration with my colleagues at the Genome Sciences Center to celebrate the 5 year anniversary of the Personalized Oncogenomics Program (POG).

5 Years of Personalized Oncogenomics Program at Canada's Michael Smith Genome Sciences Centre. The poster shows 545 cancer cases. (left) Cases ordered chronologically by case number. (right) Cases grouped by diagnosis (tissue type) and then by similarity within group.

The Personal Oncogenomics Program (POG) is a collaborative research study including many BC Cancer Agency oncologists, pathologists and other clinicians along with Canada's Michael Smith Genome Sciences Centre with support from BC Cancer Foundation.

The aim of the program is to sequence, analyze and compare the genome of each patient's cancer—the entire DNA and RNA inside tumor cells— in order to understand what is enabling it to identify less toxic and more effective treatment options.

Principal component analysis

Thu 06-07-2017
PCA helps you interpret your data, but it will not always find the important patterns.

Principal component analysis (PCA) simplifies the complexity in high-dimensional data by reducing its number of dimensions.

Nature Methods Points of Significance column: Principal component analysis. (read)

To retain trend and patterns in the reduced representation, PCA finds linear combinations of canonical dimensions that maximize the variance of the projection of the data.

PCA is helpful in visualizing high-dimensional data and scatter plots based on 2-dimensional PCA can reveal clusters.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Principal component analysis. Nature Methods 14:641–642.

Altman, N. & Krzywinski, M. (2017) Points of Significance: Clustering. Nature Methods 14:545–546.

$k$ index: a weightlighting and Crossfit performance measure

Wed 07-06-2017

Similar to the $h$ index in publishing, the $k$ index is a measure of fitness performance.

To achieve a $k$ index for a movement you must perform $k$ unbroken reps at $k$% 1RM.

The expected value for the $k$ index is probably somewhere in the range of $k = 26$ to $k=35$, with higher values progressively more difficult to achieve.

In my $k$ index introduction article I provide detailed explanation, rep scheme table and WOD example.

Dark Matter of the English Language—the unwords

Wed 07-06-2017

I've applied the char-rnn recurrent neural network to generate new words, names of drugs and countries.

The effect is intriguing and facetious—yes, those are real words.

But these are not: necronology, abobionalism, gabdologist, and nonerify.

These places only exist in the mind: Conchar and Pobacia, Hzuuland, New Kain, Rabibus and Megee Islands, Sentip and Sitina, Sinistan and Urzenia.

And these are the imaginary afflictions of the imagination: ictophobia, myconomascophobia, and talmatomania.

And these, of the body: ophalosis, icabulosis, mediatopathy and bellotalgia.

Want to name your baby? Or someone else's baby? Try Ginavietta Xilly Anganelel or Ferandulde Hommanloco Kictortick.

When taking new therapeutics, never mix salivac and labromine. And don't forget that abadarone is best taken on an empty stomach.

And nothing increases the chance of getting that grant funded than proposing the study of a new –ome! We really need someone to looking into the femome and manome.

Dark Matter of the Genome—the nullomers

Wed 31-05-2017

An exploration of things that are missing in the human genome. The nullomers.

Julia Herold, Stefan Kurtz and Robert Giegerich. Efficient computation of absent words in genomic sequences. BMC Bioinformatics (2008) 9:167