Continuous monitoring for data projects
Operational metrics and monitoring are the pieces of software engineering that are required to make any software project successful. However, in the data world, there are different aspects we need to consider in terms of monitoring AI/ML applications, model or even datasets.
The fundamental question for data science projects is if the team is deploying stuff to production, if they are making changes all the time, how do they know if the changes are doing anything good? How do they know if the changes are fixing things, improving things? That is fundamentally where monitoring and visibility becomes of paramount importance.
Usually, tools for monitoring applications capture metrics via one of these three methods:
- Instrumentation: Adding custom code to the monitored application’s source code.
- Agents: Adding special general-purpose code to the application environment designed to automatically capture standard metrics.
- Spying: Using network taps to monitor calls or data flow between systems.
Software projects have been using these techniques for years. However, there are some fundamental challenges when it comes to monitoring data projects. Here we will consider the building blocks model and dataset to understand these challenges.
Data integrity — Business and business operations data is dynamic and its composition is constantly changing. This can have a performance impact on ML Models, especially with automated data pipelines. Data inconsistencies and irregularities can go unobserved in deployed ML applications. Performance degradation on applications or pipelines should be tracked, traced and fixed from time to time to keep precision and recall for them up to the mark.
Data drift — Sometimes models are build with a very specific use case in mind. Let us say that a model predicts the mileage of a car using the car’s age. The team trained the model on cars which were 1–20 years in age. However, when the application is live, if it encounters cars whose age is more than 20, the model will start making less accurate predictions. This information needs to be logged for the team to take action on and improve the model.
Concept drift — Concept drift arises when the model’s interpretation of the data or the model changes over time even while the data may not have. The model used to predict that a certain data point as belonging to class A in the past, now it claims that it should belong to class B, as our understanding of the properties of A and B have changed since. This is pure concept drift. For tracing concept drift the application should be equipped to keep comparing historical logs and aggregated metrics to current logs and current aggregated metrics and try to see the variance in predictions.
Bias drift — A principal source of these biases is the data used to train the ML models . The fact is almost all big data sets, generated by systems powered by ML/AI based models, are known to be biased. However, if the team is able to minimize that bias, its true impact on biased groups might change despite model validation. An ML model could become biased after deployment. The first defense could be to drop protected attributes (e.g., race, gender) during the training process, but models could also exhibit biases due to other features that are highly correlated with the protected attributes. Up to date logging and tracking should be able to help us solve this problem.
It should be evident from the points above that monitoring needs to continuous for all ML applications, models and datasets. In my opinion a team should build monitoring upfront ahead of time and avoid doing it in haste when things turn bad as haste makes waste. Best approach is to do it right at the beginning with the proof of concept itself and keep adding and building it up as the project matures.
Subscribe to our Acing AI newsletter, I promise not to spam and its FREE!
Subscribe to the Acing AI/Data Science Newsletter. It is FREE! Reducing the entropy in data science. Helping you with…
Thanks for reading! 😊 If you enjoyed it, test how many times can you hit 👏 in 5 seconds. It’s great cardio for your fingers AND will help other people see the story.