Finished pass on Intro (Aaron)

master
Aaron Huber 2021-04-06 16:11:19 -04:00
parent 4835ff234a
commit acdc8396d8
2 changed files with 14 additions and 19 deletions

View File

@ -1,9 +1,6 @@
%!TEX root=./main.tex
\revision{
\section{More on Circuits and Moments}
}
\label{sec:gen}
\section{More on Circuits and Moments}\label{sec:gen}
%In this section, we consider generalizations/corollaries of our results.
%In particular, in~\Cref{sec:circuits} we first consider the case when the compressed polynomial is represented by a Directed Acyclic Graph (DAG) instead of an expression tree (\Cref{def:express-tree}) and observe that our results carry over.
%Then,

View File

@ -5,8 +5,8 @@
\label{sec:intro}
A \emph{probabilistic database} $\pdb = (\idb, \pd)$ is set of deterministic databases $\idb = \{ \db_1, \ldots, \db_n\}$ called possible worlds paired with a probability distribution $\pd$ over these worlds. A well-studied problem in probabilistic databases is given a query $\query$ and probabilistic database $\pdb$ to compute the \emph{marginal probability} of a tuple $\tup$, i.e., its probability to exist in the result of query $\query$ over $\pdb$. This problem is \sharpphard for set semantics, even for \emph{tuple-independent probabilistic databases}~\cite{DBLP:series/synthesis/2011Suciu} (TIDBs) which are a subclass of probabilistic databases where tuples are independent events. The dichotomy of Dalvi and Suciu~\cite{10.1145/1265530.1265571} separates the hard cases from cases that are in \ptime for the class of union of conjunctive queries (UCQs). In this work, we consider bag semantics where each tuple is associated with a multiplicity $\db_i(\tup)$ in each possible world $\db_i$ and study the analog problem of computing the expectation of the multiplicity of a query result tuple $\tup$:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}\label{eq:bag-expectation}
\expct_{\idb \sim \probDist}[\query(\db)(t)] = \sum_{\db \in \idb} \query(\db)(t) \cdot \pd(\db) \hspace{2cm}\text{\textbf{(Expected Result Multiplicity)}}
\begin{equation}\label{eq:intro-bag-expectation}
\expct_{\idb \sim \probDist}[\query(\idb)(t)] = \sum_{\db \in \idb} \query(\db)(t) \cdot \pd(\db) \hspace{2cm}\text{\textbf{(Expected Result Multiplicity)}}
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -112,37 +112,35 @@ A \emph{probabilistic database} $\pdb = (\idb, \pd)$ is set of deterministic dat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{Example}\label{ex:intro-tbls}
Consider the bag-\ti relations shown in \Cref{fig:ex-shipping-simp}. We define a \ti under bag semantics analog to the set case: each tuple is associated with a probability of having a multiplicity of one (and otherwise has multiplicity zero) and tuples are independent random events. Ignore column $\Phi$ for now. In this example, we have shipping routes that are certain (probability 1.0) and information about whether shipping at locations is on time (with a certain probability). Query $\query_2$ shown below that returns starting points of shipping routes where processing of shipping is on time.
Consider the bag-\ti relations shown in \Cref{fig:ex-shipping-simp}. We define a \ti under bag semantics analog to the set case: each tuple is associated with a probability of having a multiplicity of one (and otherwise has multiplicity zero) and tuples are independent random events. Ignore column $\Phi$ for now. In this example, we have shipping routes that are certain (probability 1.0) and information about whether shipping at locations is on time (with a certain probability). Query $\query_1$ shown below returns starting points of shipping routes where processing of shipping is on time.
$$Q_2 := \pi_{\text{City}_1}(Loc \bowtie_{\text{City}_\ell = \text{City}_1} Route)$$
$$Q_1 := \pi_{\text{City}_1}(Loc \bowtie_{\text{City}_\ell = \text{City}_1} Route)$$
\Cref{subfig:ex-shipping-simp-route} shows the possible results of this query. For example, there is a 90\% probability there is a single route starting in Buffalo that with 90\% probability is on time. Thus, the expected multiplicity of this result tuple is $0.9$. There are two shipping routes starting in Chicago and the Chicago location has a 50\% probability to be on time (we assume that either all shipping starting in a location is on time or all shipping from this location is delayed). Thus, the expected multiplicity of this result tuple is $0.5 + 0.5 = 1.0$.
\Cref{subfig:ex-shipping-simp-queries} shows the possible results of this query. For example, there is a 90\% probability there is a single route starting in Buffalo that with 90\% probability is on time. Thus, the expected multiplicity of this result tuple is $0.9$. There are two shipping routes starting in Chicago and the Chicago location has a 50\% probability to be on time (we assume that either all shipping starting in a location is on time or all shipping from this location is delayed). Thus, the expected multiplicity of this result tuple is $0.5 + 0.5 = 1.0$.
\end{Example}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A well-known result in probabilistic databases is that under set semantics the marginal probability of a query result $\tup$ can be computed based on the tuple's lineage. The lineage of a tuple is a Boolean formula (an element of the semiring $\text{PosBool}[\vct{X}]$ of positive Boolean expressions over variables $\vec{X}$) over random variables that encode the existence of input tuples. Each possible world $\db$ corresponds to an assignment $\mathbb{B}^\numvar$ of the variables in $\vct{X}$ to either true (the tuple exists in this world) or false (the tuple does not exist in this world). Importantly, the following holds: the lineage formula evaluates to true over the assignment for a world $\db$, then $\tup \in \query(\db)$. Thus, the marginal probability of tuple $\tup$ is equal to the probability that the lineage evaluates to true wrt. the probability distribution that associates each possible assignment from $\mathbb{B}^\numvar$ with the probability of the world it corresponds to.
A well-known result in probabilistic databases is that under set semantics the marginal probability of a query result $\tup$ can be computed based on the tuple's lineage. The lineage of a tuple is a Boolean formula (an element of the semiring $\text{PosBool}[\vct{X}]$ of positive Boolean expressions over variables $\vct{X}$) over random variables that encode the existence of input tuples. Each possible world $\db$ corresponds to an assignment $\mathbb{B}^\numvar$ of the variables in $\vct{X}$ to either true (the tuple exists in this world) or false (the tuple does not exist in this world). Importantly, the following holds: if the lineage formula evaluates to true over the assignment for a world $\db$, then $\tup \in \query(\db)$. Thus, the marginal probability of tuple $\tup$ is equal to the probability that the lineage evaluates to true wrt. the probability distribution that associates each possible assignment from $\mathbb{B}^\numvar$ with the probability of the world it corresponds to.
For bag semantics, the lineage of a tuple is a polynomial over random variables from the set $\vct{X} \in \mathbb{N}^\numvar$ with
coefficients in the set of natural numbers $\mathbb{N}$ (an element of semiring $\mathbb{N}[\vct{X}]$). Analog to the set case, evaluating the lineage over an assignment corresponding to a possible world (mapping variables to natural numbers representing input tuple multiplicities in this world) yields the multiplicity of the result tuple $\tup$ in this world. Thus, instead of using \Cref{eq:bag-expectation} to compute the expected result multiplicity of a tuple $\tup$, we can equivalently compute the expectation of the lineage polynomial of $\tup$ which we will denote as $\linsett{\query}{\pdb}{\tup}$ or $\Phi$ if the parameters are clear from the context. In this work, we study the complexity of computing the expectation of such polynomials encoded as arithmetic circuits.
coefficients in the set of natural numbers $\mathbb{N}$ (an element of semiring $\mathbb{N}[\vct{X}]$). Analog to the set case, evaluating the lineage over an assignment corresponding to a possible world (mapping variables to natural numbers representing input tuple multiplicities in this world) yields the multiplicity of the result tuple $\tup$ in this world. Thus, instead of using \cref{eq:intro-bag-expectation} to compute the expected result multiplicity of a tuple $\tup$, we can equivalently compute the expectation of the lineage polynomial of $\tup$ which we will denote as $\linsett{\query}{\pdb}{\tup}$ or $\Phi$ if the parameters are clear from the context. In this work, we study the complexity of computing the expectation of such polynomials encoded as arithmetic circuits.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{Example}\label{ex:intro-lineage}
Associating a lineage variable with every input tuple as shown in \Cref{subfig:ex-shipping-simp}, we can compute the lineage of every result tuple as shown in \Cref{subfig:ex-shipping-simp-route}. For example, the tuple Chicago is in the result, because $L_b$ it joins with both $R_b$ and $R_c$. Its lineage is $\Phi = L_b \cdot R_b + L_b \cdot R_c$. The expected multiplicity of this result tuple is calculated by summing over all possible worlds the multiplicity of the result tuple in this world multiplied
Note that since $\Phi$ is a sum of products, we can use linearity of expectation to solve the problem in linear time in the size of $\linsett{\query}{\pdb}{\tup}$: the exception of the sum is the sum of the exception of each monomial. The expectation of each monomial is then computed by multiplying the probabilities of the variables (tuple) occurring in the monomial.
Associating a lineage variable with every input tuple as shown in \cref{fig:ex-shipping-simp}, we can compute the lineage of every result tuple as shown in \cref{subfig:ex-shipping-simp-route}. For example, the tuple Chicago is in the result, because $L_b$ joins with both $R_b$ and $R_c$. Its lineage is $\Phi = L_b \cdot R_b + L_b \cdot R_c$. The expected multiplicity of this result tuple is calculated by summing over all possible worlds the multiplicity of the result tuple in this world multiplied by its probability.
Note that since $\Phi$ is a sum of products (SOP), we can use linearity of expectation to solve the problem in linear time in the size of $\linsett{\query}{\pdb}{\tup}$: the expectation of the sum is the sum of the expectations of each monomial. The expectation of each monomial is then computed by multiplying the probabilities of the variables (tuples) occurring in the monomial.
The expected multiplicity of Chicago is $1.0$.
\end{Example}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
While the expected multiplicity of a query result can be computed in linear time in the size of the result's lineage if it is in sum of product form, this may not be true for compressed representations of polynomials such as factorized polynomials and arithmetic circuits. For instance, \Cref{subfig:ex-proj-push-circ-q4} shows two circuits encoding the lineage of the result tuple $(Chicago)$ from \Cref{ex:intro-lineage}. The left one encodes the lineage as a sum of products while the right one uses distributivity push the addition below the multiplication resulting in a smaller circuit. Given that there is a large body of work that can output such compressed representations \BG{cite FDBs and FAQ}, an interesting question is whether computing expectations is still in linear time for such compressed representations. We prove that this is not the case: computing the expected count of a query result tuple is super-linear (\sharpwonehard) in the size of a lineage circuit.
Of course, any complexity results for computing the expectation of polynomials only translate to the expected result multiplicity problem when we also take into account the complexity of constructing the lineage for a given tuple.
While the expected multiplicity of a query result can be computed in linear time in the size of the result's lineage if it is in SOP form, this may not be true for compressed representations of polynomials such as factorized polynomials and arithmetic circuits. For instance, \Cref{subfig:ex-proj-push-circ-q4} shows two circuits encoding the lineage of the result tuple $(Chicago)$ from \Cref{ex:intro-lineage}. The left circuit encodes the lineage as a SOP while the right circuit uses distributivity to push the addition gate below the multiplication resulting in a smaller circuit. Given that there is a large body of work that can output such compressed representations \BG{cite FDBs and FAQ}, an interesting question is whether computing expectations is still in linear time for such compressed representations. We prove that this is not the case: computing the expected count of a query result tuple is super-linear (\sharpwonehard) in the size of a lineage circuit.
Of course, any complexity result for computing the expectation of polynomials only translates to the expected result multiplicity problem when we also take into account the complexity of constructing the lineage for a given tuple.
% As long as the complexity of constructing the lineage polynomial $\linsett{\query}{\pdb}{\tup}$ for a given database $\pdb$, query $\query$, and result tuple $\tup$ is less or equal to the complexity of computing the expected multiplicity of $\linsett{\query}{\pdb}{\tup}$, then our results for polynomials translate to the expected result multiplicity problem.
Concretely, me make the following contributions:
Concretely, we make the following contributions:
(i) We show that computing the expected result multiplicity problem for conjunctive queries for bag-$\ti$ is \sharpwonehard in the size of a lineage circuit by reduction from counting the number of $k$-matchings over an arbitrary graph;
(ii) We present an $(1-\epsilon)$-\emph{multiplicative} approximation algorithm for bag-$\ti$s and show that its complexity is linear in the size of the compressed lineage encoding;\BG{Fix not linear in all cases, restate after 4 is done}
(iii) We generalize the approximation algorithm to bag-$\bi$s, a more general model of probabilistic data;
(iv) We further generalize our results to higher moments and prove that for \raPlus queries, we can approximate the expected output tuple multiplicities with only a $O(\log{Z})$ overhead (where $Z$ is the number of output tuples) over the runtime of a broad class of query processing algorithms. We also observe that our results trivially extend to higher moments of the tuple multiplicity (instead of just the expectation).
(iv) We further generalize our results to higher moments and prove that for \raPlus queries, we can approximate the expected output tuple multiplicities with only $O(\log{Z})$ overhead (where $Z$ is the number of output tuples) over the runtime of a broad class of query processing algorithms. We also observe that our results trivially extend to higher moments of the tuple multiplicity (instead of just the expectation).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mypar{Paper Organization} We present relevant background and notation in \Cref{sec:background}. We then prove our main hardness results in \Cref{sec:hard} and present our approximation algorithm in \Cref{sec:algo}. We present some (easy) generalizations of our results in \Cref{sec:gen} and also discuss extensions from computing expectations of polynomials to the expected result multiplicity problem. Finally, we discuss related work in \Cref{sec:related-work} and conclude in \Cref{sec:concl-future-work}.