~/talk

There is always another way: Sharpen your NumPy skills with the 8 Queens puzzle

Talkat PyCon Israel 2022 · 2022-06-28..06-29· [python, machine-learning]
links:none on file
slides:none on file

Walks through five concrete NumPy implementations to check diagonals for all 40,320 permutations (8!) and finds the 92 valid boards, comparing timings: initial diagonal-loop-with-trace ~3s, a strided loop ~12s, a broadcasting+fancy-indexing reshape ~1.5s, padded/stacked views ~1.10s, and a final np.bincount with weights solution at ~0.82s. Shows use of as_strides, broadcasting, fancy indexing, flips and padding to turn diagonals into rows, measures Python-to-NumPy call overhead, and confirms the fastest method both shortens code and wins on speed.

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 1:49About the speaker and context
  3. 2:50The 8 Queens puzzle explained
  4. 4:34First solution with NumPy trace
  5. 6:04Performance of first solution
  6. 6:27Understanding NumPy array structure
  7. 8:09Second solution with strided views
  8. 8:52Performance of second solution
  9. 9:14NumPy broadcasting and fancy indexing
  10. 10:37Third solution with diagonal rows
  11. 12:23Performance of third solution
  12. 13:05Fourth solution with zero padding
  13. 15:16Performance of fourth solution
  14. 16:00Fifth solution with bin count
  15. 18:11Performance of fifth solution
  16. 18:53Key takeaways and conclusions
  17. 20:36Final summary and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.