\chapter{Introduction} \label{ch-1}

This research proposal is a significant extension of objectives and projects begun during my master's degree. Drinfeld modules have been a tool of theoretical interest in Number Theory since the 1970s when they were introduced by Valdimir Drinf'eld in his proof of the Langlands conjecture for the general linear group over a global function field of positive characteristic. Since then, there has been considerable interest in extending known results concerning Elliptic curves to the Drinfeld setting. This was partly the motivation of Gekeler in \cite{frobdist} who aimed to study the distribution of coefficients of the characteristic polynomials of Drinfeld modules to determine if an analog of the Sato-Tate conjecture might hold. Recent research has continued to scrutinize computational questions connected Drinfeld modules, which includes work that makes use of rank-two Drinfeld modules for factoring polynomials \cite{eschost2017arXiv171200669D}, as well as isogeny structures \cite{DBLP:books/ams/20/CaranayGS20} and endomorphism rings \cite{GaPa18}. Cryptographic primitives based on elliptic curves have been known for several decades and see use in real-world crypto-systems, however several attempts to extend these constructions to Drinfeld modules have proven insecure \cite{Scanlon2001PublicKC}, \cite{cryptoeprint:2019:1329}.

To that end, the main goal of \cite{Musleh} was to develop an analog of Schoof's algorithm for counting points on an elliptic curve to the Drinfeld setting; while a direct parallel was not quite achieved, an algorithm in the spirit of Schoof's approach was developed, in addition to other algorithms that could leverage randomization for better practical performance.

One of the main goals of our research has been to extend algorithms previously developed for the rank-two case to Drinfeld modules of arbitrary rank. One particular challenge in the higher rank case has been finding suitable classical methods on which to base our algorithms. While the relationship with elliptic curves is well established for the rank-two case, higher rank Drinfeld modules are less clearly analogized by classical algebro-geometric objects.

Another major motivator for studying skew polynomials has been their use in coding theory, and in particular Gabidulin codes \cite{PUCHINGER2017b} \cite{bartz2021fast}.


\section{Dealing with variation}
\label{imaging:variation}

Experimental error is always present in our
measurements. Additionally, any given feature
may show extensive biological variability even within
apparently homogeneous populations. The biological
variation can be informative, as it gives us
insight into the limits to accuracy of cellular
processing and can reveal phenotypically distinct
subpopulations (see \ar{insulation:introduction}).
However, if experimental error is mis-interpreted
as biological variability, we lose statistical resolution
or may assign unwarranted meaning to non-biological
variation. It is then important to be able to separate
experimental from biological variation.

Experimental variation in fluorescence imaging
comes from many sources.
The imaging plane itself may cause
variation by intersecting cells at different
relative heights. This focal plane effect
can cause cell-to-cell differences in the
degree of focus and in how much off-plane
fluorescence is captured. As discussed
in \ar{imaging:distortion}, image shading and
background can also contribute to artificial variation
due to microscopy.

Aside from microscopy artifacts, the process
of preparing cells for imaging may also
generate distortions of true biological variability.
For example, variation in cellular surface
area or volume may lead to differences
in how well an antibody or non-permeable dye
can access an intracellular target.
Such differences in cell morphology may be
enhanced or dampened by fixatives, which can cause cells to shrink
in the $z$-axis \cite{Pawly2006}.

  \begin{figure}[!bt]
  \centering
  \includegraphics[width=4in]{FIGS/imaging/cycleFit.pdf}
  {\singlespacing
  \caption[ Fitting total DNA to a simple cell cycle model.]
            {An asynchronous cell population can be
            fit to a simple model of the cell cycle
            with reasonable accuracy. Left,
            the theoretical
            asynchronous cell-cycle distribution consists
            of delta functions for G1 and G2 cells (i.e.
            all cells in these populations have identical
            DNA content) and a uniform distribution for
            S-phase cells that are moving from the G1 to G2
            states at a constant rate. Middle, the
            total DNA feature of G1 and G2 nuclei shows log-normal variation
            that can thus be fit to normal distributions after log-transformation.
            Right, the cell subpopulation models
            add up to a reasonably accurate estimate
            of the cell cycle distribution. Gray, filled
            histograms are of $\log_2$(total DNA), with
            DNA in arbitrary units, of $\sim2\times10^4$ Hoechst-stained
            human colonic epithelial cells. Dashed lines are
            the actual fits to this data using the method described
            in the text.}
  \label{fig:imaging:cycleFit}}
  \end{figure}

Finally, non-biological variation can be introduced
during segmentation. This can be due to outright errors
(e.g. a cell being split into two objects) or to
the more subtle fact that the accuracy of a set of
segmentation parameters will vary from cell to cell.
For example, a chosen threshold that perfectly separates
background from foreground for one cell may end up
discarding the outer edges of a dimmer cell.

\subsection{Using DNA features for quality control}
\label{imaging:variation:dnaQC}

Due to the error sources discussed above (among others)
there may be many outlier cells to discard. Manual or pseudo-manual
approaches are often used for this task.
Visual inspection of a random
subset of segmented cells is a common approach,
though automated solutions are needed for large datasets.
An example is the identification of out-of-focus images using
image-level features from tools like PhenoRipper
\cite{Rajaram2012}.
I use an automated statistical approach that takes
advantage of ``ground truth'' aspects of total DNA
content in cells.
This approach uses population-level statistics
of DNA features to determine which cells
are likely to be properly
segmented and in focus. In effect, I make the assumption that
cells with biologically-unlikely DNA feature values will have
non-biological values in other features as well.

  \begin{figure}[!bt]
  \centering
  \includegraphics[width=6in]{FIGS/imaging/qualityControl.pdf}
  {\singlespacing
  \caption[ Using DNA features for quality control.]
            {DNA features can be used for single-cell quality
            control. Bottom left, the Total DNA feature
            is fit to a cell cycle plot (fit not shown)
            and the G1 population is gated as all cells
            within $\mu_{G1}\pm2\sigma_{G1}$ (blue). The population is
            also statistically gated using the nuclear area (bottom,
            middle) and the intra-nuclear intensity $cv$ (bottom, right).
            The gating is $\pm3\times\text{MAD}$ from the median of each
            feature, where $\text{MAD}$ is the median absolute deviation
            ($\text{median}(|X-\text{median}(X)|)$.
            ($3\times\text{MAD}\approx2\sigma$ for normal distributions.)
            The gated points are considered to be in-focus G1 cells
            that are likely segmented properly. In the top plot,
            these quality-controlled
            cells are found as red points within the blue box. Data from
            >4000 Hoechst-stained human colonic epithelial cells.}
  \label{fig:imaging:qualityControl}}
  \end{figure}

The first step in my quality control pipeline is to identify cell cycle
subpopulations by fitting a cell cycle model
to the total DNA histograms. This allows for later isolation
of these subpopulations and removal of outliers. Note that
in tissue culture microscopy
mitotic (M-phase) cells are often lost during sample washes
and so are already excluded from analysis.

An asynchronous cell population can be accurately
fit to a simple model of the cell cycle. The
theoretical, variation-free model of this cell cycle
consists of of delta functions for the G1 and G2 peaks
with a uniform S-phase distribution in between
(\ar{fig:imaging:cycleFit}, left). In other words, all
cells within G1 or G2 have the exact same DNA content,
and cells moving through S-phase increase their DNA content
at a constant rate. In reality,
the cell cycle distribution arising from measured
total DNA consists of $\log$-normally distributed G1
and G2 peaks, with a variable-shaped S-phase distribution
in between. I note that, on a $\log$-scale, the G1 and
G2 distributions have near-identical standard deviations
($\sigma_{G1}\approx\sigma_{G2}$).

I implemented a simple variant of the
Dean-Jett-Fox cell cycle model \cite{Dean1974,Fox1980}
that is sufficient to accurately identify G1 and G2 cells
from microscopy data.
The formulae that comprise this model are in
Equations~\ref{eq:imaging:g1}\nobreakdash-\ref{eq:imaging:g2},
where: $T_c$ is the $\log_2$-transformed
total DNA of a single cell; $\mu_{G1}$ is the average of this
value across all G1-phase cells; $\sigma$ is the standard
deviation of the G1 and G2 distributions; $v$ is the height of the S-phase
uniform distribution, $f(T_c)$ is the fraction of
cells with the same $T_c$ DNA content (in practice, it is the fraction of cells
falling into the same histogram bin), and $w$ values are weights. \ar{fig:imaging:cycleFit} shows
this model graphically, fit to experimental data.
    %
    \begin{align}
    f_{G1}(T_c) &= \frac{w_1}{\sigma \sqrt{2\pi}}
    e^{-\frac{(T_c-\mu_{G1})^2}{2\sigma^2}} \label{eq:imaging:g1}\\
    f_{S} (T_c) &= \left\{
        \begin{array}{lr}
        0 & : T_c \notin [ \mu_{G1}, \mu_{G2} ] \\
        v & : T_c \in    [ \mu_{G1}, \mu_{G2} ]
        \end{array}
        \right.
    \label{eq:imaging:s}\\
    f_{G2}(T_c) &= \frac{w_2}{\sigma \sqrt{2\pi}}
    e^{-\frac{(T_c-\mu_{G2})^2}{2\sigma^2}} \label{eq:imaging:g2}
    \end{align}

While fitting to a cell cycle distribution model may
be sufficient to identify biological outlier cells, I use two
additional DNA features to further exclude low-quality
images of nuclei. These features
are the nuclear area and the coefficient of variation ($cv$)
of intra-nuclear DNA intensity.
The $cv$ is a rough proxy for the DNA texture,
and so can be used to identify out-of-focus cells
(lower $cv$) or those with chromatin condensation or
punctate artifacts (higher $cv$). I therefore statistically
gate the population by rejecting those cells that are too
far from the median of either of these features
(see \ar{fig:imaging:qualityControl}).

Finally, I restrict my analyses to cells in the G1 phase
\arp{fig:imaging:qualityControl}.
The rationale for this is that I do not expect G1
and G2 cells to have different qualitative behaviors
for the signaling pathways that I study in \ar{insulation:introduction},
though I do expect them to have somewhat different quantitative
behaviors. The effect of combining these subpopulations
would then be a meaningless increase in apparent signaling variability.
I therefore chose the G1 population as it is
typically more populated and is less prone to
double-segmentation errors.

\subsection{Using DNA features to correct measurement error}

By using DNA features for quality control, we can thus collect
all cells within the G1 and/or G2 populations that are high-quality
(from an imaging standpoint) and accurately segmented.
The quality control described above may be a sufficient level of
data clean-up for some experimental goals, but
it does not deal with the problem
identified at the top of this section:
that is, the separation of true biological variation from
measurement error. In other words, quality control only discards
cells that are too far from the ``typical'' cell, it does nothing
to determine or correct the measurement error in those cells that are kept.

To identify biological variability, then,
I again take advantage of the cell cycle ``ground truth.''
As shown in \ar{fig:imaging:cycleFit}, the theoretical
cell cycle distribution has no variation in the G1 or G2
populations, as all cells have exactly the same diploid
or tetraploid DNA content. The observed variation
around the theoretical values then do not carry any biological
meaning. (Note that this approximation becomes less accurate
with chromosomally-unstable cell populations.)

\subsubsection{Single-cell measurement error correction}
\label{imaging:singleCellCorrection}

If the variation in total DNA carries no biological
information, then it should not be predictive of
of other feature values: any feature dependence on
the DNA content must then be due to a global source
of error. In principle, then, we can then reduce this error by
removing the meaningless correlations of other features to total DNA content.

  \begin{figure}[!bt]
  \centering
  \includegraphics[width=6in]{FIGS/imaging/singleCellNorm.pdf}
  {\singlespacing
  \caption[ Single-cell correction using DNA features.]
            {The variation in total DNA content (within a single cell cycle peak)
            is non-biological and therefore should not be predictive of
            intensity values for other probes.
            \b{a}, Total Smad as a function of
            total DNA. The raw data show a low
            Pearson correlation coefficient (inset $r$ value)
            and linear regression slope (black line),
            which is over-corrected by
            multiplicative normalization (middle) and
            corrected by regression-based normalization
            (right). \b{b}, Comparison of single-cell values
            before (x-axis) and after (y-axis) regresson-based
            correction. This dataset has low correlation to
            total DNA, and so the change is small.
            $n=689$ human colonic epithelial cells (G1 only,
            quality-controlled) immunostained
            with anti-Smad2/3 (Smad) and Hoechst (DNA).
            All $y$-axes on the same scale.}
  \label{fig:imaging:singleCellNorm}}
  \end{figure}

I take two single-cell level approaches to correcting
total intensity feature errors
\arp{fig:imaging:singleCellNorm}. The intuitive method
is to estimate a normalization factor for e.g. all G1 cells
using total DNA ($T_{\text{DNA},c}$), and then use this
factor to normalize the total intensity of other
fluorescent probes ($T_{\text{probe},c}$)
in those same cells (\ar{eq:imaging:dnaNorm}). Indeed,
I have seen this approach used in the literature even
without first restricting analysis to one cell cycle
subpopulation. This
method assumes a simple multiplicative relationship
between the DNA and other channels such that, for example, a 10\%
increase in total DNA content would predict a 10\%
increase in different total probe intensity. Note
that this assumption may not hold true, such that this
method can cause over- or under-correction (as in
\ref{fig:imaging:singleCellNorm}a, middle).
    %
    \begin{equation} \label{eq:imaging:dnaNorm}
    f_{\text{norm}}(T_{\text{probe},c})=
    \frac{\text{median}_c(T_{\text{DNA},c})}{T_{\text{DNA},c}}T_{\text{probe},c}
    \end{equation}

My preferred method is regression-based, as it
guarantees removal of
correlation between total Hoechst and the total intensity of
another probe (\ar{fig:imaging:singleCellNorm}a, right).
For this method, linear regression is performed to get the
function in \ar{eq:imaging:reg} with slope $m$ and intercept $b$.
This results in a residual value ($\text{r}_{\text{probe},c}$)
for every cell.
The value of each $T_{\text{probe},c}$ can then be corrected
by setting it equal to the median across all values plus the residual
value for the same cell (\ar{eq:imaging:regNorm}).
    %
    \begin{gather}
    T_{\text{probe},c}=f_\text{regression}(T_{\text{DNA},c})=mT_{\text{DNA},c}+\text{r}_{\text{probe},c}+b
        \label{eq:imaging:reg}\\
    f_\text{norm}(T_{\text{probe},c}) =
        \text{median}_c(T_{\text{probe},c})+\text{r}_{\text{probe},c}
        \label{eq:imaging:regNorm}
    \end{gather}

For the sample data in \ar{fig:imaging:singleCellNorm} it is
clear that there is low basal correlation between total DNA
and total Smad, though I have observed much
higher correlations in some datasets. I further note that this same rationale
could be extended to non-DNA references and other features
for cases in which cross-probe
correlations are expected to be meaningless.
For all datasets in this dissertation I
apply the total DNA regression-based correction when accurate
single-cell values are needed (such as for the calculation of mutual
information between single-cell distributions).

\subsubsection{Population-level error correction}

While the single-cell correction above can be used to remove
those measurement errors that are directly shared by each probe,
it is reasonable to expect that much
of measurement error is more random and so affects probes independently. Though it is
not possible to correct single-cell values for such
unpredictable error, we can apply correction at the
population level.

  \begin{figure}[!bt]
  \centering
  \includegraphics[width=4in]{FIGS/imaging/convolution.pdf}
  {\singlespacing
  \caption[ Estimating measurement error of the total intensity feature.]
            {An observed total intensity distribution $f_\text{observed}$
            is the result of convolution of the true distribution
            $f_\text{true}$ and the measurement error $f_\text{error}$.
            The error function for total nuclear intensity features
            can be estimated as having $\sigma_\text{error}\approx
            \sigma_\text{DNA}$.
            Cartoon, using distributions from \ar{fig:imaging:cycleFit}.}
  \label{fig:imaging:convolution}}
  \end{figure}

An observed feature distribution can be modeled as the convolution
of a true biological distribution with a measurement error
distribution centered on zero, $f_{true}*f_{error}$. In the case of $\log$-total DNA
in G1 cells, $f_{true}$
is a delta distribution, $\delta_{true}$, positioned at $\mu_{G1}$.
I can then take advantage of
the property that $\delta_{true}*f_{error}=f_{error}+\mu_{G1}$.
In other words, the G1 and G2 distributions are themselves
estimates of the measurement error distribution, if their
means are set to 0
\arp{fig:imaging:convolution}.

For distributions that are log-normal, as are the total
intensity features for all probes used in this dissertation,
I can also use the property that two convolved normal distributions
yield a third normal distribution with mean
$\mu_3=\mu_1+\mu_2$ and variance
$\sigma_3^2=\sigma_1^2+\sigma_2^2$.
Thus, I can estimate the ``true'' cell-to-cell
total nuclear intensity variation
for any probe by \ar{eq:imaging:decon}. There of course may
be other sources of error not compensated for in this way, and
such an approach is only defensible for the total intensity feature.
    %
    \begin{equation} \label{eq:imaging:decon}
    \sigma_\text{probe,true} = \sqrt{ \sigma_\text{probe,observed}^2-\sigma_\text{DNA,error}^2 }
    \end{equation}

What utility does this deconvolution have? Published
measurements of cell-to-cell
variability range from 15-30\% \cite{Sigal2006a},
and my own raw data show values within
this same range. However, these values include measurement error
that is not being compensated for. Thus,
cell-to-cell variability, as measured by microscopy, is
necessarily overestimated. The above reasoning shows that
this overestimation is simple to measure, as all that is
needed are the log-scale standard deviations of the G1/2
total DNA distributions and the standard deviations of
the total-probe values in question.

I have not performed a comprehensive
study of the size of this effect, though I have measured it
in several independent datasets for various markers. I find
that deconvolved total intensity distributions yield
$\sim10\%$ lower standard deviations and $\sim10\%$ higher
information content (measured by mutual information \cite{Cheong2011}).
These inaccuracies are small enough that I feel comfortable
stating that measurement errors in high-quality microscopy datasets
are much smaller
than true biological variation.

It is important to note
that this DNA-based deconvolution makes the assumption
that the sources of error are the same between Hoechst and other probes. It is
possible that nuclear antibody-based stains have a partially non-overlapping
set of error sources with small molecules like Hoechst.
One possibility to address this, then, would be to use a
non-specific secondary antibody in a free channel.
That non-specific antibody should
not be correlated with the specific antibody staining in other
channels, and so any measured correlations could be removed using the
same rationale as for DNA content-based correction. Unfortunately,
I have had limited success with this
approach, though non-specific secondary antibodies
do indeed show high single-cell correlation. The problem has been that they also
show unexpected properties, like differences in intracellular
localization, for which adequate controls are not clear.


\documentclass[11pt]{article}

\usepackage{framed}
\usepackage{float}
\usepackage{listings}
\usepackage{graphicx}

\begin{document}
	\title{\texttt{markov\_populator.py} Documentation}
	\date{\today}
	\maketitle

	\section{Introduction}
	This document serves to explain the algorithm behind how the script
	\texttt{markov\_populator.py} functions and how a user may use it to produce
	scenarios.  This script lives within the \texttt{GOSM} library and the
	proper installation of the most recent version of \texttt{GOSM} will
	correctly install this script. Note it may be necessary to run
	\texttt{python setup.py install} again if you do not have the most recent
	version installed.

	\section{Algorithm}
	This section will serve as a brief description how the script actually
	produces scenarios. It functions by first classifying given historic data on
	forecasts, actuals, and errors, each historic date-time into a specific
	state $S_i$. The state will generally just be an interval that a certain
	field is in. For example if we have that the error at a given time is 125,
	then the corresponding state might be $[100, 150]$. It might also be
	preferred to specify the state by quantiles in which case the state might be
	$[0.2,0.4]$. In the simplest case, the state will just be an error interval,
	but in separate tests, it may be useful to include the forecast interval or
	the forecast derivative interval in the state.
	Then given this mapping of date-times to states produces a
	transition matrix $A$ where $A_{ij}$ is the frequency with which state
	$S_j$ follows state $S_i$. Empirically we take this as the probability with
	which one state will proceed another.

	For each scenario on a specific day, we choose a start state for the Markov
	Chain. To do this, we categorize the first hour of that day based on the
	forecast into a certain state and pick a random sample from the historically
	observed states which fall into the same forecast category. Then using this
	start state, we transition from state to state based on the probabilities in
	the transition matrix until we have a state for all 24 hours of the day.

	Using this sequence of states, we then can convert this into an 24-error
	vector by sampling from an empirical distribution on the error interval of
	the state. This error is then added to the daily forecast which then is
	truncated at 0 and the capacity of the source to complete the scenario.

	\section{Input Files}
	This script only requires two input files, a data file and an options file.
	The data file is structured the same as is used for \texttt{prescient} and
	is described here for good measure.
	These files are described in turn.

	Once you have both of these, with an appropriately structured options file,
	the script can be executed with the command:
	\begin{verbatim}
		runner.py <options_file>
	\end{verbatim}
	where \texttt{<options\_file>} is replaced by the name of the file.

	\input{data.tex}

	\subsection{Options File}
	The options file specifies how you may configure behavior of the script to
	generate scenarios differently. Any option's description can be found using
	the command \texttt{python markov\_populator.py -h}. We discuss the most
	common options here. We begin by presenting the most basic
	example of an options file in Figure \ref{example1}.

	\begin{figure}[H]
	\begin{framed}
		\lstinputlisting{markov_example1.txt}
	\end{framed}
	\label{example1}
	\caption{A basic example of an options file}
	\end{figure}

	The first thing we note is that all options file used for executing this
	script must begin with the following line verbatim:
	\begin{verbatim}
		command/exec markov_populator.py
	\end{verbatim}
	This specifies to the script \texttt{runner.py} which program to actually
	run.

	Also contained in this script are required options for every run of
	\texttt{markov\_populator.py}. Namely, these are \texttt{--power-source}
	which specifies the data file which contains forecasts and actuals,
	\texttt{--start-date} and \texttt{--end-date} which specify the date range
	for which you would like to produce scenarios, and
	\texttt{--output-directory} which specifies where to store all the output
	files.

	In addition, this specifies the number of scenarios to generate with the
	\texttt{--number-of-scenarios} option. All other options are left to
	defaults. This means that the exact specification for what a state is
	will simply be which interval the recorded error is in. Put more precisely,
	the separate error states will be intervals of length 100 and the entire
	set is given by $\{[0, 100], [100, 200], \ldots\}$. This specific length
	can be adjusted with the \texttt{--error-bin-size} argument. Note that the
	limits of the intervals will always be multiples of this size option.

	An example where the user expresses more control over the what a state
	actually is can be seen in Figure \ref{example2}. Note that here, the user
	specifies that they would like to use quantile intervals instead of raw
	energy intervals with the \texttt{--use-error-quantiles} option. The user
	also specifies the exact width of the intervals with the
	\texttt{--error-quantile-size} option. This means the states will
	be quantile intervals $\{[0,0.1],[0.1,0.2],\ldots,[0.9,1]\}$. If the user
	wants more control over the exact quantiles that determine the state, then
	he may use the \texttt{explicit-error-quantiles} option with a string
	specifying the quantiles in the form \texttt{0,0.1,0.9,1}.

	\begin{figure}[H]
	\begin{framed}
		\lstinputlisting{markov_example2.txt}
	\end{framed}
	\caption{A more involved example of an options file}
	\label{example2}
	\end{figure}

	Note that the user also includes forecasts in the state description with
	the option \texttt{--consider-forecasts}. This just includes the interval
	the forecast is in (each of size 100) in the state information. After
	generating the state walk, this will not use the forecast state though
	to compute the scenario, only the error state. The forecast state is just
	used for computing the random walk itself. There are options
	\texttt{--forecast-bin-size}, \texttt{--use-forecast-quantiles},
	\texttt{--forecast-quantile-size}, \texttt{--explicit-forecast-quantiles}
	and similar options for derivatives (replace 'forecast' with 'derivative' in the option) for more control over what a state is.

	This options file also specifies the name of the source with \texttt{--source-name}. This has no effect on the computation and only affects names on
	the plots and data files generated.

	The option \texttt{--allow-multiprocessing} enables parallelism over the
	days of scenario generation.

	A final example of an options file is shown in Figure \ref{example3}. The
	only new option used here is the \texttt{--capacity} option which specifies
	an upper bound at which the scenarios will be truncated.

	\begin{figure}[H]
	\begin{framed}
		\lstinputlisting{markov_example3.txt}
	\end{framed}
	\caption{A third options file}
	\label{example3}
	\end{figure}

	\section{Output Files}
	For each day of scenario generation, inside the output directory a
	directory will be created which will
	contain two files. The first of which is a csv file with all produced
	scenarios and the second a plot of scenarios.

	Examples of each follow:

	\begin{figure}
		\begin{framed}
			\lstinputlisting{scenarios.csv}
		\end{framed}
	\end{figure}

	\begin{figure}
	\includegraphics{wind.png}
	\end{figure}

\end{document}


%
% Appendix A
%

\chapter{SVFit Mass}
\label{SVFit}

A study has been performed to improve the next iteration of the search for LFV decays of the Higgs boson. In this study, we have observed that using the ``Classic'' SVFit (Sensitivity Volume Fit) algorithm can help improve the signal resolution compared to the collinear mass resolution~\cite{Bianchini:2016yrt}. The ``Classic'' SVFit algorithm has been developed to reconstruct the mass of a Higgs boson decaying into two tau leptons \mtt and is an improved version of the SVFit algorithm. The SVfit algorithm~\cite{Bianchini:2014vza} has been used to reconstruct the Higgs boson mass in the SM \Htt analysis and searches for further Higgs bosons predicted by models beyond the SM performed by the CMS collaboration during LHC Run 1. Compared to alternative mass variables, the SVfit algorithm's usage has improved the SM \Htt analysis's sensitivity for measuring the signal rate by $\approx 40\%$~\cite{Chatrchyan:2014nva}. The improvement in sensitivity corresponds to a gain by about a factor of two in the integrated luminosity of the analyzed dataset.

The ``Classic'' SVFit algorithm uses a likelihood function of arbitrary normalization. The algorithm allows for the reconstruction of not only the mass \mtt of the tau lepton pair but any kinematic function of the two tau leptons, including the \pt, $\eta$, and $\phi$ and transverse mass of the tau lepton pair. A further improvement concerns the algorithm's extension to account for the experimental resolution on the reconstruction of hadrons produced in the tau decays. The ``Classic'' SVFit algorithm was modified to reconstruct the mass of the Higgs boson decaying into LFV decay modes \mlt. A brief description of the algorithm is given in the following paragraphs.

\section{``Classic'' SVfit algorithm}
As only one of the lepton from an LFV Higgs decay is a tau, it was modified so that the matrix element of the probability density function defined can reconstruct the Higgs mass \mlt. The phase space of the tau decay products along with the angles $\theta_{inv}$ and $\phi_{inv}$ are illustrated in Figure~\ref{fig:sv}. The $\bp_{inv}$ vector is located on the surface of a cone, the axis of which is given by the $\bp_{vis}$ vector. The variable $\phi_{inv}$ represents the angle of rotation, in a counter-clockwise direction, around the cone's axis. The value $\phi_{inv} = 0$ is chosen to correspond to the case that the $\bp_{inv}$ vector is within the plane spanned by the $\bp_{vis}$ vector and the beam direction.

\begin{equation}
  \begin{aligned}
    \mathcal{L}\left(\bp^{\text{vis}} ; p_{\text{x}}^{\text{rec}}, p_{\text{y}}^{\text{rec}} \mid \mh \right)=\frac{32 \pi^{4}}{s} \int \text{d} \mh \text{d} \Phi_{n} \left|\text{BW}_{\Pgt}\right|^{2} \left|\mathcal{M}_{\Pgt \rightarrow \ldots}(\tilde{\bp})\right|^{2} \\
    W\left(\bp^{\text{vis}} \mid \hat{\bp}^{\text{vis}}\right) W_{\text{rec}}\left(p_{\text{x}}^{\text{rec}}, p_{\text{y}}^{\text{rec}} \mid \hat{p}_{\text{x}}^{\text{rec}}, \hat{p}_{\text{y}}^{\text{rec}} \right) \mathcal{F}(\bp)
  \end{aligned}
\end{equation}

\begin{figure*}[!htpb]
  \centering
  \includegraphics[width=0.9\textwidth]{plots/appendix/SV.png}
  \caption{Illustration of the variables $\theta_{inv}$ and $\phi_{inv}$ that specify the orientation of the $\bp_{inv}$ vector relative to the momentum vector $\bp_{vis}$ of the visible tau decay products.}
  \label{fig:sv}
\end{figure*}

The function $\mathcal{F}(\bp)$ in the integrand may be an arbitrary function of the momenta of the prompt and tau leptons. The integral is evaluated numerically, using a custom implementation of the Markov chain MC integration method with the Metropolis-Hastings algorithm~\cite{Hastings:1970aa}. The actual value $\mathcal{L}(y)$ of the integral is irrelevant. The reconstruction of the mass \mlt of the prompt and tau lepton pair is based on choosing:
%
$\mathcal{F}(\bp) \equiv \left(\hat{E}_{\ell} + \hat{E}_{\Pgt}\right)^{2} - \left(\left(\hat{p}_{\text{x}}^{\ell}+\hat{p}_{\text{x}}^{\Pgt}\right)^{2}+\left(\hat{p}_{\text{y}}^{\ell}+\hat{p}_{\text{y}}^{\Pgt}\right)^{2}+\left(\hat{p}_{\text{z}}^{\ell}+\hat{p}_{\text{z}}^{\Pgt}\right)^{2}\right)$,
%
recording the values of $\mathcal{F}(\bp)$ for each evaluation of the integrand by the Markov chain and taking the median of the series of $\mathcal{F}(\bp)$ values as the best estimate \mlt for the mass of the prompt and tau lepton pair in a given event. The total number of evaluations of the integrand referred to as Markov chain ``states'', amounts to 100000 per event. The first 10000 evaluations of the integrand are used as a ``burn-in'' period and are excluded from the median's computation.

Figure~\ref{fig:svfit} shows the collinear mass and SVFit mass distributions. The distributions are fit with a double Gaussian, and the goodness of fit as tested from $\chi^2/\text{ndof}$ is close to one, suggesting that it is a good fit. The full width at half maximum is used for inferring the signal resolution, and it has a value of 38.88~\GeV for collinear mass, while for SVFit mass, the value is 30.90~\GeV. This corresponds to a 20\% improvement in signal resolution. The collinear mass and SVFit mass are peaking close to the Higgs mass of 125~\GeV. The collinear mass has a higher mean of $\sim 129 \GeV$ due to its larger tail, while SVFit mass has a mean of $\sim 117 \GeV$ due to it's smaller tail distribution.

\begin{figure*}[!htpb]
  \centering
  \includegraphics[width=0.45\textwidth]{plots/appendix/CollMass.png}
  \includegraphics[width=0.45\textwidth]{plots/appendix/SVFit.png}
  \caption{Collinear mass vs SVFit mass.}
  \label{fig:svfit}
\end{figure*}

This study has shown that mass resolution is significantly improved by using the SVFit mass instead of the collinear mass, and it can give much more sensitive results for the \Hmt and \Het searches. A future search using the full Run 3 data can benefit from this improved sensitivity, and the SVFit can easily be extended to be used for heavy Higgs boson searches. The only disadvantage that was noted during the study was from the computing point of view. It takes an order of magnitude longer time to compute the SVFit mass than the collinear mass, which has to be investigated and improved in any future analysis.


%!TEX root = ../../main.tex
\subsection{Supervised deep anomaly detection}
\label{sec:supervisedDAD}
 Supervised anomaly detection techniques are superior in performance compared to unsupervised anomaly detection techniques  since these techniques use  labeled samples.~\cite{gornitz2013toward}.  Supervised anomaly detection learns the separating boundary from a set of annotated data instances (training) and then, classify a test instance into  either normal or anomalous classes with the learned model (testing).\\
\textbf{Assumptions :}
Deep supervised learning methods depend on separating data classes whereas unsupervised
techniques focus on explaining and understanding the characteristics of data. Multi-class classification based anomaly detection techniques assume that the training data contains labeled instances of  multiple normal classes ~\cite{shilton2013combined,jumutc2014multi,kim2015deep,erfani2017shared}. Multi-class anomaly detection techniques learn a classifier to distinguish between anomalous class from the rest of the classes. In general, supervised deep learning-based classification schemes for anomaly detection have two sub-networks, a feature extraction network followed by a classifier network. Deep models require extremely large number of training samples (in the order of thousands or millions) to effectively learn feature representations to discriminate various class instances. Due to, lack of availability of clean data labels supervised deep anomaly detection techniques are not so popular as semi-supervised and unsupervised methods.

\textbf{Computational Complexity :}
The computational complexity of deep supervised  anomaly detection methods based techniques depends on the  input data dimension and the number of hidden layers trained using back-propagation algorithm. High dimensional data tend to have more hidden layers to ensure meaning-full hierarchical learning of input features.The computational complexity also increases  linearly with the number of hidden layers and require greater model training and update time.

\textbf{Advantages and Disadvantages :}
The advantages of supervised DAD techniques are as follows:
\begin{itemize}
\item Supervised DAD methods are more accurate than semi-supervised and unsupervised models.
\item The testing phase of classification based techniques is fast since each test instance
needs to be compared against the pre-computed model.
\end{itemize}
The disadvantages of Supervised DAD techniques are as follows:
\begin{itemize}
\item  Multi-class supervised techniques require accurate labels for various normal classes and anomalous instances, which is often not available.
\item Deep supervised techniques fail to separate normal from anomalous data , if the feature space is highly complex and non-linear.
\end{itemize}


% This LaTeX was auto-generated from an M-file by MATLAB.
% To make changes, update the M-file and republish this document.

\subsection*{draw\_unicycle.m}

\begin{par}
\textbf{Summary:} Draw the unicycle with cost and applied torques
\end{par} \vspace{1em}

\begin{verbatim}  function draw_unicycle(latent, plant,t2,cost,text1, text2)\end{verbatim}
    \begin{par}
\textbf{Input arguments:}
\end{par} \vspace{1em}

\begin{lstlisting}
%		latent     state of the unicycle (including the torques)
%   plant      plant structure
%     .dt      sampling time
%     .dyno    state indices that are passed ont the cost function
%   t2         supersampling frequency (in case you want smoother plots)
%   cost       cost structure
%     .fcn     function handle (it is assumed to use saturating cost)
%     .<>      other fields that are passed to cost
%   text1      (optional) text field 1
%   text2      (optional) text field 2
%
%
% Copyright (C) 2008-2013 by
% Marc Deisenroth, Andrew McHutchon, Joe Hall, and Carl Edward Rasmussen.
%
% Last modified: 2013-04-04

function draw_unicycle(latent,plant,t2,cost,text1, text2)
\end{lstlisting}

\subsection*{Code}

\begin{lstlisting}
clf; set(gca,'FontSize',16);

t1 = plant.dt;

rw =  0.225; % wheel radius
rf =  0.54;  % frame center of mass to wheel
rt =  0.27;  % frame centre of mass to turntable
rr =  rf+rt;  % distance wheel to turntable

M = 24; MM = 2*pi*(0:M)/M;
RR = ['r-';'r-';'r-';'k-';'b-';'b-';'b-'];
ii = 10000;

qq = latent;

clear q;
xi = t1*(0:size(qq,1)-1); xn = 0:t2:(size(qq,1)-1)*t1;
for i = 1:size(qq,2), q(:,i) = interp1(xi,qq(:,i),xn); end

for i=1:size(q,1)
  x     = q(i,10);
  y     = q(i,11);
  theta = q(i,14);
  phi   = q(i,15);
  psiw  = -q(i,16);
  psif  = q(i,17);
  psit  = q(i,18);

  A = [  cos(phi)             sin(phi)              0
    -sin(phi)*cos(theta)  cos(phi)*cos(theta)  -sin(theta)
    -sin(phi)*sin(theta)  cos(phi)*sin(theta)   cos(theta) ]';

  r = rw*[cos(psiw+MM); zeros(1,M+1); sin(psiw+MM)+1];
  R{1} = bsxfun(@plus,A*r,[x; y; 0]);
  r = rw*[cos(psiw) -cos(psiw); 0 0; sin(psiw)+1 -sin(psiw)+1];
  R{2} = bsxfun(@plus,A*r,[x; y; 0]);
  r = rw*[sin(psiw) -sin(psiw); 0 0; -cos(psiw)+1 cos(psiw)+1];
  R{3} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [0 rr*sin(psif); 0 0; rw rw+rr*cos(psif)];
  R{4} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [rr*sin(psif)+rw*cos(psif)*cos(psit+MM); rw*sin(psit+MM); rw+rr*cos(psif)-rw*sin(psif)*cos(psit+MM)];
  R{5} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [rr*sin(psif)+rw*cos(psif)*cos(psit) rr*sin(psif)-rw* ...
    cos(psif)*cos(psit); rw*sin(psit) -rw*sin(psit); rw+rr* ...
    cos(psif)-rw*sin(psif)*cos(psit) rw+rr*cos(psif)+rw* ...
    sin(psif)*cos(psit)];
  R{6} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [rr*sin(psif)+rw*cos(psif)*sin(psit) rr*sin(psif)-rw* ...
    cos(psif)*sin(psit); -rw*cos(psit) rw*cos(psit); rw+rr* ...
    cos(psif)-rw*sin(psif)*sin(psit) rw+rr*cos(psif)+rw* ...
    sin(psif)*sin(psit)];
  R{7} = bsxfun(@plus,A*r,[x; y; 0]);
  hold off
  aa = linspace(0,2*pi,201); plot3(2*sin(aa),2*cos(aa),0*aa,'k:','LineWidth',2);
  hold on

  r = A*[0; 0; rw] + [x; y; 0];
  P = [r R{1}(:,1:M/4+1) r]; fill3(P(1,:),P(2,:),P(3,:),'r','EdgeColor','none');
  P = [r R{1}(:,M/2+1:3*M/4+1) r]; fill3(P(1,:),P(2,:),P(3,:),'r','EdgeColor','none');

  r = A*[rr*sin(psif); 0; rw+rr*cos(psif) ] + [x; y; 0];
  P = [r R{5}(:,1:M/4+1) r]; fill3(P(1,:),P(2,:),P(3,:),'b','EdgeColor','none');
  P = [r R{5}(:,M/2+1:3*M/4+1) r]; fill3(P(1,:),P(2,:),P(3,:),'b','EdgeColor','none');

  for j = [1 4 5];
    plot3(R{j}(1,:),R{j}(2,:),R{j}(3,:),RR(j,:),'LineWidth',2)
  end
  axis equal; axis([-2 2 -2 2 0 1.5]);
  xlabel 'x [m]';
  ylabel 'y [m]';
  grid on

  % draw controls:
  ut  = q(i,end-1);
  uw  = q(i,end);
  L = cost.fcn(cost,q(i,plant.dyno)',zeros(length(plant.dyno)));

  utM = 10;
  uwM = 50;

  oo = [4 -3.07 0]/6.4; o1 = [-0.5 2 2.0]; o2 = [-0.5 2 1.6]; o3 = [-0.5 2 1.2];
  o0 = 1.5*ut/utM;
  plot3([o1(1) o1(1)+o0*oo(1)],[o1(2) o1(2)+o0*oo(2)],[o1(3) o1(3)+o0*oo(3)],'b','LineWidth',5)
  plot3([o1(1)-1.5*oo(1) o1(1)+1.5*oo(1) o1(1)+1.5*oo(1) o1(1)-1.5*oo(1) o1(1)-1.5*oo(1)],...
    [o1(2)-1.5*oo(2) o1(2)+1.5*oo(2) o1(2)+1.5*oo(2) o1(2)-1.5*oo(2) o1(2)-1.5*oo(2)],...
    [o1(3)+0.04 o1(3)+0.04 o1(3)-0.04 o1(3)-0.04 o1(3)+0.04], 'b');
  plot3([-0.5 -0.5],[2 2],o1(3)+[-0.06 0.06],'b');
  o0 = 1.5*uw/uwM;
  plot3([o2(1) o2(1)+o0*oo(1)],[o2(2) o2(2)+o0*oo(2)],[o2(3) o2(3)+o0*oo(3)],'r','LineWidth',5)
  plot3([o2(1)-1.5*oo(1) o2(1)+1.5*oo(1) o2(1)+1.5*oo(1) o2(1)-1.5*oo(1) o2(1)-1.5*oo(1)],...
    [o2(2)-1.5*oo(2) o2(2)+1.5*oo(2) o2(2)+1.5*oo(2) o2(2)-1.5*oo(2) o2(2)-1.5*oo(2)],...
    [o2(3)+0.04 o2(3)+0.04 o2(3)-0.04 o2(3)-0.04 o2(3)+0.04], 'r');
  plot3([-0.5 -0.5],[2 2],o2(3)+[-0.06 0.06],'r');

  o0 = 3*L-1.5;
  plot3([o3(1)-1.5*oo(1) o3(1)+o0*oo(1)],[o3(2)-1.5*oo(2) o3(2)+o0*oo(2)],[o3(3)-1.5*oo(3) o3(3)+o0*oo(3)],'k','LineWidth',5)
  plot3([o3(1)-1.5*oo(1) o3(1)+1.5*oo(1) o3(1)+1.5*oo(1) o3(1)-1.5*oo(1) o3(1)-1.5*oo(1)],...
    [o3(2)-1.5*oo(2) o3(2)+1.5*oo(2) o3(2)+1.5*oo(2) o3(2)-1.5*oo(2) o3(2)-1.5*oo(2)],...
    [o3(3)+0.04 o3(3)+0.04 o3(3)-0.04 o3(3)-0.04 o3(3)+0.04], 'k');

  text(-0.5-1.5*oo(1), 2-1.5*oo(2), 2.2,'Disc torque    max \pm 10 Nm','Color','b');
  text(-0.5-1.5*oo(1), 2-1.5*oo(2), 1.8,'Wheel torque max \pm 50 Nm','Color','r');
  text(-0.5-1.5*oo(1), 2-1.5*oo(2), 1.4,'Instantaneous Cost','Color','k');

  if nargin > 4
    text(2,1,1.8,text1);
    text(2,1,1.4,text2);
  end

  drawnow
%   pause(plant.dt/2);
end
\end{lstlisting}


\subsection{Elasticity of intertemporal substitution}


\section{Selection Method}
To generate a new population, specific genetic operators are applied to members of an existing population with specific probabilities. These operators are explained in more detail in section \ref{sec:genetic_operators}. However, before these operators can be applied, the members of the existing population to which they need to be applied must be determined - hence, a selection method is necessary.

For this assignment, tournament selection \cite{miller1995genetic} was used as the selection method for all genetic operators. This entails selecting \emph{T} individuals entirely at random from the existing population. Then, from this set of individuals (ie. the \emph{tournament}) the fittest individual is selected. After some initial test runs the size, \emph{T}, of the tournament used was 48. On average, this tournament size produced the best balance between genetic diversity and convergence.

In the cases where genetic operators required more than one individual from the existing population, the tournament selection method was simply reapplied to select each individual.