Simple example of Parzen window (kernel density estimation)2019 Community Moderator ElectionGradient boosting algorithm exampleApproximating density of test set in trainFitting Gaussian to data: Density-Estimation vs RegressionSimple Time Series PredictionDoes Non Negativity Constrains increases the estimation errorIs this a Q-learning algorithm or just brute force?Bandwidth selection Kernel Density Estimationkernel fisher discriminantQuantile regression with inhomogeneous density of pointsWhat does Make Density Based Clusterer in Weka do?

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

What is a Samsaran Word™?

Meaning of "Around In"

Alternative to sending password over mail?

Do Iron Man suits sport waste management systems?

Simple macro for new # symbol

Forgetting the musical notes while performing in concert

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

In Bayesian inference, why are some terms dropped from the posterior predictive?

files created then deleted at every second in tmp directory

Migrate from Force.com IDE to VScode

Am I breaking OOP practice with this architecture?

How do I deal with an unproductive colleague in a small company?

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

How to set continue counter from another counter (latex)?

Why do I get negative height?

Is it possible to mathematically extract an AES key from black-box encrypt/decrypt hardware?

Amending the P2P Layer

Bullying boss launched a smear campaign and made me unemployable

Mathematica command that allows it to read my intentions

Can I set a Ready action to trigger when literally anything happens?

How to compactly explain secondary and tertiary characters without resorting to stereotypes?

What exactly is ineptocracy?

Expand and Contract



Simple example of Parzen window (kernel density estimation)



2019 Community Moderator ElectionGradient boosting algorithm exampleApproximating density of test set in trainFitting Gaussian to data: Density-Estimation vs RegressionSimple Time Series PredictionDoes Non Negativity Constrains increases the estimation errorIs this a Q-learning algorithm or just brute force?Bandwidth selection Kernel Density Estimationkernel fisher discriminantQuantile regression with inhomogeneous density of pointsWhat does Make Density Based Clusterer in Weka do?










1












$begingroup$


I am confused about the Parzen Window question.



Suppose we have two training data points located at 0.5 and 0.7, and we use 0.3 as its rectangle window width. How do we estimate its probability density?



According to the definition, the probability density is $frack/nV$, where $k$ is the number of patterns, $n$ is the total number of points, and $V$ is the window region.



Therefore, is the density for this question $(1/2)/1$?



Then what if we use a triangle instead of a rectangle?










share|improve this question











$endgroup$
















    1












    $begingroup$


    I am confused about the Parzen Window question.



    Suppose we have two training data points located at 0.5 and 0.7, and we use 0.3 as its rectangle window width. How do we estimate its probability density?



    According to the definition, the probability density is $frack/nV$, where $k$ is the number of patterns, $n$ is the total number of points, and $V$ is the window region.



    Therefore, is the density for this question $(1/2)/1$?



    Then what if we use a triangle instead of a rectangle?










    share|improve this question











    $endgroup$














      1












      1








      1





      $begingroup$


      I am confused about the Parzen Window question.



      Suppose we have two training data points located at 0.5 and 0.7, and we use 0.3 as its rectangle window width. How do we estimate its probability density?



      According to the definition, the probability density is $frack/nV$, where $k$ is the number of patterns, $n$ is the total number of points, and $V$ is the window region.



      Therefore, is the density for this question $(1/2)/1$?



      Then what if we use a triangle instead of a rectangle?










      share|improve this question











      $endgroup$




      I am confused about the Parzen Window question.



      Suppose we have two training data points located at 0.5 and 0.7, and we use 0.3 as its rectangle window width. How do we estimate its probability density?



      According to the definition, the probability density is $frack/nV$, where $k$ is the number of patterns, $n$ is the total number of points, and $V$ is the window region.



      Therefore, is the density for this question $(1/2)/1$?



      Then what if we use a triangle instead of a rectangle?







      machine-learning unsupervised-learning density-estimation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 14:17









      Esmailian

      2,536318




      2,536318










      asked Mar 26 at 0:47









      Coda ChangCoda Chang

      1253




      1253




















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          In kernel density estimation, rectangle, triangle, or Gaussian kernels assign weight to positions around query point $x$. For rectangle and square, the weight is steady, for triangle, weight drops linearly with distance, and for Gaussian, weight drops exponentially with distance. Here is an image for square, rectangle, and triangle kernels (one dimensional).





          Here is the formula for kernel density estimation in one dimension:



          $$hatf_h(x) =frac1nhsum_i=1^nKleft(fracx-x_ihright)=frac1nsum_i=1^nK_hleft(x-x_iright)$$



          where scaled kernel $K_h$ is defined as:
          $$K_h(x-x_i) := frac1hK(fracx-x_ih)$$



          Example



          We have two training points located at $0.5$, and $0.7$ in one dimension.



          If we assume query point is $x=0.5$, and $h$ is 0.3 (for rectangle and triangle, the scaled width is 0.6 from -0.3 to 0.3), for rectangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(rect left(frac0.5-colorblue0.50.3 right)+rect left(frac0.5-colorblue0.70.3 right)right) \
          &= frac10.6(0.5+0.5) = 1.67
          endalign*$$

          and for triangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(tri left(frac0.5-colorblue0.50.3 right)+tri left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0.33) = 2.22
          endalign*$$



          For square kernel $sqr$, kernel outputs 1 for each point inside the hyper-cube, and $h$ would be the width of scaled hyper-cube (from $-h/2$ to $h/2$). For the square kernel, estimation in $d$ dimension is:
          $$hatf_h(x) =frac1nVsum_i=1^nsqrleft(fracx-x_ihright)=frac1nVk=fracfracknV$$



          where $k$ is the number of points inside a hyper-cube centered at $x$ with width $h$, and $V=h^d$ is the size of hyper-cube in $d$ dimensions (length of a segment in one dimension).



          The previous example for $h=0.3$ would be:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(sqr left(frac0.5-colorblue0.50.3 right)+sqr left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0) = fracfrac120.3 = 1.67
          endalign*$$

          Note that these are estimations for density not probability, thus, they are allowed to be larger than one (imagine a rectangle with width 0.5 and height 2 as pdf of a continuous random variable).






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            Thanks for your effort!
            $endgroup$
            – Coda Chang
            Mar 28 at 3:16











          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: "557"
          ;
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f47984%2fsimple-example-of-parzen-window-kernel-density-estimation%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









          1












          $begingroup$

          In kernel density estimation, rectangle, triangle, or Gaussian kernels assign weight to positions around query point $x$. For rectangle and square, the weight is steady, for triangle, weight drops linearly with distance, and for Gaussian, weight drops exponentially with distance. Here is an image for square, rectangle, and triangle kernels (one dimensional).





          Here is the formula for kernel density estimation in one dimension:



          $$hatf_h(x) =frac1nhsum_i=1^nKleft(fracx-x_ihright)=frac1nsum_i=1^nK_hleft(x-x_iright)$$



          where scaled kernel $K_h$ is defined as:
          $$K_h(x-x_i) := frac1hK(fracx-x_ih)$$



          Example



          We have two training points located at $0.5$, and $0.7$ in one dimension.



          If we assume query point is $x=0.5$, and $h$ is 0.3 (for rectangle and triangle, the scaled width is 0.6 from -0.3 to 0.3), for rectangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(rect left(frac0.5-colorblue0.50.3 right)+rect left(frac0.5-colorblue0.70.3 right)right) \
          &= frac10.6(0.5+0.5) = 1.67
          endalign*$$

          and for triangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(tri left(frac0.5-colorblue0.50.3 right)+tri left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0.33) = 2.22
          endalign*$$



          For square kernel $sqr$, kernel outputs 1 for each point inside the hyper-cube, and $h$ would be the width of scaled hyper-cube (from $-h/2$ to $h/2$). For the square kernel, estimation in $d$ dimension is:
          $$hatf_h(x) =frac1nVsum_i=1^nsqrleft(fracx-x_ihright)=frac1nVk=fracfracknV$$



          where $k$ is the number of points inside a hyper-cube centered at $x$ with width $h$, and $V=h^d$ is the size of hyper-cube in $d$ dimensions (length of a segment in one dimension).



          The previous example for $h=0.3$ would be:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(sqr left(frac0.5-colorblue0.50.3 right)+sqr left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0) = fracfrac120.3 = 1.67
          endalign*$$

          Note that these are estimations for density not probability, thus, they are allowed to be larger than one (imagine a rectangle with width 0.5 and height 2 as pdf of a continuous random variable).






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            Thanks for your effort!
            $endgroup$
            – Coda Chang
            Mar 28 at 3:16















          1












          $begingroup$

          In kernel density estimation, rectangle, triangle, or Gaussian kernels assign weight to positions around query point $x$. For rectangle and square, the weight is steady, for triangle, weight drops linearly with distance, and for Gaussian, weight drops exponentially with distance. Here is an image for square, rectangle, and triangle kernels (one dimensional).





          Here is the formula for kernel density estimation in one dimension:



          $$hatf_h(x) =frac1nhsum_i=1^nKleft(fracx-x_ihright)=frac1nsum_i=1^nK_hleft(x-x_iright)$$



          where scaled kernel $K_h$ is defined as:
          $$K_h(x-x_i) := frac1hK(fracx-x_ih)$$



          Example



          We have two training points located at $0.5$, and $0.7$ in one dimension.



          If we assume query point is $x=0.5$, and $h$ is 0.3 (for rectangle and triangle, the scaled width is 0.6 from -0.3 to 0.3), for rectangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(rect left(frac0.5-colorblue0.50.3 right)+rect left(frac0.5-colorblue0.70.3 right)right) \
          &= frac10.6(0.5+0.5) = 1.67
          endalign*$$

          and for triangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(tri left(frac0.5-colorblue0.50.3 right)+tri left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0.33) = 2.22
          endalign*$$



          For square kernel $sqr$, kernel outputs 1 for each point inside the hyper-cube, and $h$ would be the width of scaled hyper-cube (from $-h/2$ to $h/2$). For the square kernel, estimation in $d$ dimension is:
          $$hatf_h(x) =frac1nVsum_i=1^nsqrleft(fracx-x_ihright)=frac1nVk=fracfracknV$$



          where $k$ is the number of points inside a hyper-cube centered at $x$ with width $h$, and $V=h^d$ is the size of hyper-cube in $d$ dimensions (length of a segment in one dimension).



          The previous example for $h=0.3$ would be:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(sqr left(frac0.5-colorblue0.50.3 right)+sqr left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0) = fracfrac120.3 = 1.67
          endalign*$$

          Note that these are estimations for density not probability, thus, they are allowed to be larger than one (imagine a rectangle with width 0.5 and height 2 as pdf of a continuous random variable).






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            Thanks for your effort!
            $endgroup$
            – Coda Chang
            Mar 28 at 3:16













          1












          1








          1





          $begingroup$

          In kernel density estimation, rectangle, triangle, or Gaussian kernels assign weight to positions around query point $x$. For rectangle and square, the weight is steady, for triangle, weight drops linearly with distance, and for Gaussian, weight drops exponentially with distance. Here is an image for square, rectangle, and triangle kernels (one dimensional).





          Here is the formula for kernel density estimation in one dimension:



          $$hatf_h(x) =frac1nhsum_i=1^nKleft(fracx-x_ihright)=frac1nsum_i=1^nK_hleft(x-x_iright)$$



          where scaled kernel $K_h$ is defined as:
          $$K_h(x-x_i) := frac1hK(fracx-x_ih)$$



          Example



          We have two training points located at $0.5$, and $0.7$ in one dimension.



          If we assume query point is $x=0.5$, and $h$ is 0.3 (for rectangle and triangle, the scaled width is 0.6 from -0.3 to 0.3), for rectangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(rect left(frac0.5-colorblue0.50.3 right)+rect left(frac0.5-colorblue0.70.3 right)right) \
          &= frac10.6(0.5+0.5) = 1.67
          endalign*$$

          and for triangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(tri left(frac0.5-colorblue0.50.3 right)+tri left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0.33) = 2.22
          endalign*$$



          For square kernel $sqr$, kernel outputs 1 for each point inside the hyper-cube, and $h$ would be the width of scaled hyper-cube (from $-h/2$ to $h/2$). For the square kernel, estimation in $d$ dimension is:
          $$hatf_h(x) =frac1nVsum_i=1^nsqrleft(fracx-x_ihright)=frac1nVk=fracfracknV$$



          where $k$ is the number of points inside a hyper-cube centered at $x$ with width $h$, and $V=h^d$ is the size of hyper-cube in $d$ dimensions (length of a segment in one dimension).



          The previous example for $h=0.3$ would be:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(sqr left(frac0.5-colorblue0.50.3 right)+sqr left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0) = fracfrac120.3 = 1.67
          endalign*$$

          Note that these are estimations for density not probability, thus, they are allowed to be larger than one (imagine a rectangle with width 0.5 and height 2 as pdf of a continuous random variable).






          share|improve this answer











          $endgroup$



          In kernel density estimation, rectangle, triangle, or Gaussian kernels assign weight to positions around query point $x$. For rectangle and square, the weight is steady, for triangle, weight drops linearly with distance, and for Gaussian, weight drops exponentially with distance. Here is an image for square, rectangle, and triangle kernels (one dimensional).





          Here is the formula for kernel density estimation in one dimension:



          $$hatf_h(x) =frac1nhsum_i=1^nKleft(fracx-x_ihright)=frac1nsum_i=1^nK_hleft(x-x_iright)$$



          where scaled kernel $K_h$ is defined as:
          $$K_h(x-x_i) := frac1hK(fracx-x_ih)$$



          Example



          We have two training points located at $0.5$, and $0.7$ in one dimension.



          If we assume query point is $x=0.5$, and $h$ is 0.3 (for rectangle and triangle, the scaled width is 0.6 from -0.3 to 0.3), for rectangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(rect left(frac0.5-colorblue0.50.3 right)+rect left(frac0.5-colorblue0.70.3 right)right) \
          &= frac10.6(0.5+0.5) = 1.67
          endalign*$$

          and for triangle kernel we have:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(tri left(frac0.5-colorblue0.50.3 right)+tri left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0.33) = 2.22
          endalign*$$



          For square kernel $sqr$, kernel outputs 1 for each point inside the hyper-cube, and $h$ would be the width of scaled hyper-cube (from $-h/2$ to $h/2$). For the square kernel, estimation in $d$ dimension is:
          $$hatf_h(x) =frac1nVsum_i=1^nsqrleft(fracx-x_ihright)=frac1nVk=fracfracknV$$



          where $k$ is the number of points inside a hyper-cube centered at $x$ with width $h$, and $V=h^d$ is the size of hyper-cube in $d$ dimensions (length of a segment in one dimension).



          The previous example for $h=0.3$ would be:
          $$beginalign*
          hatf_0.3(0.5) &=frac12*0.3left(sqr left(frac0.5-colorblue0.50.3 right)+sqr left(frac0.5-colorblue0.70.3 right)right) \
          & = frac10.6(1+0) = fracfrac120.3 = 1.67
          endalign*$$

          Note that these are estimations for density not probability, thus, they are allowed to be larger than one (imagine a rectangle with width 0.5 and height 2 as pdf of a continuous random variable).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 28 at 11:47

























          answered Mar 26 at 14:47









          EsmailianEsmailian

          2,536318




          2,536318







          • 1




            $begingroup$
            Thanks for your effort!
            $endgroup$
            – Coda Chang
            Mar 28 at 3:16












          • 1




            $begingroup$
            Thanks for your effort!
            $endgroup$
            – Coda Chang
            Mar 28 at 3:16







          1




          1




          $begingroup$
          Thanks for your effort!
          $endgroup$
          – Coda Chang
          Mar 28 at 3:16




          $begingroup$
          Thanks for your effort!
          $endgroup$
          – Coda Chang
          Mar 28 at 3:16

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science 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%2fdatascience.stackexchange.com%2fquestions%2f47984%2fsimple-example-of-parzen-window-kernel-density-estimation%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

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?