i’m willing to bet at least O(100) of you have experienced a silent failure because of numpy or broadcasting. even yesterday i found a pandas join bug because i didn’t reset the dataframe’s index. 😢
i‘m wondering how to build basic tools that “catch” such bugs before runtime.
the overkill solution may be to train a language model on “correct” numpy code to perform “autocorrect” and “autocomplete.” but the thought of collecting a dataset and paying $$ to train or fine-tune a model is meh.
you can probably approximate a good-enough solution without ML. what if you listen for every shape change in a variable, or enforce a typing scheme such that the default doesn’t allow you to change the shape of an array?
maybe output a warning every time you hit a shape change? or wrap lengthy numpy operations in a “numpy DAG” object in which the client could specify each input, and the DAG will compute the output shape wrt input shapes for the client to verify?
ML attracts so many silent failures and i wonder if people will either create better Python tools or just move to a different DSL entirely for productionized ML. would love to hear others’ perspectives on this.
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
