mirror of
https://github.com/Findus23/Bachelors-Thesis.git
synced 2024-08-27 19:52:12 +02:00
RBF explaination
This commit is contained in:
parent
1f79313c62
commit
150794f2b3
5 changed files with 115 additions and 6 deletions
|
@ -111,4 +111,14 @@
|
|||
keywords = {Earth, planets and satellites: composition, planets and satellites: formation, Astrophysics - Earth and Planetary Astrophysics},
|
||||
}
|
||||
|
||||
@Thesis{RBF,
|
||||
author = {Du Toit, Wilna},
|
||||
title = {Radial basis function interpolation},
|
||||
type = {mathesis},
|
||||
institution = {Stellenbosch: Stellenbosch University},
|
||||
date = {2008-03},
|
||||
url = {https://core.ac.uk/download/pdf/37320748.pdf},
|
||||
file = {:/home/lukas/Bachelorarbeit/papers/RBF.pdf:PDF},
|
||||
}
|
||||
|
||||
@Comment{jabref-meta: databaseType:biblatex;}
|
||||
|
|
BIN
images/rbf1.pdf
Normal file
BIN
images/rbf1.pdf
Normal file
Binary file not shown.
BIN
images/rbf2.pdf
Normal file
BIN
images/rbf2.pdf
Normal file
Binary file not shown.
107
main.tex
107
main.tex
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Here comes some short science explanation about how planets form and water is transported.
|
||||
\lipsum[1]
|
||||
|
||||
|
||||
\section{The perfect merging assumption}
|
||||
|
||||
|
@ -119,7 +119,7 @@ In one dimension linear interpolation is pretty trivial. For example if we assum
|
|||
\label{fig:one-dim-interpolation}
|
||||
\end{figure}
|
||||
|
||||
In two dimensions things get more complicated as we now have a set of points with $X$ and $Y$ coordinates (Figure \ref{fig:3dinterpolate-1}). One fast way to find the closest points to the point that should be interpolated is using Delaunay triangulation. This separates the space between the points into triangles while trying to maximize their smallest angle. Afterwards the closest three points can be found very quickly by checking the nodes of the surrounding triangle (Figure \ref{fig:3dinterpolate-2}). If we now again have a function $f(X,Y)$ similar to the one-dimensional example (Figure \ref{fig:3dinterpolate-3}), we can create an unique plain\todo{right word?} through the three points and get the interpolated value for any $X$ and $Y$ on this layer.
|
||||
In two dimensions things get more complicated as we now have a set of points with $X$ and $Y$ coordinates (Figure \ref{fig:3dinterpolate-1}). One fast way to find the closest points to the point that should be interpolated is using Delaunay triangulation. This separates the space between the points into triangles while trying to maximize their smallest angle. Afterwards the closest three points can be found very quickly by checking the nodes of the surrounding triangle (Figure \ref{fig:3dinterpolate-2}). If we now again have a function $f(X,Y)$ similar to the one-dimensional example (Figure \ref{fig:3dinterpolate-3}), we can create a unique plain through the three points and get the interpolated value for any $X$ and $Y$ on this layer.
|
||||
|
||||
\todo[inline]{It might be a better idea (and maybe more correct) to add the green point to the Delaunay list and use it's neighbors as the nearest points instead of the edges of the surrounding triangle.}
|
||||
|
||||
|
@ -149,12 +149,110 @@ In two dimensions things get more complicated as we now have a set of points wit
|
|||
\label{fig:3dinterpolate-3}
|
||||
\end{figure}
|
||||
|
||||
This approach has the advantage that it can be extended in more than two dimensions by replacing the triangle in the Delaunay triangulation with a n-simplex in n dimensions. The \texttt{scipy.spatial.Delaunay} python function allows to quickly calculate it thanks to the \texttt{Qhull} library\footnote{\url{http://www.qhull.org/}}
|
||||
This approach has the advantage that it can be extended in more than two dimensions by replacing the triangle in the Delaunay triangulation with a n-simplex in n dimensions. The \texttt{scipy.spatial.Delaunay} python function allows to quickly calculate it thanks to the \texttt{Qhull} library\footnote{\url{http://www.qhull.org/}}. One noticeable limitation of this method is that data can't be extrapolated. Therefore the possible output is limited to the convex hull of the input parameter space (as seen in Figure \ref{fig:3dinterpolate-2}).
|
||||
|
||||
\subsection{Implementation}
|
||||
|
||||
For doing the actual interpolations the \texttt{scipy.interpolate.griddata} function is used with the \texttt{method="linear"} argument that itself uses \texttt{scipy.interpolate.LinearNDInterpolator} which does the interpolation as described above. The function is given a $6\times n$ matrix of the six parameters and a $n$ list of the water retention fraction for those $n$ simulations. In addition \texttt{griddata} supports not only calculating interpolations for one set of parameters, but also lists of parameters which allows to quickly generate 2d diagrams as seen in \ref{the_chapter_where_I_show_the_v_alpha_plots}.
|
||||
|
||||
\subsection{Results}
|
||||
|
||||
\section{RBF interpolation}
|
||||
|
||||
Another approach to interpolate data is using \textit{Radial Basis Functions}. A function $\phi$ for which $\phi(x)=\phi(\left\|x\right\|)$ is true is called \textit{radial}. Now to interpolate, we need to find a $s(x)$ which is the same as the given values $p_i$ in all points.
|
||||
|
||||
\begin{align}
|
||||
s(x_i)=p_i,\quad i=1,2,\dots,n
|
||||
\end{align}
|
||||
|
||||
The RBF interpolation now consists of a linear combination of $\phi(\left\|x-x_i\right\|)$ which the $n$ constants $\lambda_i$.
|
||||
|
||||
\begin{align}
|
||||
s(x)&= \sum_{i=1}^{n}\lambda_i\phi(\left\|x-x_i\right\|) \\
|
||||
%
|
||||
p_i&=\sum_{i=1}^{n}\lambda_i\phi(\left\|x_j-x_i\right\|),\quad j=1,2,\dots,n
|
||||
\end{align}
|
||||
|
||||
Therefore this can be written as a linear matrix equation:
|
||||
|
||||
\begin{align}
|
||||
\begin{bmatrix}
|
||||
\phi(\left\|x_1-x_1\right\|) & \phi(\left\|x_2-x_1\right\|) & \dots & \phi(\left\|x_n-x_1\right\|) \\
|
||||
\phi(\left\|x_1-x_2\right\|) & \phi(\left\|x_2-x_2\right\|) & \dots & \phi(\left\|x_n-x_2\right\|) \\
|
||||
\vdots & \vdots & \ddots & \vdots \\
|
||||
\phi(\left\|x_1-x_n\right\|) & \phi(\left\|x_2-x_n\right\|) & \dots & \phi(\left\|x_n-x_n\right\|)
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
\lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\vdots \\
|
||||
\lambda_n
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
p_1 \\
|
||||
p_2 \\
|
||||
\vdots \\
|
||||
p_n
|
||||
\end{bmatrix}
|
||||
\end{align}
|
||||
or simply
|
||||
\begin{align}
|
||||
\Phi\lambda=p
|
||||
\end{align}
|
||||
|
||||
with $\Phi$ being a symmetric $n \times n $ matrix as $\left\|x_j-x_i\right\|=\left\|x_i-x_j\right\|$. There are many possibilities for the radias basis function $\phi(r)$. It can be for example linear ($r$), gaussian ($e^{-r^2}$) or multiquadric ($\sqrt{\left(\frac{r}{\epsilon}\right)^2 + 1}$) with $\epsilon$ being a constant that defaults to the approximate average distance between nodes.
|
||||
|
||||
If we for example have the three points $x_1=0$, $x_1=3$ and $x_1=5$ with $p(x_1)=0.2$, $p(x_2)=0.8$ and $p(x_3)=0.1$ and choose the gaussian RB-function\todo{looks odd} we get the following:
|
||||
\begin{align}
|
||||
\begin{bmatrix}
|
||||
\phi(0) & \phi(3) & \phi(5) \\
|
||||
\phi(3) & \phi(0) & \phi(2) \\
|
||||
\phi(5) & \phi(2) & \phi(0)
|
||||
\end{bmatrix}
|
||||
\lambda
|
||||
=
|
||||
\begin{bmatrix}
|
||||
1 & \num{1.23e-4} & \num{1.39e-11} \\
|
||||
\num{1.23e-4} & 1 & \num{1.83e-2} \\
|
||||
\num{1.39e-11} & \num{1.83e-2} & 1
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
\lambda_1 \\
|
||||
\lambda_2 \\
|
||||
\lambda_3
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
0.22\\0.8\\0.1
|
||||
\end{bmatrix}
|
||||
\end{align}
|
||||
|
||||
Solving this
|
||||
%[0.19990147 0.7984116 0.08537658]
|
||||
|
||||
|
||||
\begin{figure}[h] % also temporary
|
||||
\centering
|
||||
\begin{subfigure}[t]{0.5\textwidth}
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/rbf1.pdf}
|
||||
\caption{Lorem ipsum}
|
||||
\label{fig:rbf-1}
|
||||
\end{subfigure}%
|
||||
~
|
||||
\begin{subfigure}[t]{0.5\textwidth}
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/rbf2.pdf}
|
||||
\caption{Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum}
|
||||
\label{fig:rbf-2}
|
||||
\end{subfigure}
|
||||
\caption{Caption place holder}
|
||||
|
||||
\end{figure}
|
||||
|
||||
\footcite{RBF}\todo{whole section?}
|
||||
|
||||
\section{Neural Networks}
|
||||
|
||||
\subsection{Theory}
|
||||
|
@ -168,7 +266,8 @@ This approach has the advantage that it can be extended in more than two dimensi
|
|||
\appendix
|
||||
\chapter{Placeholder}
|
||||
|
||||
\lipsum[1]\footcite{Schaefer2016}\footcite{dvorakMoon}\footcite{MaindlSummary}\footcite{Burger2018}\footcite{Dorninger}\footcite{CollisionParameters}\footcite{CollisionTypes}
|
||||
\lipsum[1]\footcite{Schaefer2016}\footcite{dvorakMoon}\footcite{MaindlSummary}\footcite{Burger2018}\footcite{Dorninger}\footcite{CollisionParameters}\footcite{CollisionTypes}\footcite{RBF}
|
||||
\nocite{*}
|
||||
|
||||
\printbibliography
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ DIV=14, % replace this with a larger number to get less padding around all text
|
|||
parskip=half, % how much space between paragraphs. If you prefer indention instead of space between paragraphs remove it
|
||||
oneside, % replace with twoside before printing
|
||||
%draft, % uncomment for faster compilation
|
||||
british, % language of the document
|
||||
american, % language of the document
|
||||
%appendixprefix=true % in case you want Appendix A written in front of appendix headings
|
||||
]{scrbook}
|
||||
|
||||
|
@ -64,7 +64,7 @@ british, % language of the document
|
|||
|
||||
\hyphenpenalty=750 % break less words than default - try different values for success
|
||||
\interfootnotelinepenalty=10000 % splitting footnotes between pages is really ugly and should only be done if really necessary
|
||||
\usepackage[sc]{mathpazo} % use the Palatino font and a fitting math font
|
||||
%\usepackage[sc]{mathpazo} % use the Palatino font and a fitting math font
|
||||
|
||||
\pagestyle{headings}
|
||||
% how the header of the pages looks like
|
||||
|
|
Loading…
Reference in a new issue