Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How to optimize this will depend on some properties of your data, but here are some ideas:</p> <ol> <li><p>Have you tried profiling the code? Using one of the <a href="http://docs.python.org/2/library/profile.html" rel="nofollow">Python profilers</a> can give you some useful information about what's taking the most time. Often, a piece of code you've just written will have one biggest bottleneck, and it's not always obvious which piece it is; profiling lets you figure that out and attack the main bottleneck first.</p></li> <li><p>Do you know what typical values of <code>i</code> are? If you have some idea, you can speed things up by starting with <code>i</code> greater than 0 (as @vhallac noted), or by increasing <code>i</code> by larger amounts — if you often see big values for <code>i</code>, increase <code>i</code> by 2 or 3 at a time; if the distribution of <code>i</code>s has a long tail, try doubling it each time; etc.</p></li> <li><p>Do you need all the data when doing the least squares regression? If that function call is the bottleneck, you may be able to speed it up by using only some of the data in the range. Suppose, for instance, that at a particular point, you need <code>i</code> to be 200 to see a large enough (above-noise) change in the data. But you may not need all 400 points to get a good estimate of the slope — just using 10 or 20 points, evenly spaced in the <code>start:end</code> range, may be sufficient, and might speed up the code a lot.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload