\subsection{Experiments}

\subsubsection{MNIST}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MNIST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%MNIST%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\textbf{Two Layer, opti=nadam, init=hessian uniform}
%\input{mnist_five_2_adg_heu.tex}
\noindent This section provides comprehensive study on the choice of mini batch size, its relationship with number of classes in classification task.

\renewcommand{\legdnwonoptinit}{1xc}
\renewcommand{\legdnwtwoptinit}{2xc}
\renewcommand{\legdnwfooptinit}{4xc}
\renewcommand{\legdnwsxoptinit}{6xc}
\renewcommand{\legdnwegoptinit}{8xc}
\renewcommand{\legdnwhnoptinit}{10xc}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_nadam_he_u.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_nadam_he_u.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_nadam_he_u.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_nadam_he_u.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_nadam_he_u.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_nadam_he_u.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=nadam, init=glorot uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_nadam_gl_u.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_nadam_gl_u.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_nadam_gl_u.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_nadam_gl_u.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_nadam_gl_u.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_nadam_gl_u.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=nadam, init=uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_nadam_unif.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_nadam_unif.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_nadam_unif.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_nadam_unif.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_nadam_unif.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_nadam_unif.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=sgd with momentum, init=hessian uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_SGD_he_u.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_SGD_he_u.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_SGD_he_u.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_SGD_he_u.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_SGD_he_u.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_SGD_he_u.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=sgd with momentum, init=uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_SGD_unif.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_SGD_unif.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_SGD_unif.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_SGD_unif.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_SGD_unif.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_SGD_unif.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Three Layer, opti=sgd with momentum, init=uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_10B_0E_SGD_he_u.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_20B_0E_SGD_he_u.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_40B_0E_SGD_he_u.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_60B_0E_SGD_he_u.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_80B_0E_SGD_he_u.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/mnist_TwoLayer_100B_0E_SGD_he_u.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.99}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\subsubsection{CIFAR10}

\textbf{Three Layer, opti=adagrad, init=uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_10B_0E_adagrad_unif.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_20B_0E_adagrad_unif.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_40B_0E_adagrad_unif.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_60B_0E_adagrad_unif.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_80B_0E_adagrad_unif.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_100B_0E_adagrad_unif.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Three Layer, opti=adagrad, init=glorot normal}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_10B_0E_adagrad_gl_n.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_20B_0E_adagrad_gl_n.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_40B_0E_adagrad_gl_n.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_60B_0E_adagrad_gl_n.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_80B_0E_adagrad_gl_n.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_ThreeLayer_100B_0E_adagrad_gl_n.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=adagrad, init=normal}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_10B_0E_adagrad_norm.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_20B_0E_adagrad_norm.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_40B_0E_adagrad_norm.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_60B_0E_adagrad_norm.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_80B_0E_adagrad_norm.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar10_TwoLayer_100B_0E_adagrad_norm.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\subsubsection{CIFAR100}
\textbf{Two Layer, opti=adagrad, init=hessian uniform}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_100B_0E_adagrad_he_u.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_200B_0E_adagrad_he_u.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_400B_0E_adagrad_he_u.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_600B_0E_adagrad_he_u.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_800B_0E_adagrad_he_u.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_1000B_0E_adagrad_he_u.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

\textbf{Two Layer, opti=sgd with nesterov momentum, init=glorot normal}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_100B_0E_SGD_gl_n.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_200B_0E_SGD_gl_n.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_400B_0E_SGD_gl_n.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_600B_0E_SGD_gl_n.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_800B_0E_SGD_gl_n.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_1000B_0E_SGD_gl_n.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEW %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\textbf{Two Layer, opti=nadam, init=glorot normal}

\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_100B_0E_nadam_gl_n.csv}\dnwonoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_200B_0E_nadam_gl_n.csv}\dnwtwoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_400B_0E_nadam_gl_n.csv}\dnwfooptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_600B_0E_nadam_gl_n.csv}\dnwsxoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_800B_0E_nadam_gl_n.csv}\dnwegoptinit
\pgfplotstableread[col sep = comma]{ResultsNormal/cifar100_TwoLayer_1000B_0E_nadam_gl_n.csv}\dnwhnoptinit
\renewcommand{\initerr}{Error for initial epochs}
\renewcommand{\initacc}{Accuracy for initial epcohs}
\renewcommand{\lateerr}{Error for later epochs}
\renewcommand{\lateacc}{Accuracy for later epochs}
\renewcommand{\boxerr}{Error variation}
\renewcommand{\boxacc}{Accuracy variation}

\renewcommand{\initfigtitle}{Different batch results for starting 15 epochs }
\renewcommand{\initcaption}{The initial epochs seen shows that 2x batch size(2x batch size=2*number of classes) started with the lowest error(a) as well as best accuracy(b), surprisingly 8x batch size started quite well inspite of less network updates in an epoch.
	Then till 15 epochs it is mixed results and no batch size cannot be singled out as a best performer.}

\renewcommand{\latefigtitle}{Different batch results for later epochs}
\renewcommand{\latecaption}{8x started well but in late epochs it could not sustain the start, Another good perfromance is shown by 10x which has reached quite good accuracy but its error become high and entered overfitting regime, 2x performance in error as well as accuracy side remain quite robust.}

\renewcommand{\boxerraccfigtitle}{accuracy and error plot for full training epochs}
\renewcommand{\boxerracccaption}{4x perform quite well as error remain with in small range, but on high side, 16x and 18x have low error regime as their minimum error but their variance range is on higher side, 10x shows quite good accuracy and has its maximum value is maximum among all other batch sizes, while its error had high variance than 2x. 2x is consistent in both low error with less vairance as well as accuracy. Low error makes 2x a robust classifier.}

\renewcommand{\trtscaption}{2x shows quite good performance}
\renewcommand	{\ymaxlim}{0.65}

\input{batch_init_epochsnew.tex}
\input{batch_box_plotsnew.tex}
\input{batch_late_epochsnew.tex}
%\input{batch_train_test_plots.tex}

\pgfplotstableclear{\dnwonoptinit}
\pgfplotstableclear{\dnwtwoptinit}
\pgfplotstableclear{\dnwfooptinit}
\pgfplotstableclear{\dnwsxoptinit}
\pgfplotstableclear{\dnwegoptinit}
\pgfplotstableclear{\dnwhnoptinit}

\relax


\chapter{Export Formats}
\label{chap:exports}

\section{CSV}

Exports waveform data to a comma-separated-value file.

The first two columns of the generated file contain the X and Y values of the timebase reference channel (the channel
selected on the first page of the export wizard). Each sample in this channel maps directly to a row in the generated
CSV. Any waveform-type channel can be selected for export, however eye patterns, spectrograms, and other 2D density
plots cannot be used.

The second page of the wizard allows additional channels to be added to the export. Each channel maps to an additional
column in the generated CSV. The wizard will only allow channels with compatible X axis units; for example if the first
channe has X axis units of time then it will not be possible to add a channel with X axis units of frequency to the
same CSV.

Since the first channel serves as a timebase reference, all subsequent channels in the exported data share the same
timestamps as the first channel. If the channels are not sampled at identical times, the following resampling
algorithms are used for additional channels:

\begin{itemize}
\item Analog data: linear interpolation
\item Digital data: nearest neighbor
\item Protocol data: No interpolation. Protocol events are displayed as close as possible to their start timestamp;
remaining cells are blank.
\end{itemize}

\section{Touchstone}

Exports S-parameter data to a Touchstone 1.1 file with an arbitrary number of ports.

The exporter expects waveform data in mag/angle format. Magnitude channels must have X axis units of Hz and Y axis
units of dB; angle channels must have X axis units of Hz and Y axis units of degrees. While input data need not be
\emph{uniformly} sampled, all input channels must be sampled at the same set of frequencies.

Frequency units for the generated file can be selected as Hz, kHz, MHz, or GHz.

The export wizard allows mag/angle, dB mag/angle, or real/imaginary format to be selected. However, as of this writing
only mag/angle is actually implemented. Selecting any other format will result in a warning on the console; the file
will be generated in mag/angle format regardless of the user's choice.


\chapter{Predictions}

All we did so far is predict what we already knew - the tale type of each text. We had the right answers already in our ATU Topic column. But what if we don't have this information? Could we perhaps predict tale types for unlabelled texts?

Open a new \widget{Corpus} widget and load the \emph{andersen.tab} corpus. Here we have three tales from H. C. Andersen. Inspect them in \widget{Corpus Viewer} and try to guess the tale type yourself.

\vspace{-0.2cm}
\begin{figure*}[h]
  \centering
  \includegraphics[width=0.8\linewidth]{workflow.png}%
  \caption{$\;$}
\end{figure*}
\vspace{-0.3cm}

Now connect them to \widget{Predictions} the same way as before - with \widget{Logistic Regression} passing the constructed model and the new Corpus widget passing the data for prediction. Do not forget to copy-paste the preprocessing widgets, namely \widget{Preprocess Text} and \widget{Bag of Words} to repeat data preparation.

Logistic Regression predicted all the tales to be Tales of Magic.\marginnote{Hint: Think about what kind of data the model was trained on and what were the most important words for the model.} The Ugly Duckling as a Tale of Magic? Sounds strange! Why do you think this happens?

\vspace{-0.2cm}
\begin{figure*}[h]
  \centering
  \includegraphics[width=\linewidth]{predictions.png}%
  \caption{$\;$}
\end{figure*}
\vspace{-0.3cm}


\section{Performance}
\label{sec:result}
We have tested our approaches under various parameters, based on a corpus provided by teacher Xu.
For detailed description of the corpus, please see former report.

All the tests in this section have been conducted serval times
(depending on computation cost, vary from 10 to 30)
with random selected training and testing speakers.
The average over these tests are considered as confidential result.

\subsection{Efficiency Test of our GMM}
We have extensively examined the efficiency of our implementation of GMM
compared to scikit-learn version. Test is conducted using real MFCC data with
13 dimensions, 20ms frame length. We consider the scenario when training a UBM with 256 mixtures.
We examine the time used for ten iteration.  For comparable results, we diabled
the K-means initialization process of both scikit-learn GMM implementation and
ours. Time used for ten iterations under different data size and concurrency
is recorded.

\begin{figure}[!ht]
	\begin{minipage}{0.48\linewidth}
		\centering
		\includegraphics[width=\linewidth]{img/time-comp.pdf}
		\caption{Comparison on efficiency\label{fig:gmm_efficiency}}
	\end{minipage}
	\hfill
	\begin{minipage}{0.48\linewidth}
		\centering
		\includegraphics[width=\linewidth]{img/time-comp-small.pdf}
		\caption{Comparison on efficiency when number of MFCC features is small\label{fig:gmm_efficiency_small}}
	\end{minipage}
\end{figure}

From \figref{gmm_efficiency}, we can immediately infer that our method
is much-much more efficient than the widely used version of GMM provided
by scikit-learn when the data size grows sufficiently large.

We shall analyze in two aspect:
\begin{itemize}
    \item No concurrency

             When the number of MFCC features grows sufficiently large, our method
                shows great improvement. When training 512,000 features, our method
                is 5 times faster than comparing method.
    \item With concurrency \\
        Our method shows considerable concurrency scalability that the running time
        is approximately lineary to the number of cores using.

        When using 8-cores, our method is \textbf{$19$ times} faster than comparing
        method.
\end{itemize}

\subsection{Change in MFCC Parameters}
The following tests reveal the effect of MFCC parameters on the final accuracy.
The tests were all performed on ``Style-Reading'' corpus with 40 speakers, each with 20 seconds for enrollment
and 5 seconds for recognition.
\begin{enumerate}
  \item Different Number of Cepstrums
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.7\textwidth]{img/mfcc-nceps.pdf}
    \end{figure}

  \item Different Number of Filterbanks
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.7\textwidth]{img/mfcc-nfilter.pdf}
    \end{figure}

  \item Different Size of Frame
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.7\textwidth]{img/mfcc-frame-len.pdf}
    \end{figure}
\end{enumerate}

\subsection{Change in LPC Parameters}
The following tests display the effect of LPC parameters on the final accuracy.
The tests were performed on ``Style-Reading'' with 40 speakers, each with 20 seconds for enrollment
and 5 seconds for recognition.
\begin{enumerate}
  \item Different Number of Coefficient
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.7\textwidth]{img/lpc-nceps.pdf}
    \end{figure}

  \item Different Size of Frame
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.7\textwidth]{img/lpc-frame-len.pdf}
    \end{figure}
\end{enumerate}

\subsection{Change in GMM Components}

We experimented on the effect of GMM Components. We found that the number of components
have slight effect on the accuracy, but a GMM with higher order might take
significantly longer time to train. Therefore we still use GMM with 32 components in our system.

\begin{figure}[H]
  \centering
  \includegraphics[width=0.7\textwidth]{img/nmixture.pdf}
\end{figure}

\subsection{Different GMM Algorithms}
We compare our implementation of GMM to GMM in scikits-learn.

The configurations of the test is as followed:
\begin{itemize}
    \item Only MFCC: frame size is $20 ms $, 19 cepstrums, 40 filterbanks
	\item Number of mixtures is set to 32, the optimal number we found previously
	\item GMM from scikit-learn, compared to our GMM.
	\item 30s training utterance and 5s test utterance
	\item 100 sampled test utterance for each user
\end{itemize}

\begin{figure}[!ht]
	\centering
	\includegraphics[width=\linewidth]{img/gmm-compare.pdf}
	\caption{Accuracy curve for two GMM}
\end{figure}

From this graph we could see that, our GMM performs better than GMM from scikit-learn in general.
Due to the random selection of test data,
the variance of the test can be high when the number of speakers is small,
as is also the case in the next experiment. But this result still shows that
our optimization on GMM takes effect.

\subsection{Accuracy Curve on Different Number of Speakers}

An apparent trade-off in speaker recognition task is the number of speakers
enrolled and the accuracy on recognization.
Also, the duration of signal for enrollment and test can have significant effect on the accuracy.
We've conducted test using well-tuned parameters for feature extraction as well as GMM, on dataset with
various number of people and with various test duration.

The configurations of this experiment is as followed:
\begin{itemize}
  \item Database: ``Style-Reading''
  \item MFCC: frame size is $32 ms $, 19 cepstrums, 55 filterbanks
  \item LPC: frame size is $32 ms $, 15 coefficients
  \item GMM from scikit-learn, number of mixtures is 32
  \item 20s utterance for enrollment
  \item 50 sampled test utterance for each user
\end{itemize}

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{img/performance.pdf}
\end{figure}

We also conducted experiments on different style of corpus.
The configurations of this experiment is as followed:
\begin{itemize}
  \item MFCC: frame size is $32 ms $, 15 cepstrums, 55 filterbanks
  \item LPC: frame size is $32 ms $, 23 coefficients
  \item GMM from scikit-learn, number of mixtures is 32
  \item 20s utterance for enrollment
  \item 50 sampled test utterance for each user
\end{itemize}

The result is shown below. Note that each point in the graph is an
average value of 20 independent test with random sampled speakers .

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{img/reading.pdf}
\end{figure}
\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{img/spont.pdf}
\end{figure}

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{img/whisper.pdf}
\end{figure}

\subsection{CRBM Performance Test}
We also tested RBM using following configuration:
\begin{itemize}
  \item MFCC: frame size is $32 ms $, 15 cepstrums, 55 filterbanks
  \item LPC: frame size is $32 ms $, 23 coefficients
  \item CRBM with 32 hidden units.
  \item 50 sampled test utterance for each user
  \item 5s test utterance
\end{itemize}

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{img/crbm.pdf}
  \caption{\label{crbmresult}}
\end{figure}

Result shown in \figref{crbmresult} indicates that, although CRBM have
generic modeling ability, applying it on signal features does not fit
our expectation. To achieve similar results, the training utterance should
be twice as large as GMM used. Further investigation on using RBM to
process signal features need to be conducted.


%\documentclass[fleqn]{article}
%\usepackage{graphicx}
%\usepackage{here}
%\usepackage{amsmath}
%\textwidth=15.0cm
%\textheight=22.0cm
%\topmargin=-1cm
%\oddsidemargin=-0.3cm
%\evensidemargin=-0.3cm
%
%
%%packages
%\usepackage{amsmath}
%\usepackage{cite}
%\usepackage[toc,page]{appendix}
%\usepackage{fancyvrb}
%\usepackage{tikz}
%\usepackage{multicol}
%\usepackage{framed}
%\usepackage{pgfplots}
%\usepackage{fixltx2e}
%\usepackage{subfigure}
%\usepackage{lscape}
%\usepackage{enumitem}
%\usepackage{multirow}
%\usepackage{color}
%\usepackage{xcolor}
%\usepackage{comment}
%\usepackage{changes}
%\renewcommand*\descriptionlabel[1]{\hspace\leftmargin$#1$}
%
%%tikz labraries
%\usetikzlibrary{matrix}
%\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{positioning}
%\usetikzlibrary{calc}
%\usetikzlibrary{shapes,arrows, chains}
%\usetikzlibrary{intersections}
%\usetikzlibrary{decorations.markings}
%\usetikzlibrary{calc,intersections}
%\usetikzlibrary{patterns}
%
%
%\makeatletter
%\def\mathcolor#1#{\@mathcolor{#1}}
%\def\@mathcolor#1#2#3{%
%  \protect\leavevmode
%  \begingroup
%    \color#1{#2}#3%
%  \endgroup
%}
%\makeatother
%
%%##### DEFINE YOUR NAME #########################
%\definechangesauthor[color=blue,name={Arpad Rozsas}]{AR}
%\definechangesauthor[color=red,name={Nadieh Meinen}]{NEM}
%%###########################################
%
%\begin{document}

\section{Conclusion}\label{conclusions}
In this research an assessment procedure is developed which is able to determine the structural reliability of wind-loaded fa\c{c}ade elements in terms of the failure probability. The assessment procedure accounts for the uncertainties in the extreme wind speeds, the extreme pressure coefficients, the factor correcting for terrain roughness, the structural resistance and the uncertainties in the wind-load model as such. For the modeling of the extreme wind speeds and the extreme pressure coefficients location-specific wind speed and pressure coefficient measurements are being used. The assessment procedure accounts explicitly for the effects of wind-directionality. \\
\\
In order to show its potential, the assessment procedure is applied on a case-study. It is found that the structural reliability of wind-loaded fa\c{c}ade elements is strongly dependent on the building orientation, differing in failure probabilities of several orders of magnitude. Additionally it is found that the failure probability is almost fully determined by the governing incident wind-directions only; the contribution of all other incident wind-directions were found to be negligibly small. \\
\\
For the future developments of the assessment procedure it is recommended to further investigate appropriate statistical methods for the modeling of the extreme wind speeds and the extreme pressure coefficients, to additionally account for the sampling uncertainties in the modeling of the extreme wind speeds and the extreme pressure coefficients, to use realistic resistance models for different failure mechanisms and different material types and, finally, to further investigate the probabilistic description of the roughness factor and the model uncertainty factor.

%\end{document}


\section{State}
\subsection{Motivation}
\begin{frame}[fragile]{State Monad}{Motivation}
  \begin{columns}[t]
    \begin{column}{.55\textwidth}
      {\tiny\inputminted[escapeinside=\\`\\`,breaklines,breakafter=>]{haskell}{state-motivation.hs}}
    \end{column}
    \begin{column}{.4\textwidth}
      \begin{itemize}
        \item Notice how we must pass this \texttt{\mylib{gs*}} around
        \item Again, we must pass it through functions that may never use it
        \item And this time we get back a new version which we must remember to use so we do not lose state
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}
\subsection{Definition}
\begin{frame}[fragile]{State Monad}{Type}
    {\scriptsize\inputminted[escapeinside=||]{haskell}{state-types.hs}}
    \begin{block}{\textbf{Exercise: }Reader Type Definition}
      \begin{align*}
        \mathsf{newtype}\ \StateH{a} &=
          \mathsf{State} \left\{ \fn{runState} ::\ \uncover<2->{\mylib{s}\ \rightarrow\ (\mylib{s}, \mylibo{a})} \right\}\\
      \end{align*}
    \end{block}
\end{frame}
\begin{frame}[fragile]{State Monad}{Type}
    Recall: $\mathsf{newtype}\ \State{a} = \mathsf{State} \left\{ \fn{runState} ::\ s\ \rightarrow\ (s, a) \right\}$
    \begin{block}{\textbf{Exercise: }State Type Definition}
      \begin{align*}
        \return &:: a\ \rightarrow\ \State{a}\\
        \return\ a\ &= \uncover<2->{\mathsf{State}\ (\lambda\,s\ \rightarrow\ (s, a))}\\[1.5em]
        (\bind) &:: \State{a}\ \rightarrow\ (a\ \rightarrow\ \State{b})\ \rightarrow\ \State{b}\\
        x\ \bind\ fn &=\uncover<3->{\mathsf{State}\ (\lambda\,s\ \rightarrow\
          \begin{aligned}[t]
            \mathbf{let}&\ (s\,', a) = \fn{runState}\ x\ s\\
            \mathbf{in}&\ \fn{runState}\ (fn\ a)\ s\,')
          \end{aligned}}\\
      \end{align*}
    \end{block}
\end{frame}
\begin{frame}[fragile]{State Monad}{Functions}
    \begin{block}{\textbf{Homework: }State Functions}
      \begin{align*}
        \fn{get} &:: \State{s}\\
        \fn{gets} &:: (s\ \rightarrow\ a)\ \rightarrow\ \State{a}\\
        \fn{put} &:: s\ \rightarrow\ \State{\unit}\\
        \fn{modify} &:: (s\ \rightarrow\ s)\ \rightarrow\ \State{\unit}\\
      \end{align*}
    \end{block}
\end{frame}
\subsection{Example}
\begin{frame}
  \centering
  \begin{tcolorbox}[enhanced, size=minimal,auto outer arc,
    width=2.8cm,octogon arc, colback=red,colframe=white,colupper=white, fontupper=\fontsize{7mm}{7mm}\selectfont\bfseries\sffamily, halign=center,valign=center,
    square,arc is angular, borderline={1mm}{-3mm}{red} ]
    CODE
  \end{tcolorbox}
\end{frame}


\section{Validation}
\label{sec:performance-modeling-validation}
A well conducted performance modeling workflow should include a final validation step to assess the consistency of the model with the real system.
%
As the simulation main purpose is insight, a widely adopted Turing-like technique is to place the computational model alongside with the real system and assess the consistency of performance metrics.
%
Clearly, we cannot adopt this technique because, since we do not have any real system at hand, we cannot compare the model with its real counterpart.
%
For this reason, we totally rely on the validation with respect to the analytical model.

In Tables \ref{tbl:evaluation-performance-metrics-1}, \ref{tbl:evaluation-performance-metrics-2-5} and \ref{tbl:evaluation-performance-metrics-2-20} we show the comparison between theoretical performance results, taken from the analytical model, and their experimental counterpart, taken from the simulator.
%
The results demonstrate that our simulator is a pretty reliable tool to conduct the performance analysis for the target system.


    \filetitle{resample}{Resample from a VAR object}{VAR/resample}

	\paragraph{Syntax}\label{syntax}

\begin{verbatim}
Outp = resample(V,Inp,Range,NDraw,...)
Outp = resample(V,[],Range,NDraw,...)
\end{verbatim}

\paragraph{Input arguments}\label{input-arguments}

\begin{itemize}
\item
  \texttt{V} {[} VAR {]} - VAR object to resample from.
\item
  \texttt{Inp} {[} struct \textbar{} tseries {]} - Input database or
  tseries used in bootstrap; not needed when
  \texttt{'method=' 'montecarlo'}.
\item
  \texttt{Range} {[} numeric {]} - Range for which data will be
  returned.
\end{itemize}

\paragraph{Output arguments}\label{output-arguments}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  \texttt{Outp} {[} struct \textbar{} tseries {]} - Resampled output
  database or tseries.
\end{itemize}

\paragraph{Options}\label{options}

\begin{itemize}
\item
  \texttt{'deviation='} {[} \texttt{true} \textbar{}
  \emph{\texttt{false}} {]} - Do not include the constant term in
  simulations.
\item
  \texttt{'group='} {[} numeric \textbar{} \emph{\texttt{NaN}} {]} -
  Choose group whose parameters will be used in resampling; required in
  VAR objects with multiple groups when \texttt{'deviation=' false}.
\item
  \texttt{'method='} {[} \texttt{'bootstrap'} \textbar{}
  \emph{\texttt{'montecarlo'}} \textbar{} function\_handle {]} -
  Bootstrap from estimated residuals, resample from normal distribution,
  or use user-supplied sampler.
\item
  \texttt{'progress='} {[} \texttt{true} \textbar{}
  \emph{\texttt{false}} {]} - Display progress bar in the command
  window.
\item
  \texttt{'randomise='} {[} \texttt{true} \textbar{}
  \emph{\texttt{false}} {]} - Randomise or fix pre-sample initial
  condition.
\item
  \texttt{'wild='} {[} \texttt{true} \textbar{} \emph{\texttt{false}}
  {]} - Use wild bootstrap instead of standard Efron bootstrap when
  \texttt{'method=' 'bootstrap'}.
\end{itemize}

\paragraph{Description}\label{description}

\paragraph{Example}\label{example}


    \filetitle{issolved}{True if a model solution exists}{model/issolved}

	\paragraph{Syntax}\label{syntax}

\begin{verbatim}
flag = issolved(m)
\end{verbatim}

\paragraph{Input arguments}\label{input-arguments}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  \texttt{m} {[} model {]} - Model object.
\end{itemize}

\paragraph{Output arguments}\label{output-arguments}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  \texttt{flag} {[} \texttt{true} \textbar{} \texttt{false} {]} - True
  for each parameterisation for which a stable unique solution has been
  found and exists currently in the model object.
\end{itemize}

\paragraph{Description}\label{description}

\paragraph{Example}\label{example}


\input{dfki.defs}

\usepackage[hidelinks]{hyperref}
\usepackage[style=verbose,backend=bibtex]{biblatex}
\addbibresource{SimulationLectures.bib}

\title[Simulation in Robotics]{Lecture 1 - Simulation of Dynamical Systems}
\author{Julius Martensen}
\date{\today}

\begin{document}

\frame{\titlepage}

\section[\Overview]{}
% Talk about the targets
% Refer to Christoph and Bernd
% Give an outline to the lectures

\section{Motivation}

% First frame, show venn diagram of robotics with different influences
% Show the difficulties
\frame{

	\frametitle{Robotics - An Interdisciplinary Science}
	\begin{figure}
		\includegraphics[width = 0.5\textwidth]{./pics/robotics_motivation.png}
	\end{figure}
}

% Show useage for simulation in context of mechanical engineering
% Robot walking
% Finite Elements
% Path Finding
% Mechatronics

\frame{
	\frametitle{Simulation in the Context of Robotics}
	\begin{itemize}
		\item Structural Optimization
		\item Mechanical Prototyping
		\item Testing of Controller
		\item Learning
		\item ...
	\end{itemize}
}

% Show Targets for this lecture
\frame{
	\frametitle{Lecture Targets}
	\begin{itemize}
		\item Basics: Modeling techniques \nocite{*}
		\item Basics: System dynamics
		\item Basics: (Numerical) Stability of models
		\item Example : DC Motor
	\end{itemize}
}

\section{Modeling of Systems}

\frame{
	\begin{figure}
		\includegraphics[width = 0.9\textwidth]{./pics/simulation_ideal.png}
	\end{figure}
}

\section{Basics of Systemdynamics}
% Start with general system of ODEs
\frame{

	% Initial Conditions
	\begin{exampleblock}<1->{Initial Conditions}
		The system at begin of our simulation or observation.
	\end{exampleblock}

	% Evolution
	\begin{alertblock}<2->{Evolution}
		The system propagates through time and changes.
	\end{alertblock}

	% Next State
	\begin{block}<3->{Next State}
		The system arrives at a new state.
	\end{block}
}

\frame{
	\begin{figure}
		\includegraphics[width = 0.9\textwidth]{./pics/dynamics_concept.png}
	\end{figure}
}

\frame{
	In general, the system is given as a set of nonlinear differential equations.

	\begin{align*}
		\dot{x} & = f(x, u, t) \\
		y       & = h(x,u, t)
	\end{align*}

	Where $x \in \mathbb{R}^{n_x}$ is called the state , $u \in \mathbb{R}^{n_u}$ the inputs
	and $y \in \mathbb{R}^{n_y}$ the outputs of a system. \newline
	The function $f : \mathbb{R}^{n_x} \times \mathbb{R}^{n_u} \mapsto \mathbb{R}^{n_x}$ evolves the system through time while
	$g : \mathbb{R}^{n_x} \times \mathbb{R}^{n_u} \mapsto \mathbb{R}^{n_y}$ defines the output.
}

% Reduce to linear equations
\frame{
	For many systems a set of of linear differential equations is sufficient

	\begin{align*}
		\dot{x} & = Ax + Bu \\
		y       & = Cx + Du
	\end{align*}

	With the state matrix $A \in \mathbb{R}^{n_x \times n_x}$, the input matrix $B \in \mathbb{R}^{n_x \times n_u}$,
	the output matrix $C \in \mathbb{R}^{n_y \times n_x}$ and the feedthrough matrix $D \in \mathbb{R}^{n_y \times n_u}$
}

\frame{
	\begin{figure}
		\includegraphics[width = 0.5\textwidth]{./pics/linearization.png}
	\end{figure}
}

% Example: Pendulum

\frame{
	\frametitle{Pendulum}
	% Whiteboard : Derive EQM
	\begin{column}{0.3\textwidth}
		\begin{figure}
			\includegraphics[width = 0.8\textwidth]{./pics/pendulum.png}
		\end{figure}%

		\begin{align*}
			\dot{\phi} & = \frac{p}{l^2 m} \\
			\dot{p}    & = mgl~cos(\phi)
		\end{align*}

	\end{column}%
	\begin{column}{0.7\textwidth}
		\begin{figure}
			\includegraphics[width = 0.8\textwidth]{./pics/PenduleEspaceDesPhases.png}
			\caption{\href{https://commons.wikimedia.org/wiki/File:PenduleEspaceDesPhases.png}{Phase space }{\tiny Wikipedia, 14/11/2018}}
		\end{figure}
	\end{column}
}

\section{Stability of Simulation}

\frame{
	\begin{column}{0.5\textwidth}

		\begin{exampleblock}{Status}<1->
			Continoous model in form of a system of (nonlinear) equations.
		\end{exampleblock}

		\begin{block}{Task}<2->
			Simulate the system over time
		\end{block}

		\begin{alertblock}{Problem}<3->
			Discrete calculation!
		\end{alertblock}
	\end{column}%
	\begin{column}{0.5\textwidth}

		\begin{align*}
			\dot{x} & = f(x, u)     \\
			y       & = g(x,u)      \\
			\downarrow \\
			x_{i+1} & = F(x_i,u_i)  \\
			y_{i+1} & = G(x_i, u_i)
		\end{align*}

	\end{column}
}

\frame{
	\frametitle{Example : Forward Euler Scheme}
	\begin{column}{0.5\textwidth}
		\begin{align*}
			\dot{x} & =  f(x,u)                                            \\
			        & \approx \frac{x_{i+1} - x_i}{\delta t}               \\
			        & = f(x_i, u_i)                                        \\
			x_{i+1} & = x_i + \delta t ~f(x_i, u_i)
			\end{align}
			\end{column}%
			\begin{column}{0.5\textwidth}
			\begin{figure}
			\includegraphics[width = 0.8\textwidth]{./pics/linearization_stepsize.png}
			\end{figure}

			\end{column}
			}

			\frame{
			A system is stable if trajectories starting near a final state end in this state or enter a closed orbit in its neighborhood.

			\begin{column}{0.5\textwidth}
			\begin{align*}
			x_S     & = \{x \in \mathbb{R}^{n_X} | f(x_S) = 0 \}           \\
			x_S     & = \{x \in \mathbb{R}^{n_X} | f(x_S) \leq \epsilon \}
		\end{align*}
	\end{column}%

	\begin{column}{0.5\textwidth}

		Image - Stability on Phase space
	\end{column}
}

\frame{
	\frametitle{Stability - Direct Method of Lyapunov}
	\begin{column}{0.5\textwidth}
		A given system is stable of the form
		\begin{align*}
			\dot{x} & = -A x
		\end{align*}
		is stable if all eigenvalues $\lambda_i$ are on the right half plane of the complex plane.
	\end{column}%
	\begin{column}{0.5\textwidth}
		\begin{figure}
			\includegraphics[width = 0.8\textwidth]{./pics/stability.png}
		\end{figure}
	\end{column}
}

\frame{
	Most physical system derived by first principles are stable due to conservation laws! \newline

	However, instability is possible due to wrong parametrization, the solver or the nature of the problem itself ( stiffness of differential equations).

	\begin{figure}
		\includegraphics[width = 0.3\textwidth]{./pics/linearization_error.png}
	\end{figure}

	An stability criterion for numerical solver is the asymptotic stability.
	% Steifigkeit : Condition no of the transition matrix
	% Solver : Error Propagation due to solver
	% parametrization : Step size, convergence limit etc.
}

\frame{
	\frametitle{A-Stability}
	A solver is called asymptotic stable, if for a given problem of the form:
	\begin{align*}
		\dot{x} & = -A x, ~ Re(\lambda_i(A)) > 0
	\end{align*}
	The resulting calculation is monotonic decreasing for $\forall \delta t \in \mathbb{R}^+$
}

\frame{
	Consider the Pendulum in Euler Forward Notation:

	\begin{align*}
		x_{i+1} &= \begin{bmatrix} \phi_i \\ p_i \end{bmatrix} + \delta t \begin{bmatrix} \frac{p_i}{l^2 m} \\ m*g*l*cos(\phi_i)\end{bmatrix} \\
		  & = \left[ I + \delta t ~\begin{bmatrix} 0 & \frac{1}{l^2 m} \\ mglsin(\phi_i) & 0 \end{bmatrix}\right] \begin{bmatrix} \phi_i \\ p_i \end{bmatrix} + \mathcal{O}^2
	\end{align*}

	The eigenvalues are then given as:
	\begin{align*}
		\lambda_i & = 1 \pm \delta t \sqrt{\frac{g}{l}sin(\phi_i)}
	\end{align*}

	Hence, the system is not alway stable, both in the sense of the step size or the formulation.

}

\frame{
	Stiffness of the problem:

	\begin{align*}
		\mu & = \frac{max(Re(\lambda_i))}{min(Re(\lambda_i))}                                                   \\
		    & = \frac{1 + \delta t~\sqrt{\frac{g}{l} sin(\phi_i)}}{1 - \delta t~\sqrt{\frac{g}{l} sin(\phi_i)}}
	\end{align*}
}

\section{Recapture}
\frame{
	% Modeling Techniques
	\begin{exampleblock}<1->{Modeling}
		A model can be derived via \textbf{first principles} (white-box), by \textbf{data-driven} techniques (black-box) or a combination (gray-box)
	\end{exampleblock}

	% Evolution
	\begin{alertblock}<2->{Systems}
		A system has characteristics like fixed points, saddle points, ... which \textbf{influence} the simulation
	\end{alertblock}

	% Next State
	\begin{block}<3->{Simulation}
		Even \textbf{stable systems} can lead to \textbf{unstable simulations} due to wrong parametrization, poor choice of algorithms or high nonlinearities.
	\end{block}
}

\section{Example: Modeling a DC Motor}

\frame{
	\frametitle{A simple DC Motor}
	\begin{figure}
		\includegraphics[width = 0.8\textwidth]{./pics/DC_Motor.png}
	\end{figure}
	% Aufgabe: Welche Dinge sind hier wichtig
	% Welche Parameter
	% Welche Gleichungen führen zur DGL?
	% Herleitung am Whiteboard
}

\section{Bibliography}

\frame[allowframebreaks]{
	\frametitle{References}
	% This prints the bibliography on the slide
	\nocite{*}
	\printbibliography
}

\end{document}


\newpage
\section{Log likelihood (post-burn)}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{loglike_postburn.pdf}{\imscale}
  \end{center}
  \caption{Log-likelihood for 5000 iterations after burn-in of 10000 for each
  simulation setup.}
  \label{fig:ll}
\end{figure}

\newpage
\section{Swap proportions}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{swapprops.pdf}{\imscale}
  \end{center}
  \caption{These figures summarize proportion of instances that swaps were made
  when proposed between the various chains for each setup. A noticeable amount
  of Swapping occurred between the chains. The colorbars on the right of each
  heatmap show that the highest proportion of swaps between any two chains is
  between 40\% and 60\%.}
  \label{fig:swapproprs}
\end{figure}

\newpage
\section{Posterior mean of $Z$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{Zmean.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{Posterior means of $Z$ for each run. This figure is included only
  to show that it should not be used, due to label switching which happens as
  a result of states-swapping between chains.}
  \label{fig:zmean}
\end{figure}

\newpage
\section{Box plots for $p_i$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{p.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:ppost}
\end{figure}

\newpage
\section{Trace plots for $p_1$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{p1_trace.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:p1trace}
\end{figure}

\newpage
\section{Trace plots for $p_2$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{p2_trace.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:p2trace}
\end{figure}

% \newpage
% \section{Trace plots for $p_3$}
% \begin{figure}[H]
%   \begin{center}  % 6 x 5
%     \imgtemplate{p3_trace.pdf}{\imscale}
%   \end{center}
%   % TODO: Write more?
%   \caption{}
%   \label{fig:p3trace}
% \end{figure}

\newpage
\section{Box plots for $W$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{W.pdf}{\imscale}
  \end{center}
  \caption{Posterior distribution for $W$. This figure is not very useful
  to look at, due to label-switching.}
  \label{fig:W-post}
\end{figure}

\newpage
\section{Trace plots for $\mu^\star$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{mus_trace.pdf}{\imscale}
  \end{center}
  \caption{Trace plots for $\mu^\star_z$.}
  \label{fig:mus-trace}
\end{figure}

\newpage
\section{Trace plots for $\sigma^2$}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{sig2_trace.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{Trace plots for $\sigma^2$.}
  \label{fig:sig2-trace}
\end{figure}

\newpage
\section{Posterior distributions for sample 1 marker 1}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{dden/dden_i1_j1.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:ddi1j1}
\end{figure}

\newpage
\section{Posterior distributions for sample 1 marker 2}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{dden/dden_i1_j2.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:ddi1j2}
\end{figure}

\newpage
\section{Posterior distributions for sample 2 marker 1}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{dden/dden_i2_j1.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:ddi2j1}
\end{figure}

\newpage
\section{Posterior distributions for sample 2 marker 2}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \imgtemplate{dden/dden_i2_j2.pdf}{\imscale}
  \end{center}
  % TODO: Write more?
  \caption{}
  \label{fig:ddi2j2}
\end{figure}

% \newpage
% \section{Posterior distributions for sample 3 marker 1}
% \begin{figure}[H]
%   \begin{center}  % 6 x 5
%     \imgtemplate{dden/dden_i3_j1.pdf}{\imscale}
%   \end{center}
%   % TODO: Write more?
%   \caption{}
%   \label{fig:ddi1j6}
% \end{figure}
%
% \newpage
% \section{Posterior distributions for sample 3 marker 2}
% \begin{figure}[H]
%   \begin{center}  % 6 x 5
%     \imgtemplate{dden/dden_i3_j2.pdf}{\imscale}
%   \end{center}
%   % TODO: Write more?
%   \caption{}
%   \label{fig:ddi2j6}
% \end{figure}

\newpage
\section{Missing Mechanisms}
\begin{figure}[H]
  \begin{center}  % 6 x 5
    \begin{tabular}{ccc}
      \includegraphics[scale=0.35]{\imgdir/phi0/img/missmech_1.pdf} &
      \includegraphics[scale=0.35]{\imgdir/phi0/img/missmech_2.pdf} &
      % \includegraphics[scale=0.35]{\imgdir/phi0/img/missmech_3.pdf} \\
    \end{tabular}
  \end{center}
  \caption{}
\label{fig:missmech}
\end{figure}


\subsubsection{Floating Leg Data, Spreads, Gearings, Caps and Floors}
\label{ss:floatingleg_data}

The \lstinline!FloatingLegData! trade component node is used within the \lstinline!LegData! trade component when the
\lstinline!LegType! element is set to \emph{Floating}. It is also used directly within the \lstinline!CapFloor! trade
data container.  The \lstinline!FloatingLegData! node includes elements specific to a floating leg.

An example of a \lstinline!FloatingLegData! node is shown in Listing \ref{lst:floatingleg_data}.
\begin{listing}[H]
%\hrule\medskip
\begin{minted}[fontsize=\footnotesize]{xml}
                <FloatingLegData>
                    <Index>USD-LIBOR-3M</Index>
                    <IsInArrears>false</IsInArrears>
                    <IsAveraged>false</IsAveraged>
                    <HasSubPeriods>false</HasSubPeriods>
                    <IncludeSpread>false</IncludeSpread>
                    <FixingDays>2</FixingDays>
                    <Spreads>
                        <Spread>0.005</Spread>
                    </Spreads>
                    <Gearings>
                        <Gearing>2.0</Gearing>
                    </Gearings>
                    <Caps>
                        <Cap>0.05</Cap>
                    </Caps>
                    <Floors>
                        <Floor>0.01</Floor>
                    </Floors>
                    <NakedOption>false</NakedOption>
                </FloatingLegData>
\end{minted}
\caption{Floating leg data}
\label{lst:floatingleg_data}
\end{listing}

The meanings and allowable values of the elements in the \lstinline!FloatingLegData! node follow below.

\begin{itemize}
\item Index:  The combination of currency, index and term that
  identifies the relevant fixings and yield curve of the floating leg.

  Allowable values: An alphanumeric string of the form CCY-INDEX-TERM. CCY, INDEX and TERM must be separated by dashes (-). CCY and INDEX must be among the supported currency and index combinations. TERM must be an integer followed by D, W,
  M or Y. See Table \ref{tab:indices}.

\item IsAveraged [Optional]:  For cases where there are multiple index fixings over a period \emph{true} indicates that
  the average of the fixings is used to calculate the coupon.  \emph{false} indicates that the coupon is calculated by
  compounding the fixings.  IsAveraged only applies to Overnight indices and Sub Periods Coupons.

Allowable values:  \emph{true, false}. Defaults to \emph{false} if left blank or omitted.

\item HasSubPeriods [Optional]: For cases where several Ibor fixings result in a single payment for a period, e.g. if
  the Ibor tenor is 3M and the schedule tenor is 6M, two fixings are used to compute the amount of the semiannual coupon
  payments. \emph{true} indicates that an average (IsAveraged = true) or a compounded (IsAveraged=false) value of the
  fixings is used to determine the payment rate.  \emph{false} indicates that the initial index period fixing determines the payment rate for the
  full tenor, i.e. no further fixings, no averaging and no compounding. IsAveraged is ignored for Ibor legs when HasSubPeriods is set to  \emph{false}.
  HasSubPeriods does not apply to Overnight indices.

Allowable values:  \emph{true, false}. Defaults to \emph{false} if left blank or omitted.

\item IncludeSpread [Optional]: Only applies to Sub Periods and (compounded) OIS Coupons. If \emph{true} the spread is
  included in the compounding, otherwise it is excluded.

Allowable values:  \emph{true, false}. Defaults to \emph{false} if left blank or omitted.

A Zero Coupon Floating leg with compounding that includes spread can be set up using a rules-based schedule as shown
in Listing \ref{lst:float_zero_coupon_leg_rules}. Note that the \lstinline!Tenor! in the rules-based schedule is not used when \lstinline!Rule! is set to \emph{Zero}.
\begin{listing}[H]
%\hrule\medskip
\begin{minted}[fontsize=\footnotesize]{xml}
            <LegData>
                <LegType>Floating</LegType>
                <Payer>false</Payer>
                <Currency>USD</Currency>
                <Notionals>
                    <Notional>200000.0000</Notional>
                </Notionals>
                <DayCounter>A360</DayCounter>
                <PaymentConvention>MF</PaymentConvention>
                <ScheduleData>
                    <Rules>
                        <StartDate>2020-01-14</StartDate>
                        <EndDate>2020-07-14</EndDate>
                        <Tenor>3M</Tenor>
                        <Calendar>USD</Calendar>
                        <Convention>MF</Convention>
                        <TermConvention>MF</TermConvention>
                        <Rule>Zero</Rule>
                    </Rules>
                </ScheduleData>
                <FloatingLegData>
                    <Index>USD-LIBOR-3M</Index>
                    <IsAveraged>false</IsAveraged>
                    <HasSubPeriods>true</HasSubPeriods>
                    <IncludeSpread>true</IncludeSpread>
                    <Spreads>
                        <Spread>0.006500</Spread>
                    </Spreads>
                    <IsInArrears>false</IsInArrears>
                    <FixingDays>2</FixingDays>
                </FloatingLegData>
            </LegData>
\end{minted}
\caption{Zero Coupon Floating Leg - Rules-based}
\label{lst:float_zero_coupon_leg_rules}
\end{listing}

A Zero Coupon Floating leg with compounding that includes spread can also be set up using a dates-based schedule with two dates (start and end) as shown
in Listing \ref{lst:float_zero_coupon_leg_dates}. \begin{listing}[H]
%\hrule\medskip
\begin{minted}[fontsize=\footnotesize]{xml}
            <LegData>
                <LegType>Floating</LegType>
                <Payer>false</Payer>
                <Currency>USD</Currency>
                <Notionals>
                    <Notional>200000.0000</Notional>
                </Notionals>
                <DayCounter>A360</DayCounter>
                <PaymentConvention>MF</PaymentConvention>
                <ScheduleData>
                    <Dates>
                        <Calendar>USD</Calendar>
                        <Convention>MF</Convention>
                        <Dates>
                            <Date>2020-01-14</Date>
                            <Date>2020-07-14</Date>
                        </Dates>
                    </Dates>
                </ScheduleData>
                <FloatingLegData>
                    <Index>USD-LIBOR-3M</Index>
                    <IsAveraged>false</IsAveraged>
                    <HasSubPeriods>true</HasSubPeriods>
                    <IncludeSpread>true</IncludeSpread>
                    <Spreads>
                        <Spread>0.006500</Spread>
                    </Spreads>
                    <IsInArrears>false</IsInArrears>
                    <FixingDays>2</FixingDays>
                </FloatingLegData>
            </LegData>
\end{minted}
\caption{Zero Coupon Floating Leg - Dates-based}
\label{lst:float_zero_coupon_leg_dates}
\end{listing}

\item IsInArrears [Optional]:  \emph{true} indicates that  fixing is in arrears,
  i.e. the fixing gap is calculated in relation to the current period
  end date.\\ \emph{false} indicates that  fixing is in advance,
  i.e. the fixing gap is calculated in relation to the previous period
  end date.

Allowable values:  \emph{true, false}. Defaults to \emph{false} if left blank or omitted.

\item FixingDays [Optional]: The fixing gap. For Ibor coupons this is the number of business days before the accrual
  period's {\em reference} date to observe the index fixing. Here, the accrual period reference date is the accrual
  start date for an in advanced fixed coupon and the accrual end date for in arrears fixed coupon. \\
  For overnight coupons this is the number of business days by which the value dates are shifted into the past to get
  the fixing observation dates. In the context of the Ibor reform the FixingDays parameter is sometimes also called
  ``obervation lag''.

  Allowable values: A non-negative whole number.  Defaults to the index's fixing days if blank or omitted.

\item Lookback [Optional]: Only applicable to OIS legs. A period by which the value dates schedule of (averaged,
  compounded) OIS legs is shifted into the past. On top of this the gap defined by the FixingDays is applied to get the
  final fixing date for an original date in the OIS value dates schedule. In the context of the Ibor reform the Lookback
  parameter is sometimes also called ``shift''. With this terminology, first the shift and then the observation lag is
  applied to get the fixing date for an original value date of an overnight coupon.

  Allowable values: any valid period, e.g. 2D, 3M, 1Y

\item RateCutoff [Optional]: Only applicable to OIS legs. The number of fixing dates at the end of the fixing period for
  which the fixing value is held constant and set to the previous value. Defaults to $0$.

Allowable values: any non-negative whole number

\item Spreads [Optional]: This node contains child elements of type
  \lstinline!Spread!. If the spread is constant over the life of the
  floating leg, only one spread value should be entered. If two or more
  coupons have different spreads, multiple spread values are required,
  each represented by a \lstinline!Spread! child element. The first
  spread value corresponds to the first coupon, the second spread
  value corresponds to the second coupon, etc. If the number of
  coupons exceeds the number of spread values, the spread will be kept
  flat at the value of last entered spread for the remaining coupons.
  The number of entered spread values cannot exceed the number of
  coupons.

  Allowable values: Each child element can take any real number. The spread is expressed in decimal form, e.g. 0.005 is
  a spread of 0.5\% or 50 bp.

For the {\tt <Spreads>} section, the same applies as for notionals and
rates - a list of changing spreads can be specified without or with individual starte dates as shown
in Listing \ref{lst:spreads_dates}.
\begin{listing}[H]
%\hrule\medskip
\begin{minted}[fontsize=\footnotesize]{xml}
                    <Spreads>
                        <Spread>0.005</Spread>
                        <Spread startDate='2017-03-05'>0.007</Spread>
                        <Spread startDate='2019-03-05'>0.009</Spread>
                    </Spreads>
\end{minted}
\caption{'Dated' spreads}
\label{lst:spreads_dates}
\end{listing}

If the entire {\tt <Spreads>} section is omitted, it defaults to a spread of \emph{0\%}.

\item Gearings [Optional]: This node contains child elements of type \lstinline!Gearing! indicating that the coupon rate is
  multiplied by the given factors. The mode of specification is analogous to spreads, see above.

If the entire {\tt <Gearings>} section is omitted, it defaults to a gearing of \emph{1}.

\item Caps [Optional]: This node contains child elements of type \lstinline!Cap! indicating that the coupon rate is capped at the
  given rate (after applying gearing and spread, if any). The mode of specification is analogous to spreads, see above.

\item Floors [Optional]: This node contains child elements of type \lstinline!Floor! indicating that the coupon rate is floored at
  the given rate (after applying gearing and spread, if any). The mode of specification is analogous to spreads, see
  above.

\item NakedOption [Optional]: Optional node, if \emph{true} the leg represents only the embedded floor, cap or collar.
  By convention the embedded floor (cap) are considered long if the leg is a receiver leg, otherwise short. For a
  collar the floor is long and the cap is short if the leg is a receiver leg.

 Allowable values: \emph{true}, \emph{false} . Defaults to \emph{false} if left blank or omitted.

\end{itemize}


\section*{Appendix A: Example MPS Language}
\label{sec:mps-lang}

 The language for MP scripts given here is only a suggestion and its
implementation may differ from the one given here. The constructors which make
up the MPS script scheme are used to express the following
aspects of monetary policy:

\begin{itemize}
\item $\type{JustMSig}$~ :~ evaluates an MSig script

\item $\type{RequireAll}$~:~evaluates all MPS scripts in the given set

\item Others will be here once decided on
\end{itemize}

The Figures~\ref{fig:defs:tx-mc-eval},~\ref{fig:whitelist-example},
~\ref{fig:defs:tx-mc-eval-2}, and~\ref{fig:defs:tx-mc-eval-3} give
possible constructors of the MPS language.

%% \begin{note}
%%   sort out the constructors
%% \end{note}

\begin{figure*}[htb]
  \begin{align*}
    & \fun{evalMPSScript} \in\ScriptMPS\to\PolicyID\to\Slot\to\powerset\KeyHash \\
    &~~~~\to\TxBody\to\UTxO \to\Bool  \\
    & \text{UTxO is only for the outputs THIS tx is spending, not global UTxO, i.e.} \\
    & \text{when called,}~\var{spentouts}~=~(\fun{txins}~\var{txb}) ~\restrictdom~\var{utxo} \\~\\
    %
    & \fun{evalMPSScript}  ~(\type{JustMSig}~s)~\var{pid}~\var{slot}~\var{vhks}
     ~\var{txb}~\var{spentouts} \\
    &~~~~ =~ \fun{evalMultiSigScript}~s~\var{vhks} \\
    & \text {checks the msig script}\\~\\
    %
    & \fun{evalMPSScript}
     ~\type{DoForge}~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
    &~~~~ =~ \var{pid} \notin \dom~(\fun{forge}~\var{txb}) \\
    & \text {checks that script hash of this script is not an asset ID being forged by tx}  \\~\\
    %
    & \fun{evalMPSScript}
     ~\type{SignedByPIDToken}~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
    &~~~~ =~ \exists~t\mapsto ~\_~\in~ \fun{range}~(\var{pid}~ \restrictdom~(\fun{ubalance}~\var{spentouts})) ~:~ t~\in~\var{vhks} \\
    & \text{checks that tx is signed by a key whose hash is the name of a token in this asset}
    \\~\\
    & \fun{evalMPSScript}
     ~(\type{SpendsCur}~\var{pid'})~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
    &~~~~ =~ (\var{pid'}~\neq~\Nothing ~\wedge ~\var{pid'}~\in~ \dom~(\fun{ubalance}~\var{spentouts}))\\
    &~~~~~~ \vee (\var{pid'}~=~\Nothing ~\wedge ~\var{pid}~\in~ \dom~(\fun{ubalance}~\var{spentouts})) \\
    & \text{checks that this transaction spends asset pid' OR itself if}~\var{pid'}~=~\Nothing
    \\~\\
    &\fun{evalMPSScript}~(\type{Not}~s)~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}
   \\
    &~~~~ = \neg ~\fun{evalMPSScript}~s~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}\\~\\
    %
    &\fun{evalMPSScript}~(\type{RequireAll}~ls)~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}
   \\
    &~~~~ = \forall ~s'~ \in~ ls~:~\fun{evalMPSScript}~s'~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}\\~\\
    %
    &\fun{evalMPSScript}~(\type{RequireOr}~ls)~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}
   \\
    &~~~~ = \exists ~s'~ \in~ ls~:~\fun{evalMPSScript}~s'~\var{pid}~\var{slot}~\var{vhks}
    ~\var{txb}~\var{spentouts}\\
  \end{align*}
  \caption{Multi-asset Script Evaluation}
  \label{fig:defs:tx-mc-eval}
\end{figure*}

\begin{figure*}[htb]
  \begin{align*}
    & \fun{evalMPSScript}
     ~(\type{AssetToAddress}~\var{pid'}~\var{addr})~\var{pid}~ \var{slot}~\var{vhks} ~\var{txb}~\var{spentouts} \\
    &~~~~ =~ \forall~(a, v)~\in~\fun{range}~(\fun{outs}~txb),~\\
    &~~~~~~ \var{c}~\in~\dom~v~\Rightarrow~(a~=~ \var{a'} ~\wedge~
                       v~=~\var{c}~ \restrictdom~(\fun{ubalance}~(\fun{outs}~txb)) \\
    & \where \\
    & ~~~~~~~ \var{a'}~=~\fun{if}~ \var{addr}~\neq~\Nothing~\fun{then}~\var{addr}~\fun{else}~\var{(pid',pid')} \\
    & ~~~~~~~ \var{c}~=~\fun{if}~ \var{pid'}~\neq~\Nothing~\fun{then}~\var{pid'}~\fun{else}~\var{pid} \\
    & \text{checks that tx outputs any pid tokens by themselves to the specified address} \\
    & \text {the script address of the given asset when addr unspecified} \\~\\
    & \fun{evalMPSScript}
     ~(\type{TrancheTokens}~\var{tts}~\var{txin})~\var{pid}~\var{slot}~\var{vhks}
     ~\var{txb}~\var{spentouts}  \\
    &~~~~ =~(\var{pid}\mapsto\var{tts}~\in~\var{val})~ \wedge~(\var{txin}~\in~\fun{txins}~{txb}) \\
    & \text{tranche tokens is incomplete} \\~\\
    %
    & \fun{evalMPSScript}
     ~(\type{FreshTokens})~\var{pid}~\var{slot}~\var{vhks}
     ~\var{txb}~\var{spentouts}
      \\
    &~~~~ =~\forall~\var{pid}~ \mapsto ~tkns ~\in~ \var{val}~:~ \\
    &~~~~ \forall~t~\in~\var{tkns},~
        \fun{nameToken}~(\fun{indexof}~\var{t}~\var{tkns},~\fun{txins}~{txb})~=~t
    \end{align*}
    \caption{Multi-asset Script Evaluation, cont.}
    \label{fig:defs:tx-mc-eval-3}
\end{figure*}

\begin{figure*}[htb]
  \begin{align*}
    & \fun{whitelist} \in\ScriptMSig\to\Script  \\~\\
    %
    & \type{whitelist}  ~\var{msig}~ =~ \type{RequireOr}~
      (\type{RequireAll}~(\type{DoForge};~\type{JustMSig}~\var{msig});~\\
    &~~~~~~ \type{RequireAll}~(\type{AssetToAddress}~\Nothing~\Nothing ;\\
    &~~~~~~ (\type{Not}~\type{DoForge});~\type{SignedByPIDToken})) \\
    %
    & \text{msig is some MSig script containing signatures of some accreditation authority} \\
    & \text{i.e. this authority can do any forging or spending of this token} \\~\\
    %
    & (\fun{hashScript}~(\type{SpendsCur}~(\fun{hashScript}~(\type{whitelist}~\var{msig}))),~ \var{tkns}) \\
    & \text{an example of an output spending which requires to be on a whitelist made by msig authority}
  \end{align*}
  \caption{Whitelist Script Example}
  \label{fig:whitelist-example}
\end{figure*}


\chapter*{Abstract}
\chaptermark{Abstract}
\addcontentsline{toc}{chapter}{Abstract}

% self-contained and less than 1 pg!
% no references

% GW, motivation
Gravitational waves are ``ripples'' in spacetime emitted by massive astrophysical events. % that they carry away information about.
Over the past decade, interferometric detectors have been used to measure gravitational waves from the binary mergers of black holes and neutron stars to learn more about such systems; these gravitational waves had frequencies around 100~Hz.
Other frequencies of gravitational waves are thought to exist and contain valuable information but are yet to be detected. For example, detecting kilohertz (1--4~kHz) gravitational waves from binary neutron-star mergers could be used to further constrain the neutron-star equation-of-state and better understand exotic states of matter.
% However, gravitational waves are predicted to be emitted from other sources but are yet to be detected because they are outside the sensitive frequency range, and therefore there is valuable astrophysical information that is currently going uncollected. For example, 1--4~kHz gravitational waves from the merger and post-merger remnant of binary neutron star systems are predicted to contain information that could be used to further constrain the neutron star equation-of-state and better understand the exotic states of matter within.
% The ability to detect kilohertz (around 1~kHz) gravitational waves could also lead to better understanding of the origin of low-mass black holes, the post-bounce dynamics of core-collapse supernovae, and the discovery of exotic or primordial sources in the stochastic gravitational-wave background.
% why they can't be seen
% existing proposals for kHz sensitivity
However, to do so, the sensitivity of current detectors will need to be extended from 100~Hz to the kilohertz regime.
% Current interferometric gravitational-wave detectors are not as sensitive at kilohertz compared to 100~Hz because of their use of optical cavities  and a limit on their quantum noise--limited sensitivity, where the quantum noise in the measurement comes from the fundamental quantum uncertainties in the state of the laser light.
% Two existing proposals to improve kilohertz sensitivity are (1) degenerate internal squeezing that uses quantum squeezing inside the detector to improve the quantum noise or (2) stable optomechanical filtering that counters the cavity resonance to improve the response to the gravitational-wave signal. However, these two proposals require low optical loss and mechanical loss, respectively.
%a configuration that combines these two existing proposals and has not been thoroughly examined to date.

The kilohertz sensitivity of current gravitational-wave detectors is limited by quantum noise from the fundamental quantum uncertainties in the state of light inside the detector. This noise can be mitigated by replacing the vacuum fluctuations entering the readout port of the detector with squeezed states.
In this thesis, I investigate a new technique to improve kilohertz sensitivity by placing a nondegenerate squeezer inside the detector. This technique, called nondegenerate internal squeezing, improves sensitivity by amplifying the detector's response to the gravitational-wave signal more than it increases the quantum noise.
To assess its feasibility, I derive an analytic Hamiltonian model of nondegenerate internal squeezing and calculate its sensitivity and stability as well as analyse its tolerance to the realistic optical losses expected in a future gravitational-wave detector.

% I investigate nondegenerate internal squeezing, a configuration that uses a nonlinear crystal to manipulate the state of the light inside the detector. This technique, called ``squeezing'', avoids the above limit on the quantum noise--limited sensitivity. Nondegenerate internal squeezing improves the quantum noise--limited sensitivity by amplifying the response to the gravitational-wave signal more than it increases the quantum noise. However, it has not been thoroughly examined to date.
% conclusions
% and show that it is robust to detection loss in the output chain. I also compare its loss tolerance to other proposed configurations to improve kilohertz sensitivity.

My model indicates that nondegenerate internal squeezing is stable, robust to detection loss in the readout, and provides a viable alternative to other proposals to improve kilohertz sensitivity. %I determine its squeezing threshold which to find the maximum
% I validate my model by showing that it reduces to the correct high and low loss limits.
I demonstrate a technique to determine its squeezing threshold and, therefore, the limits of its operation.
% For a realistic future gravitational-wave detector, I find that nondegenerate internal squeezing is more detection loss-resistant than degenerate internal squeezing and is a viable, all-optical alternative to stable optomechanical filtering.
I find that nondegenerate internal squeezing could feasibly improve the sensitivity of a future detector to 1--4~kHz gravitational waves. I also explore an alternative readout scheme that is promising for broadband 0.1--4~kHz sensitivity.


\chapter{Conclusion}

Existing \ematching algorithms are based on backtracking and suffer from problems like implementation difficulty, run inefficiency, and a loose complexity bound. To tackle these problems, we propose relational \ematching, an algorithm that efficiently solves the \ematching problem by reducing it to conjunctive queries. Relational \ematching is based on the observation that \ematching is definitionally similar to conjunctive queries. Leveraging this observation, relational \ematching maps an \egraph to a set of relations and compiles every \ematching pattern to a conjunctive query. As conjunctive query has been extensively studied in the database community for decades, relational \ematching is \textit{conceptually simpler}. Moreover, such relational representation provides an unified way to express not only structural constraints, but also equality constraints, which are constraints that backtracking-based \ematching fails to take advantage of during query planning. By exploiting equality constraints, relational \ematching performs \textit{asymptotically faster }than existing\ematching algorithms on many queries. Finally, to avoid enumerate an unnecessarily large space of candidates, relational \ematching uses generic join to solve the generated conjunctive queries, which makes relational \ematching \textit{worst-case optimal}.

We implemented relational \ematching in \egg and evaluate our relational \ematching on some microbenchmarks. Preliminary experiment indicates that relational \ematching shows asymptotic speedup over backtracking-based \ematching algorithms on both cyclic and nonlinear acyclic patterns. However, for linear patterns, relational \ematching shows similar performance as backtracking-based \ematching algorithms, up to a constant factor. In the future, we plan to evaluate relational \ematching more extensively and on more realistic \egraph applications.


\documentclass{report}

\title{\nzmathbig\ User Manual\\ {\large{(for version 1.2)}}}

% header
\date{}
\author{}
\input{../macros}
\maketitle

\tableofcontents
\C
% end of header

\chapter{Overview}\label{overview}
\input{manual_overview}
%
\chapter{Basic Utilities}\label{utility}
\input{config}
\input{bigrandom}
\input{bigrange}
\input{compatibility}
%
\chapter{Functions}\label{function}
\input{algorithm}
\input{arith1}
\input{arygcd}
\input{combinatorial}
\input{cubic_root}
\input{ecpp}
\input{equation}
\input{gcd}
\input{multiplicative}
\input{prime}
\input{prime_decomp}
\input{quad}
\input{round2}
\input{squarefree}
%
\chapter{Classes}\label{class}
\input{algfield}
\input{elliptic}
\input{finitefield}
\input{group}
\input{imaginary}
\input{intresidue}
\input{lattice}
\input{matrix}
\input{module}
\input{permute}
\input{rational}
\input{real}
\input{ring}
\input{vector}
\input{factor.ecm}
\input{factor.find}
\input{factor.methods}
\input{factor.misc}
\input{factor.mpqs}
\input{factor.util}
\input{poly.factor}
\input{poly.formalsum}
\input{poly.groebner}
\input{poly.hensel}
\input{poly.multiutil}
\input{poly.multivar}
\input{poly.ratfunc}
\input{poly.ring}
\input{poly.termorder}
\input{poly.uniutil}
\input{poly.univar}

% footer
\bibliographystyle{jplain}%use jbibtex
\bibliography{nzmath_references}
% end of footer

\end{document}