How Much Data is Needed to Train a (Good) Model?
We’ve gotten some questions recently about how much data is needed to train a good model. While there is no “one-size-fits-all” approach, there are some general best practices to follow and questions to ask about your data beforehand. Ryan elaborates.
How much data do you need to train a model? Arguably, only a single data point. Is this model likely to make accurate predictions? Probably not. So how much data is necessary to train a decent model that will generalize well, i.e. make accurate predictions?
How much data?
Short answer is: it depends. It depends on the type of machine learning problem you want to solve:
- A typical image classification problem could require tens of thousands of images or more in order to create a classifier.
- Sentiment analysis or document classification problems can require thousands of examples due to the sheer number of words and phrases, i.e. n-grams.
- For many regression problems, it’s suggested that you have 10x as many observations as you do features. A more general rule of thumb is that the number of observations should be proportional to 1/d^p where p = # of features and d = the maximum spacing between consecutive or neighboring data points after each feature is scaled to the range 0-1.
- For time series problems, you should always have more observations than parameters (we elaborate more on this type of machine learning problem below).
In time series forecasting there is a general rule of thumb that a decent model should always have more observations than parameters in the time series. For most time series applications, this means that the submitted data should have as many observations as the period of the maximum expected seasonality.
In time series forecasting, there is a general rule of thumb that a decent model should always have more observations than parameters in the time series. For most time series applications, this means that the submitted data should have as many observations as the period of the maximum expected seasonality.
For example, if you have daily sales data and you expect that it exhibits annual seasonality, you should have more than 365 data points to train a successful model. If you have hourly data and you expect your data exhibits weekly seasonality, you should have more than 7*24 = 168 observations to train a model. However, these are the bare minimum number of points needed to train these types of models – more data is required if you want to effectively test how accurately your model performs at making predictions. Your test set should be about 25% the size of your training set. So with a dataset that is expected to exhibit annual seasonality, the minimum number of points required to train and test multiple models is 365 + 365/4 ~ 456 observations.
There’s still no “Golden Rule”
Of course, these are rough generalizations not intended to be taken as golden rules to follow for every problem. Depending on how correlated different variables are, you may require more or less data. However, to refrain from making some fatal mistakes you should ask a few questions about your data before jumping in and building a forecasting model.
- What’s the granularity of my data, e.g., seconds, hours, years? A year’s worth of data can imply 365 data points, 52 data points, 12 data points, or even a single data point depending on how the data was recorded, and all are equally valid.
- What are my underlying assumptions about my data? If you expect your data is annually seasonal, make sure you have at least 365 days, 52 weeks, or 12 months of data plus some additional data points for testing- note how important the granularity of data is in this scenario.
- How far out am I trying to predict? If you’re trying to predict 12 months into the future, you should have at least 12 months worth (a data point for every month) to train on before you can expect to have trustworthy results.
We will contact you shortly
We’re almost there! These are the next steps:
- Look out for an email from DataRobot with a subject line: Your Subscription Confirmation.
- Click the confirmation link to approve your consent.
- Done! You have now opted to receive communications about DataRobot’s products and services.
Didn’t receive the email? Please make sure to check your spam or junk folders.
How the DataRobot AI Platform Is Delivering Value-Driven AIMarch 16, 2023· 4 min read
New DataRobot and Snowflake Integrations: Seamless Data Prep, Model Deployment, and MonitoringMarch 16, 2023· 5 min read
Discover insights on the specific conditions that make machine learning effective in certain financial applications, such as high-frequency trading. Read more.
In this article, we’ll first take a closer look at the concept of Real Estate Data Intelligence and the potential of AI to become a game changer in this niche.
In this blog post we’ll explore how Mindshare, a global media agency network, has leveraged data science tools to create a fast and reliable decision-making engine. Read more.