How it works...
Again, rayon-rs—a fantastic library—has made roughly a 50% improvement in the benchmark performance (parallel versus sequential) by changing a single line of code. This is significant for many applications but in particular for machine learning, where the loss function of an algorithm is required to run hundreds or thousands of times during a training cycle. Cutting this time in half would immediately have a large impact on productivity.
In the first steps after setting everything up (step 3, step 4, and step 5), we are creating a sequential and parallel implementation of the sum of squared errors (https://hlab.stanford.edu/brian/error_sum_of_squares.html) with the only difference being par_iter() versus the iter() call including ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access