Agile Data Science – Part 1

With vast amounts of data being generated and collected across virtually all parts of business ecosystems – manufacturing, supply chains, marketing, online advertising, customer relationship management, social media – business operations are open to data mining and exploitation of data for business problem solving and competitive advantage.

The work of a data science team may be characterized as the extraction of knowledge from data, or at least, the refinement of data into increasingly higher of states value. Data science teams apply an array of practices and tools for the analysis and solution of data-centric business problems. The challenge for many teams today is how to accomplish this in an agile way, meaning how do these teams deliver the equivalent of ‘working software’ (working models), or at least meaningful stakeholder value every 2-4 weeks? The ‘inspect & adapt’ principle is just as important in data science as it is in software development – it provides teams, in collaboration with other project stakeholders, with the frequent opportunity to reflect, assess progress and adapt to emerging challenges or opportunities. It needs to acknowledged at the outset that the practice of data science is not the same as the practice of software development. The skills, knowledge, techniques and tools are fundamentally different. However, whereas agile methods have their roots in manufacturing, and eventually found their way into software development, many of the same practices can be leveraged effectively in the service of data science. Both the team ceremonies of scrum (iteration planning, daily stand-ups, iteration demos and retrospectives), and team organization (product owner, scrum master and team) can all be applied very effectively to improve the agility of any data science team.

For those (like me) who have not completely memorized the 12 agile principles, here they are, with emphasis on those most relevant to our discussion:

The Agile Principles
The Agile Principles

Many data science teams have adopted lifecycle models like CRISP-DM (Cross Industry Standard Process for Data Mining), or SEMMA (Sample, Explore, Modify, Model, and Assess). These frameworks define a set of steps or stages to guide the process of data-mining and data-modeling. The problem with these models is that they prescribe a purely sequential series of steps, each producing an intermediate work-product that may not be of demonstrable value to a business stakeholder.

CRISP-DM Data Science Lifecycle
CRISP-DM Data Science Lifecycle

Furthermore, few of these intermediate work products are consistent with 2-4 week agile iterations – data preparation tasks may consume up to 80% of the effort in some data science projects. The CRISP model is essentially a waterfall. A team may come up with an approach that produces things like ‘Data Preparation Stories’, or ‘EDA Stories’, and so on. However calling these artifacts ‘stories’ does not make the process agile. These things are of course essential steps for the data science team, but are unlikely to make much sense to a business stakeholder, who may be looking for answers to questions like: which customers will not renew their wireless service contracts, or which customers will fail to pay off their credit card balances? Furthermore, many of these artifacts require significantly longer to produce than the 2-4 week time-boxes typical of agile practices. Teams will close out their sprints frustrated in not having much in the way of demonstrable business value to show for their efforts, and will need to continually push unfinished work into subsequent sprints.

The same challenge exists in software development, namely, how to support the basic agile value proposition of delivering stakeholder value on a frequent basis. Enter user stories. In software, user stories are a vehicle for breaking up product features into iteration-sized pieces that still provide demonstrable value. Frequently we have to include elements of a user interface, some business objects, and data from a database within the same story to demonstrate something of meaningful value to a potential user of the system. This is referred to as vertical slicing.

Vertical Slicing
Vertical Slicing

Vertical slicing is important because showing a user a ‘database story’ is completely meaningless to them  – they need to see a real working increment of the product’s capabilities in order to acknowledge progress and provide feedback. The later we delay the demonstration of working software to stakeholders, the later we push opportunities for feedback and change, and the larger the risk we incur to project success. Collaboration and consensus-building with business stakeholders is critical for project success. So what options do we have?

The question is: How to deliver the data science equivalent of ‘working software’ or ‘stakeholder value’ in 2-4 week agile sprints? Do partially working models make any sense? For example, a model that can classify outcomes with a 50% accuracy is effectively useless, and certainly not shippable. However the same model may be considered valuable in the sense that it has helped moved the project forward by eliminating certain model features that needed to be evaluated.

The Agile Value Proposition
The Agile Value Proposition

We still have a number of options for adopting a less waterfall-like approach. Let’s explore some of these options and their associated challenges.

Approach 1: ‘Horizontal Stories’. Iterations deliver intermediate data science work-products  – ‘Data Preparation Stories’, ‘EDA Stories’, and so on – demonstration of working models or anything of real stakeholder value is not possible until late in the program. This is essentially waterfall with iterations. It severely limits opportunities for stakeholder collaboration.The following diagram shows how option 1 could be setup using Jira.

Data Science Workflow using Jira
Data Science Workflow using Jira

Approach 2: ‘Vertical Stories’. Preferable but challenging. Iterations deliver (at least partially complete) working models. We start with limited data (‘thin slices’) and improve by iteration. However, even thinly sliced stories may take multiple iterations. Data preparation in particular may consume the majority of the effort in a data science project.

Vertical Vs Horizontal Stories
Vertical Vs Horizontal Stories

Approach 3: Hybrid Horizontal/Vertical Approach. In the hybrid Horizontal/Vertical approach we attempt to get all or most of the time-consuming data preparation work done first – call it a ‘Sprint-0’ – and then follow with sprints that build and improve models incrementally, in thin slices. Stories need to be carefully scoped to fit in an iteration – strive for incremental changes to EDA/Modeling/Model Evaluation in a single sprint. We iterate on the model construction work until we converge on something close to Minimum Viable Product (MVP), at which point we hand-off the data science work to an IT team for productization and deployment to actual users.

A Hybrid Model for Data Science
A Hybrid Model for Data Science

Even with the hybrid approach where most most of the required data preparation work is completed up-front to establish a solid baseline for model development, new data needs may be identified before an MVP goal is achieved requiring teams to cycle back for more data to improve model performance and get closer to a viable solution.

A serious weakness common to all three approaches is the IT team hand-off for productization and deployment, once an MVP status has been achieved by the data science team. As any agilist will tell you, hand-offs are fraught with risk and the potential for significant re-work and delay.

In Agile Data Science – Part 2 we will continue to seek an answer to the question: How does a data science project deliver meaningful value with every iteration, and fully  leverage collaboration and feedback with stakeholders. We will also discuss how to simultaneously eliminate the ‘IT hand-off’ step in the program. We will take a look at an entirely different approach based on the ‘data value pyramid’.