Problem understanding the math in HyperLogLog
$begingroup$
I have problem understanding how the math works in the hyperloglog algorithm. More specifically, I have trouble seeing how the author get formula 5 from formula 4, in the HyperLogLog paper, page 132.
The formula 4 says
$mathbb{E}_n(Z) = sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}$, where $gamma_{n_j,k_j} = (1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}$
Then the paper assumes $n$ satisfies Poisson distribution of rate $lambda$, $mathbb{P}(N=n) = e^{-lambda}frac{lambda^n}{n!}$, and get formula 5
$mathbb{E}_{P(lambda)}(Z) = sum_{ngeq 0}mathbb{E}_n(Z)e^{-lambda}frac{lambda^n}{n!}=sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})$, where $g(x) = e^{-x}-e^{-2x}$.
The paper says it is obtained by simple series rearrangements. However I fail to understand how this is done. Any help is greatly appreciated!
probability-distributions poisson-distribution
$endgroup$
add a comment |
$begingroup$
I have problem understanding how the math works in the hyperloglog algorithm. More specifically, I have trouble seeing how the author get formula 5 from formula 4, in the HyperLogLog paper, page 132.
The formula 4 says
$mathbb{E}_n(Z) = sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}$, where $gamma_{n_j,k_j} = (1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}$
Then the paper assumes $n$ satisfies Poisson distribution of rate $lambda$, $mathbb{P}(N=n) = e^{-lambda}frac{lambda^n}{n!}$, and get formula 5
$mathbb{E}_{P(lambda)}(Z) = sum_{ngeq 0}mathbb{E}_n(Z)e^{-lambda}frac{lambda^n}{n!}=sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})$, where $g(x) = e^{-x}-e^{-2x}$.
The paper says it is obtained by simple series rearrangements. However I fail to understand how this is done. Any help is greatly appreciated!
probability-distributions poisson-distribution
$endgroup$
add a comment |
$begingroup$
I have problem understanding how the math works in the hyperloglog algorithm. More specifically, I have trouble seeing how the author get formula 5 from formula 4, in the HyperLogLog paper, page 132.
The formula 4 says
$mathbb{E}_n(Z) = sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}$, where $gamma_{n_j,k_j} = (1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}$
Then the paper assumes $n$ satisfies Poisson distribution of rate $lambda$, $mathbb{P}(N=n) = e^{-lambda}frac{lambda^n}{n!}$, and get formula 5
$mathbb{E}_{P(lambda)}(Z) = sum_{ngeq 0}mathbb{E}_n(Z)e^{-lambda}frac{lambda^n}{n!}=sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})$, where $g(x) = e^{-x}-e^{-2x}$.
The paper says it is obtained by simple series rearrangements. However I fail to understand how this is done. Any help is greatly appreciated!
probability-distributions poisson-distribution
$endgroup$
I have problem understanding how the math works in the hyperloglog algorithm. More specifically, I have trouble seeing how the author get formula 5 from formula 4, in the HyperLogLog paper, page 132.
The formula 4 says
$mathbb{E}_n(Z) = sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}$, where $gamma_{n_j,k_j} = (1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}$
Then the paper assumes $n$ satisfies Poisson distribution of rate $lambda$, $mathbb{P}(N=n) = e^{-lambda}frac{lambda^n}{n!}$, and get formula 5
$mathbb{E}_{P(lambda)}(Z) = sum_{ngeq 0}mathbb{E}_n(Z)e^{-lambda}frac{lambda^n}{n!}=sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})$, where $g(x) = e^{-x}-e^{-2x}$.
The paper says it is obtained by simple series rearrangements. However I fail to understand how this is done. Any help is greatly appreciated!
probability-distributions poisson-distribution
probability-distributions poisson-distribution
asked Dec 22 '18 at 19:33
HarperHarper
1955
1955
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Here is the derivation which uses the identity $e^x = sum_{ngeq 0} frac{x^n}{n!}$:
begin{aligned}
mathbb{E}_{P(lambda)}(Z) &= sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}mathbb{E}_n(Z)
\
&=
sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{ngeq 0}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}frac{lambda^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{ngeq 0}sum_{n_1+...+n_m=n}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1geq 0}sum_{n_2geq 0}cdotssum_{n_mgeq 0}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}gamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}left((1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j}})right)^{n_j}}{n_j!}right)
-
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j-1}})right)^{n_j}}{n_j!}right)
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j}}right)}
-
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j-1}}right)}
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
e^frac{lambda}{m}left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})
end{aligned}
By the way, a simpler derivation of the HyperLogLog algorithm that does not involve complex analysis can be found in my paper https://arxiv.org/pdf/1702.01284.pdf.
$endgroup$
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3049773%2fproblem-understanding-the-math-in-hyperloglog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Here is the derivation which uses the identity $e^x = sum_{ngeq 0} frac{x^n}{n!}$:
begin{aligned}
mathbb{E}_{P(lambda)}(Z) &= sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}mathbb{E}_n(Z)
\
&=
sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{ngeq 0}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}frac{lambda^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{ngeq 0}sum_{n_1+...+n_m=n}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1geq 0}sum_{n_2geq 0}cdotssum_{n_mgeq 0}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}gamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}left((1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j}})right)^{n_j}}{n_j!}right)
-
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j-1}})right)^{n_j}}{n_j!}right)
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j}}right)}
-
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j-1}}right)}
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
e^frac{lambda}{m}left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})
end{aligned}
By the way, a simpler derivation of the HyperLogLog algorithm that does not involve complex analysis can be found in my paper https://arxiv.org/pdf/1702.01284.pdf.
$endgroup$
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
add a comment |
$begingroup$
Here is the derivation which uses the identity $e^x = sum_{ngeq 0} frac{x^n}{n!}$:
begin{aligned}
mathbb{E}_{P(lambda)}(Z) &= sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}mathbb{E}_n(Z)
\
&=
sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{ngeq 0}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}frac{lambda^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{ngeq 0}sum_{n_1+...+n_m=n}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1geq 0}sum_{n_2geq 0}cdotssum_{n_mgeq 0}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}gamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}left((1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j}})right)^{n_j}}{n_j!}right)
-
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j-1}})right)^{n_j}}{n_j!}right)
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j}}right)}
-
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j-1}}right)}
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
e^frac{lambda}{m}left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})
end{aligned}
By the way, a simpler derivation of the HyperLogLog algorithm that does not involve complex analysis can be found in my paper https://arxiv.org/pdf/1702.01284.pdf.
$endgroup$
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
add a comment |
$begingroup$
Here is the derivation which uses the identity $e^x = sum_{ngeq 0} frac{x^n}{n!}$:
begin{aligned}
mathbb{E}_{P(lambda)}(Z) &= sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}mathbb{E}_n(Z)
\
&=
sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{ngeq 0}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}frac{lambda^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{ngeq 0}sum_{n_1+...+n_m=n}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1geq 0}sum_{n_2geq 0}cdotssum_{n_mgeq 0}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}gamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}left((1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j}})right)^{n_j}}{n_j!}right)
-
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j-1}})right)^{n_j}}{n_j!}right)
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j}}right)}
-
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j-1}}right)}
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
e^frac{lambda}{m}left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})
end{aligned}
By the way, a simpler derivation of the HyperLogLog algorithm that does not involve complex analysis can be found in my paper https://arxiv.org/pdf/1702.01284.pdf.
$endgroup$
Here is the derivation which uses the identity $e^x = sum_{ngeq 0} frac{x^n}{n!}$:
begin{aligned}
mathbb{E}_{P(lambda)}(Z) &= sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}mathbb{E}_n(Z)
\
&=
sum_{ngeq 0}e^{-lambda}frac{lambda^n}{n!}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}begin{pmatrix}n\n_1,...,n_mend{pmatrix}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{ngeq 0}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1+...+n_m=n}frac{lambda^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}frac{1}{m^n}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{ngeq 0}sum_{n_1+...+n_m=n}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}sum_{n_1geq 0}sum_{n_2geq 0}cdotssum_{n_mgeq 0}frac{left(frac{lambda}{m}right)^{n_1+n_2+cdots n_m}}{n_1!n_2!cdots n_m!}prod_{j=1}^mgamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}gamma_{n_j,k_j}
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^msum_{n_jgeq 0}frac{left(frac{lambda}{m}right)^{n_j}}{n_j!}left((1-frac{1}{2^{k_j}})^{n_j}-(1-frac{1}{2^{k_j-1}})^{n_j}right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j}})right)^{n_j}}{n_j!}right)
-
left(
sum_{n_jgeq 0}frac{left(frac{lambda}{m}(1-frac{1}{2^{k_j-1}})right)^{n_j}}{n_j!}right)
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j}}right)}
-
e^{frac{lambda}{m}left(1-frac{1}{2^{k_j-1}}right)}
right)
\
&=
e^{-lambda}sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
e^frac{lambda}{m}left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^m
left(
e^{-frac{lambda}{m 2^{k_j}}}
-
e^{-frac{lambda}{m 2^{k_j-1}}}
right)
\
&=
sum_{k_1,...,k_mgeq 1}frac{1}{sum_{j=1}^m2^{-k_j}}prod_{j=1}^mg(frac{lambda}{m2^{k_j}})
end{aligned}
By the way, a simpler derivation of the HyperLogLog algorithm that does not involve complex analysis can be found in my paper https://arxiv.org/pdf/1702.01284.pdf.
answered Dec 24 '18 at 14:42
otmarotmar
13810
13810
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
add a comment |
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
$begingroup$
Fantastic and thank you! I now understand how the derivation works and am reading your paper.
$endgroup$
– Harper
Dec 26 '18 at 19:53
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3049773%2fproblem-understanding-the-math-in-hyperloglog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown