Understanding CPUs can help speed up Numba and NumPy code

When you need to speed up your NumPy processing—or just reduce your memory usage—the Numba just-in-time compiler is a great tool. It lets you write Python code that gets compiled at runtime to machine code, allowing you to get the kind of speed improvements you’d get from languages like C, Fortran, or Rust. Or at least, that’s the theory. In practice, your initial Numba code may be no faster than the NumPy equivalent. But you can do better, once you […]

Read more

Highlights from Machine Translation and Multilinguality in May 2023

Here are a few papers I found most interesting in the flood of new pre-prints on arXiv. There was ACL’s camera-ready deadline and the start of the EMNLP anonymity period, so there were many more papers than usual. What is the best recipe for character-level encoder-only modeling? A paper from DeepMind accepted to ACL 2023 systematically (and empirically) studies how to train a BERT-like model that works directly with character-level inputs using existing architectural building blocks. Transformers work well with […]

Read more

What’s the Zen of Python?

If you’ve been learning Python long enough, then you’ve likely seen or heard about the Zen of Python. Experienced Pythonistas often refer to it as a source of wisdom and guidance, especially when they want to settle an argument about certain design decisions in a piece of code. Others take these principles even more seriously by considering them a sort of Pythonic decalogue. In this tutorial, you’ll learn where to find the Zen of Python, how it came into existence, […]

Read more

Mazes in Python Part 1: Building and Visualizing

If you’re up for a little challenge and would like to take your programming skills to the next level, then you’ve come to the right place! In this hands-on video course, you’ll practice object-oriented programming, among several other good practices, while building a cool maze solver project in Python. This is the first part in a two-part series. Throughout the series, you’ll go step by step through the guided process of building a complete and working project. This will include […]

Read more

Using the NumPy Random Number Generator

Once you have a NumPy array, regardless of whether you’ve generated it randomly or obtained it from a more ordered source, there may be times when you need to select elements from it randomly or reorder its structure randomly. You’ll learn how to do this next. Selecting Array Elements Randomly Suppose you have a NumPy array of data collected from a survey, and you wish to use a random sample of its elements for analysis. The Generator object’s .choice() method […]

Read more
1 94 95 96 97 98 913