Losing your Loops Fast Numerical Computing with NumPy

Поделиться
HTML-код
  • Опубликовано: 31 дек 2024

Комментарии • 56

  • @ericmacleod8605
    @ericmacleod8605 8 лет назад +98

    This guy is python gold.

  • @NicolasJulioFlores
    @NicolasJulioFlores 6 лет назад +17

    The fact that he showed that you can do nearest neighbors without a single loop really shows the power of numpy

  • @joelcastellon9129
    @joelcastellon9129 9 лет назад +25

    Jake is a great speaker. Enjoyed and learned a lot from his talks. Waiting for more

    • @juangutierrez7366
      @juangutierrez7366 Год назад

      We are using his textbook in our intro to data science class, and his writing is also very informative and accessible at the same time.

  • @veganath
    @veganath 5 лет назад +4

    Absolutely brilliant, still being appreciated, thank you Jake

  • @JustinHuangA1
    @JustinHuangA1 4 года назад

    awesome video. everyone starting out with numpy should watch this video. makes so much more sense now to me.

  • @23489215
    @23489215 8 лет назад +5

    Thanks, very informative, the tips make my program run lot faster

  • @adamhendry945
    @adamhendry945 2 года назад +1

    The strategies for fast looping begin at 7:15

  • @sonersteiner
    @sonersteiner 2 года назад

    That is cool man, fortranmagic in ipython notebooks!!!!

  • @gholamrezadar
    @gholamrezadar 3 года назад

    Amazing video! thank you astronomer.

  • @danbrown6698
    @danbrown6698 2 года назад

    I'm wondering how I can reduce the for loops in my project. And it happens that I met this video😮thanks a lot😁

  • @subhendum
    @subhendum 8 лет назад +1

    Great talk . Learned a lot.

  • @matti1337
    @matti1337 8 лет назад

    Really great and enlightening talk.

  • @gmaffy
    @gmaffy 7 лет назад +2

    Great talk. Since this talk, has there been any other methods developed to make loops faster, other than numpy? Anyone?

    • @wowepic2256
      @wowepic2256 4 года назад +2

      Numba and pypy. Also cython

  • @JonathanObise
    @JonathanObise 4 года назад

    Amazing insight

  • @yyf234xcvfqew4
    @yyf234xcvfqew4 4 года назад

    Great talk.

  • @jimmyshenmusic
    @jimmyshenmusic 4 года назад

    This is awesome. Thanks.

  • @VickiBrownatcfcl
    @VickiBrownatcfcl 5 лет назад +1

    I like the embedded image of the speaker, but not when it obscures part of the current slide. ;-(

  • @nikolaytodorov9785
    @nikolaytodorov9785 6 лет назад

    What makes it fast is what makes it slow...Zen.
    Joke aside, 10x for the vid! Useful info.

  • @sapirAO
    @sapirAO 8 лет назад

    Excellent talk.

  • @gabestrenk5471
    @gabestrenk5471 4 года назад +1

    Are the slides available anywhere?

  • @sachinkaps
    @sachinkaps 9 лет назад +1

    What if the data is dynamic? eg a few data points are added every second. So the process might start with no data at the beginning of the day and end up with millions of rows by the end of the day. This is typical for financial time series.
    I presume insertion of elements or copying would not be very efficient. Is pandas or any other implementation good enough for such use cases?

    • @fachofacho5436
      @fachofacho5436 7 лет назад

      Correct me if i'm wrong, but couldn't you use array slicing to make operations on the array? That is because editing the sliced array edits the array as a whole.

  • @johnstarfire
    @johnstarfire 3 года назад +1

    10:16 it gives me 5.19 ms in pure python and 47.4 us with numpy, python is speeding up or computers are faster?

  • @CristiNeagu
    @CristiNeagu 7 лет назад

    The problem i have is that i use functions that cannot be trivially simplified to ufuncs. Stuff like detecting a rising edge, for example. How do you speed up those kinds of loops?

    • @haakonvt
      @haakonvt 5 лет назад +1

      Cristi Neagu Check out numba!

  • @MarkJay
    @MarkJay 7 лет назад

    awesome video!

  • @KirillBezzubkine
    @KirillBezzubkine 3 года назад +1

    23:45 - KNN worth pure numpy

  • @theamrpi397
    @theamrpi397 6 лет назад

    Just a doubt though....even if numpy ufunc does take an array as an element....internally should the elements of an array loop to get the output? So is it right to say looping does not happen in numpy?

  • @nodavood
    @nodavood 5 лет назад +1

    Thanks. Very useful tips. But, the nearest neighbors example shows a fatal flaw to losing loops. The diff matrix that you generated, transforms your 1000*3 input to a 1000*1000*3 one. This leads to MemoryError in cases with larger input data. I am sorry, but having a fast loop is still a must.

    • @tejvirjogani418
      @tejvirjogani418 2 года назад

      Can you not work in batches and minimize the number of single operations

  • @陆得水
    @陆得水 5 лет назад

    How does X.reshape(1000, 1, 3) - X end up in a result with shape(1000, 1000, 3)? I can't figure it out. Help!!!

    • @陆得水
      @陆得水 5 лет назад

      Figured it out by myself. haha

    • @OlumideOni
      @OlumideOni 5 лет назад

      Could you explain please?

    • @tabtang
      @tabtang 4 года назад

      @@OlumideOni docs.scipy.org/doc/numpy/user/basics.broadcasting.html

    • @OlumideOni
      @OlumideOni 4 года назад

      @@tabtang thank you

  • @RonJohn63
    @RonJohn63 7 лет назад +1

    11:45 How many of these tasks can also be done using itertools?

    • @CristiNeagu
      @CristiNeagu 7 лет назад +3

      They will be slower than ufuncs.

    • @rohitbhanot7809
      @rohitbhanot7809 5 лет назад +1

      Itertools is mainly built keeping in mind memory efficiency and not really execution speed.

  • @jb6395
    @jb6395 4 года назад

    what about recursion?

  • @Psycho4Ever666
    @Psycho4Ever666 7 лет назад

    26:02 one could also just use D[D==0] = np.inf

    • @ScottTsaiTech
      @ScottTsaiTech 7 лет назад +5

      That'd accidentally change the distance between two distinct points that happen to occupy the same space and not just between a point and itself.
      I think it depends on whether that's acceptable in your model.

    • @Psycho4Ever666
      @Psycho4Ever666 7 лет назад +1

      A bit embarrassing, but I haven't thought about that... it was too obvious xD

  • @greatbahram
    @greatbahram 7 лет назад

    Thank you, I now it's out of dated. But it was awesome

    • @bosk1n
      @bosk1n 6 лет назад +6

      Why is that outdated? Any more effecient techniques out there to make python faster?

  • @ibrahimtouman2279
    @ibrahimtouman2279 6 лет назад

    Good lecture, but it would have been more interesting if he compared NumPy to other competing numerical computing softwares such as Matlab, for example...!

  • @drticktock4011
    @drticktock4011 2 года назад

    OR....just go back to FORTRAN (or C)

  • @annamalainarayanan9310
    @annamalainarayanan9310 8 лет назад +4

    almost everyone who did numpy knows this - seemingly very basic and nothing hacky!

    • @zachs5231
      @zachs5231 7 лет назад +21

      you should link us to one of your talks anna

    • @tam31433
      @tam31433 6 лет назад +1

      But he is right anyway.

    • @raphaeldayan
      @raphaeldayan 4 года назад

      not everyone