\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"@Rasmussen:book06 is still one of the most important references on\n",
"Gaussian process models. It is [available freely\n",
"online](http://www.gaussianprocess.org/gpml/).\n",
"\n",
"# What is Machine Learning? [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"What is machine learning? At its most basic level machine learning is a\n",
"combination of\n",
"\n",
"$$\\text{data} + \\text{model} \\xrightarrow{\\text{compute}} \\text{prediction}$$\n",
"\n",
"where *data* is our observations. They can be actively or passively\n",
"acquired (meta-data). The *model* contains our assumptions, based on\n",
"previous experience. That experience can be other data, it can come from\n",
"transfer learning, or it can merely be our beliefs about the\n",
"regularities of the universe. In humans our models include our inductive\n",
"biases. The *prediction* is an action to be taken or a categorization or\n",
"a quality score. The reason that machine learning has become a mainstay\n",
"of artificial intelligence is the importance of predictions in\n",
"artificial intelligence. The data and the model are combined through\n",
"computation.\n",
"\n",
"In practice we normally perform machine learning using two functions. To\n",
"combine data with a model we typically make use of:\n",
"\n",
"**a prediction function** a function which is used to make the\n",
"predictions. It includes our beliefs about the regularities of the\n",
"universe, our assumptions about how the world works, e.g. smoothness,\n",
"spatial similarities, temporal similarities.\n",
"\n",
"**an objective function** a function which defines the cost of\n",
"misprediction. Typically it includes knowledge about the world's\n",
"generating processes (probabilistic objectives) or the costs we pay for\n",
"mispredictions (empiricial risk minimization).\n",
"\n",
"The combination of data and model through the prediction function and\n",
"the objectie function leads to a *learning algorithm*. The class of\n",
"prediction functions and objective functions we can make use of is\n",
"restricted by the algorithms they lead to. If the prediction function or\n",
"the objective function are too complex, then it can be difficult to find\n",
"an appropriate learning algorithm. Much of the acdemic field of machine\n",
"learning is the quest for new learning algorithms that allow us to bring\n",
"different types of models and data together.\n",
"\n",
"A useful reference for state of the art in machine learning is the UK\n",
"Royal Society Report, [Machine Learning: Power and Promise of Computers\n",
"that Learn by\n",
"Example](https://royalsociety.org/~/media/policy/projects/machine-learning/publications/machine-learning-report.pdf).\n",
"\n",
"You can also check my blog post on [\"What is Machine\n",
"Learning?\"](http://inverseprobability.com/2017/07/17/what-is-machine-learning)\n",
"\n",
"In practice, we normally also have uncertainty associated with these\n",
"functions. Uncertainty in the prediction function arises from\n",
"\n",
"1. scarcity of training data and\n",
"2. mismatch between the set of prediction functions we choose and all\n",
" possible prediction functions.\n",
"\n",
"There are also challenges around specification of the objective\n",
"function, but for we will save those for another day. For the moment,\n",
"let us focus on the prediction function.\n",
"\n",
"## Neural Networks and Prediction Functions [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"Neural networks are adaptive non-linear function models. Originally,\n",
"they were studied (by McCulloch and Pitts [@McCulloch:neuron43]) as\n",
"simple models for neurons, but over the last decade they have become\n",
"popular because they are a flexible approach to modelling complex data.\n",
"A particular characteristic of neural network models is that they can be\n",
"composed to form highly complex functions which encode many of our\n",
"expectations of the real world. They allow us to encode our assumptions\n",
"about how the world works.\n",
"\n",
"We will return to composition later, but for the moment, let's focus on\n",
"a one hidden layer neural network. We are interested in the prediction\n",
"function, so we'll ignore the objective function (which is often called\n",
"an error function) for the moment, and just describe the mathematical\n",
"object of interest\n",
"\n",
"$$\n",
"\\mappingFunction(\\inputVector) = \\mappingMatrix^\\top \\activationVector(\\mappingMatrixTwo, \\inputVector)\n",
"$$\n",
"\n",
"Where in this case $\\mappingFunction(\\cdot)$ is a scalar function with\n",
"vector inputs, and $\\activationVector(\\cdot)$ is a vector function with\n",
"vector inputs. The dimensionality of the vector function is known as the\n",
"number of hidden units, or the number of neurons. The elements of this\n",
"vector function are known as the *activation* function of the neural\n",
"network and $\\mappingMatrixTwo$ are the parameters of the activation\n",
"functions.\n",
"\n",
"## Relations with Classical Statistics\n",
"\n",
"In statistics activation functions are traditionally known as *basis\n",
"functions*. And we would think of this as a *linear model*. It's doesn't\n",
"make linear predictions, but it's linear because in statistics\n",
"estimation focuses on the parameters, $\\mappingMatrix$, not the\n",
"parameters, $\\mappingMatrixTwo$. The linear model terminology refers to\n",
"the fact that the model is *linear in the parameters*, but it is *not*\n",
"linear in the data unless the activation functions are chosen to be\n",
"linear.\n",
"\n",
"## Adaptive Basis Functions\n",
"\n",
"The first difference in the (early) neural network literature to the\n",
"classical statistical literature is the decision to optimize these\n",
"parameters, $\\mappingMatrixTwo$, as well as the parameters,\n",
"$\\mappingMatrix$ (which would normally be denoted in statistics by\n",
"$\\boldsymbol{\\beta}$)[^1].\n",
"\n",
"In this tutorial, we're going to go revisit that decision, and follow\n",
"the path of Radford Neal [@Neal:bayesian94] who, inspired by work of\n",
"David MacKay [@MacKay:bayesian92] and others did his PhD thesis on\n",
"Bayesian Neural Networks. If we take a Bayesian approach to parameter\n",
"inference (note I am using inference here in the classical sense, not in\n",
"the sense of prediction of test data, which seems to be a newer usage),\n",
"then we don't wish to fit parameters at all, rather we wish to integrate\n",
"them away and understand the family of functions that the model\n",
"describes.\n",
"\n",
"## Probabilistic Modelling [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"This Bayesian approach is designed to deal with uncertainty arising from\n",
"fitting our prediction function to the data we have, a reduced data set.\n",
"\n",
"The Bayesian approach can be derived from a broader understanding of\n",
"what our objective is. If we accept that we can jointly represent all\n",
"things that happen in the world with a probability distribution, then we\n",
"can interogate that probability to make predictions. So, if we are\n",
"interested in predictions, $\\dataScalar_*$ at future points input\n",
"locations of interest, $\\inputVector_*$ given previously training data,\n",
"$\\dataVector$ and corresponding inputs, $\\inputMatrix$, then we are\n",
"really interogating the following probability density, $$\n",
"p(\\dataScalar_*|\\dataVector, \\inputMatrix, \\inputVector_*),\n",
"$$ there is nothing controversial here, as long as you accept that you\n",
"have a good joint model of the world around you that relates test data\n",
"to training data,\n",
"$p(\\dataScalar_*, \\dataVector, \\inputMatrix, \\inputVector_*)$ then this\n",
"conditional distribution can be recovered through standard rules of\n",
"probability\n",
"($\\text{data} + \\text{model} \\rightarrow \\text{prediction}$).\n",
"\n",
"We can construct this joint density through the use of the following\n",
"decomposition: $$\n",
"p(\\dataScalar_*|\\dataVector, \\inputMatrix, \\inputVector_*) = \\int p(\\dataScalar_*|\\inputVector_*, \\mappingMatrix) p(\\mappingMatrix | \\dataVector, \\inputMatrix) \\text{d} \\mappingMatrix\n",
"$$\n",
"\n",
"where, for convenience, we are assuming *all* the parameters of the\n",
"model are now represented by $\\parameterVector$ (which contains\n",
"$\\mappingMatrix$ and $\\mappingMatrixTwo$) and\n",
"$p(\\parameterVector | \\dataVector, \\inputMatrix)$ is recognised as the\n",
"posterior density of the parameters given data and\n",
"$p(\\dataScalar_*|\\inputVector_*, \\parameterVector)$ is the *likelihood*\n",
"of an individual test data point given the parameters.\n",
"\n",
"The likelihood of the data is normally assumed to be independent across\n",
"the parameters, $$\n",
"p(\\dataVector|\\inputMatrix, \\mappingMatrix) = \\prod_{i=1}^\\numData p(\\dataScalar_i|\\inputVector_i, \\mappingMatrix),$$\n",
"\n",
"and if that is so, it is easy to extend our predictions across all\n",
"future, potential, locations, $$\n",
"p(\\dataVector_*|\\dataVector, \\inputMatrix, \\inputMatrix_*) = \\int p(\\dataVector_*|\\inputMatrix_*, \\parameterVector) p(\\parameterVector | \\dataVector, \\inputMatrix) \\text{d} \\parameterVector.\n",
"$$\n",
"\n",
"The likelihood is also where the *prediction function* is incorporated.\n",
"For example in the regression case, we consider an objective based\n",
"around the Gaussian density, $$\n",
"p(\\dataScalar_i | \\mappingFunction(\\inputVector_i)) = \\frac{1}{\\sqrt{2\\pi \\dataStd^2}} \\exp\\left(-\\frac{\\left(\\dataScalar_i - \\mappingFunction(\\inputVector_i)\\right)^2}{2\\dataStd^2}\\right)\n",
"$$\n",
"\n",
"In short, that is the classical approach to probabilistic inference, and\n",
"all approaches to Bayesian neural networks fall within this path. For a\n",
"deep probabilistic model, we can simply take this one stage further and\n",
"place a probability distribution over the input locations, $$\n",
"p(\\dataVector_*|\\dataVector) = \\int p(\\dataVector_*|\\inputMatrix_*, \\parameterVector) p(\\parameterVector | \\dataVector, \\inputMatrix) p(\\inputMatrix) p(\\inputMatrix_*) \\text{d} \\parameterVector \\text{d} \\inputMatrix \\text{d}\\inputMatrix_*\n",
"$$ and we have *unsupervised learning* (from where we can get deep\n",
"generative models).\n",
"\n",
"## Graphical Models [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"One way of representing a joint distribution is to consider conditional\n",
"dependencies between data. Conditional dependencies allow us to\n",
"factorize the distribution. For example, a Markov chain is a\n",
"factorization of a distribution into components that represent the\n",
"conditional relationships between points that are neighboring, often in\n",
"time or space. It can be decomposed in the following form.\n",
"$$p(\\dataVector) = p(\\dataScalar_\\numData | \\dataScalar_{\\numData-1}) p(\\dataScalar_{\\numData-1}|\\dataScalar_{\\numData-2}) \\dots p(\\dataScalar_{2} | \\dataScalar_{1})$$\n",
"\n",
"\n",
"\n",
"By specifying conditional independencies we can reduce the\n",
"parameterization required for our data, instead of directly specifying\n",
"the parameters of the joint distribution, we can specify each set of\n",
"parameters of the conditonal independently. This can also give an\n",
"advantage in terms of interpretability. Understanding a conditional\n",
"independence structure gives a structured understanding of data. If\n",
"developed correctly, according to causal methodology, it can even inform\n",
"how we should intervene in the system to drive a desired result\n",
"[@Pearl:causality95].\n",
"\n",
"However, a challenge arises when the data becomes more complex. Consider\n",
"the graphical model shown below, used to predict the perioperative risk\n",
"of *C Difficile* infection following colon surgery\n",
"[@Steele:predictive12].\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"To capture the complexity in the interelationship between the data, the\n",
"graph itself becomes more complex, and less interpretable.\n",
"\n",
"## Performing Inference\n",
"\n",
"As far as combining our data and our model to form our prediction, the\n",
"devil is in the detail. While everything is easy to write in terms of\n",
"probability densities, as we move from $\\text{data}$ and $\\text{model}$\n",
"to $\\text{prediction}$ there is that simple\n",
"$\\xrightarrow{\\text{compute}}$ sign, which is now burying a wealth of\n",
"difficulties. Each integral sign above is a high dimensional integral\n",
"which will typically need approximation. Approximations also come with\n",
"computational demands. As we consider more complex classes of functions,\n",
"the challenges around the integrals become harder and prediction of\n",
"future test data given our model and the data becomes so involved as to\n",
"be impractical or impossible.\n",
"\n",
"Statisticians realized these challenges early on, indeed, so early that\n",
"they were actually physicists, both Laplace and Gauss worked on models\n",
"such as this, in Gauss's case he made his career on prediction of the\n",
"location of the lost planet (later reclassified as a asteroid, then\n",
"dwarf planet), Ceres. Gauss and Laplace made use of maximum a posteriori\n",
"estimates for simplifying their computations and Laplace developed\n",
"Laplace's method (and invented the Gaussian density) to expand around\n",
"that mode. But classical statistics needs better guarantees around model\n",
"performance and interpretation, and as a result has focussed more on the\n",
"*linear* model implied by $$\n",
" \\mappingFunction(\\inputVector) = \\left.\\mappingVector^{(2)}\\right.^\\top \\activationVector(\\mappingMatrix_1, \\inputVector)\n",
" $$\n",
"\n",
"$$\n",
" \\mappingVector^{(2)} \\sim \\gaussianSamp{\\zerosVector}{\\covarianceMatrix}.\n",
" $$\n",
"\n",
"The Gaussian likelihood given above implies that the data observation is\n",
"related to the function by noise corruption so we have, $$\n",
" \\dataScalar_i = \\mappingFunction(\\inputVector_i) + \\noiseScalar_i,\n",
" $$ where $$\n",
" \\noiseScalar_i \\sim \\gaussianSamp{0}{\\dataStd^2}\n",
" $$\n",
"\n",
"and while normally integrating over high dimensional parameter vectors\n",
"is highly complex, here it is *trivial*. That is because of a property\n",
"of the multivariate Gaussian.\n",
"\n",
"Gaussian processes are initially of interest because\n",
"\n",
"1. linear Gaussian models are easier to deal with\n",
"2. Even the parameters *within* the process can be handled, by\n",
" considering a particular limit.\n",
"\n",
"Let's first of all review the properties of the multivariate Gaussian\n",
"distribution that make linear Gaussian models easier to deal with. We'll\n",
"return to the, perhaps surprising, result on the parameters within the\n",
"nonlinearity, $\\parameterVector$, shortly.\n",
"\n",
"To work with linear Gaussian models, to find the marginal likelihood all\n",
"you need to know is the following rules. If $$\n",
"\\dataVector = \\mappingMatrix \\inputVector + \\noiseVector,\n",
"$$ where $\\dataVector$, $\\inputVector$ and $\\noiseVector$ are vectors\n",
"and we assume that $\\inputVector$ and $\\noiseVector$ are drawn from\n",
"multivariate Gaussians, $$\n",
"\\begin{align}\n",
"\\inputVector & \\sim \\gaussianSamp{\\meanVector}{\\covarianceMatrix}\\\\\n",
"\\noiseVector & \\sim \\gaussianSamp{\\zerosVector}{\\covarianceMatrixTwo}\n",
"\\end{align}\n",
"$$ then we know that $\\dataVector$ is also drawn from a multivariate\n",
"Gaussian with, $$\n",
"\\dataVector \\sim \\gaussianSamp{\\mappingMatrix\\meanVector}{\\mappingMatrix\\covarianceMatrix\\mappingMatrix^\\top + \\covarianceMatrixTwo}.\n",
"$$\n",
"\n",
"With apprioriately defined covariance, $\\covarianceMatrixTwo$, this is\n",
"actually the marginal likelihood for Factor Analysis, or Probabilistic\n",
"Principal Component Analysis [@Tipping:probpca99], because we integrated\n",
"out the inputs (or *latent* variables they would be called in that\n",
"case).\n",
"\n",
"However, we are focussing on what happens in models which are non-linear\n",
"in the inputs, whereas the above would be *linear* in the inputs. To\n",
"consider these, we introduce a matrix, called the design matrix. We set\n",
"each activation function computed at each data point to be $$\n",
"\\activationScalar_{i,j} = \\activationScalar(\\mappingVector^{(1)}_{j}, \\inputVector_{i})\n",
"$$ and define the matrix of activations (known as the *design matrix* in\n",
"statistics) to be, $$\n",
"\\activationMatrix = \n",
"\\begin{bmatrix}\n",
"\\activationScalar_{1, 1} & \\activationScalar_{1, 2} & \\dots & \\activationScalar_{1, \\numHidden} \\\\\n",
"\\activationScalar_{1, 2} & \\activationScalar_{1, 2} & \\dots & \\activationScalar_{1, \\numData} \\\\\n",
"\\vdots & \\vdots & \\ddots & \\vdots \\\\\n",
"\\activationScalar_{\\numData, 1} & \\activationScalar_{\\numData, 2} & \\dots & \\activationScalar_{\\numData, \\numHidden}\n",
"\\end{bmatrix}.\n",
"$$ By convention this matrix always has $\\numData$ rows and $\\numHidden$\n",
"columns, now if we define the vector of all noise corruptions,\n",
"$\\noiseVector = \\left[\\noiseScalar_1, \\dots \\noiseScalar_\\numData\\right]^\\top$.\n",
"\n",
"If we define the prior distribution over the vector $\\mappingVector$ to\n",
"be Gaussian, $$\n",
"\\mappingVector \\sim \\gaussianSamp{\\zerosVector}{\\alpha\\eye},\n",
"$$\n",
"\n",
"then we can use rules of multivariate Gaussians to see that, $$\n",
"\\dataVector \\sim \\gaussianSamp{\\zerosVector}{\\alpha \\activationMatrix \\activationMatrix^\\top + \\dataStd^2 \\eye}.\n",
"$$\n",
"\n",
"In other words, our training data is distributed as a multivariate\n",
"Gaussian, with zero mean and a covariance given by $$\n",
"\\kernelMatrix = \\alpha \\activationMatrix \\activationMatrix^\\top + \\dataStd^2 \\eye.\n",
"$$\n",
"\n",
"This is an $\\numData \\times \\numData$ size matrix. Its elements are in\n",
"the form of a function. The maths shows that any element, index by $i$\n",
"and $j$, is a function *only* of inputs associated with data points $i$\n",
"and $j$, $\\dataVector_i$, $\\dataVector_j$.\n",
"$\\kernel_{i,j} = \\kernel\\left(\\inputVector_i, \\inputVector_j\\right)$\n",
"\n",
"If we look at the portion of this function associated only with\n",
"$\\mappingFunction(\\cdot)$, i.e. we remove the noise, then we can write\n",
"down the covariance associated with our neural network, $$\n",
"\\kernel_\\mappingFunction\\left(\\inputVector_i, \\inputVector_j\\right) = \\alpha \\activationVector\\left(\\mappingMatrix_1, \\inputVector_i\\right)^\\top \\activationVector\\left(\\mappingMatrix_1, \\inputVector_j\\right)\n",
"$$ so the elements of the covariance or *kernel* matrix are formed by\n",
"inner products of the rows of the *design matrix*.\n",
"\n",
"## Gaussian Process [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"This is the essence of a Gaussian process. Instead of making assumptions\n",
"about our density over each data point, $\\dataScalar_i$ as i.i.d. we\n",
"make a joint Gaussian assumption over our data. The covariance matrix is\n",
"now a function of both the parameters of the activation function,\n",
"$\\mappingMatrixTwo$, and the input variables, $\\inputMatrix$. This comes\n",
"about through integrating out the parameters of the model,\n",
"$\\mappingVector$.\n",
"\n",
"## Basis Functions\n",
"\n",
"We can basically put anything inside the basis functions, and many\n",
"people do. These can be deep kernels [@Cho:deep09] or we can learn the\n",
"parameters of a convolutional neural network inside there.\n",
"\n",
"Viewing a neural network in this way is also what allows us to beform\n",
"sensible *batch* normalizations [@Ioffe:batch15].\n",
"\n",
"## Non-degenerate Gaussian Processes [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"The process described above is degenerate. The covariance function is of\n",
"rank at most $\\numHidden$ and since the theoretical amount of data could\n",
"always increase $\\numData \\rightarrow \\infty$, the covariance function\n",
"is not full rank. This means as we increase the amount of data to\n",
"infinity, there will come a point where we can't normalize the process\n",
"because the multivariate Gaussian has the form, $$\n",
"\\gaussianDist{\\mappingFunctionVector}{\\zerosVector}{\\kernelMatrix} = \\frac{1}{\\left(2\\pi\\right)^{\\frac{\\numData}{2}}\\det{\\kernelMatrix}^\\frac{1}{2}} \\exp\\left(-\\frac{\\mappingFunctionVector^\\top\\kernelMatrix \\mappingFunctionVector}{2}\\right)\n",
"$$ and a non-degenerate kernel matrix leads to $\\det{\\kernelMatrix} = 0$\n",
"defeating the normalization (it's equivalent to finding a projection in\n",
"the high dimensional Gaussian where the variance of the the resulting\n",
"univariate Gaussian is zero, i.e. there is a null space on the\n",
"covariance, or alternatively you can imagine there are one or more\n",
"directions where the Gaussian has become the delta function).\n",
"\n",
"In the machine learning field, it was Radford Neal [@Neal:bayesian94]\n",
"that realized the potential of the next step. In his 1994 thesis, he was\n",
"considering Bayesian neural networks, of the type we described above,\n",
"and in considered what would happen if you took the number of hidden\n",
"nodes, or neurons, to infinity, i.e. $\\numHidden \\rightarrow \\infty$.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"When viewing these contour plots, I sometimes find it helpful to think\n",
"of Uluru, the prominent rock formation in Australia. The rock rises\n",
"above the surface of the plane, just like a probability density rising\n",
"above the zero line. The rock is three dimensional, but when we view\n",
"Uluru from the classical position, we are looking at one side of it.\n",
"This is equivalent to viewing the marginal density.\n",
"\n",
"The joint density can be viewed from above, using contours. The\n",
"conditional density is equivalent to *slicing* the rock. Uluru is a holy\n",
"rock, so this has to be an imaginary slice. Imagine we cut down a\n",
"vertical plane orthogonal to our view point (e.g. coming across our view\n",
"point). This would give a profile of the rock, which when renormalized,\n",
"would give us the conditional distribution, the value of conditioning\n",
"would be the location of the slice in the direction we are facing.\n",
"\n",
"## Prediction with Correlated Gaussians\n",
"\n",
"Of course in practice, rather than manipulating mountains physically,\n",
"the advantage of the Gaussian density is that we can perform these\n",
"manipulations mathematically.\n",
"\n",
"Prediction of $\\mappingFunction_2$ given $\\mappingFunction_1$ requires\n",
"the *conditional density*,\n",
"$p(\\mappingFunction_2|\\mappingFunction_1)$.Another remarkable property\n",
"of the Gaussian density is that this conditional distribution is *also*\n",
"guaranteed to be a Gaussian density. It has the form, $$\n",
" p(\\mappingFunction_2|\\mappingFunction_1) = \\gaussianDist{\\mappingFunction_2}{\\frac{\\kernelScalar_{1, 2}}{\\kernelScalar_{1, 1}}\\mappingFunction_1}{ \\kernelScalar_{2, 2} - \\frac{\\kernelScalar_{1,2}^2}{\\kernelScalar_{1,1}}}\n",
" $$where we have assumed that the covariance of the original joint\n",
"density was given by $$\n",
" \\kernelMatrix = \\begin{bmatrix} \\kernelScalar_{1, 1} & \\kernelScalar_{1, 2}\\\\ \\kernelScalar_{2, 1} & \\kernelScalar_{2, 2}.\\end{bmatrix}\n",
" $$\n",
"\n",
"Using these formulae we can determine the conditional density for any of\n",
"the elements of our vector $\\mappingFunctionVector$. For example, the\n",
"variable $\\mappingFunction_8$ is less correlated with\n",
"$\\mappingFunction_1$ than $\\mappingFunction_2$. If we consider this\n",
"variable we see the conditional density is more diffuse."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pods\n",
"from ipywidgets import IntSlider"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pods.notebook.display_plots('two_point_sample{sample:0>3}.svg', '../slides/diagrams/gp', sample=IntSlider(13, 13, 17, 1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
"\n",
"\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n", "- Gold medal times for Olympic Marathon since 1896.\n", "- Marathons before 1924 didnâ€™t have a standardised distance.\n", "- Present results using pace per km.\n", "- In 1904 Marathon was badly organised leading to very slow times.\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
"Image from Wikimedia Commons |

\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"Things to notice about the data include the outlier in 1904, in this\n",
"year, the olympics was in St Louis, USA. Organizational problems and\n",
"challenges with dust kicked up by the cars following the race meant that\n",
"participants got lost, and only very few participants completed.\n",
"\n",
"More recent years see more consistently quick marathons.\n",
"\n",
"## Alan Turing [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" | \n", "$\\eigenvalueMatrix$ represents distance on axes. $\\rotationMatrix$ gives\n", "rotation.\n", " |

\n", "\n", " | \n", "\\includesvg{../slides/diagrams/gp/gp-optimise010}\n", " |

\n", "\n", " | \n", "\\includesvg{../slides/diagrams/gp/gp-optimise021}\n", " |

\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"- Want to detect if a gene is expressed or not, fit a GP to each gene\n",
" @Kalaitzis:simple11.\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"{\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n", "\n", " | \n",
" \n",
"\n",
"\n",
"\n",
" \n",
"\n",
" |

\n",
"\n",
"\\includesvgclass{../slides/diagrams/logo/gpss-logo.svg}\n",
"\n",
"

\n",
"\n",
"If you're interested in finding out more about Gaussian processes, you\n",
"can attend the Gaussian process summer school, or view the lectures and\n",
"material on line. Details of the school, future events and past events\n",
"can be found at the website \n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"GPy is a BSD licensed software code base for implementing Gaussian\n",
"process models in python. This allows GPs to be combined with a wide\n",
"variety of software libraries.\n",
"\n",
"The software itself is available on\n",
"[GitHub](https://github.com/SheffieldML/GPy) and the team welcomes\n",
"contributions.\n",
"\n",
"The aim for GPy is to be a probabilistic-style programming language,\n",
"i.e. you specify the model rather than the algorithm. As well as a large\n",
"range of covariance functions the software allows for non-Gaussian\n",
"likelihoods, multivariate outputs, dimensionality reduction and\n",
"approximations for larger data sets.\n",
"\n",
"## Other Software [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"GPy has inspired other software solutions, first of all\n",
"[GPflow](https://github.com/GPflow/GPflow), which uses Tensor Flow's\n",
"automatic differentiation engine to allow rapid prototyping of new\n",
"covariance functions and algorithms. More recently,\n",
"[GPyTorch](https://github.com/cornellius-gp/gpytorch) uses PyTorch for\n",
"the same purpose.\n",
"\n",
"GPy itself is being restructured with MXFusion as its computational\n",
"engine to give similiar capabilities.\n",
"\n",
"## MXFusion: Modular Probabilistic Programming on MXNet [\\[[edit]{.editsection style=\"\"}\\]]{.editsection-bracket style=\"\"}\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"

\n",
"\n",
"\n", "- Work by Eric Meissner and Zhenwen Dai.\n", "- Probabilistic programming.\n", "- Available on [Github](https://github.com/amzn/mxfusion)\n", " | \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
" \n",
"\n",
" |