More Isn't Always Better in ML Training

More Isn't Always Better in ML Training

The law of diminishing returns, first articulated by economists in the 18th century, states that in any production process, adding more of one factor of production, while holding all others constant, will at some point yield lower incremental per-unit returns. This principle is not only applicable to economics but also significantly impacts fields like agriculture, finance, and machine learning.

Time for an experiment...

Here’s an example using standard TensorFlow and TensorFlow Datasets that highlights an important concept in machine learning.?

Experiment Overview

I ran two sets of training epochs to illustrate a key principle.

In machine learning:

  • Neurons are the fundamental units in a neural network, analogous to the brain's neurons.
  • Epochs refer to the number of times the learning algorithm works through the entire training dataset.

First Set

5 epochs using 128 neurons.

Second Set

5 epochs using 256 neurons

The result?

The second set showed an improvement of just 0.0007. Adding more neurons would further diminish the returns while increasing the time and cost of training.

Why does this happen? It's called the law of diminishing returns. Even minor adjustments can trigger this effect, where developers assume that more means better or faster. However, this isn't always the case in model training.

Model Training Tips

  • Lower the number of neurons and check if results are still optimal.
  • Use callbacks to optimize training.

Why Callbacks are Useful?

Callbacks are powerful tools that are executed during or at the end of training epochs. They help monitor training, make adjustments, and save models automatically. For instance, you can stop training early if the model reaches a desired accuracy, saving time and resources.

Here is an example Python callback class using TensorFlow to modify the behavior of a Keras model during training to stop training a model that reaches 94% accuracy.

#MachineLearning #TensorFlow #DataScience #AI #DeepLearning #TechTips #ModelTraining #NeuralNetworks #LawOfDiminishingReturns #keras

要查看或添加评论,请登录

Brendan Skousen的更多文章

  • Quick Setup to Explore Google’s Vertex AI Workbench

    Quick Setup to Explore Google’s Vertex AI Workbench

    Google’s Vertex AI is rapidly evolving, offering a comprehensive platform for building, deploying, and scaling machine…

  • MLOps + BigQueryML = 9x ROI

    MLOps + BigQueryML = 9x ROI

    ?? MLOps has been a cornerstone at Google for quite some time, but with the rise of AI tools like ChatGPT, existing ML…

  • Equalizer - Problem Solving Technique

    Equalizer - Problem Solving Technique

    We were often taught algebra and long division as children to solve common numerical problems. Despite being told that…

  • Ruh Roh Shaggy, Regular Expressions!

    Ruh Roh Shaggy, Regular Expressions!

    If you’ve ever looked at a regular expression and felt like you'd just seen a ghost, you’re not alone. Regular…

  • A Simple Example of Cryptography

    A Simple Example of Cryptography

    Like many topics in technology, this is one that isn't difficult to grasp; however, the way it's taught often goes over…

    1 条评论
  • Import Best Practices in React

    Import Best Practices in React

    What is Tree Shaking? When you build your application, your bundler attempts to remove any imports not needed in a…

  • Interesting Facts on the Fibonacci Sequence

    Interesting Facts on the Fibonacci Sequence

    In 1202, Leonardo of Pisa wrote the book Liber Abaci (The Book of Calculations). This book taught merchants in the…

  • Day Trading with Abe

    Day Trading with Abe

    Picture this: a young, self-taught attorney, armed with nothing but sheer determination and a mind sharpened by the…

    2 条评论
  • ?? Exploring the Monty Hall Problem: A Python Simulation

    ?? Exploring the Monty Hall Problem: A Python Simulation

    Recently, I dove into the fascinating world of the Monty Hall problem. For those unfamiliar, it's a probability puzzle…

    1 条评论
  • Beet'ing the Clock with Dwight: A Python Script's Leap from Schrute to Superb

    Beet'ing the Clock with Dwight: A Python Script's Leap from Schrute to Superb

    Summary: My latest GPT tool improved the request response time from 16 seconds using GPT 4 to 1.17 seconds on my fine…

社区洞察

其他会员也浏览了