We built a machine learning model to predict which shipping vessels are likely to be held in detention. The model made it into the shortlist of the Singapore Ocean of Opportunities AI Track, an internationally renowned event where competing companies aim to build AI solutions for the shipping industry.
Click here to try the AI ship detention tool shown in the screenshot above.
The problem of ship detentions
At the start of the current coronavirus outbreak you may have read about the British flagged cruise ship Diamond Princess, which was quarantined in Yokohama after some passengers tested positive for Covid-19.
In fact vessels of all types are liable to be detained if they fail an inspection by port authorities. The UK detained two vessels in January 2020: the Latvian flagged Liv Greta, detained for inadequate lifeboat and safety compliance, and the Nigerian flagged MV Jireh, for failing to meet safety and welfare standards.
The risk of detentions is a problem for shipping companies as disrupted journeys cost money. In addition there is a human cost. Nine Russian crewmen were stranded off the coast of England in February without supplies when the MV Jireh was detained.
When a company sends a container over sea, they need to choose a vessel which is less likely to be held up at a foreign port. Ship registries currently classify ships into high, medium and low risk, based on a human-defined set of rules about how many defects were found on previous inspections.
Building a machine learning model to predict risk
Since machine learning has been disruptive in a number of other industries, I have tried training a machine learning model to predict vessel detentions.
Fortunately it’s possible to download information on past inspections in the Asia Pacific region from a number of sources on the internet for free. I downloaded data on 21,000 vessels for 2017, 2018 and 2019 and used Microsoft Azure ML to train a model to learn what it is that makes a vessel prone to detention.
You can tell this AI everything you know about a ship and it will give you a probability of the ship being detained.
Can the machine learning model explain detention risk?
I found that the most important factor used by the AI was the country that the inspection takes place. The next most informative indicator is the number of deficiencies that were uncovered in previous inspections at other ports. Of particular interest are the state of the ship’s watertight condition, its fire safety adherence and life saving appliances.
So if you wanted to assess a ship’s likelihood of detention, you would consider first the country that it’s calling at, and look at past records of any leaks, fire safety issues and life saving equipment.
How does the machine learning model perform in numbers?
To evaluate the model I have used ROC curves and Area Under the Curve (AUC) rather than accuracy, as detentions are a very rare event and ROC/AUC allow us to measure how good we are at distinguishing relatively high and low risk vessels.
In terms of the model performance, the current vessel classification system of high/medium/low gives an AUC of 0.66, whereas my model gave an AUC of 0.80. This means the model has much more predictive power than the current system.
Try out the machine learning model
I have deployed the model at https://fastdatascience.com/demo/vessels, where you can view in real time the high risk vessels currently in the port of Singapore and you can experiment by calculating the risk of a vessel.
A vessel inspection also involves producing a PDF of free text describing all aspects of the vessel. Unfortunately these documents aren’t publicly available, however it would be possible to also train a model to predict a vessel’s seaworthiness from this text document using natural language processing.
Value for business
Any shipping or forwarding company would be able to integrate this kind of model into their systems in order to quantify the risk of detentions on their shipments. The cost savings for a business would be enormous.
If you have a similar problem in your industry where you think AI could help, I am interested to hear from you. Please add your ideas in the comments below or contact me with your ideas.