How to assign weight while approximating multiplicationNotation question with Dirichlet processescalculating an incoherence propertyWhat is the distribution of the dot product of a Dirichlet vector with a fixed vector?Probability mass function of the sum of the function of the sum of iid random variablesGMM with full and diagonal covariancesLet $X$ have a Poisson distribution with parameter $lambda$.[data generating process]-[sampling from an infinite population]-[i.i.d.]: some clarificationsSampling from probability distribution via multiplying probabilities by a uniform random numberSampling vector at intersection of hypersphere and hyperplaneHow to find most likely family of probability density polynomials given prior data?

Is it inappropriate for a student to attend their mentor's dissertation defense?

How much of data wrangling is a data scientist's job?

Can a virus destroy the BIOS of a modern computer?

Do I have a twin with permutated remainders?

SSH "lag" in LAN on some machines, mixed distros

How can I make my BBEG immortal short of making them a Lich or Vampire?

intersection of two sorted vectors in C++

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Why doesn't H₄O²⁺ exist?

Stopping power of mountain vs road bike

How to model explosives?

How to say in German "enjoying home comforts"

Facing a paradox: Earnshaw's theorem in one dimension

What killed these X2 caps?

Why is the 'in' operator throwing an error with a string literal instead of logging false?

prove that the matrix A is diagonalizable

Should I tell management that I intend to leave due to bad software development practices?

How could indestructible materials be used in power generation?

UK: Is there precedent for the governments e-petition site changing the direction of a government decision?

Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?

Could gravitational lensing be used to protect a spaceship from a laser?

Combinations of multiple lists

Twin primes whose sum is a cube

Can I use a neutral wire from another outlet to repair a broken neutral?



How to assign weight while approximating multiplication


Notation question with Dirichlet processescalculating an incoherence propertyWhat is the distribution of the dot product of a Dirichlet vector with a fixed vector?Probability mass function of the sum of the function of the sum of iid random variablesGMM with full and diagonal covariancesLet $X$ have a Poisson distribution with parameter $lambda$.[data generating process]-[sampling from an infinite population]-[i.i.d.]: some clarificationsSampling from probability distribution via multiplying probabilities by a uniform random numberSampling vector at intersection of hypersphere and hyperplaneHow to find most likely family of probability density polynomials given prior data?













1












$begingroup$


I have two summations: $y = sum_i=1^s w_i x_i$, and $y' = sum_i=1^s' w'_i x'_i$.



$s$ and $s'$ are the number of terms in each summation, and both are big numbers.



$w_i$ and $w'_i$ are weights of the terms $x$ and $x'$, so we have: $sum_i=1^s w_i = sum_i=1^s' w'_i = 1$. We can therefore treat $x$ and $x'$ as terms in a probability distribution.



Now, I want to approximate the multiplication of the two summations: $y cdot y'$. The accurate multiplication could easily be expressed as a sum of $s cdot s'$ terms, but we want to reduce the number of terms; so we do approximation.



To this end, I draw a sample of $M$ pairs of indices $(k_r, l_r)^M_r=1$, where the indices are sampled independently from the two probability distributions $w$ and $w'$.



The next step is to compute $z_r = x_k_r cdot x'_l_r$ for each $r$.



Next, we need to assign new weights $q$ to each $z_r$. Apparently, we can use the frequency of the sampled indices as new weights. We will then get another sum $sum q_i z_i$ as the final product.



I am trying to implement the above steps in a programming language. Due to the nature of the program I write, I can't sample exact indices.



To give an example, in the above, when I sample an index of 3 from a total of 5 elements, I am in effect generating a one-hot vector $[0, 0, 0, 1, 0]$. This vector could next be dot-multiplied with the original sum to get the 3rd element in the sum.



In the program I am writing, I am generating approximate one-hot vectors that look like $[0.05, 0.05, 0.1, 0.75, 0.05]$, where the largest value approximately represents index of the sampled element.



If we had an exact one-hot vector, it is easy to get the frequencies and new weights. However, it is not so obvious how to do so when the one-hot vectors themselves are approximate. Can anyone help me get an expression of the new weights with these approximate one-hot vectors?










share|cite|improve this question









$endgroup$











  • $begingroup$
    Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
    $endgroup$
    – CyborgOctopus
    Mar 21 at 13:04










  • $begingroup$
    Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
    $endgroup$
    – Su Xuan
    Mar 21 at 13:10















1












$begingroup$


I have two summations: $y = sum_i=1^s w_i x_i$, and $y' = sum_i=1^s' w'_i x'_i$.



$s$ and $s'$ are the number of terms in each summation, and both are big numbers.



$w_i$ and $w'_i$ are weights of the terms $x$ and $x'$, so we have: $sum_i=1^s w_i = sum_i=1^s' w'_i = 1$. We can therefore treat $x$ and $x'$ as terms in a probability distribution.



Now, I want to approximate the multiplication of the two summations: $y cdot y'$. The accurate multiplication could easily be expressed as a sum of $s cdot s'$ terms, but we want to reduce the number of terms; so we do approximation.



To this end, I draw a sample of $M$ pairs of indices $(k_r, l_r)^M_r=1$, where the indices are sampled independently from the two probability distributions $w$ and $w'$.



The next step is to compute $z_r = x_k_r cdot x'_l_r$ for each $r$.



Next, we need to assign new weights $q$ to each $z_r$. Apparently, we can use the frequency of the sampled indices as new weights. We will then get another sum $sum q_i z_i$ as the final product.



I am trying to implement the above steps in a programming language. Due to the nature of the program I write, I can't sample exact indices.



To give an example, in the above, when I sample an index of 3 from a total of 5 elements, I am in effect generating a one-hot vector $[0, 0, 0, 1, 0]$. This vector could next be dot-multiplied with the original sum to get the 3rd element in the sum.



In the program I am writing, I am generating approximate one-hot vectors that look like $[0.05, 0.05, 0.1, 0.75, 0.05]$, where the largest value approximately represents index of the sampled element.



If we had an exact one-hot vector, it is easy to get the frequencies and new weights. However, it is not so obvious how to do so when the one-hot vectors themselves are approximate. Can anyone help me get an expression of the new weights with these approximate one-hot vectors?










share|cite|improve this question









$endgroup$











  • $begingroup$
    Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
    $endgroup$
    – CyborgOctopus
    Mar 21 at 13:04










  • $begingroup$
    Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
    $endgroup$
    – Su Xuan
    Mar 21 at 13:10













1












1








1





$begingroup$


I have two summations: $y = sum_i=1^s w_i x_i$, and $y' = sum_i=1^s' w'_i x'_i$.



$s$ and $s'$ are the number of terms in each summation, and both are big numbers.



$w_i$ and $w'_i$ are weights of the terms $x$ and $x'$, so we have: $sum_i=1^s w_i = sum_i=1^s' w'_i = 1$. We can therefore treat $x$ and $x'$ as terms in a probability distribution.



Now, I want to approximate the multiplication of the two summations: $y cdot y'$. The accurate multiplication could easily be expressed as a sum of $s cdot s'$ terms, but we want to reduce the number of terms; so we do approximation.



To this end, I draw a sample of $M$ pairs of indices $(k_r, l_r)^M_r=1$, where the indices are sampled independently from the two probability distributions $w$ and $w'$.



The next step is to compute $z_r = x_k_r cdot x'_l_r$ for each $r$.



Next, we need to assign new weights $q$ to each $z_r$. Apparently, we can use the frequency of the sampled indices as new weights. We will then get another sum $sum q_i z_i$ as the final product.



I am trying to implement the above steps in a programming language. Due to the nature of the program I write, I can't sample exact indices.



To give an example, in the above, when I sample an index of 3 from a total of 5 elements, I am in effect generating a one-hot vector $[0, 0, 0, 1, 0]$. This vector could next be dot-multiplied with the original sum to get the 3rd element in the sum.



In the program I am writing, I am generating approximate one-hot vectors that look like $[0.05, 0.05, 0.1, 0.75, 0.05]$, where the largest value approximately represents index of the sampled element.



If we had an exact one-hot vector, it is easy to get the frequencies and new weights. However, it is not so obvious how to do so when the one-hot vectors themselves are approximate. Can anyone help me get an expression of the new weights with these approximate one-hot vectors?










share|cite|improve this question









$endgroup$




I have two summations: $y = sum_i=1^s w_i x_i$, and $y' = sum_i=1^s' w'_i x'_i$.



$s$ and $s'$ are the number of terms in each summation, and both are big numbers.



$w_i$ and $w'_i$ are weights of the terms $x$ and $x'$, so we have: $sum_i=1^s w_i = sum_i=1^s' w'_i = 1$. We can therefore treat $x$ and $x'$ as terms in a probability distribution.



Now, I want to approximate the multiplication of the two summations: $y cdot y'$. The accurate multiplication could easily be expressed as a sum of $s cdot s'$ terms, but we want to reduce the number of terms; so we do approximation.



To this end, I draw a sample of $M$ pairs of indices $(k_r, l_r)^M_r=1$, where the indices are sampled independently from the two probability distributions $w$ and $w'$.



The next step is to compute $z_r = x_k_r cdot x'_l_r$ for each $r$.



Next, we need to assign new weights $q$ to each $z_r$. Apparently, we can use the frequency of the sampled indices as new weights. We will then get another sum $sum q_i z_i$ as the final product.



I am trying to implement the above steps in a programming language. Due to the nature of the program I write, I can't sample exact indices.



To give an example, in the above, when I sample an index of 3 from a total of 5 elements, I am in effect generating a one-hot vector $[0, 0, 0, 1, 0]$. This vector could next be dot-multiplied with the original sum to get the 3rd element in the sum.



In the program I am writing, I am generating approximate one-hot vectors that look like $[0.05, 0.05, 0.1, 0.75, 0.05]$, where the largest value approximately represents index of the sampled element.



If we had an exact one-hot vector, it is easy to get the frequencies and new weights. However, it is not so obvious how to do so when the one-hot vectors themselves are approximate. Can anyone help me get an expression of the new weights with these approximate one-hot vectors?







probability-distributions sampling






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Mar 21 at 12:35









Su XuanSu Xuan

1112




1112











  • $begingroup$
    Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
    $endgroup$
    – CyborgOctopus
    Mar 21 at 13:04










  • $begingroup$
    Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
    $endgroup$
    – Su Xuan
    Mar 21 at 13:10
















  • $begingroup$
    Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
    $endgroup$
    – CyborgOctopus
    Mar 21 at 13:04










  • $begingroup$
    Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
    $endgroup$
    – Su Xuan
    Mar 21 at 13:10















$begingroup$
Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
$endgroup$
– CyborgOctopus
Mar 21 at 13:04




$begingroup$
Could you loop through each approximate vector and set all of the elements to zero except for the biggest one to get an exact vector?
$endgroup$
– CyborgOctopus
Mar 21 at 13:04












$begingroup$
Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
$endgroup$
– Su Xuan
Mar 21 at 13:10




$begingroup$
Nope, this is not possible (and not very clean). I want a formula to compute the weights that explicitly involves those approximate vectors.
$endgroup$
– Su Xuan
Mar 21 at 13:10










0






active

oldest

votes












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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3156771%2fhow-to-assign-weight-while-approximating-multiplication%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3156771%2fhow-to-assign-weight-while-approximating-multiplication%23new-answer', 'question_page');

);

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







Popular posts from this blog

Moe incest case Sentencing See also References Navigation menu"'Australian Josef Fritzl' fathered four children by daughter""Small town recoils in horror at 'Australian Fritzl' incest case""Victorian rape allegations echo Fritzl case - Just In (Australian Broadcasting Corporation)""Incest father jailed for 22 years""'Australian Fritzl' sentenced to 22 years in prison for abusing daughter for three decades""RSJ v The Queen"

Who is our nearest planetary neighbor, on average?Santa Claus flies to the South PoleSeven Spheres of Unequal Mass, a weighing problem with a twistDescribe a large integerFast Mental Calculation of $7.5^7$Math in Space (without the help of celebrities)Find the value of $bigstar$: Puzzle 8 - InequalityWho drinks beer while running anyway?A Crucial DeliveryRanking And AverageHow long will my money last at roulette?

Daza language Contents Vocabulary Phonology References External links Navigation menudaza1242Daza"Dazaga"eeee178086576