mirror of
https://github.com/lukefleed/ShfitedPowGMRES.git
synced 2026-10-06 22:14:52 +00:00
big restyle, last fixes before final release
This commit is contained in:
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
\section{Introduction}
|
||||
|
||||
The PageRank model was proposed by Google in a series of papers to evaluate accurately the most important web-pages from the World Wide Web matching a set of keywords entered by a user. For search engine rankings, the importance of web-pages is computed from the stationary probability vector of the random process of a web surfer who keeps visiting a large set of web-pages connected by hyperlinks. The link structure of the World Wide Web is represented by a directed graph, the so-called web link graph, and its corresponding adjacency matrix $G \in \N^{n \times n}$ where $n$ denotes the number of pages and $G_{ij}$ is nonzero (being 1) only if the \emph{jth} page has a hyperlink pointing to the \emph{ith} page. The transition probability matrix $P \in \R^{n \times n}$ of the random process has entries as described in \ref{eq:transition}.
|
||||
|
||||
\begin{equation}\label{eq:transition}
|
||||
P(i,j) =
|
||||
\begin{cases}
|
||||
\displaystyle \frac{1}{\sum_{k=1}^n G_{kj}} & \text{if } G_{i,j} = 0 \\
|
||||
0 & \text{otherwise}
|
||||
\end{cases}
|
||||
\end{equation}
|
||||
|
||||
\noindent The entire random process needs a unique stationary distribution. To ensure this propriety is satisfied , the transition matrix $P$ is usually modified to be an irreducible stochastic matrix $A$ (called the Google matrix) as follows:
|
||||
|
||||
% \noindent To ensure that the random process has a unique stationary distribution and it will not stagnate, the transition matrix P is usually modified to be an irreducible stochastic matrix $A$ (called the Google matrix) as follows
|
||||
|
||||
\begin{equation}\label{eq:google}
|
||||
A = \alpha \tilde P + (1 - \alpha)v e^T
|
||||
\end{equation}
|
||||
|
||||
\noindent In \ref{eq:google} we have defined a new matrix called $\tilde P = P + vd^T$ where $d \in N^{n \times 1}$ is a binary vector tracing the indices of the damping web pages with no hyperlinks, i.e., $d(i) = 1$ if the \emph{i-th} page has no hyperlink, $v \in \R^{n \times n}$ is a probability vector, $e = [1, 1, ... ,1]^T$ and $0<\alpha<1$, the so-called damping factor that represents the probability in the model that the surfer transfer by clicking a hyperlink rather than other ways. Mathematically, the PageRank model can be formulated as the problem of finding the positive unit eigenvector $x$ (the so-called PageRank vector) such that
|
||||
\begin{equation}\label{eq:pr}
|
||||
Ax = x, \quad \lVert x \rVert = 1, \quad x > 0
|
||||
\end{equation}
|
||||
or, equivalently, as the solution of the linear system
|
||||
\begin{equation}\label{eq:pr2}
|
||||
(I - \alpha \tilde P)x = (1 - \alpha)v
|
||||
\end{equation}
|
||||
|
||||
\noindent The authors of the paper \cite{SHEN2022126799} emphasize how in the in the past decade or so, considerable research attention has been devoted to the efficient solution of problems \ref{eq:pr} \ref{eq:pr2}, especially when $n$ is very large. For moderate values of the damping factor, e.g. for $\alpha = 0.85$ as initially suggested by Google for search engine rankings, solution strategies based on the simple Power method have proved to be very effective. However, when $\alpha$ approaches 1, as is required in some applications, the convergence rates of classical stationary iterative methods including the Power method tend to deteriorate sharply, and more robust algorithms need to be used. \vspace*{0.4cm}
|
||||
|
||||
\noindent In the reference paper that we are using for this project, the authors focus their attention in the area of PageRank computations with the same network structure but multiple damping factors. For example, in the Random Alpha PageRank model used in the design of anti-spam mechanism \cite{Constantine2009Random}, the rankings corresponding to many different damping factors close to 1 need to be computed simultaneously. They explain that the problem can be expressed mathematically as solving a sequence of linear systems
|
||||
\begin{equation}\label{eq:pr3}
|
||||
(I - \alpha_i \tilde P)x_i = (1 - \alpha_i)v \quad \alpha_i \in (0, 1) \quad \forall i \in \{1, 2, ..., s\}
|
||||
\end{equation}
|
||||
As we know, standard PageRank algorithms applied to \ref{eq:pr3} would solve the $s$ linear systems independently. Although these solutions can be performed in parallel, the process would still demand large computational resources for high dimension problems.
|
||||
This consideration motived the authors to search novel methods with reduced algorithmic and memory complexity, to afford the solution of larger problems on moderate computing resources. They suggest to write the PageRank problem with multiple damping factors given at once \ref{eq:pr3} as a sequence of shifted linear systems of the form:
|
||||
\begin{equation}
|
||||
\Big(\frac{1}{\alpha_i}I - \tilde P \Big)x^{(i)} = \frac{1 - \alpha_i}{\alpha_i}v \quad \forall i \in \{1, 2, ..., s\} \quad 0 < \alpha_i < 1
|
||||
\end{equation}
|
||||
We know from literature that the Shifted Krylov methods may still suffer from slow convergence when the damping factor approaches 1, requiring larger search spaces to converge with satisfactory speed. In \cite{SHEN2022126799} is suggest that, to overcome this problem, we can combine stationary iterative methods and shifted Krylov subspace methods. They derive an implementation of the Power method that solves the PageRank problem with multiple dumpling factors at almost the same computational time of the standard Power method for solving one single system. They also demonstrate that this shifted Power method generates collinear residual vectors. Based on this result, they use the shifted Power iterations to provide smooth initial solutions for running shifted Krylov subspace methods such as \texttt{GMRES}. Besides, they discuss how to apply seed system choosing strategy and extrapolation techniques to further speed up the iterative process.
|
||||
|
||||
% As an attempt of a possible remedy in this situation, we present a framework that combines. shifted stationary iterative methods and shifted Krylov subspace methods. In detail, we derive the implementation of the Power method that solves the PageRank problem with multiple damping factors at almost the same computational cost of the standard Power method for solving one single system. Furthermore, we demonstrate that this shifted Power method generates collinear residual vectors. Based on this result, we use the shifted Power iterations to provide smooth initial solutions for running shifted Krylov subspace methods such as GMRES. Besides, we discuss how to apply seed system choosing strategy and extrapolation techniques to further speed up the iterative process.
|
||||
|
||||
\subsection{Overview of the classical PageRank problem}
|
||||
The Power method is considered one of the algorithms of choice for solving either the eigenvalue \ref{eq:pr} or the linear system \ref{eq:pr2} formulation of the PageRank problem, as it was originally used by Google. Power iterations write as
|
||||
\begin{equation}\label{eq:power}
|
||||
x_{(k+1)} = Ax_k =\alpha \tilde P x_{(k)} + (1 - \alpha)v
|
||||
\end{equation}
|
||||
The convergence behavior is determined mainly by the ratio between the two largest eigenvalues of A. When $\alpha$ gets closer to $1$, though, the convergence can slow down significantly. \\
|
||||
|
||||
\noindent As stated in \cite{SHEN2022126799} The number of iterations required to reduce the initial residual down to a tolerance $\tau$, measured as $\tau = \lVert Ax_k - x_k \rVert = \lVert x_{k+1} - x_k \rVert$ can be estimated as $\frac{\log_{10} \tau}{\log_{10} \alpha}$. The authors provide an example: when $\tau = 10^{-8}$ the Power method requires about 175 steps to converge for $\alpha = 0.9$ but the iteration count rapidly grows to 1833 for $\alpha = 0.99$. Therefore, for values of the damping parameter very close to 1 more robust alternatives to the simple Power algorithm should be used.
|
||||
|
||||
Binary file not shown.
Vendored
+24
-146
@@ -1,5 +1,5 @@
|
||||
\documentclass[12pt]{article}
|
||||
\usepackage[margin=1in]{geometry}
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage[margin=1.2in]{geometry}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[english]{babel}
|
||||
\usepackage[T1]{fontenc}
|
||||
@@ -17,6 +17,21 @@
|
||||
\usepackage{lipsum}
|
||||
\usepackage{algorithm}
|
||||
\usepackage{algpseudocode}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{nccmath}
|
||||
\usepackage[most]{tcolorbox}
|
||||
\newtcolorbox[auto counter]{problem}[1][]{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback=white,
|
||||
colbacktitle=white,
|
||||
coltitle=black,
|
||||
fonttitle=\bfseries,
|
||||
boxrule=.6pt,
|
||||
titlerule=.2pt,
|
||||
toptitle=3pt,
|
||||
bottomtitle=3pt,
|
||||
title=GitHub repository of this project}
|
||||
|
||||
\newcommand{\R}{\mathbb{R}}
|
||||
\newcommand{\N}{\mathbb{N}}
|
||||
@@ -42,153 +57,16 @@ for solving PageRank with multiple damping factors}
|
||||
\tableofcontents
|
||||
\clearpage
|
||||
|
||||
\section{Introduction}
|
||||
|
||||
The PageRank model was proposed by Google in a series of papers to evaluate accurately the most important web-pages from the World Wide Web matching a set of keywords entered by a user. For search engine rankings, the importance of web-pages is computed from the stationary probability vector of the random process of a web surfer who keeps visiting a large set of web-pages connected by hyperlinks. The link structure of the World Wide Web is represented by a directed graph, the so-called web link graph, and its corresponding adjacency matrix $G \in \N^{n \times n}$ where $n$ denotes the number of pages and $G_{ij}$ is nonzero (being 1) only if the \emph{jth} page has a hyperlink pointing to the \emph{ith} page. The transition probability matrix $P \in \R^{n \times n}$ of the random process has entries as described in \ref{eq:transition}.
|
||||
|
||||
\begin{equation}\label{eq:transition}
|
||||
P(i,j) =
|
||||
\begin{cases}
|
||||
\displaystyle \frac{1}{\sum_{k=1}^n G_{kj}} & \text{if } G_{i,j} = 0 \\
|
||||
0 & \text{otherwise}
|
||||
\end{cases}
|
||||
\end{equation}
|
||||
|
||||
\noindent The entire random process needs a unique stationary distribution. To ensure this propriety is satisfied , the transition matrix $P$ is usually modified to be an irreducible stochastic matrix $A$ (called the Google matrix) as follows:
|
||||
|
||||
% \noindent To ensure that the random process has a unique stationary distribution and it will not stagnate, the transition matrix P is usually modified to be an irreducible stochastic matrix $A$ (called the Google matrix) as follows
|
||||
|
||||
\begin{equation}\label{eq:google}
|
||||
A = \alpha \tilde P + (1 - \alpha)v e^T
|
||||
\end{equation}
|
||||
|
||||
\noindent In \ref{eq:google} we have defines a new matrix called $\tilde P = P + vd^T$ where $d \in N^{n \times 1}$ is a binary vector tracing the indices of the damping web pages with no hyperlinks, i.e., $d(i) = 1$ if the \emph{i-th} page ha no hyperlink, $v \in \R^{n \times n}$ is a probability vector, $e = [1, 1, ... ,1]^T$ and $0<\alpha<1$, the so-called damping factor that represents the probability in the model that the surfer transfer by clicking a hyperlink rather than other ways. Mathematically, the PageRank model can be formulated as the problem of finding the positive unit eigenvector $x$ (the so-called PageRank vector) such that
|
||||
\begin{equation}\label{eq:pr}
|
||||
Ax = x, \quad \lVert x \rVert = 1, \quad x > 0
|
||||
\end{equation}
|
||||
or, equivalently, as the solution of the linear system
|
||||
\begin{equation}\label{eq:pr2}
|
||||
(I - \alpha \tilde P)x = (1 - \alpha)v
|
||||
\end{equation}
|
||||
|
||||
\noindent The authors of the paper \cite{SHEN2022126799} emphasize how in the in the past decade or so, considerable research attention has been devoted to the efficient solution of problems \ref{eq:pr} \ref{eq:pr2}, especially when $n$ is very large. For moderate values of the damping factor, e.g. for $\alpha = 0.85$ as initially suggested by Google for search engine rankings, solution strategies based on the simple Power method have proved to be very effective. However, when $\alpha$ approaches 1, as is required in some applications, the convergence rates of classical stationary iterative methods including the Power method tend to deteriorate sharply, and more robust algorithms need to be used. \vspace*{0.4cm}
|
||||
|
||||
\noindent In the reference paper that we are using for this project, the authors focus their attention in the area of PageRank computations with the same network structure but multiple damping factors. For example, in the Random Alpha PageRank model used in the design of anti-spam mechanism \cite{Constantine2009Random}, the rankings corresponding to many different damping factors close to 1 need to be computed simultaneously. They explain that the problem can be expressed mathematically as solving a sequence of linear systems
|
||||
\begin{equation}\label{eq:pr3}
|
||||
(I - \alpha_i \tilde P)x_i = (1 - \alpha_i)v \quad \alpha_i \in (0, 1) \quad \forall i \in \{1, 2, ..., s\}
|
||||
\end{equation}
|
||||
As we know, standard PageRank algorithms applied to \ref{eq:pr3} would solve the $s$ linear systems independently. Although these solutions can be performed in parallel, the process would still demand large computational resources for high dimension problems.
|
||||
This consideration motived the authors to search novel methods with reduced algorithmic and memory complexity, to afford the solution of larger problems on moderate computing resources. They suggest to write the PageRank problem with multiple damping factors given at once \ref{eq:pr3} as a sequence of shifted linear systems of the form:
|
||||
\begin{equation}
|
||||
(\frac{1}{\alpha_i}I - \tilde P)x^{(i)} = \frac{1 - \alpha_i}{\alpha_i}v \quad \forall i \in \{1, 2, ..., s\} \quad 0 < \alpha_i < 1
|
||||
\end{equation}
|
||||
We know from literature that the Shifted Krylov methods may still suffer from slow convergence when the damping factor approaches 1, requiring larger search spaces to converge with satisfactory speed. In \cite{SHEN2022126799} is suggest that, to overcome this problem, we can combine stationary iterative methods and shifted Krylov subspace methods. They derive an implementation of the Power method that solves the PageRank problem with multiple dumpling factors at almost the same computational time of the standard Power method for solving one single system. They also demonstrate that this shifted Power method generates collinear residual vectors. Based on this result, they use the shifted Power iterations to provide smooth initial solutions for running shifted Krylov subspace methods such as \texttt{GMRES}. Besides, they discuss how to apply seed system choosing strategy and extrapolation techniques to further speed up the iterative process.
|
||||
|
||||
% As an attempt of a possible remedy in this situation, we present a framework that combines. shifted stationary iterative methods and shifted Krylov subspace methods. In detail, we derive the implementation of the Power method that solves the PageRank problem with multiple damping factors at almost the same computational cost of the standard Power method for solving one single system. Furthermore, we demonstrate that this shifted Power method generates collinear residual vectors. Based on this result, we use the shifted Power iterations to provide smooth initial solutions for running shifted Krylov subspace methods such as GMRES. Besides, we discuss how to apply seed system choosing strategy and extrapolation techniques to further speed up the iterative process.
|
||||
|
||||
\subsection{Overview of the classical PageRank problem}
|
||||
The Power method is considered one of the algorithms of choice for solving either the eigenvalue \ref{eq:pr} or the linear system \ref{eq:pr2} formulation of the PageRank problem, as it was originally used by Google. Power iterations write as
|
||||
\begin{equation}\label{eq:power}
|
||||
x_{(k+1)} = Ax_k =\alpha \tilde P x_{(k)} + (1 - \alpha)v
|
||||
\end{equation}
|
||||
The convergence behavior is determined mainly by the ratio between the two largest eigenvalues of A. When $\alpha$ gets closer to $1$, though, the convergence can slow down significantly. \\
|
||||
|
||||
\noindent As stated in \cite{SHEN2022126799} The number of iterations required to reduce the initial residual down to a tolerance $\tau$, measured as $\tau = \lVert Ax_k - x_k \rVert = \lVert x_{k+1} - x_k \rVert$ can be estimated as $\frac{\log_{10} \tau}{\log_{10} \alpha}$. The authors provide an example: when $\tau = 10^{-8}$ the Power method requires about 175 steps to converge for $\alpha = 0.9$ but the iteration count rapidly grows to 1833 for $\alpha = 0.99$. Therefore, for values of the damping parameter very close to 1 more robust alternatives to the simple Power algorithm should be used.
|
||||
|
||||
\clearpage
|
||||
\section{The shifted power method for PageRank computations}
|
||||
In this section presents the extensions of stationary iterative methods for the solution of PageRank problems with multiple damping factors, as presented in \cite{SHEN2022126799}. We are interested in knowing if, for each method, there exists an implementation such that the computational cost of solving the PageRank problem with multiple damping factor is comparable to that of solving the ordinary PageRank problem with single damping factor.
|
||||
|
||||
\subsection{The implementation of the shifted power method}
|
||||
Inspired by the reason why shifted Krylov subspaces can save computational cost, the authors of \cite{SHEN2022126799} investigate whether there are duplications in the calculations of multiple linear systems in this problem class by the stationary iterative methods, so that the duplications in the computation can be deleted and used for all systems. It's some sort of dynamic programming approach. Firstly, they analyze the Power method applied to the sequence of linear systems in \ref{eq:pr2}. It computes at the \emph{i-th} iteration approximate solutions $x_k (i) (1 \leq i \leq s)$ of the form
|
||||
\begin{equation}
|
||||
\alpha_i^k \tilde P^k x_k^{(i)} + (1 - \alpha_i^k) \sum_{j=0}^{k-1} \alpha_i^j \tilde P^j v
|
||||
\end{equation}
|
||||
If the $s$ systems in \ref{eq:pr2} are solved synchronously, that is all $x^{(i)}_k$ are computed only after all previous approximations $x^{(j)}_{k-1}$ are available, then the computation can be rearranged efficiently as follows:
|
||||
\begin{itemize}
|
||||
\item at the first iterations
|
||||
\begin{itemize}
|
||||
\item compute and store $\mu_1 = \tilde P x_0$ and $\mu_2 = v$;
|
||||
\item compute and store $x_1^{(i)} = \alpha_i \mu_1 + (1-\alpha_i)\mu_2;$
|
||||
\end{itemize}
|
||||
\item at any other subsequent iteration $k>1$
|
||||
\begin{itemize}
|
||||
\item compute and store $x_k^(i) := (1-\alpha_i)\sum_{j=0}^{k-2} \alpha_i^j \tilde P^j v= x_{k-1}^{(i)} - \alpha_i^{k-1} \mu_1$;
|
||||
\item compute and store $\mu_1 = \tilde P \mu_1$ and $\mu_2 = \tilde P \mu_2$;
|
||||
\item compute and store $x_k^{(i)} = \alpha_i \mu_1 + x_k^{(i)} + (1-\alpha_i)\alpha^{k-1}_i \mu_2$.
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
This implementation requires at most $2$ matrix-vector products at each step, which is a significant gain compared to the $s$ matrix-vector products required by the standard Power method to compute $x^{(i)}_{k+1}$ , especially when $s \gg 2$. \vspace{0.4cm}
|
||||
|
||||
\noindent An efficient implementation can compute and store $\mu = \tilde Pv -v$ at the first iteration and store
|
||||
$$\mu = \tilde P^{k-1}(\tilde P v - v) = \tilde P \cdot (\tilde P^{k-2}(\tilde P v - v))$$
|
||||
At each \emph{k-th} iteration ($k > 1$), and finally from each approximate solution as $x_k^{(i)} = \alpha_i^k \mu + x_{k-1}^{(i)}$. The residual vector $r_k^{(i)}$ associated with the approximate solution $x_k^{(i)}$ has the following expression
|
||||
\begin{equation}
|
||||
r_k^{(i)} = A x_k^{(i)} - x_k^{(i)} = x_{k+1}^{(i)} - x_k^{(i)} = \alpha_i^{k+1} \tilde P^k (\tilde P v - v)
|
||||
\end{equation}
|
||||
Since in general each of the $s$ linear systems may require a different number of Power iterations to converge, the $s$ residual norms have to be monitored separately to test the convergence. \vspace{0.4cm}
|
||||
|
||||
\noindent Now we can summarize the efficient implementation of the Power method presented in this section for solving problem \ref{eq:pr2} in Algorithm \ref{alg:algo1}, and we call it the shifted Power method hereafter.
|
||||
|
||||
\begin{algorithm}\label{alg:algo1}
|
||||
\caption{Shifted-Power method for PageRank with multiple damping factors}\label{alg:algo1}
|
||||
\begin{algorithmic}
|
||||
\Require $\tilde P, ~v, ~\tau, ~\max_{mv}, ~\alpha_i ~ (1 \leq i \leq s)$
|
||||
\Ensure $mv,~ x^{(i)},~ r^{(i)} ~ (1 \leq i \leq s)$
|
||||
\State Compute $\mu = \tilde P v - v$
|
||||
\State Set $mv =1$
|
||||
\For {$i = 1:s$}
|
||||
\State Compute $r^{(i)} = \alpha_i \mu$
|
||||
\State Compute $Res(i) = \lVert r^{(i)} \rVert$
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $x^{(i)} = r^{(i)} + v$
|
||||
\EndIf
|
||||
\EndFor
|
||||
|
||||
\While {$\max(Res \geq \tau)$ and $ mv \leq \max_{mv}$}
|
||||
\State compute $\mu = \tilde P \mu$
|
||||
\State $mv = mv + 1$
|
||||
\For {$i = 1:s$}
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $r^{(i)} = \alpha_i^{k+1} \mu$
|
||||
\State Compute $Res(i) = \lVert r^{(i)} \rVert$
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $x^{(i)} = r^{(i)} + x^{(i)}$
|
||||
\EndIf
|
||||
\EndIf
|
||||
\EndFor
|
||||
\EndWhile
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
|
||||
\noindent Where $mv$ is an integer that counts the number of matrix-vector products performed by the algorithm. The algorithm stops when either all the residual norms are smaller than the tolerance $\tau$ or the maximum number of matrix-vector products is reached. An implementation of this algorithm written in Python is available in the github repository \cite{ShfitedPowGMRES} of this project.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\include{intro.tex}
|
||||
\include{shifted.tex}
|
||||
\include{shift_GMRES.tex}
|
||||
\include{num.tex}
|
||||
|
||||
\clearpage
|
||||
\bibliographystyle{unsrt}
|
||||
\bibliography{ref}
|
||||
\nocite{*}
|
||||
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
|
||||
\section{Numerical experiments}\label{sec:exp}
|
||||
|
||||
In this experiment, we test the performance of the shifted Power method against the conventional Power method for solving PageRank problems with multiple damping factors, namely $\{ \alpha_1 = 0.85, ~\alpha_2 = 0.86, ~...~ ,~ \alpha_{15} = 0.99 \}$ on the \texttt{web-stanford} and \texttt{web-BerkStan} datasets. The \texttt{web-stanford} dataset is a directed graph with $|V| = 281,903$ nodes and $|E| = 1,810,314$ edges, and the \texttt{web-BerkStan} dataset is a directed graph with $|V| = 1, 013, 320$ nodes and $|E| = 5, 308, 054$ edges. The datasets are available at \url{http://snap.stanford.edu/data/web-Stanford.html} and \url{http://snap.stanford.edu/data/web-BerkStan.html} respectively. The datasets are stored in the \texttt{.txt} edge-list format. The characteristics of the datasets are summarized in Table \ref{tab:datasets}.
|
||||
|
||||
% create a table with cols: Name, Number of Nodes, Number of edges, Density, Average Number of zeros (per row)
|
||||
\begin{table}[h]
|
||||
\centering
|
||||
\begin{tabular}{|c|c|c|c|}
|
||||
\hline
|
||||
\textbf{Dataset} & \textbf{Nodes} & \textbf{Edges} & \textbf{Density} \\ \hline
|
||||
\texttt{web-Stanford} & $281,903$ & $2,312,497$ & $2.9099 \times 10^{-5}$ \\ \hline
|
||||
\texttt{web-BerkStan} & $685,230$ & $7,600,595$ & $1.6187 \times 10^{-5}$ \\ \hline
|
||||
\end{tabular}
|
||||
\caption{Summary of the datasets used in the experiments.}
|
||||
\label{tab:datasets}
|
||||
\end{table}
|
||||
|
||||
\noindent The personalization vector $v$ has been set to $v = [1, 1, ... , 1]^T/n$. All the experiments are run in Python 3.10 on a 64-bit Arch Linux machine with an AMD Ryzen™ 5 2600 Processor and 16 GB of RAM.
|
||||
|
||||
\subsection{Technical details}
|
||||
|
||||
\begin{problem}
|
||||
\centering
|
||||
\url{https://github.com/lukefleed/ShfitedPowGMRES}
|
||||
\end{problem}
|
||||
|
||||
\noindent In the project github repository we can find an \texttt{algo.py} file where all the functions used in the experiments are implemented. The \texttt{algo.py} file contains the following functions:
|
||||
|
||||
\paragraph{load\_data} This function loads the datasets from the \texttt{.txt} edge-list format and returns a networkx graph object. It takes as input a literal, the options are \texttt{web-stanford} and \texttt{web-BerkStan}.
|
||||
|
||||
\paragraph{pagerank} This function computes the PageRank vector of a given graph. It takes as input the following parameters:
|
||||
\begin{itemize}
|
||||
\item \texttt{G:} a networkx graph object.
|
||||
\item \texttt{alpha:} Damping parameter for PageRank, default=$0.85$.
|
||||
\item \texttt{personalization:} The "personalization vector" consisting of a dictionary with a key some subset of graph nodes and personalization value each of those. At least one personalization value must be non-zero. If not specified, a nodes personalization value will $1/N$ where $N$ is the number of nodes in \texttt{G}.
|
||||
\item \texttt{max\_iter:} The maximum number of iterations in power method eigenvalue solver. Default is $200$.
|
||||
\item \texttt{nstart:} Starting value of PageRank iteration for each node. Default is $None$.
|
||||
\item \texttt{tol:} Error tolerance used to check convergence in power method solver. Default is $10^{-6}$.
|
||||
\item \texttt{weight:} Edge data key corresponding to the edge weight. If None, then uniform weights are assumed. Default is $None$.
|
||||
\item \texttt{dangling:} The outedges to be assigned to any "dangling" nodes, i.e., nodes without any outedges. The dict key is the node the outedge points to and the dict value is the weight of that outedge. By default, dangling nodes are given outedges according to the personalization vector (uniform if not specified).
|
||||
\end{itemize}
|
||||
This function is strongly based on the \texttt{pagerank\_scipy} function of the networkx library.
|
||||
|
||||
\paragraph{shifted\_pow\_pagerank}: This is the implementation of the algorithm \ref{alg:algo1} with the difference that I am using the $l1$ norm since the $l2$ norm is still not implemented for sparse matrices in SciPy.
|
||||
|
||||
\vspace{0.5cm}
|
||||
|
||||
\noindent There are is also another function called \texttt{pagerank\_numpy}. The eigenvector calculation uses NumPy's interface to the \texttt{LAPACK} eigenvalue solvers. This will be the fastest and most accurate for small graphs. Unfortunately, the eigenvector calculation is not stable for large graphs. Therefore, the \texttt{pagerank\_numpy} function is not used in the experiments.
|
||||
|
||||
\subsection{Convergence results for the Shifted Power method}
|
||||
|
||||
In the PageRank formulation with multiple damping factors, the iterative solution of each $i-th$ linear system is started from the initial guess $x_0^{(i)} = v$ and it's stopped when either the solution $x_k^{(i)}$ satisfies
|
||||
\begin{equation*}
|
||||
\frac{\lVert (1 - \alpha_i)v - (I - \alpha_i \tilde P x_k^{(i)} \rVert_2}{\lVert x_k^{(i)} \rVert_2} < 10^{-6}
|
||||
\end{equation*}
|
||||
or the number of matrix-vector products exceeds $200$. \vspace*{0.5cm}
|
||||
|
||||
\noindent In this experiment we test the performance of the shifted Power method against the conventional Power method for solving PageRank problems with multiple damping factors.
|
||||
|
||||
% create a table to store the results on each dataset for the two methods. We are interest in the mv and cpu time
|
||||
\begin{table}[h]
|
||||
\centering
|
||||
\begin{tabular}{|c|c|c|c|}
|
||||
\hline
|
||||
\textbf{Dataset} & \textbf{Method} & \textbf{CPU Time (s)} & \textbf{mv} \\ \hline
|
||||
\texttt{web-Stanford} & \texttt{Power} & $71.7$ & $70$ \\ \hline
|
||||
\texttt{web-Stanford} & \texttt{Shifted Power} & $665.4$ & $56$ \\ \hline
|
||||
|
||||
\hline
|
||||
|
||||
\texttt{web-BerkStan} & \texttt{Power} & $202.1$ & $49$ \\ \hline
|
||||
\texttt{web-BerkStan} & \texttt{Shifted Power} & $1342.9$ & $73$ \\ \hline
|
||||
\end{tabular}
|
||||
\caption{Summary of the experiments.}
|
||||
\label{tab:results}
|
||||
\end{table}
|
||||
|
||||
\noindent The results presented on table \ref{tab:results} are a bit in contrast compared to what the paper \cite{SHEN2022126799} reports. In their experiment the CPU time of the shifted power method is lower then the one of the standard power method. However, in our experiments the CPU time of the shifted power method is far higher then the one of the standard power method. Furthermore, theoretically, the number of matrix-vector products should be lower for the shifted power method, in particular it should be equal to the one of the standard PageRank algorithm with the biggest damping factor. However, in our experiments the number of matrix-vector products is higher for the shifted power method for the dataset \texttt{web-BerkStan} and lower for the dataset \texttt{web-Stanford}. \vspace*{0.5cm}
|
||||
|
||||
\noindent The reasons to those differences in results may be a lot. I think that the most plausible reason is the difference in programming language and implementation, combined with a possibility of misunderstanding of the pseudo-code presented in \cite{SHEN2022126799}. My standard PageRank function is a slightly modified version of the network library function \texttt{pagerank\_scipy}, so I suppose that is better optimized in comparison to the shifted power method implementation that I wrote. Also, the network \texttt{Web-BerkStan} is very different from the \texttt{web-stanford} one. The adjacency matrix relative to the first one, has a lot of rows full of zeros in comparison to the second one ($4744$ vs $172$). This might effect negatively the shifted power method for this specific cases of networks with a lot of dangling nodes. \vspace*{0.5cm}
|
||||
+1
-12
@@ -23,15 +23,4 @@ abstract = {}
|
||||
year=2009,
|
||||
month=1,
|
||||
day=1,
|
||||
}
|
||||
|
||||
# cite this repo made by Luca Lombardo https://github.com/lukefleed/ShfitedPowGMRES
|
||||
|
||||
@misc{ShfitedPowGMRES,
|
||||
author = {Lombardo, Luca},
|
||||
title = {Shifted power method for solving PageRank with multiple damping factors},
|
||||
year = {2022},
|
||||
publisher = {},
|
||||
journal = {GitHub repository},
|
||||
howpublished = {\url{https://github.com/lukefleed/ShfitedPowGMRES}}
|
||||
}
|
||||
}
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
\clearpage
|
||||
\section{Shifted power-GMRES method}
|
||||
|
||||
In this section we'll cover the approach that the authors in \cite{SHEN2022126799} used to combine the shifted power method with the fast shifted \texttt{GMRES} method to create an hybrid algorithm for solving complex PageRank problems with multiple damping factors.
|
||||
|
||||
\subsection{Restarted GMRES method}
|
||||
|
||||
The Restarted GMRES method (hereafter referred to as GMRES in short) is a non-symmetric Krylov subspace solver based on the Arnoldi decomposition procedure, that the authors sketch in the following algorithm
|
||||
|
||||
\begin{algorithm}[H]
|
||||
\caption{Arnoldi}
|
||||
\label{alg:arnoldi}
|
||||
\begin{algorithmic}[1]
|
||||
\Require $A, v_0, m$
|
||||
\Ensure $V_m, H_m, v_{m+1}, h_{m+1,m}, \beta, j$
|
||||
\State Compute $\beta = \lVert v_0 \rVert$
|
||||
\State $v_1 = v_0/ \beta$
|
||||
\For {$j = 1:m$}
|
||||
\State Compute $w = Av_j$
|
||||
\For {$i = 1:j$}
|
||||
\State Compute $h_{i,j} = v_i^T w$
|
||||
\State Compute $w = w - h_{i,j} v_i$
|
||||
\EndFor
|
||||
\State $h_{j+1,j} = \lVert w_i \rVert$
|
||||
\If {$h_{j+1,j} = 0$}
|
||||
\State $m = j$,
|
||||
\State $v_{m+1} = 0$
|
||||
\State \textbf{break}
|
||||
\Else
|
||||
\State $v_{j+1} = w / h_{j+1,j}$
|
||||
\EndIf
|
||||
\EndFor
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
|
||||
\noindent Where $A \in \R^{n\times n}$ and $v_0 \in \R ^{n \times 1}$ is the initial vector. After $m$ iterations, the Arnoldi procedure produces the orthogonal basis $V_m = [v_1, \dots, v_m]$ and the upper Hessenberg matrix $H_m \in \R^{m\times m}$, and the residual vector $v_{m+1} \in \R^{n \times 1}$ and the residual norm $h_{m+1,m} \in \R$. Starting from $v_0 = b - Ax_0$ with an initial guess $x_0$, after running $m$ steps of the algorithm \ref{alg:arnoldi}, the \texttt{GMRES} method produces the approximate solution $\tilde x$ of the linear system $Ax = b$ that minimizes the residual norm $\lVert b - Ax \rVert$ in the Krylov subspace of dimension $m$. \vspace*{0.4cm}
|
||||
|
||||
\noindent We know that the accuracy of the approximate solution $\tilde x$ of \texttt{GMRES} depends heavily on the dimension $m$ of the search space. The authors in \cite{SHEN2022126799} propose to use the \texttt{GMRES} method as a preconditioner for the shifted power method presented in the previous section. The core idea of the method is to run standard GMRES on a seed system and to approximate the other solutions as by products. The theoretical basis is the shift-invariance property of the Krylov subspace that enables us to use only one Krylov subspace for all the shifted systems, provided that the residual vectors are collinear to one other. The algorithm proposed by the authors is presented in Algorithm \ref{alg:shifted_GMRES}.
|
||||
|
||||
\begin{algorithm}[H]
|
||||
\caption{Shifted GMRES}
|
||||
\label{alg:shifted_GMRES}
|
||||
\begin{algorithmic}[1]
|
||||
\Require $\tilde P, v, m, \alpha_i, maxit, x_0^i ~~ (1 \leq i \leq s)$
|
||||
\Ensure $x^i, res_i ~~(1 \leq i \leq s), mv$
|
||||
\State Set $_0^i = \frac{1-\alpha_i}{\alpha_i} v - \Big(\frac{1}{\alpha_i} I - \tilde P \Big) x_0^i$, iter = 1
|
||||
\State Set $res_i = \alpha_i \lVert v \rVert ~~ (1 \leq i \leq s)$
|
||||
\State Set mv = 0
|
||||
\While {$\max (res_i) \geq \tau~~ \&\& ~~ iter \leq maxit$}
|
||||
\State Find $k$ that satisfies $res_k = \max (res_i)$
|
||||
\State Compute $\gamma^i = \frac{res_i \alpha_k}{res_k \alpha_i}$ for all $i \neq k$
|
||||
\State Run Arnoldi by $ [V_m, \bar H_m^k, v_{m+1}, \bar h_{m+1,m}, \beta, j] = Arnoldi(\frac{1}{\alpha_k}I - \tilde P, r_0^k, m)$
|
||||
\State Set $mv = mv + j$
|
||||
\State Compute $y_k$, the minimizer of $\lVert \beta e_1 - \bar H_m^k y_k \rVert_2$
|
||||
\State Compute $x^k = x_0^k + V_m y_k$
|
||||
\State Compute $res_k = \alpha_k \lVert \beta e_1 - \bar H_m^k y^k \rVert$
|
||||
\For {i = 1, 2, \dots , k-1, k+1, \dots , s}
|
||||
\If {$res_i \geq \tau$}
|
||||
\State Set $\bar H_m^i = \bar H_m^k + \Big( \frac{1-\alpha_i}{\alpha_i} - \frac{1-\alpha_k}{\alpha_k} \Big) I_m$
|
||||
\State Solve $y_i$ and $\gamma_i$ from $\begin{bmatrix} \bar H_m^i & z \end{bmatrix} \begin{bmatrix} y^i \\ \gamma^i \end{bmatrix} = \gamma^i \beta e_1$
|
||||
\State Set $x^i = x_0^i + V_m y^i$
|
||||
\State Set $res_i = \frac{\alpha_i}{\alpha_k} \gamma_k^i res_k$
|
||||
\EndIf
|
||||
\EndFor
|
||||
\State Set $iter = iter + 1$
|
||||
\State Set $x_0^i = x^i$
|
||||
\EndWhile
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
|
||||
\noindent Where $z = \beta e_1 - H_m^1 y_m^1$. In line 15, by solving this small size system, we can obtain the vector $y_m^i$ and scalar $\gamma_m^i$ that ensures the collinearity of the shifted results.
|
||||
|
||||
\paragraph{Problems:} The implementation of this algorithm has been very problematic. The key of this algorithm is the use of the \emph{seed choosing strategy} described in \cite{SHEN2022126799}. However, during my tests, after the second iteration, the $k$ value remains the same and the $res$ vector does not change. This leads obviously to a stall situation, where the program runs without updating the values until it reaches the maximum number of iterations allowed. This problem is still under investigation. I have provided anyway a notebook in the github repository with the code of the algorithm for completeness, even if it's still not working. I think that the problem is related to some misunderstanding of the algorithm provided in the pseudo-code, but I have not been able to find it yet. For this reason, there won't be any tests results for this algorithm in the following section.
|
||||
|
||||
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
|
||||
\section{The shifted power method for PageRank computations}
|
||||
In this section we'll see the extensions of stationary iterative methods for the solution of PageRank problems with multiple damping factors, as presented in \cite{SHEN2022126799}. We are interested in knowing if, for each method, there exists an implementation such that the computational cost of solving the PageRank problem with multiple damping factor is comparable to that of solving the ordinary PageRank problem with single damping factor.
|
||||
|
||||
\subsection{The implementation of the shifted power method}
|
||||
Inspired by the reason why shifted Krylov subspaces can save computational cost, the authors of \cite{SHEN2022126799} investigate whether there are duplications in the calculations of multiple linear systems in this problem class by the stationary iterative methods, so that the duplications in the computation can be deleted and used for all systems. It's some sort of dynamic programming approach. Firstly, they analyze the Power method applied to the sequence of linear systems in \ref{eq:pr2}. It computes at the \emph{k-th} iteration approximate solutions $x_k^{(i)} (1 \leq i \leq s)$ of the form
|
||||
\begin{equation}
|
||||
x_k^{(i)} = \alpha_i^k \tilde P^k x_k^{(i)} + (1 - \alpha_i^k) \sum_{j=0}^{k-1} \alpha_i^j \tilde P^j v
|
||||
\end{equation}
|
||||
If the $s$ systems in \ref{eq:pr2} are solved synchronously, this means that all the $x^{(i)}_k$ are computed only after all previous approximations $x^{(j)}_{k-1}$ are available. We can now rearrange the computation efficiently as reported in \cite{SHEN2022126799}:
|
||||
\begin{itemize}
|
||||
\item at the first iterations
|
||||
\begin{itemize}
|
||||
\item compute and store $\mu_1 = \tilde P x_0$ and $\mu_2 = v$;
|
||||
\item compute and store $x_1^{(i)} = \alpha_i \mu_1 + (1-\alpha_i)\mu_2;$
|
||||
\end{itemize}
|
||||
\item at any other subsequent iteration $k>1$
|
||||
\begin{itemize}
|
||||
\item compute and store $ x_k^{(i)} := (1-\alpha_i)\sum_{j=0}^{k-2} \alpha_i^j \tilde P^j v= x_{k-1}^{(i)} - \alpha_i^{k-1} \mu_1$;
|
||||
\item compute and store $\mu_1 = \tilde P \mu_1$ and $\mu_2 = \tilde P \mu_2$;
|
||||
\item compute and store $x_k^{(i)} = \alpha_i \mu_1 + x_k^{(i)} + (1-\alpha_i)\alpha^{k-1}_i \mu_2$.
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
This implementation requires at most $2$ matrix-vector products at each step, which is a significant gain compared to the $s$ matrix-vector products required by the standard Power method to compute $x^{(i)}_{k+1}$ , especially when $s \gg 2$. \vspace{0.4cm}
|
||||
|
||||
\noindent This was of course still a theoretical explanation. An efficient implementation can be written to compute and store $\mu = \tilde Pv -v$ at the first iteration and then store
|
||||
$$\mu = \tilde P^{k-1}(\tilde P v - v) = \tilde P \cdot (\tilde P^{k-2}(\tilde P v - v))$$
|
||||
at each \emph{k-th} iteration ($k > 1$), and then from each approximate solution as $x_k^{(i)} = \alpha_i^k \mu + x_{k-1}^{(i)}$. The residual vector $r_k^{(i)}$ associated with the approximate solution $x_k^{(i)}$ has the following expression
|
||||
\begin{equation}
|
||||
r_k^{(i)} = A x_k^{(i)} - x_k^{(i)} = x_{k+1}^{(i)} - x_k^{(i)} = \alpha_i^{k+1} \tilde P^k (\tilde P v - v)
|
||||
\end{equation}
|
||||
Since in general each of the $s$ linear systems may require a different number of Power iterations to converge, the $s$ residual norms have to be monitored separately to test the convergence. \vspace{0.4cm}
|
||||
|
||||
\noindent Now we can summarize the efficient implementation of the Power method presented in this section for solving problem \ref{eq:pr2} in Algorithm \ref{alg:algo1}, as reported in \cite{SHEN2022126799}. From now on, we'll refer to this implementation as the \emph{Shifted-Power method}.
|
||||
|
||||
\begin{algorithm}\label{alg:algo1}
|
||||
\caption{Shifted-Power method for PageRank with multiple damping factors}\label{alg:algo1}
|
||||
\begin{algorithmic}
|
||||
\Require $\tilde P, ~v, ~\tau, ~\max_{mv}, ~\alpha_i ~ (1 \leq i \leq s)$
|
||||
\Ensure $mv,~ x^{(i)},~ r^{(i)} ~ (1 \leq i \leq s)$
|
||||
\State Compute $\mu = \tilde P v - v$
|
||||
\State Set $mv =1$
|
||||
\For {$i = 1:s$}
|
||||
\State Compute $r^{(i)} = \alpha_i \mu$
|
||||
\State Compute $Res(i) = \lVert r^{(i)} \rVert$
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $x^{(i)} = r^{(i)} + v$
|
||||
\EndIf
|
||||
\EndFor
|
||||
|
||||
\While {$\max(Res \geq \tau)$ and $ mv \leq \max_{mv}$}
|
||||
\State compute $\mu = \tilde P \mu$
|
||||
\State $mv = mv + 1$
|
||||
\For {$i = 1:s$}
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $r^{(i)} = \alpha_i^{k+1} \mu$
|
||||
\State Compute $Res(i) = \lVert r^{(i)} \rVert$
|
||||
\If {$Res(i) \geq \tau$}
|
||||
\State Compute $x^{(i)} = r^{(i)} + x^{(i)}$
|
||||
\EndIf
|
||||
\EndIf
|
||||
\EndFor
|
||||
\EndWhile
|
||||
\end{algorithmic}
|
||||
\end{algorithm}
|
||||
|
||||
\noindent Where $mv$ is an integer that counts the number of matrix-vector products performed by the algorithm. The algorithm stops when either all the residual norms are smaller than the tolerance $\tau$ or the maximum number of matrix-vector products is reached. An implementation of this algorithm written in Python is available in the github repository of this project.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\clearpage
|
||||
Reference in New Issue
Block a user