Here, I help you understand color blindness and describe a process by which you can make good color choices when designing for accessibility.
The opposite of color blindness is seeing all the colors and I can help you find 1,000 (or more) maximally distinct colors.
You can also delve into the mathematics behind the color blindness simulations and learn about copunctal points (the invisible color!) and lines of confusion.
The transformations described here will allow you to simulate color blindness and apply conversions of the kind shown in the images below to your own work.
The conversion from RGB values to their color blindness equivalents for protanopia, deuteranopia and tritanopia consists of the following steps
The greyscale conversion for achromatopsia does not require the XYZ and LMS steps. We can go straight to `Y`.
The details of each of the steps are shown below. If you just want the `\mathbf{T}` matrices, scroll down to the bottom or download the code.
Depending on the implementation, this process may have an additional step that reduces the color domain (e.g. step 2 in Viénot, Brettel & Mollon, 1999). This makes sure that none of the transformed colors are outside of the sRGB domain. Here, I instead of doing this I just clip the transformed colors at the end. This simplifies the process and (my sense is that) the difference is negligible.
Different simulators will yield slightly different results, too.
The RGB input color is `\{R,G,B\} = \{ V \in [0,255] \}` and assumed to be sRGB. This is first linearized with `\gamma = 2.4` to obtain `\{r,g,b\} = \{ v \in [0,1] \}`. $$v = \begin{cases} \dfrac{V/255}{12.92} & \text{if $V/255 \le 0.04045$} \\[2ex] \left({\dfrac{V/255+0.055}{1.055}}\right)^\gamma & \text{otherwise} \end{cases} $$
Next, convert the linearized `(r,g,b)` to XYZ by multiplying by `\mathbf{M}_\textrm{XYZ}`. $$ \left[ \begin{matrix} X \\Y \\Z \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 0.4124564 & 0.3575761 & 0.1804375 \\0.2126729 & 0.7151522 & 0.0721750 \\0.0193339 & 0.1191920 & 0.9503041 \end{matrix} \right] }_{\mathbf{M}_\textrm{XYZ}} \left[ \begin{matrix} r \\g \\b \end{matrix} \right] $$
Multiply by `\mathbf{M}_\textrm{LMSD65}` to convert XYZ to LMS. This matrix is normalized to the D65 illuminant, which will ensure that greys will be preserved.
The LMS (long, medium, short) is a color space which represents the response of the three types of cones of the human eye, named for their sensitivity peaks at long (560 nm, red) medium (530 nm, green), and short (420 nm, blue) wavelengths. $$ \left[ \begin{matrix} L \\ M \\ S \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 0.4002 & 0.7076 & -0.0808 \\ -0.2263 & 1.1653 & 0.0457 \\ 0 & 0 & 0.9182 \end{matrix} \right] }_{\mathbf{M}_\textrm{LMSD65}} \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] $$
If for some reason you don't want to normalize to D65, you would use `\mathbf{M}_\textrm{LMS}` below but whites will now appear pinkish. $$ \left[ \begin{matrix} L \\ M \\ S \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 0.38971 & 0.68898 & -0.07868 \\ -0.22981 & 1.18340 & 0.04641 \\ 0 & 0 & 1 \end{matrix} \right] }_{\mathbf{M}_\textrm{LMS}} \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] $$
There are other XYZ to LMS matrices and the R code lists them all. Below this section, I show the dichromacy transformations for each of these XYZ-LMS matrices.
Now that we have the RGB color represented in LMS space, we can correct for color receptor dysfunction in this space, since color blindness affects one of the L, M or S receptors.
I show the calculations here in a lot of detail—they're not as complicated as things look. Once you understand what's happening for one of the color blindness types, the other two are analogously treated.
Each of the color blindness types will have its own correction matrix `\mathbf{S}`. $$ \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] = \mathbf{S} \left[ \begin{matrix} L \\ M \\ S \\ \end{matrix} \right] $$
This matrix is the identity matrix with the row for the malfunctioning receptor (e.g. S for protanopia) replaced by two free parameters `a` and `b`. $$ \begin{align} \mathbf{S}_\textrm{protanopia} & = \left[ \begin{matrix} 0 & a & b \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix} \right] \\ \mathbf{S}_\textrm{deuteranopia} & = \left[ \begin{matrix} 1 & 0 & 0 \\ a & 0 & b \\ 0 & 0 & 1 \end{matrix} \right] \\ \mathbf{S}_\textrm{tritanopia} & = \left[ \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ a & b & 0 \end{matrix} \right] \end{align} $$
The reason why these matrices have this format is so that we can satisfy two conditions. First, we expect that one of the `rgb` primaries won't be affected, depending on the color blindness type. For protanopia and deuteranopia this is blue and for tritanopia this is red. Second, this matrix should not affect how white appears—if one of the rows was just zero then white would be altered.
If we set `\mathbf{M} = \mathbf{M}_\textrm{LMSD65} \mathbf{M}_\textrm{XYZ}` then these conditions (using the blue case for protanopia) can be expressed as $$ \mathbf{S}_\textrm{protanopia} \mathbf{M} \left[ \begin{matrix} 0 \\ 0 \\ 1 \end{matrix} \right] = \mathbf{M} \left[ \begin{matrix} 0 \\ 0 \\ 1 \end{matrix} \right] = \left[ \begin{matrix} L_b \\ M_b \\ S_b \end{matrix} \right] $$ $$ \mathbf{S}_\textrm{protanopia} \mathbf{M} \left[ \begin{matrix} 1 \\ 1 \\ 1 \end{matrix} \right] = \mathbf{M} \left[ \begin{matrix} 1 \\ 1 \\ 1 \end{matrix} \right] = \left[ \begin{matrix} L_0 \\ M_0 \\ S_0 \end{matrix} \right] $$
where `(L_b,M_b,S_b)` of the primary that is not affected (e.g. blue) and `(L_0,M_0,S_0)` are the LMS coordinates of white. These two coordinates are eigenvectors of `\mathbf{S}_\textrm{protanopia}` with an eigenvalue of `\lambda=1`. Using the form for `\mathbf{S}_\textrm{protanopia}`, these lead to the following equations $$ \begin{align} a M_b + b S_b & = L_b \\a M_0 + b S_0 & = L_0 \end{align} $$
which can be written as $$ \left[ \begin{matrix} a \\b \end{matrix} \right]_\textrm{protanopia} = { \left[ \begin{matrix} M_b & S_b \\M_0 & S_0 \end{matrix} \right] }^{-1} \left[ \begin{matrix} L_b \\L_0 \end{matrix} \right] $$
For deuteranopia and tritanopia the calculation of `a` and `b` is analogous, except that because now `a` and `b` change position in `\mathbf{S}`, the equations are slightly different. $$ \left[ \begin{matrix} a \\b \end{matrix} \right]_\textrm{deuteranopia} = { \left[ \begin{matrix} L_b & S_b \\L_0 & S_0 \end{matrix} \right] }^{-1} \left[ \begin{matrix} M_b \\M_0 \end{matrix} \right] $$
and for tritanopia (here `(L_r,M_r,S_r)` refers to the coordinates of red). $$ \left[ \begin{matrix} a \\b \end{matrix} \right]_\textrm{tritanopia} = { \left[ \begin{matrix} L_r & M_r \\L_0 & M_0 \end{matrix} \right] }^{-1} \left[ \begin{matrix} S_r \\S_0 \end{matrix} \right] $$
Using the following LMS coordinates (calculated by linearizing the corresponding RGB values and then muptiplying by `\mathbf{M}`) $$ \begin{align} \left[ \begin{matrix} L_0 \\ M_0 \\ S_0 \end{matrix} \right] & = \left[ \begin{matrix} 1 \\ 0.999683 \\ 0.9997637 \end{matrix} \right] \\ \left[ \begin{matrix} L_b \\ M_b \\ S_b \end{matrix} \right] & = \left[ \begin{matrix} 0.04649755 \\ 0.08670142 \\ 0.87256922 \end{matrix} \right] \\ \left[ \begin{matrix} L_r \\ M_r \\ S_r \end{matrix} \right] & = \left[ \begin{matrix} 0.31399022 \\ 0.15537241 \\ 0.01775239 \end{matrix} \right] \end{align} $$
Using protanopia as the example $$ \begin{align} \left[ \begin{matrix} a \\b \end{matrix} \right]_\textrm{protanopia} & = { \left[ \begin{matrix} 0.08670142 & 0.87256922 \\0.999683 & 0.9997637 \end{matrix} \right] }^{-1} \left[ \begin{matrix} 0.04649755 \\1 \end{matrix} \right] \\ & = \left[ \begin{matrix} -1.27219 & 1.1103359 \\1.27245 & -0.1103267 \end{matrix} \right] \left[ \begin{matrix} 0.04649755 \\1 \end{matrix} \right] \\ & = \left[ \begin{matrix} 1.05118294 \\-0.05116099 \end{matrix} \right] \end{align} $$
The `(a,b)` calculations for deuteranopia and tritanopia are analogous and once they're done we can write the correction matrices as $$ \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 0 & 1.05118294 & -0.05116099 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix} \right] }_{\mathbf{S}_\textrm{protanopia}} \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] $$ $$ \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 1 & 0 & 0 \\ 0.9513092 & 0 & 0.04866992 \\ 0 & 0 & 1 \end{matrix} \right] }_{\mathbf{S}_\textrm{deuteranopia}} \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] $$ $$ \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ -0.86744736 & 1.86727089 & 0 \end{matrix} \right] }_{\mathbf{S}_\textrm{tritanopia}} \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] $$
These `(a,b)` values are for the D65-normalized XYZ-to-LMS matrix and will change if you use a different matrix. The R code calculates `(a,b)` for whatever matrix you provide.
Once the color blindness correction has been applied in LMS space, we convert back to XYZ using the inverse `\mathbf{M}_\text{LMSD65}^{-1}`. $$ \left[ \begin{matrix} X' \\ Y' \\ Z' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 1.8600666 & -1.1294801 & 0.2198983 \\ 0.3612229 & 0.6388043 & 0 \\ 0 & 0 & 1.089087 \end{matrix} \right] }_{\mathbf{M}_\textrm{LMSD65}^{-1}} \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] $$
If you used `\mathbf{M}_\textrm{LMS}` and didn't normalize to D65, then you'd use its inverse `\mathbf{M}_\text{LMS}^{-1}` instead. $$ \left[ \begin{matrix} X' \\ Y' \\ Z' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 1.9101968 & -1.1121239 & 0.2019080 \\ 0.3709501 & 0.6290543 & 0 \\ 0 & 0 & 1 \end{matrix} \right] }_{\mathbf{M}_\textrm{LMS}^{-1}} \left[ \begin{matrix} L' \\ M' \\ S' \end{matrix} \right] $$
Finally, one last matrix multiplication from XYZ back to linear RGB using `\mathbf{M}_\textrm{XYZ}^{-1}`. $$ \left[ \begin{matrix} r' \\ g' \\ b' \end{matrix} \right] = \underbrace{ \left[ \begin{matrix} 3.24045484 & -1.5371389 & -0.49853155 \\ -0.96926639 & 1.8760109 & 0.04155608 \\ 0.05564342 & -0.2040259 & 1.05722516 \end{matrix} \right] }_{\mathbf{M}_\textrm{XYZ}^{-1}} \left[ \begin{matrix} X' \\ Y' \\ Z' \end{matrix} \right] $$
The first step is now inverted to obtain the final sRGB values as perceived by someone with color blindness. $$V = \begin{cases} 255(12.92v) & \text{if $v \le 0.0031308$} \\[1ex] 255(1.055 v^{1/\gamma} - 0.055) & \text{otherwise} \end{cases} $$
Make sure to clip `v` to `[0,1]` before applying the final transformation back to sRGB.
The matrix multiplication steps can be written compactly as $$ \left[ \begin{matrix} r' \\ g' \\ b' \end{matrix} \right] = \mathbf{M}_\textrm{XYZ}^{-1} \mathbf{M}_\textrm{LMSD65}^{-1} \mathbf{S} \mathbf{M}_\textrm{LMSD65} \mathbf{M}_\textrm{XYZ} \left[ \begin{matrix} r \\ g \\ b \end{matrix} \right] = \mathbf{T} \left[ \begin{matrix} r \\ g \\ b \end{matrix} \right] $$
where `\mathbf{T}` is the product of all the matrices for a given color blindness correction `\mathbf{S}`, which are $$ \begin{align} \mathbf{T}_\textrm{protanopia} & = \left[ \begin{matrix} 0.170556992 & 0.829443014 & 0 \\ 0.170556991 & 0.829443008 & 0 \\ -0.004517144 & 0.004517144 & 1 \end{matrix} \right] \\ \mathbf{T}_\textrm{deuteranopia} & = \left[ \begin{matrix} 0.33066007 & 0.66933993 & 0 \\ 0.33066007 & 0.66933993 & 0 \\ -0.02785538 & 0.02785538 & 1 \end{matrix} \right] \\ \mathbf{T}_\textrm{tritanopia} & = \left[ \begin{matrix} 1 & 0.1273989 & -0.1273989 \\ 0 & 0.8739093 & 0.1260907 \\ 0 & 0.8739093 & 0.1260907 \end{matrix} \right] \\ \mathbf{T}_\textrm{achromatopsia} & = \left[ \begin{matrix} 0.2126 & 0.7152 & 0.0722 \\ 0.2126 & 0.7152 & 0.0722 \\ 0.2126 & 0.7152 & 0.0722 \end{matrix} \right] \end{align} $$
The matrices above use the LMSD65 XYZ-LMS conversion matrix.
Here I summarize all the `rgb` colorblindness tranformation matrices for each XYZ-LMS conversion matrix. The transformation for achromatopsia does not depend on how the XYZ-LMS conversion is done.
If colorblindness is partial (e.g. associated photoreceptors are present but either reduced in number of function), then the correction matrix is a linear combination of the total colorblindness correction matrix (e.g. `\mathbf{T}_\textrm{protanopia}`) and the identity matrix: `k\mathbf{T}_\textrm{protanopia}+(1-k)\mathbf{I}`, where `k=1` corresponds to total colorblindness and `k=0` is perfect color vision.
A line of confusion is the set of colors that appear identical to someone with colorblindness. Each kind of colorblindness has its own set of lines of confusion.
Lines of confusion can be nicely visualized in `xyY` color space, in which the chromaticity of a color is specified by `(x,y)` and the luminance by `Y`. This space is the projection of the `XYZ` color space onto the plane with the equation `X+Y+Z=`, which is the triangle made by the ends of the unit vectors in `XYZ` space (i.e. `[1,0,0],[0,1,0],[0,0,1]`).
The specific line of confusion that passes through the white point divides the space into two hues. For example, for protanopes and deuteranopes these hues are blue and yellow but the line that divides the CIE space into the hues is slightly different. The figures below also show the line between the two colorblind primaries — the two colors that are not altered by the colorblindness (read below).
The nature of the lines of confusion can be understood in terms of the colorblindness transformation matrices described above. Recall that to convert an `[X,Y,Z]` color to its colorblind equivalent `[X',Y',Z']` we use $$ \left[ \begin{matrix} X' \\ Y' \\ Z' \end{matrix} \right] = \mathbf{M}^{-1}_{\textrm{LMSD65}} \mathbf{S_{\textrm{p,d,t}}} \mathbf{M}_{\textrm{LMSD65}} \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] = \mathbf{T_{\textrm{p,d,t}}} \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] $$
where `\mathbf{M}` is the transformation from `XYZ` to `LMS` and `\mathbf{S}` is the projection matrix in `LMS` space for a given colorblindness type. Above, I write the product of these three matrices as `\mathbf{T}_{\textrm{p,d,t}}`, with the subscript indicating the type of colorblindness.
For example, for deuteranopia, we have $$ \left[ \begin{matrix} X' \\ Y' \\ Z' \end{matrix} \right] = \mathbf{T}_{\textrm{d}} \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] = \left[ \begin{matrix} 0.3143898 & 0.5558777 & 0.08796059 \\ 0.3877631 & 0.6856102 & -0.04974820 \\ 0 & 0 & 0 \end{matrix} \right] \left[ \begin{matrix} X \\ Y \\ Z \end{matrix} \right] $$
Consider the eigenvectors `\mathbf{v}_\textrm{d}` and their corresponding eigenvalues `\lambda_\textrm{d}` of this matrix. The eigenvectors are the solution to the equation `(\mathbf{T}_{\textrm{d}} - \lambda_\textrm{d}\mathbf{I} )\mathbf{v}_\textrm{b} = 0`, which answers the question "what vectors are projected onto a multiple (the eigenvalue) of themselves?". The eigenvectors for deuteranopia are $$ \mathbf{v}_{\textrm{d},\lambda=1} = \left[ \begin{matrix} -0.62978663 \\ -0.77676818 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{\textrm{d},\lambda=1} = \left[ \begin{matrix} 0.06766092 \\ -0.07398814 \\ 0.99496188 \end{matrix} \right] \qquad \mathbf{v}_{\textrm{d},\lambda=0} = \left[ \begin{matrix} -0.8704299 \\ 0.4922923 \\ 0 \end{matrix} \right] $$
The first two eigenvectors have a unit eigenvalue `\lambda=1` and thus are transformed to themselves under the colorblind transformation. These correspond to the unique points in `XYZ` space that are perceived (if they are within the range of perceived colors & mdash; see below) identically by those with colorblindness and with normal vision. They form a basis of the `XYZ` subspace (which is a plane) of transformed colors — and can be considered as primaries, since someone with colorblindness can only perceive colors created in this plane (i.e. by mixing the primaries). Any color that is not on this plane will appear the same as some color on this plane — this is where the third eigenvector comes in.
The third eigenvector has a zero eigenvalue `\lambda=0`. It is therefore transformed to zero (i.e. black in an additive color space like `XYZ`). Thus, adding a multiple of this eigenvector to any color `XYZ` will not affect its colorblind transform — adding any amount of "no light" to any light does not change the light. Any point `\mathbf{X}` on the plane mentioned above can be moved along the parameteric line `\mathbf{X} + t \mathbf{v}_{\textrm{d},\lambda=0}` without affecting its transform — the colors along this line are indistinguishable to someone with colorblindness. Every color `\mathbf{X}` has its own line, which is called the "line of confusion".
For a given type of colorblindness, the lines of confusion of all the colors all go through the same point. This point is called to copunctal and the position of these points for each of the three colorblindness types is shown below in `xyY` color space.
The copunctal point corresponds to the "invisible color" associated with the third eigenvector `\mathbf{v}_{\lambda=0}`. It can be thought of as the colorblind person's third primary color. For trichromats (individuals with normal color vision) there are three primaries. In sRGB space you can think of these as the corners of the triangle that is the sRGB gamut (which primaries you choose doesn't matter, as long as they're not collinear). The primary associated with the missing photoreceptor in dichromats is the copunctal point. We can mix this invisible primary with any other color and not affect how it appears under the colorblind transformation. For a more thorough explanation of this see the section "Köning's concept of the dichromatic copunctal points" in Dichromatic confusion lines and color vision models by G.A. Fry.
The concept of an invisible color is purely a mathematical construct that is helpful in the calculations. Just because it exists outside of the range of human perception (ouside of the CIE monochromatic horseshoe) does not mean it's necessarily theoretically impossible — in many cases, only practially impossible, such as the so-called impossible colors, which are really fun to think about. For example, if the LMS color receptors could be stimulated with an arbitrary ratio of `(L,M,S)` then who knows what would be perceived! For example, the scenario `(L,M,S) = (0,1,0)` is impossible because any wavelength that stimulates M stimulates either S or L. Such a color would have `(X,Y,Z) = (-1.13,0.64,0)` and `(x,y) = (2.3,-1.3)` might appear as "hyper-green" or "beyond-green" Recognize this coordinate? It's the deuteranopia copunctal point — the invisible color for someone who is missing L color receptors!
In `XYZ` space, the copunctal points for `\mathbf{M}_{\textrm{LMSD65}}` (the position of these points will depend on what `XYZ` to `LMS` conversion matrix is used) are $$ \mathbf{v}_{XYZ,\textrm{p},\lambda=0} = \left[ \begin{matrix} -0.9816605 \\ -0.1906374 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{XYZ,\textrm{d},\lambda=0} = \left[ \begin{matrix} -0.8704299 \\ 0.4922923 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{XYZ,\textrm{t},\lambda=0} = \left[ \begin{matrix} 0.1979166 \\ 0 \\ 0.9802189 \end{matrix} \right] $$
and in `xyY` space they are $$ \mathbf{v}_{xyY,\textrm{p},\lambda=0} = \left[ \begin{matrix} 0.8373814 \\ 0.1626186 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{xyY,\textrm{d},\lambda=0} = \left[ \begin{matrix} 2.301887 \\ -1.301887 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{xyY,\textrm{t},\lambda=0} = \left[ \begin{matrix} 0.1679923 \\ 0 \\ 0.8320132 \end{matrix} \right] $$
These eigenvectors can also be calculated directly by transforming the unit vectors in `LMS` space to `XYZ`, since they correspond to the "invisible color" (see discussion above) for each kind of colorblindness. $$ \mathbf{v}_{XYZ,\textrm{p},\lambda=0} = \mathbf{M}^{-1}_{\textrm{LMSD65}} \left[ \begin{matrix} 1 \\ 0 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{XYZ,\textrm{d},\lambda=0} = \mathbf{M}^{-1}_{\textrm{LMSD65}} \left[ \begin{matrix} 0 \\ 1 \\ 0 \end{matrix} \right] \qquad \mathbf{v}_{XYZ,\textrm{t},\lambda=0} = \mathbf{M}^{-1}_{\textrm{LMSD65}} \left[ \begin{matrix} 0 \\ 0 \\ 1 \end{matrix} \right] $$
The position of the copunctal point depends on which `XYZ` to `LMS` transformation matrix is used (LMSD65, SMSCAM97, LMSCAM02). These matrices represent an approximation of the transformation between `XYZ` and `LMS` spaces. The successor to CIECAM02 is CIECAM16.
Given an `(R,G,B)` color, to calculate the set of colors along the line of confusion for a given type of colorblindness proceeds as follows. First, linearize the color to `(r,g,b)` (see above) and add any multiple of the `LMS` invisible primary expressed in `rgb` and then convert from linear `rgb` to `RGB`.
For LMSD65, these `rgb` invisible primaries are $$ \mathbf{v}_\textrm{rgb,p} = \left[ \begin{matrix} 5.47221206 \\ -1.12524190 \\ 0.02980165 \end{matrix} \right] \qquad \mathbf{v}_\textrm{rgb,d} = \left[ \begin{matrix} -4.6419601 \\ 2.2931709 \\ -0.1931807 \end{matrix} \right] \qquad \mathbf{v}_\textrm{rgb,t} = \left[ \begin{matrix} 0.1696371 \\ -0.1678952 \\ 1.1636479 \end{matrix} \right] $$
and for CIECAM02 they are $$ \mathbf{v}_\textrm{rgb,p} = \left[ \begin{matrix} 2.8583111 \\ -0.2104348 \\ -0.0418895 \end{matrix} \right] \qquad \mathbf{v}_\textrm{rgb,d} = \left[ \begin{matrix} -1.6287080 \\ 1.1584149 \\ -0.1181543 \end{matrix} \right] \qquad \mathbf{v}_\textrm{rgb,t} = \left[ \begin{matrix} -0.0248186967 \\ 0.0003204633 \\ 1.0688865654 \end{matrix} \right] $$
For example, suppose you want to find all the colors equivalent to `RGB=(140,198,63)` in deuteranopia. First linearize to `rgb=(0.262,0.565,0.0497)`. Then add some multiple of `\mathbf{v}_\textrm{rgb,d}` to get the color `rgb+k\mathbf{v}_\textrm{rgb,d}` and discard any mix that has any negative components. For example, if we use LMSD65 and `k=-0.15` we get a mix `rgb=(0.959,0.221,0.079)` that converts to `RGB=(250,129,78)`. Both this and the original color appear as `RGB=(181,181,68)` to deuteranopes. If instead we used CIECAM02 then all the mixes would appear as `RGB=(177,177,71)`.
Nature uses only the longest threads to weave her patterns, so that each small piece of her fabric reveals the organization of the entire tapestry. – Richard Feynman
Following up on our Neural network primer column, this month we explore a different kind of network architecture: a convolutional network.
The convolutional network replaces the hidden layer of a fully connected network (FCN) with one or more filters (a kind of neuron that looks at the input within a narrow window).
Even through convolutional networks have far fewer neurons that an FCN, they can perform substantially better for certain kinds of problems, such as sequence motif detection.
Derry, A., Krzywinski, M & Altman, N. (2023) Points of significance: Convolutional neural networks. Nature Methods 20:.
Derry, A., Krzywinski, M. & Altman, N. (2023) Points of significance: Neural network primer. Nature Methods 20:165–167.
Lever, J., Krzywinski, M. & Altman, N. (2016) Points of significance: Logistic regression. Nature Methods 13:541–542.
Nature is often hidden, sometimes overcome, seldom extinguished. —Francis Bacon
In the first of a series of columns about neural networks, we introduce them with an intuitive approach that draws from our discussion about logistic regression.
Simple neural networks are just a chain of linear regressions. And, although neural network models can get very complicated, their essence can be understood in terms of relatively basic principles.
We show how neural network components (neurons) can be arranged in the network and discuss the ideas of hidden layers. Using a simple data set we show how even a 3-neuron neural network can already model relatively complicated data patterns.
Derry, A., Krzywinski, M & Altman, N. (2023) Points of significance: Neural network primer. Nature Methods 20:165–167.
Lever, J., Krzywinski, M. & Altman, N. (2016) Points of significance: Logistic regression. Nature Methods 13:541–542.
Our cover on the 11 January 2023 Cell Genomics issue depicts the process of determining the parent-of-origin using differential methylation of alleles at imprinted regions (iDMRs) is imagined as a circuit.
Designed in collaboration with with Carlos Urzua.
Akbari, V. et al. Parent-of-origin detection and chromosome-scale haplotyping using long-read DNA methylation sequencing and Strand-seq (2023) Cell Genomics 3(1).
Browse my gallery of cover designs.
My cover design on the 6 January 2023 Science Advances issue depicts DNA sequencing read translation in high-dimensional space. The image showss 672 bases of sequencing barcodes generated by three different single-cell RNA sequencing platforms were encoded as oriented triangles on the faces of three 7-dimensional cubes.
More details about the design.
Kijima, Y. et al. A universal sequencing read interpreter (2023) Science Advances 9.
Browse my gallery of cover designs.
If you sit on the sofa for your entire life, you’re running a higher risk of getting heart disease and cancer. —Alex Honnold, American rock climber
In a follow-up to our Survival analysis — time-to-event data and censoring article, we look at how regression can be used to account for additional risk factors in survival analysis.
We explore accelerated failure time regression (AFTR) and the Cox Proportional Hazards model (Cox PH).
Dey, T., Lipsitz, S.R., Cooper, Z., Trinh, Q., Krzywinski, M & Altman, N. (2022) Points of significance: Regression modeling of time-to-event data with censoring. Nature Methods 19:1513–1515.