\chapter{IPython Notebooks}
This section contains a copy of each of the IPython notebooks used in this project showing how features were created and plots were generated for each dataset.

\section*{Blob Shape Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}95}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
         \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
         \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
         \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
         \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
         \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
Warning: Cannot change to a different GUI toolkit: qt. Using osx instead.
    \end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}56}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{hologic\PYZus{}blobs.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{synthetic\PYZus{}blobs.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{hologic\PYZus{}blob\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{features\PYZus{}from\PYZus{}blobs}\PY{p}{(}\PY{n}{hologic}\PY{p}{)}
         \PY{n}{phantom\PYZus{}blob\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{features\PYZus{}from\PYZus{}blobs}\PY{p}{(}\PY{n}{phantom}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{hologic\PYZus{}blob\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}blob\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}blob\PYZus{}features}\PY{p}{,}
                                                                          \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}61}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}blob\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}blob\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}blob\PYZus{}features}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}blob\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}blob\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}62}]:}                        blob\_count  avg\_radius  std\_radius  min\_radius  \textbackslash{}
         p214-010-60001-cr.png          78   19.054538   17.506086           8
         p214-010-60005-cl.png          97   20.132590   23.255605           8
         p214-010-60008-ml.png         310   18.777405   24.388840           8
         p214-010-60012-cr.png         185   13.947419    7.884251           8
         p214-010-60013-cr.png         141   21.821567   30.666648           8

                                max\_radius  small\_radius\_count  med\_radius\_count  \textbackslash{}
         p214-010-60001-cr.png   90.509668                  68                 4
         p214-010-60005-cl.png  181.019336                  94                 2
         p214-010-60008-ml.png  181.019336                 299                 5
         p214-010-60012-cr.png   45.254834                 152                28
         p214-010-60013-cr.png  181.019336                 134                 1

                                large\_radius\_count    density  upper\_dist\_count  25\%  \textbackslash{}
         p214-010-60001-cr.png                   6  40.749811                22    8
         p214-010-60005-cl.png                   1  41.456308                27    8
         p214-010-60008-ml.png                   6  37.667995                68    8
         p214-010-60012-cr.png                   5  47.292289                63    8
         p214-010-60013-cr.png                   6  44.586708                38    8

                                      50\%        75\%
         p214-010-60001-cr.png  11.313708  22.627417
         p214-010-60005-cl.png  11.313708  22.627417
         p214-010-60008-ml.png  11.313708  16.000000
         p214-010-60012-cr.png  11.313708  16.000000
         p214-010-60013-cr.png  11.313708  22.627417
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{min\PYZus{}radius}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}64}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic\PYZus{}blob\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom\PYZus{}blob\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{index}\PY{o}{=}\PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/blob\PYZus{}features\PYZus{}ks.tex}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}64}]:}                           KS       p-value
         blob\_count          0.341667  2.774753e-07
         avg\_radius          0.847222  1.360953e-42
         std\_radius          0.711111  3.929143e-30
         max\_radius          0.363889  3.327680e-08
         small\_radius\_count  0.319444  2.024353e-06
         med\_radius\_count    0.338889  3.583275e-07
         large\_radius\_count  0.733333  5.112303e-32
         density             0.169444  4.114705e-02
         upper\_dist\_count    0.345833  1.883393e-07
         25\%                 0.358333  5.726005e-08
         50\%                 0.743056  7.334764e-33
         75\%                 0.777778  5.796838e-36
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}65}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}blob\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}blob\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}66}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{30}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}67}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.641093
[t-SNE] Error after 72 iterations with early exaggeration: 12.697723
[t-SNE] Error after 144 iterations: 0.495631
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}68}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/blob\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}98}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.641093
[t-SNE] Error after 100 iterations with early exaggeration: 14.272421
[t-SNE] Error after 300 iterations: 2.104165
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}99}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}99}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10cca73d0>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}73}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/blob\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}74}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}100}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}100}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10c306810>
\end{Verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}76}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}77}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}78}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/blob\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}79}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}101}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,}\PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}101}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10d9d7810>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}81}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{50}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}82}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

         \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}83}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}84}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}85}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}86}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}88}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}89}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}90}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}91}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}92}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}93}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)} \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}94}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/blob\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{blob-analysis_files/blob-analysis_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}

\section*{Blob Intensity Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}131}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
          \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
          \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
          \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
          \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
          \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}82}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{real\PYZus{}intensity.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}

         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{synthetic\PYZus{}intensity.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{phantom}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}83}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,}
                                                                 \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}84}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}85}]:} \PY{n}{hologic\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{group\PYZus{}by\PYZus{}scale\PYZus{}space}\PY{p}{(}\PY{n}{hologic}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{group\PYZus{}by\PYZus{}scale\PYZus{}space}\PY{p}{(}\PY{n}{phantom}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}86}]:} \PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{,}
                                                                               \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset} \PYZbs{}
             \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}88}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}88}]:}                        count      mean       std       min       25\%  \textbackslash{}
         p214-010-60001-cr.png    256  0.558904  0.087279  0.328763  0.510450
         p214-010-60005-ml.png    256  0.579815  0.090863  0.314655  0.530318
         p214-010-60008-cr.png    256  0.493326  0.074813  0.296470  0.447373
         p214-010-60012-ml.png    256  0.469238  0.081322  0.254982  0.415496
         p214-010-60013-mr.png    256  0.524458  0.087562  0.285158  0.467286

                                     50\%       75\%       max      skew  kurtosis  \textbackslash{}
         p214-010-60001-cr.png  0.570363  0.622144  0.724731 -0.406150 -0.127657
         p214-010-60005-ml.png  0.591799  0.644746  0.759436 -0.575184  0.634554
         p214-010-60008-cr.png  0.496014  0.544188  0.679322 -0.100948  0.021890
         p214-010-60012-ml.png  0.473583  0.527386  0.660004 -0.204323 -0.192516
         p214-010-60013-mr.png  0.534160  0.588593  0.704526 -0.407108  0.041762

                                   \ldots      count\_9    mean\_9     std\_9     min\_9  \textbackslash{}
         p214-010-60001-cr.png     \ldots       131044  0.541212  0.118465  0.141845
         p214-010-60005-ml.png     \ldots       131044  0.541212  0.118465  0.141845
         p214-010-60008-cr.png     \ldots       131044  0.523970  0.099598  0.148544
         p214-010-60012-ml.png     \ldots       131044  0.541212  0.118465  0.141845
         p214-010-60013-mr.png     \ldots       131044  0.554975  0.131461  0.138075

                                   25\%\_9     50\%\_9     75\%\_9     max\_9    skew\_9  \textbackslash{}
         p214-010-60001-cr.png  0.462988  0.546140  0.624509  0.921247 -0.150691
         p214-010-60005-ml.png  0.462988  0.546140  0.624509  0.921247 -0.150691
         p214-010-60008-cr.png  0.455340  0.521359  0.589320  0.936893 -0.017659
         p214-010-60012-ml.png  0.462988  0.546140  0.624509  0.921247 -0.150691
         p214-010-60013-mr.png  0.463040  0.552301  0.645746  0.949791  0.038416

                                kurtosis\_9
         p214-010-60001-cr.png    0.148522
         p214-010-60005-ml.png    0.148522
         p214-010-60008-cr.png    0.898368
         p214-010-60012-ml.png    0.148522
         p214-010-60013-mr.png   -0.374100

         [5 rows x 100 columns]
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}89}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{copy}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}90}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{index}\PY{o}{=}\PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/intensity\PYZus{}features\PYZus{}ks.tex}\PY{l+s}{\PYZdq{}}\PY{p}{,} \PY{n}{longtable}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}90}]:}                   KS       p-value
         count       0.000000  1.000000e+00
         mean        1.000000  3.587622e-59
         std         0.876389  1.515491e-45
         min         1.000000  3.587622e-59
         25\%         1.000000  3.587622e-59
         50\%         1.000000  3.587622e-59
         75\%         1.000000  3.587622e-59
         max         1.000000  3.587622e-59
         skew        0.891667  3.923764e-47
         kurtosis    0.568056  2.209941e-19
         count\_1     0.000000  1.000000e+00
         mean\_1      1.000000  3.587622e-59
         std\_1       0.981944  4.539903e-57
         min\_1       1.000000  3.587622e-59
         25\%\_1       1.000000  3.587622e-59
         50\%\_1       1.000000  3.587622e-59
         75\%\_1       1.000000  3.587622e-59
         max\_1       0.997222  7.598385e-59
         skew\_1      0.784722  1.335838e-36
         kurtosis\_1  0.466667  3.216681e-13
         count\_2     0.000000  1.000000e+00
         mean\_2      1.000000  3.587622e-59
         std\_2       1.000000  3.587622e-59
         min\_2       1.000000  3.587622e-59
         25\%\_2       1.000000  3.587622e-59
         50\%\_2       1.000000  3.587622e-59
         75\%\_2       1.000000  3.587622e-59
         max\_2       0.994444  1.605940e-58
         skew\_2      0.501389  3.410114e-15
         kurtosis\_2  0.436111  1.342503e-11
         \ldots              \ldots           \ldots
         count\_7     0.000000  1.000000e+00
         mean\_7      1.000000  3.587622e-59
         std\_7       0.955556  4.577742e-54
         min\_7       1.000000  3.587622e-59
         25\%\_7       1.000000  3.587622e-59
         50\%\_7       1.000000  3.587622e-59
         75\%\_7       1.000000  3.587622e-59
         max\_7       0.740278  1.280685e-32
         skew\_7      0.319444  2.024353e-06
         kurtosis\_7  0.304167  7.344875e-06
         count\_8     0.000000  1.000000e+00
         mean\_8      1.000000  3.587622e-59
         std\_8       0.929167  3.823290e-51
         min\_8       1.000000  3.587622e-59
         25\%\_8       1.000000  3.587622e-59
         50\%\_8       1.000000  3.587622e-59
         75\%\_8       1.000000  3.587622e-59
         max\_8       0.736111  2.943248e-32
         skew\_8      0.547222  5.120902e-18
         kurtosis\_8  0.395833  1.248634e-09
         count\_9     0.000000  1.000000e+00
         mean\_9      1.000000  3.587622e-59
         std\_9       0.956944  3.195999e-54
         min\_9       1.000000  3.587622e-59
         25\%\_9       1.000000  3.587622e-59
         50\%\_9       1.000000  3.587622e-59
         75\%\_9       0.997222  7.598385e-59
         max\_9       0.794444  1.674259e-37
         skew\_9      0.702778  1.934059e-29
         kurtosis\_9  0.891667  3.923764e-47

         [100 rows x 2 columns]
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}91}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}92}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{20}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}93}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 2.693481
[t-SNE] Error after 65 iterations with early exaggeration: 12.552178
[t-SNE] Error after 136 iterations: 1.190411
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}94}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/intensity\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}95}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 2.693481
[t-SNE] Error after 100 iterations with early exaggeration: 16.755029
[t-SNE] Error after 314 iterations: 2.633436
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}127}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}127}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x108bf72d0>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}97}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}98}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}99}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/intensity\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}100}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}129}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}129}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x108ea9090>
\end{Verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}102}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
              \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
          \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}103}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}104}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/intensity\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}105}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}130}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}130}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10a9fe950>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}107}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{50}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}108}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
          \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
          \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

          \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
          \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
          \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                             \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}109}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}110}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                             \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                             \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                             \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}111}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}112}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                        \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                        \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                        \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}113}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}114}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                  \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                  \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                  \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}115}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                    \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}116}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                             \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                             \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                             \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}117}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                               \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}118}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                        \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                        \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                        \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}119}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
          \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                         \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}120}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                  \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                  \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                  \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
          \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
          \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/intensity\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis_files/intensity-analysis_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}

\section*{Blob Texture Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}97}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
         \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
         \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
         \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
         \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
         \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
Warning: Cannot change to a different GUI toolkit: qt. Using osx instead.
    \end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}56}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{real\PYZus{}texture.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}

         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{synthetic\PYZus{}texture.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{phantom}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,}
                                                                \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{hologic\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{group\PYZus{}by\PYZus{}scale\PYZus{}space}\PY{p}{(}\PY{n}{hologic}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{group\PYZus{}by\PYZus{}scale\PYZus{}space}\PY{p}{(}\PY{n}{phantom}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{p}{,}
                                                                             \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}61}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{p}{,}
                                                                             \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}62}]:}                          contrast  dissimilarity  homogeneity    energy  \textbackslash{}
         p214-010-60001-ml.png  217.490041      11.182093     0.089156  0.068559
         p214-010-60005-cr.png  153.433967       9.793844     0.097550  0.069263
         p214-010-60008-cl.png  278.832070      12.986904     0.077585  0.069229
         p214-010-60012-cl.png  228.203678      11.830961     0.083644  0.068756
         p214-010-60013-ml.png  233.480009      12.147959     0.081455  0.067923

                                contrast\_1  dissimilarity\_1  homogeneity\_1  energy\_1  \textbackslash{}
         p214-010-60001-ml.png  255.275936        11.383161       0.091460  0.052581
         p214-010-60005-cr.png  258.457447         9.835271       0.120798  0.066882
         p214-010-60008-cl.png  277.870310        12.970713       0.079270  0.052845
         p214-010-60012-cl.png  236.048146        11.893532       0.084507  0.050689
         p214-010-60013-ml.png  243.073751        12.150686       0.083336  0.051553

                                contrast\_2  dissimilarity\_2    \ldots     homogeneity\_7  \textbackslash{}
         p214-010-60001-ml.png  223.895510        10.859934    \ldots          0.094498
         p214-010-60005-cr.png  148.101614         9.619357    \ldots          0.133482
         p214-010-60008-cl.png  277.135918        12.925121    \ldots          0.077955
         p214-010-60012-cl.png  205.001806        11.381168    \ldots          0.108649
         p214-010-60013-ml.png  221.442525        11.778895    \ldots          0.082859

                                energy\_7  contrast\_8  dissimilarity\_8  homogeneity\_8  \textbackslash{}
         p214-010-60001-ml.png  0.014957  171.293827        10.346745       0.094648
         p214-010-60005-cr.png  0.019024  206.110004         7.723766       0.155662
         p214-010-60008-cl.png  0.019611  262.540916        12.908503       0.077737
         p214-010-60012-cl.png  0.025046  188.258062        10.873996       0.089765
         p214-010-60013-ml.png  0.014600  230.437848        12.089526       0.081013

                                energy\_8  contrast\_9  dissimilarity\_9  homogeneity\_9  \textbackslash{}
         p214-010-60001-ml.png  0.014245  157.454233         9.781551       0.105151
         p214-010-60005-cr.png  0.028688  132.380141         9.052372       0.108430
         p214-010-60008-cl.png  0.018621  257.790604        12.788839       0.078467
         p214-010-60012-cl.png  0.014025  157.454233         9.781551       0.105151
         p214-010-60013-ml.png  0.015532  203.846013        11.353827       0.086053

                                energy\_9
         p214-010-60001-ml.png  0.019975
         p214-010-60005-cr.png  0.015630
         p214-010-60008-cl.png  0.019016
         p214-010-60012-cl.png  0.019975
         p214-010-60013-ml.png  0.013723

         [5 rows x 40 columns]
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{copy}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}64}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,}
                                \PY{n}{index}\PY{o}{=}\PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/texture\PYZus{}features\PYZus{}ks.tex}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}64}]:}                        KS       p-value
         contrast         0.381944  5.383186e-09
         dissimilarity    1.000000  3.587622e-59
         homogeneity      1.000000  3.587622e-59
         energy           1.000000  3.587622e-59
         contrast\_1       0.586111  1.318746e-20
         dissimilarity\_1  1.000000  3.587622e-59
         homogeneity\_1    1.000000  3.587622e-59
         energy\_1         1.000000  3.587622e-59
         contrast\_2       0.863889  2.874007e-44
         dissimilarity\_2  1.000000  3.587622e-59
         homogeneity\_2    1.000000  3.587622e-59
         energy\_2         1.000000  3.587622e-59
         contrast\_3       0.923611  1.538596e-50
         dissimilarity\_3  1.000000  3.587622e-59
         homogeneity\_3    1.000000  3.587622e-59
         energy\_3         1.000000  3.587622e-59
         contrast\_4       0.845833  1.870608e-42
         dissimilarity\_4  1.000000  3.587622e-59
         homogeneity\_4    1.000000  3.587622e-59
         energy\_4         1.000000  3.587622e-59
         contrast\_5       0.979167  9.485680e-57
         dissimilarity\_5  1.000000  3.587622e-59
         homogeneity\_5    1.000000  3.587622e-59
         energy\_5         1.000000  3.587622e-59
         contrast\_6       1.000000  3.587622e-59
         dissimilarity\_6  1.000000  3.587622e-59
         homogeneity\_6    1.000000  3.587622e-59
         energy\_6         0.994444  1.605940e-58
         contrast\_7       0.969444  1.230285e-55
         dissimilarity\_7  1.000000  3.587622e-59
         homogeneity\_7    1.000000  3.587622e-59
         energy\_7         1.000000  3.587622e-59
         contrast\_8       0.986111  1.497318e-57
         dissimilarity\_8  1.000000  3.587622e-59
         homogeneity\_8    1.000000  3.587622e-59
         energy\_8         0.997222  7.598385e-59
         contrast\_9       1.000000  3.587622e-59
         dissimilarity\_9  1.000000  3.587622e-59
         homogeneity\_9    1.000000  3.587622e-59
         energy\_9         1.000000  3.587622e-59
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}65}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}66}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{20}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}67}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.192292
[t-SNE] Error after 83 iterations with early exaggeration: 11.373997
[t-SNE] Error after 141 iterations: 0.460456
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}68}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/texture\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}69}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.192292
[t-SNE] Error after 100 iterations with early exaggeration: 16.345359
[t-SNE] Error after 301 iterations: 2.602024
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}98}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}98}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10d6cc350>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}73}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/texture\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}74}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}101}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}101}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10ee15750>
\end{Verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}76}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{5}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}77}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}78}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/texture\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}79}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}100}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}100}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10c0ef1d0>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}81}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{10}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}82}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

         \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}83}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}84}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}85}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}86}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}88}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}89}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}90}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}91}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}92}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}93}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}94}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/texture\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis_files/texture-analysis_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}

\section*{Line Shape Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}86}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
         \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
         \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
         \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
         \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
         \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}42}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{real\PYZhy{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{phantom\PYZhy{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}43}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,}
                                                                \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}44}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}45}]:} \PY{n}{hologic\PYZus{}line\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{features\PYZus{}from\PYZus{}lines}\PY{p}{(}\PY{n}{hologic}\PY{p}{)}
         \PY{n}{phantom\PYZus{}line\PYZus{}features} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{features\PYZus{}from\PYZus{}lines}\PY{p}{(}\PY{n}{phantom}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}46}]:} \PY{n}{hologic\PYZus{}line\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}line\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}line\PYZus{}features}\PY{p}{,}
                                                                          \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}47}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}line\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}line\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}line\PYZus{}features}\PY{p}{,}
                                                                          \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}48}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}line\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}line\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}48}]:}                        count        mean         std  min   25\%   50\%     75\%  \textbackslash{}
         p214-010-60001-cl.png     72  161.791667  245.194659    1  61.5  94.5  137.25
         p214-010-60005-ml.png    124  177.153226  252.405502    1  57.0  91.5  174.75
         p214-010-60008-cl.png    105   99.695238   77.001889    1  57.0  76.0  110.00
         p214-010-60012-mr.png    213  163.037559  315.235968    1  55.0  79.0  158.00
         p214-010-60013-cr.png    225  155.368889  180.493203    1  68.0  95.0  162.00

                                 max      skew   kurtosis  upper\_dist\_count
         p214-010-60001-cl.png  1744  4.786025  26.793023                16
         p214-010-60005-ml.png  1725  3.323887  13.873128                31
         p214-010-60008-cl.png   454  2.537117   7.788977                33
         p214-010-60012-mr.png  3677  7.384801  74.429175                52
         p214-010-60013-cr.png  1285  3.584626  15.784599                60
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}49}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{min}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{)}
         \PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{fillna}\PY{p}{(}\PY{l+m+mi}{0}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}50}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic\PYZus{}line\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom\PYZus{}line\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{index}\PY{o}{=}\PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/line\PYZus{}features\PYZus{}ks.tex}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}50}]:}                         KS       p-value
         count             0.933333  1.338265e-51
         mean              0.593056  4.356206e-21
         std               0.654167  1.450514e-25
         25\%               0.143056  1.255126e-01
         50\%               0.304167  7.344875e-06
         75\%               0.508333  1.320817e-15
         max               0.737500  2.231475e-32
         skew              0.480556  5.426886e-14
         kurtosis          0.506944  1.598384e-15
         upper\_dist\_count  0.913889  1.724254e-49
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}51}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}line\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}line\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}52}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{20}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}53}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.347012
[t-SNE] Error after 65 iterations with early exaggeration: 12.391945
[t-SNE] Error after 132 iterations: 0.662618
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}54}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}55}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 1.347012
[t-SNE] Error after 100 iterations with early exaggeration: 16.628509
[t-SNE] Error after 302 iterations: 2.665706
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}83}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}83}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x110b11910>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}87}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x1128091d0>
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_35_1.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{verbatim}
<matplotlib.figure.Figure at 0x111347bd0>
    \end{verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}64}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}65}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}85}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}85}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x10902cf90>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}67}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{50}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}68}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

         \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}69}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}70}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}73}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}74}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}75}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}76}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}77}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}78}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}79}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}80}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{line-analysis_files/line-analysis_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}

\section*{Line Intensity Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}83}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
         \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
         \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
         \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
         \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
         \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
Warning: Cannot change to a different GUI toolkit: qt. Using osx instead.
    \end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}42}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{real\PYZus{}intensity\PYZus{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}

         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{synthetic\PYZus{}intensity\PYZus{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{n}{phantom}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}43}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,}
                                                                \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}44}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}45}]:} \PY{n}{hologic\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{hologic}\PY{p}{[}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{l+m+mi}{4}\PY{p}{:}\PY{p}{]}\PY{p}{]}
         \PY{n}{hologic\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{o}{.}\PY{n}{groupby}\PY{p}{(}\PY{n}{hologic}\PY{o}{.}\PY{n}{index}\PY{p}{)}\PY{o}{.}\PY{n}{agg}\PY{p}{(}\PY{n}{np}\PY{o}{.}\PY{n}{mean}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{phantom}\PY{p}{[}\PY{n}{phantom}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{l+m+mi}{4}\PY{p}{:}\PY{p}{]}\PY{p}{]}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features} \PY{o}{=} \PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{o}{.}\PY{n}{groupby}\PY{p}{(}\PY{n}{phantom}\PY{o}{.}\PY{n}{index}\PY{p}{)}\PY{o}{.}\PY{n}{agg}\PY{p}{(}\PY{n}{np}\PY{o}{.}\PY{n}{mean}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}46}]:} \PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{,}
                                                                               \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}47}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset} \PYZbs{}
             \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}48}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}48}]:}                            mean       std       min       25\%       50\%  \textbackslash{}
         p214-010-60001-cl.png  0.362584  0.099563  0.176311  0.290825  0.350695
         p214-010-60005-cr.png  0.390749  0.115338  0.178942  0.308598  0.382695
         p214-010-60008-mr.png  0.380682  0.068131  0.252233  0.335284  0.374149
         p214-010-60012-cr.png  0.310309  0.084479  0.157582  0.252724  0.301992
         p214-010-60013-cl.png  0.328995  0.077626  0.185815  0.275454  0.321237

                                     75\%       max      skew  kurtosis
         p214-010-60001-cl.png  0.425325  0.651941  0.554375  0.564813
         p214-010-60005-cr.png  0.464941  0.671299  0.285397 -0.168101
         p214-010-60008-mr.png  0.418809  0.586883  0.533288  0.537177
         p214-010-60012-cr.png  0.359711  0.574846  0.591287  0.876965
         p214-010-60013-cl.png  0.373890  0.553304  0.527032  0.352804
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}49}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{copy}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}50}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom\PYZus{}intensity\PYZus{}features}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{index}\PY{o}{=}\PY{n}{selected\PYZus{}features}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/line\PYZus{}intensity\PYZus{}features\PYZus{}ks.tex}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}50}]:}                 KS       p-value
         mean      1.000000  3.587622e-59
         std       0.966667  2.546525e-55
         min       1.000000  3.587622e-59
         25\%       1.000000  3.587622e-59
         50\%       1.000000  3.587622e-59
         75\%       1.000000  3.587622e-59
         max       1.000000  3.587622e-59
         skew      1.000000  3.587622e-59
         kurtosis  0.213889  4.106586e-03
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}51}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}intensity\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}52}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{20}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}53}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 0.714076
[t-SNE] Error after 65 iterations with early exaggeration: 12.750609
[t-SNE] Error after 130 iterations: 0.743695
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}54}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}intensity\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}55}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 0.714076
[t-SNE] Error after 100 iterations with early exaggeration: 16.315305
[t-SNE] Error after 297 iterations: 2.612050
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}84}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}84}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x115f941d0>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}intensity\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}86}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}86}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x117134a90>
\end{Verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}64}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/line\PYZus{}intensity\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}65}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}87}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x115c09d90>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}67}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{50}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}68}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

         \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}69}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}70}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}73}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}74}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}75}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}76}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}77}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}78}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}79}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}80}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/line\PYZus{}intensity\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{intensity-analysis-lines_files/intensity-analysis-lines_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}

\section*{Line Texture Analysis}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}89}]:} \PY{o}{\PYZpc{}}\PY{k}{matplotlib} \PY{n}{inline}
         \PY{k+kn}{import} \PY{n+nn}{pandas} \PY{k+kn}{as} \PY{n+nn}{pd}
         \PY{k+kn}{import} \PY{n+nn}{numpy} \PY{k+kn}{as} \PY{n+nn}{np}
         \PY{k+kn}{import} \PY{n+nn}{scipy.stats} \PY{k+kn}{as} \PY{n+nn}{stats}
         \PY{k+kn}{import} \PY{n+nn}{matplotlib.pyplot} \PY{k+kn}{as} \PY{n+nn}{plt}
         \PY{k+kn}{import} \PY{n+nn}{mia}
\end{Verbatim}

    \section{Loading and Preprocessing}\label{loading-and-preprocessing}

    Loading the hologic and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}42}]:} \PY{n}{hologic} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{real\PYZus{}texture\PYZus{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{c}{\PYZsh{} hologic.drop(hologic.columns[:2], axis=1, inplace=True)}
         \PY{n}{hologic}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}

         \PY{n}{phantom} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{o}{.}\PY{n}{from\PYZus{}csv}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{synthetic\PYZus{}texture\PYZus{}lines.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{c}{\PYZsh{} phantom.drop(phantom.columns, axis=1, inplace=True)}
         \PY{n}{phantom}\PY{o}{.}\PY{n}{drop}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{breast\PYZus{}area}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{axis}\PY{o}{=}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{inplace}\PY{o}{=}\PY{n+nb+bp}{True}\PY{p}{)}
\end{Verbatim}

    Loading the meta data for the real and synthetic datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}43}]:} \PY{n}{hologic\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}hologic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{hologic}\PY{p}{,} \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/real\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}synthetic\PYZus{}meta\PYZus{}data}\PY{p}{(}\PY{n}{phantom}\PY{p}{,}
                                                                \PY{l+s}{\PYZdq{}}\PY{l+s}{meta\PYZus{}data/synthetic\PYZus{}meta.csv}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{phantom\PYZus{}meta}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZsq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZsq{}}
\end{Verbatim}

    Prepare the BI-RADS/VBD labels for both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}44}]:} \PY{n}{hologic\PYZus{}labels} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{o}{.}\PY{n}{BIRADS}
         \PY{n}{phantom\PYZus{}labels} \PY{o}{=} \PY{n}{phantom\PYZus{}meta}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{VBD.1}\PY{l+s}{\PYZsq{}}\PY{p}{]}

         \PY{n}{class\PYZus{}labels} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}labels}\PY{p}{,} \PY{n}{phantom\PYZus{}labels}\PY{p}{]}\PY{p}{)}
         \PY{n}{class\PYZus{}labels}\PY{o}{.}\PY{n}{index}\PY{o}{.}\PY{n}{name} \PY{o}{=} \PY{l+s}{\PYZdq{}}\PY{l+s}{img\PYZus{}name}\PY{l+s}{\PYZdq{}}
         \PY{n}{labels} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{class\PYZus{}labels}\PY{p}{)}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]}
\end{Verbatim}

    \section{Creating Features}\label{creating-features}

    Create blob features from distribution of blobs

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}45}]:} \PY{n}{hologic\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{hologic}\PY{p}{[}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{l+m+mi}{5}\PY{p}{:}\PY{p}{]}\PY{p}{]}
         \PY{n}{hologic\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{o}{.}\PY{n}{groupby}\PY{p}{(}\PY{n}{hologic}\PY{o}{.}\PY{n}{index}\PY{p}{)}\PY{o}{.}\PY{n}{agg}\PY{p}{(}\PY{n}{np}\PY{o}{.}\PY{n}{mean}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{phantom}\PY{p}{[}\PY{n}{phantom}\PY{o}{.}\PY{n}{columns}\PY{p}{[}\PY{l+m+mi}{5}\PY{p}{:}\PY{p}{]}\PY{p}{]}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features} \PY{o}{=} \PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{o}{.}\PY{n}{groupby}\PY{p}{(}\PY{n}{phantom}\PY{o}{.}\PY{n}{index}\PY{p}{)}\PY{o}{.}\PY{n}{agg}\PY{p}{(}\PY{n}{np}\PY{o}{.}\PY{n}{mean}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the real mammograms. This is important so that
each patient is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}46}]:} \PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{hologic\PYZus{}meta}\PY{o}{.}\PY{n}{drop\PYZus{}duplicates}\PY{p}{(}\PY{p}{)}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{]}
         \PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{hologic\PYZus{}texture\PYZus{}features}\PY{p}{,}
                                                                             \PY{l+s}{\PYZsq{}}\PY{l+s}{patient\PYZus{}id}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Take a random subset of the phantom mammograms. This is important so
that each case is not over represented.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}47}]:} \PY{n}{syn\PYZus{}feature\PYZus{}meta} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{remove\PYZus{}duplicate\PYZus{}index}\PY{p}{(}\PY{n}{phantom\PYZus{}meta}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{]} \PY{o}{=} \PY{n}{syn\PYZus{}feature\PYZus{}meta}\PY{o}{.}\PY{n}{phantom\PYZus{}name}\PY{o}{.}\PY{n}{tolist}\PY{p}{(}\PY{p}{)}
         \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{create\PYZus{}random\PYZus{}subset}\PY{p}{(}\PY{n}{phantom\PYZus{}texture\PYZus{}features}\PY{p}{,}
                                                                             \PY{l+s}{\PYZsq{}}\PY{l+s}{phantom\PYZus{}name}\PY{l+s}{\PYZsq{}}\PY{p}{)}
\end{Verbatim}

    Combine the features from both datasets.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}48}]:} \PY{n}{features} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{concat}\PY{p}{(}\PY{p}{[}\PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{p}{,} \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{p}{]}\PY{p}{)}
         \PY{k}{assert} \PY{n}{features}\PY{o}{.}\PY{n}{shape}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{]} \PY{o}{==} \PY{l+m+mi}{96}
         \PY{n}{features}\PY{o}{.}\PY{n}{head}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}48}]:}                          contrast  dissimilarity  homogeneity    energy
         p214-010-60001-cr.png  141.645681       8.313746     0.112722  0.079576
         p214-010-60005-ml.png  160.060707       9.000738     0.107945  0.087887
         p214-010-60008-cl.png  100.450716       7.380523     0.131506  0.069471
         p214-010-60012-mr.png  147.359186       8.009818     0.097230  0.083729
         p214-010-60013-ml.png  114.488132       7.682750     0.124403  0.068205
\end{Verbatim}

    Filter some features, such as the min, to remove noise.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}49}]:} \PY{n}{selected\PYZus{}features} \PY{o}{=} \PY{n}{features}\PY{o}{.}\PY{n}{copy}\PY{p}{(}\PY{p}{)}
\end{Verbatim}

    \section{Compare Real and Synthetic
Features}\label{compare-real-and-synthetic-features}

    Compare the distributions of features detected from the real mammograms
and the phantoms using the Kolmogorov-Smirnov two sample test.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}50}]:} \PY{n}{ks\PYZus{}stats} \PY{o}{=} \PY{p}{[}\PY{n+nb}{list}\PY{p}{(}\PY{n}{stats}\PY{o}{.}\PY{n}{ks\PYZus{}2samp}\PY{p}{(}\PY{n}{hologic}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{,}
                                         \PY{n}{phantom}\PY{p}{[}\PY{n}{col}\PY{p}{]}\PY{p}{)}\PY{p}{)}
                                         \PY{k}{for} \PY{n}{col} \PY{o+ow}{in} \PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{]}

         \PY{n}{ks\PYZus{}test} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{n}{ks\PYZus{}stats}\PY{p}{,} \PY{n}{columns}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{KS}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{p\PYZhy{}value}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{,} \PY{n}{index}\PY{o}{=}\PY{n}{hologic}\PY{o}{.}\PY{n}{columns}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}\PY{o}{.}\PY{n}{to\PYZus{}latex}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{tables/texture\PYZus{}features\PYZus{}ks\PYZus{}lines.tex}\PY{l+s}{\PYZdq{}}\PY{p}{)}
         \PY{n}{ks\PYZus{}test}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}50}]:}                      KS       p-value
         area           0.079551  9.106412e-12
         min\_row        0.896401  0.000000e+00
         min\_col        0.232212  4.582395e-97
         max\_row        0.883959  0.000000e+00
         max\_col        0.219444  9.914914e-87
         contrast       0.897291  0.000000e+00
         dissimilarity  0.923237  0.000000e+00
         homogeneity    0.928761  0.000000e+00
         energy         0.554395  0.000000e+00
\end{Verbatim}

    \section{Dimensionality Reduction}\label{dimensionality-reduction}

\subsection{t-SNE}\label{t-sne}

Running t-SNE to obtain a two dimensional representation.

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}51}]:} \PY{n}{real\PYZus{}index} \PY{o}{=} \PY{n}{hologic\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
         \PY{n}{phantom\PYZus{}index} \PY{o}{=} \PY{n}{phantom\PYZus{}texture\PYZus{}features\PYZus{}subset}\PY{o}{.}\PY{n}{index}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}52}]:} \PY{n}{kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{learning\PYZus{}rate}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{200}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{perplexity}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{20}\PY{p}{,}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{verbose}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{1}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}53}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 0.380925
[t-SNE] Error after 65 iterations with early exaggeration: 11.566220
[t-SNE] Error after 129 iterations: 0.686186
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}54}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/lines\PYZus{}texture\PYZus{}SNE\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_26_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    Running t-SNE to obtain a 3 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}55}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{tSNE}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
[t-SNE] Computing pairwise distances\ldots
[t-SNE] Computed conditional probabilities for sample 96 / 96
[t-SNE] Mean sigma: 0.380925
[t-SNE] Error after 100 iterations with early exaggeration: 16.559494
[t-SNE] Error after 296 iterations: 2.686845
    \end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}85}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}85}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x111f55b90>
\end{Verbatim}

    \subsection{Isomap}\label{isomap}

Running Isomap to obtain a 2 dimensional mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{iso\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/lines\PYZus{}texture\PYZus{}iso\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_33_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{iso\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{isomap}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{iso\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}87}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}87}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x112437c10>
\end{Verbatim}

    \subsection{Locally Linear Embedding}\label{locally-linear-embedding}

Running locally linear embedding to obtain 2d mapping

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{lle\PYZus{}kwargs} \PY{o}{=} \PY{p}{\PYZob{}}
             \PY{l+s}{\PYZsq{}}\PY{l+s}{n\PYZus{}neighbors}\PY{l+s}{\PYZsq{}}\PY{p}{:} \PY{l+m+mi}{4}\PY{p}{,}
         \PY{p}{\PYZcb{}}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}2d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{2}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}64}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}2d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/mappings/lines\PYZus{}texture\PYZus{}lle\PYZus{}mapping\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_39_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}65}]:} \PY{n}{lle\PYZus{}mapping\PYZus{}3d} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{analysis}\PY{o}{.}\PY{n}{lle}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,} \PY{n}{n\PYZus{}components}\PY{o}{=}\PY{l+m+mi}{3}\PY{p}{,} \PY{o}{*}\PY{o}{*}\PY{n}{lle\PYZus{}kwargs}\PY{p}{)}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}88}]:} \PY{n}{mia}\PY{o}{.}\PY{n}{plotting}\PY{o}{.}\PY{n}{plot\PYZus{}mapping\PYZus{}3d}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{,} \PY{n}{real\PYZus{}index}\PY{p}{,} \PY{n}{phantom\PYZus{}index}\PY{p}{,} \PY{n}{labels}\PY{p}{)}
\end{Verbatim}

            \begin{Verbatim}[commandchars=\\\{\}]
{\color{outcolor}Out[{\color{outcolor}88}]:} <matplotlib.axes.\_subplots.Axes3DSubplot at 0x11209ca10>
\end{Verbatim}

    \subsection{Quality Assessment of Dimensionality
Reduction}\label{quality-assessment-of-dimensionality-reduction}

    Assess the quality of the DR against measurements from the co-ranking
matrices. First create co-ranking matrices for each of the
dimensionality reduction mappings

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}67}]:} \PY{n}{max\PYZus{}k} \PY{o}{=} \PY{l+m+mi}{50}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}68}]:} \PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}2d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}2d}\PY{p}{)}

         \PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{SNE\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{iso\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
         \PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm} \PY{o}{=} \PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{coranking\PYZus{}matrix}\PY{p}{(}\PY{n}{selected\PYZus{}features}\PY{p}{,}
                                                            \PY{n}{lle\PYZus{}mapping\PYZus{}3d}\PY{p}{)}
\end{Verbatim}

    \subsubsection{2D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}69}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}70}]:} \PY{n}{trustworthiness\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}trustworthiness\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_48_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{continuity\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}2d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}continuity\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_50_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}73}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}2d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}2d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}74}]:} \PY{n}{lcmc\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}2d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}2d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}lcmc\PYZus{}2d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_52_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \subsubsection{3D Mappings}\label{d-mappings}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}75}]:} \PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{trustworthiness}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                                   \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}76}]:} \PY{n}{trustworthiness3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{iso\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{,}
                                            \PY{n}{lle\PYZus{}trustworthiness\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                            \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{trustworthiness3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}trustworthiness\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_55_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}77}]:} \PY{n}{SNE\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}continuity\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{continuity}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                              \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}78}]:} \PY{n}{continuity3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{iso\PYZus{}continuity\PYZus{}3d}\PY{p}{,}
                                       \PY{n}{lle\PYZus{}continuity\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                       \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{continuity3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}continuity\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_57_0.png}
    \end{center}
    { \hspace*{\fill} \\}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}79}]:} \PY{n}{SNE\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{SNE\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{iso\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{iso\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
         \PY{n}{lle\PYZus{}lcmc\PYZus{}3d} \PY{o}{=} \PY{p}{[}\PY{n}{mia}\PY{o}{.}\PY{n}{coranking}\PY{o}{.}\PY{n}{LCMC}\PY{p}{(}\PY{n}{lle\PYZus{}mapping\PYZus{}3d\PYZus{}cm}\PY{p}{,} \PY{n}{k}\PY{p}{)}
                        \PY{k}{for} \PY{n}{k} \PY{o+ow}{in} \PY{n+nb}{range}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,} \PY{n}{max\PYZus{}k}\PY{p}{)}\PY{p}{]}
\end{Verbatim}

    \begin{Verbatim}[commandchars=\\\{\}]
{\color{incolor}In [{\color{incolor}80}]:} \PY{n}{lcmc3d\PYZus{}df} \PY{o}{=} \PY{n}{pd}\PY{o}{.}\PY{n}{DataFrame}\PY{p}{(}\PY{p}{[}\PY{n}{SNE\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{iso\PYZus{}lcmc\PYZus{}3d}\PY{p}{,}
                                 \PY{n}{lle\PYZus{}lcmc\PYZus{}3d}\PY{p}{]}\PY{p}{,}
                                 \PY{n}{index}\PY{o}{=}\PY{p}{[}\PY{l+s}{\PYZsq{}}\PY{l+s}{SNE}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{Isomap}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{l+s}{\PYZsq{}}\PY{l+s}{LLE}\PY{l+s}{\PYZsq{}}\PY{p}{]}\PY{p}{)}\PY{o}{.}\PY{n}{T}
         \PY{n}{lcmc3d\PYZus{}df}\PY{o}{.}\PY{n}{plot}\PY{p}{(}\PY{p}{)}
         \PY{n}{plt}\PY{o}{.}\PY{n}{savefig}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{figures/quality\PYZus{}measures/lines\PYZus{}texture\PYZus{}lcmc\PYZus{}3d.png}\PY{l+s}{\PYZsq{}}\PY{p}{,} \PY{n}{dpi}\PY{o}{=}\PY{l+m+mi}{300}\PY{p}{)}
\end{Verbatim}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{texture-analysis-lines_files/texture-analysis-lines_59_0.png}
    \end{center}
    { \hspace*{\fill} \\}