<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 26, 2016 at 1:46 PM, Stephan Hoyer <span dir="ltr"><<a href="mailto:shoyer@gmail.com" target="_blank">shoyer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I wonder if the goals of this addition could be achieved by simply adding an optional `cov` argument</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">to np.corr, which would provide a pre-computed covariance.</div></blockquote><div><br></div><div>That's a fair suggestion which I'm happy to switch to. This eliminates the need for two new functions. </div><div>I'll add an optional `cov = False` argument to numpy.corrcoef that returns a tuple (corr, cov) instead.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Either way, `covcorr` feels like a helper function that could exist in user code rather than numpy proper.</div></div></blockquote><div><br></div><div>The user would have to re-implement the part that converts the covariance matrix to a correlation</div><div>coefficient. I made this PR to avoid that code duplication.</div><div><br></div><div>Mathew</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="gmail-h5">On Wed, Oct 26, 2016 at 10:27 AM, Mathew S. Madhavacheril <span dir="ltr"><<a href="mailto:mathewsyriac@gmail.com" target="_blank">mathewsyriac@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5"><div dir="ltr">Hi all,<div><br></div><div>I posted a pull request:<br><a href="https://github.com/numpy/numpy/pull/8211" target="_blank">https://github.com/numpy/numpy<wbr>/pull/8211</a><br></div><div><br></div><div>which adds a function `numpy.covcorr` that calculates both <br>the covariance matrix and correlation coefficient with a single</div><div>call to `numpy.cov` (which is often an expensive call for large</div><div>data-sets). A function `numpy.covtocorr` has also been added</div><div>that converts a covariance matrix to a correlation coefficent,</div><div>and `numpy.corrcoef` has been modified to call this. The</div><div>motivation here is that one often needs the covariance for</div><div>subsequent analysis and the correlation coefficient for </div><div>visualization, so instead of forcing the user to write their own</div><div>code to convert one to the other, we want to allow both to </div><div>be obtained from `numpy` as efficiently as possible.</div><div><br></div><div>Best,<br>Mathew</div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman<wbr>/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/numpy-<wbr>discussion</a><br>
<br></blockquote></div><br></div></div>