Machine learning offers new potential in terms of diagnosis

A University of Nottingham study finds that machine learning has the potential to enhance and improve veterinarians’ ability to quickly and accurately diagnose mastitis origin in dairy herds. Led by veterinarian and researchers Dr. Robert Hyde and Professor Martin Green, the aim of the study was to create an automated diagnostic support tool that can be used to quickly implement appropriate control measures to reduce mastitis levels on dairy farms. Such a tool has implications for animal health and welfare, as well as antimicrobial usage and overall farm productivity.


Mastitis costs UK dairy farmers an estimated £170 million annually. To control the costly disease, farmers and veterinarians must first identify where the mastitis-causing pathogens originate to determine if they are being spread environmentally or contagiously. Ordinarily, to determine this, veterinarians analyze on-farm data. In fact, this is the first step of the Mastitis Control Plan, a structured and evidence-based plan to prevent and control mastitis that has been previously developed by the University of Nottingham and the Agriculture and Horticulture Development Board (AHDB).

The Mastitis Control Plan creates an achievable set of action points to tackle clinical mastitis and high somatic cell counts. Trained professionals look at all aspects of the farm and provide a structured approach for prevention and control.

Basically, it comes down to how that pathogen is spread. “If it’s environmental, cows are likely to be acquiring pathogens from their housing or in their bedding,” said Hyde. “If it’s contagious then they’re likely to be acquiring infections through the milking parlour, and are most likely passing it from cow to cow.”

Environmental mastitis can be further split into dry and lactation periods.

The outcomes for AHDB’s control plan are very different, depending on the diagnosis. If the diagnosis points to environmental spread during the dry period then the plan would focus on hygiene in the dry pen, for example, said Hyde. If the diagnosis is contagious, action would be directed towards the milking parlour and making sure pathogens are not spreading from cow to cow.

“The diagnosis is really the cornerstone of the plan,” Hyde added.

Currently diagnosis is subjective and based on a specialist’s skillset. It takes a lot of time, experience and training to be able to make a strong diagnosis.

“If a veterinarian was to make that diagnosis, they would get all of their mastitis data – so that’s all of the cell count data, all the clinical cases – and start looking for patterns in that data,” said Hyde.

Using software, he looks at graphs to uncover trends and try and figure out where the mastitis is coming from. The approach is both cumbersome and slow, though, which is why Hyde wanted to see if a machine-learning algorithm could provide a quicker, more automatic analysis.

Machine learning is used all sorts of applications today. In your inbox, machine learning is used to filter spam from valid email. It predicts what film you will like next on Netflix or which artists you will enjoy on Spotify. Essentially, the algorithms spot patterns within the existing data and use it to predict new outcomes.

To study its potential, Hyde and the University of Nottingham team used data from UK 1,000 dairy herds. Each herd had already received a diagnosis from a specialist. This data was used to train the machine-learning algorithms how to spot the different causes of mastitis. Once they trained it, they tested it using data from new farms the algorithm had never seen before. They assessed its level of accuracy by comparing the machine’s diagnosis to that of a trained veterinarian’s.

“We found that we had some very accurate predictions,” said Hyde.

An accuracy of 98 per cent, positive predictive value of 86 per cent and negative predictive value of 99 per cent was achieved for the diagnosis of contagious versus environmental (with contagious as a “positive” diagnosis), and an accuracy of 78 per cent, positive predictive value of 76 per cent and negative predictive value of 81 per cent for the diagnosis of non-lactating “dry” period versus lactating period (with non-lactating “dry” period as a “positive” diagnosis).

“So this means as an illustrative case is that it is possible for machine learning in the veterinary world to do a very similar job as a specialist vet in diagnosing the origin of mastitis, but it will do it much, much quicker,” said Hyde. “The idea being that at some point you could envisage these kind of tools doing an automated job.”

Having access to a tool like this would allow the vet to get on to doing the important task of putting that plan into place.

Hyde said in evaluating machine learning as a possible tool for veterinarians, accuracy and the ability to interpret data were crucial parameters.

“People don’t always respond all that well to a robot telling them what to do,” said Hyde. “It will tell you it’s likely to be contagious origin mastitis, but then also provide an estimate of certainty; for example 80 per cent certain it is contagious mastitis.”

This gives veterinarians the opportunity to sift out the cases that would need human evaluation.

The researchers haven’t yet looked at the impact of using the tool. While the algorithm is very accurate, veterinarians will have to think about how best to use it, said Hyde.

While farmers could also use this machine-learning tool, Hyde said it is best used by both farmers and veterinarians together. If used incorrectly, it could actually worsen the problem.

“It definitely requires vet input, and certainly in planning preventative measures to prevent mastitis,” said Hyde.

“The tool certainly isn’t designed to replace the role of the vet in this diagnosis, rather to provide a decision support tool for vets to make a diagnosis more accurately, faster and easier,” he added. “In terms of making proactive, preventative management changes, vets and farmers working hand in hand is definitely the way to go.”

Hyde said he and his colleagues still have some kinks to work out before making it available online.

“But what this paper does show that machine-learning algorithms have the capability of making a clinical, subjective diagnosis that normally would require years and years of training and specialist training and experience,” Hyde concluded. “And this machine-learning algorithm can perform a very similar job, with similar levels of accuracy, in the blink of an eye.”

Leave a Reply

%d bloggers like this: