Product

Friday, 9 February 2024

Why Implement a Machine Learning Algorithm From Scratch

 Why would you ever implement machine learning algorithms from scratch when there are so many provided in existing APIs?

This is a great question. One that must be considered before you write that first line of code.

In this post you will discover a variety of interesting and even thought-provoking answers to this question.

The answers in this post are summarized from the Quora question titled: “Why is there a need to manually implement machine learning algorithms when there are many advanced APIs like tensorflow available?“.

Two Major Reasons To (re)Implement an Algorithm

I think that all of the answers can be broken down into two camps:

  1. Self Study where an algorithm is implemented as a learning exercise.
  2. Operational Requirements where an algorithm is implemented to meet needs of a production system.

Implement Algorithms for Self-Study

Charles Gee gives a great answer from the self-study perspective. He comments:

… suppose that instead of talking about machine learning algorithms, we were talking about sorting algorithms. Sure, many data structures have a sort function that requires little to no coding, but would you really hire a programmer who couldn’t do a bubblesort? selectionsort? insertionsort? mergesort? quicksort? binary search tree?

Charles describes 4 different use cases where it may be highly desirable to implement a machine learning algorithm from scratch:

  • As a beginner in the machine learning realm.
  • As a researcher in the machine learning realm.
  • As a teacher in the machine learning realm.
  • As a user of these machine learning algorithms.

Implement Algorithms for Operational Requirements

Xavier Amatriain focuses on this topic in his answer. He comments:

Let me start by saying that I do believe that any team should default to re-using existing implementations. … However, there are also many reasons why a company may decide implement their own version of an ML algorithm.

Xavier lists 5 reasons to implement a machine learning algorithm, as follows:

  • Performance. Open source implementations may be too general and not efficient enough for specific use cases.
  • Correctness. There may be bugs or limitations in the open source implementations for specific use cases (such as larger scale datasets).
  • Programming Language. Implementations may be limited to specific programming languages.
  • Integration. There may be a need to integrate an algorithm implementation into the infrastructure of existing production systems.
  • Licensing. There may be limitations imposed by the choice of open source license.

Summary

In this post, you discovered that there are two major reasons why you might want to implement an algorithm from scratch.

  1. To learn more about how the algorithm works for self-study.
  2. To customize the implementation of the algorithm for a production system.

Further Reading

I have posted a number of times on the benefits of implementing machine learning algorithms from scratch

No comments:

Post a Comment

Connect broadband

AI:List AI views on when for a naive kin after prolonged life suppression coercive behaviour by family members after demise of father with trauma for kin ocd formed after forced to do rituals, family tribal values honor specific activities, utmost religious activities occult witchcraft enforced to do by elder sibling his wife and mother thrice with great celibacy turned the kundalini activated after deep celibacy penance shouting physical Mental financial Extortion by sibling with toxic behaviours and the wife mother and then mockery suppression asking about who’re your worth backbiting among relatives sector toon negligence of intelligence intuitive behaviour- all religious psychological traps when not work and lead to loss of consciousness of kin trance state recovered by governance with technocrats using AI - kin was asked by mother that he’s to go the male should not be seen in house he’s many absurd thought forcefully in brain mind and outsiders already feel awkward of this kin unresponsive behaviour due to TBI PTSD ocd cvt and tell at workplace social gathering he’s to go and asked for sector toon extortion and mockery in various sense due to un practical behaviour negligence of body building due to neglect ion if essential food nutrition and stubbed suppressed in every sense in religious psychological traps by family members AI humanoid using various neural networks and LLMs for kin and required steps.

  List AI views on when for a naive kin after prolonged life suppression coercive behaviour by family members after demise of father with tr...