Random Gaussian Noise

username: Andre_Amaral_IST
cooked: <p>Hey,<br>
I have this waveform predicted:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/e/be164745f7b1e24f9e01f196e7c9849f47a8304f.png" data-download-href="https://discuss.pytorch.org/uploads/default/be164745f7b1e24f9e01f196e7c9849f47a8304f" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/e/be164745f7b1e24f9e01f196e7c9849f47a8304f_2_690x211.png" alt="image" data-base62-sha1="r7ArWlgqO4MCPLVcMm5GSKFNuW3" width="690" height="211" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/e/be164745f7b1e24f9e01f196e7c9849f47a8304f_2_690x211.png, https://discuss.pytorch.org/uploads/default/original/3X/b/e/be164745f7b1e24f9e01f196e7c9849f47a8304f.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/e/be164745f7b1e24f9e01f196e7c9849f47a8304f.png 2x" data-dominant-color="F7F8F9"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">797×244 33.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>Why when I add this code:</p>
<pre><code class="lang-auto">a = np.random.normal(mean, stdv, error_noise.shape[0])
test_predict[0] = test_predict[0] + a[0]
</code></pre>
<p>The output result is the following:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/5/05a4e5d7ce9a32bb89db88e8301616e22d777b83.png" data-download-href="https://discuss.pytorch.org/uploads/default/05a4e5d7ce9a32bb89db88e8301616e22d777b83" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/5/05a4e5d7ce9a32bb89db88e8301616e22d777b83_2_690x197.png" alt="image" data-base62-sha1="NVG7gT5QRH3SvQNKSR1UkqOid5" width="690" height="197" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/5/05a4e5d7ce9a32bb89db88e8301616e22d777b83_2_690x197.png, https://discuss.pytorch.org/uploads/default/original/3X/0/5/05a4e5d7ce9a32bb89db88e8301616e22d777b83.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/0/5/05a4e5d7ce9a32bb89db88e8301616e22d777b83.png 2x" data-dominant-color="F8F8F9"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">794×227 23.3 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: AlphaBetaGamma96
cooked: <p><code>a</code> will a vector of length <code>error_noise.shape[0]</code> which will be the same length as <code>test_predict</code></p>
<p>When you do,</p>
<pre><code class="lang-auto">test_predict[0] = test_predict[0] + a[0]
</code></pre>
<p>You’re taking the first element of the <code>test_predict</code> vector and adding the first element of the <code>a</code> vector which is why only the very first element changes. If you want to add all of <code>a</code> to <code>test_predict</code> just do,</p>
<pre><code class="lang-auto">test_predict = test_predcit + a
</code></pre>