4.1 Intro to NumPy (L04: Scientific Computing in Python)

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

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

  • @isharadissanayake9269
    @isharadissanayake9269 Месяц назад +2

    Wow! This gives so much subtle but important details about numpy.

  • @Jane-ln7kg
    @Jane-ln7kg 3 года назад +3

    Astoundingly clear and insightful explanations. Even as an analytics practitioner, I learned so much from this video! Super awesome. Thanks so much for uploading this content.

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

      Thanks for the kind words, that's very motivating to hear!

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

    after some weeks of learning python for environmental data science (from a FORTRAN background) this despite being basic intro to Numpy, taught me several things I was unaware of before. Thanks.

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

    It's quite interesting I changed the python for loop implementation to 'return sum(map(operator.mul, x, w))', and the timeit outcome reached to 36.5 µs.
    Thanks for sharing these vidoes

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

      Interesting. How does it compare to the list comprehension on your machine? (just asking because it's different on each machine so I don't know whether 36.5 µs would be better or worse)

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

      @@SebastianRaschka Well, at first I tried the list comprehension and it was 66.5 μs. The functional methods are also implemented in C and this is why it outperformed the list comprehemsion

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

      ​@@greatbahram So it's about twice as fast. That's interesting to know, thanks. I usually don't use much base Python when I do scientific computing, but it's still useful insight that the map func can speed things up further compared to list comprehensions

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

    For x@(w) seems that the parentheses are also optional, so one can write even the shorter x@w. After you learn to associate the .at with dot product, becomes quick and easy to read. But I also notice that this notation doubles the %timeit timings for me from 2 micro seconds to 4 micro seconds. I guess @ is just syntactic sugar and adds one internal transformation to the execution stack. Still, between 60 to 110 times faster than python for loop.
    Another method would be a list comprehension, but that would actually be 3 times slower than the for loop.
    def mydot(v1, v2):
    return sum([x*y for x,y in zip(v1, v2)])