This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp4/Project_4_Maggioni_Claudio.tex

125 lines
6.4 KiB
TeX
Raw Normal View History

2020-11-04 13:59:14 +00:00
\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
2020-11-11 20:36:00 +00:00
\usepackage{graphicx}
2020-11-04 13:59:14 +00:00
\input{assignment.sty}
2020-11-11 20:36:00 +00:00
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{grffile}
\usepackage{amsmath}
\usepgfplotslibrary{external}
\tikzexternalize
2020-11-04 13:59:14 +00:00
\begin{document}
\setassignment
\setduedate{Wednesday, 18 November 2020, 11:55 PM}
2020-11-17 13:12:36 +00:00
\serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed with: --}{Solution for Project 4}{}
2020-11-04 13:59:14 +00:00
\newline
\assignmentpolicy
2020-11-17 13:12:36 +00:00
\section{Spectral clustering of non-convex sets [60 points]:}
Plots for the \textit{Two spirals}, \textit{Cluster in cluster}, \textit{Crescent moon}, \textit{Full moon} clustering for $K=2$ and for \textit{Corners}, \textit{Outlier} for $K=4$ can be found in figures~\ref{fig:setsa},~\ref{fig:setsb},~\ref{fig:setsc},~\ref{fig:setsd},~\ref{fig:setse}, and ~\ref{fig:setsf}. All the plots are reproducible by simply running \texttt{ClusterPoints.m} once.
\subsection{Observation on the \textit{Spiral} set of points}
It is possible to distinguish two distinct cluster in the \textit{Spiral} set: if we consider this set of points as two intertwined non-intersecting spiral shaped curves, then each of the spiral can be considered as a cluster.
However, it is possible that a naive clustering approach might not recognise these two clusters: since the spirals are intertwined and the points they are rotating on are close, averaging the points on each spiral leads to very close centroids and thus an algorithm heavily based on coordinate averaging (like k-means clustering) might have a hard time in identifying the spirals.
\subsection{Choice of $\sigma$ parameter for the Gaussian similarity function}
According to the recommendations and rules of thumb on $\epsilon$ neighboorhood graph based spectral clustering, the
$\sigma$ parameter, as a rule of thumb, should be chosen in the order of $\log(n)$. However, choosing
$\sigma = \log(n)$ produces ill-conditioned
i.e. (singular) Laplacian matrices for some graphs, which make spectral clustering inaccurate or impossible. Therefore,
I have chosen $\sigma = 2 \log(n)$. As the choice of this parameter is not governed by any strict law and this choice follows the rule
of thumb and produces results that do not raise suspicion on incorrectness, I sticked to this choice.
\section{Spectral clustering of real-world graphs [40 points]:}
\subsection{Plotting and commenting spectral and k-means clustering for several example graphs}
Plots of spectral and K-means clustering for graphs \textit{Airfoil}, \textit{Barth}, \textit{Grid2}, and \textit{3elt} can be
found respectively in figure~\ref{fig:air},~\ref{fig:bar},~\ref{fig:gri} and~\ref{fig:elt}. These graphs are reproducible by running \texttt{ClusterGraphs.m} once.
2020-11-04 13:59:14 +00:00
2020-11-17 13:12:36 +00:00
Overall, in all graphs spectral clustering seems to favour a more even distribution of vertices
along the various clusters, while K-means generates clusters that cover similar areas. The extreme
example of this is the \textit{3elt} graph, where spectral and k-means clustering with wild imbalances
respectively in cluster area and in cluster vertex count.
2020-11-04 13:59:14 +00:00
2020-11-17 13:12:36 +00:00
In the \textit{Airfoil} graph it is unclear how the graph should be partitioned: both clusterings seem artificial and arbitrary.
Again the comparison of cluster areas and cluster node counts follows what said above.
2020-11-04 13:59:14 +00:00
2020-11-17 13:12:36 +00:00
For the \textit{Grid2} graph, spectral clustering seems to form a more natural cluster set by cutting somewhat radially
along the center of the graph's ``hole''. In contrast, k-means clustering performs more artificial cuts along the y axis,
creating clusters that resemble even slices of a cake.
2020-11-04 13:59:14 +00:00
2020-11-17 13:12:36 +00:00
Both \textit{Barth} and \textit{3elt} clusterings differ drammatically between spectral and k-means clustering and, albeit
following the general observation stated above as well, both are not natural or obvious clusterings to human judgement.
2020-11-04 13:59:14 +00:00
2020-11-17 13:12:36 +00:00
\subsection{Vertex count for spectral and k-means clustering}
The table for the node counts of each cluster produced by spectral and k-means clustering of graphs \textit{Airfoil}, \textit{Grid2},
\textit{Barth}, and \textit{3elt} can be found in figure~\ref{fig:tab}. The table and histograms found under the figures in the last
section can be reproduced by running \texttt{ClusterGraphs.m} once.
As stated before, we observe that node counts for clusters generated by spectral clustering are more balanced with each other than the
ones produced by K-means.
\begin{figure}
\centering
\scalebox{.75}{\input{Two spirals.tex}}\label{fig:setsa}\caption{Spectral and k-means clustering graphs for \textit{Two Spirals}}
\end{figure}
\begin{figure}
\centering
\scalebox{.75}{\input{Cluster in cluster.tex}}\label{fig:setsb}\caption{Spectral and k-means clustering graphs for \textit{Cluster in cluster}}
\end{figure}
\begin{figure}
\centering
\scalebox{.75}{\input{Half crescent.tex}}\label{fig:setsc}\caption{Spectral and k-means clustering graphs for \textit{Half crescent}}
\end{figure}
\begin{figure}
\centering
\scalebox{.75}{\input{Full crescent.tex}}\label{fig:setsd}\caption{Spectral and k-means clustering graphs for \textit{Full crescent}}
\end{figure}
\begin{figure}
\centering
\scalebox{.75}{\input{Corners.tex}}\label{fig:setse}\caption{Spectral and k-means clustering graphs for \textit{Corners}}
\end{figure}
\begin{figure}
\centering
\scalebox{.75}{\input{Outlier.tex}}\label{fig:setsf}\caption{Spectral and k-means clustering graphs for \textit{Outlier}}
\end{figure}
2020-11-04 13:59:14 +00:00
2020-11-11 20:36:00 +00:00
\begin{figure}
2020-11-17 13:12:36 +00:00
\centering\input{airfoil1_clu.tex}\label{fig:air}
2020-11-11 20:36:00 +00:00
\caption{Graphs for \textit{Airfoil1}}
\end{figure}
\begin{figure}
2020-11-17 13:12:36 +00:00
\centering\input{barth_clu.tex}\label{fig:bar}
2020-11-11 20:36:00 +00:00
\caption{Graphs for \textit{Barth}}
\end{figure}
\begin{figure}
2020-11-17 13:12:36 +00:00
\centering\input{grid2_clu.tex}\label{fig:gri}
2020-11-11 20:36:00 +00:00
\caption{Graphs for \textit{Grid2}}
\end{figure}
\begin{figure}
2020-11-17 13:12:36 +00:00
\centering\input{3elt_clu.tex}\label{fig:elt}
2020-11-11 20:36:00 +00:00
\caption{Graphs for \textit{3elt}}
\end{figure}
\begin{figure}
2020-11-17 13:12:36 +00:00
\centering
\begin{tabular}{ccccccccc}
Graph & \multicolumn{4}{c}{Spectral} & \multicolumn{4}{c}{K-means} \\
{} & 1 & 2 & 3 & 4 & 1 & 2 & 3 & 4 \\\hline
airfoil1 & 1150& 1082 &1050& 971 & 1871& 347 & 738 &1297\\
barth & 1601 &1490 &1405 &2195 & 70 &3526 & 70 &3025\\
grid2 & 379& 827 &1305 & 785 & 1271 & 604 & 238 &1183\\
3elt & 965 &874 &1794 &1087 & 13 &1714 & 37 &2956\\
\end{tabular}\label{fig:tab}\caption{Spectral and K-means clustering node counts for node counts}
2020-11-11 20:36:00 +00:00
\end{figure}
2020-11-04 13:59:14 +00:00
\end{document}