Player not loading? Watch on YouTube
This live coding session, interspersed with audience chat, continues an anomaly detection project in Rust using Hugging Face's Candle library. The speaker adapts a tutorial to a small, hand-built dataset with an unusual row. The session focuses on normalization; the full detection workflow still needs another function at the end.
The code calculates a mean, subtracts it through tensor broadcasting, squares the differences, and averages them to obtain variance. It then takes the square root for standard deviation and divides the centered data by that value. The speaker prints intermediate tensors and repeatedly uses cargo run to inspect the results, identifying Metal as the accelerator in this example.
Much of the lesson follows debugging. A custom method named norm conflicts with an existing Tensor method, so the speaker renames it and adjusts the implementation to use self. Later, zero values lead to NaN output. The speaker adds a tensor with a value of 1.0 and corrects its type to F32, then reports that the NaNs are gone. This is a walkthrough of the example's fix, rather than evidence of a general numerical solution.
The speaker describes Candle as inspired by PyTorch and briefly discusses prior use of PyTorch through Rust bindings. The final output appears to distinguish the unusual column, according to the speaker, but the project remains unfinished.