Predicting Murder Cases in Kenya

It takes on average 3 years to conclude a murder case in Kenya – that’s according to the data on However, Prosecution Counsel Katto Wambua puts the number at 1.5 years. I decided to put Man Vs Machine Learning in understanding homicide cases in the country. To that end, I conducted an interview with Prosecution Counsel Katto Wambua, and in parallel wrote a piece of code to download all court rulings that mention murder.


Who’s doing the killing
The first order of business was to know which county has the highest murder rate in Kenya. From the visualisation below, Kisii County is the murder capital of the country. By February of this year, more than 10 people had been murdered in Kisii County with the youngest perpetrator being 14 years old.

When I posted the same question to Counsel Katto, he gave a different answer. Meru County has the highest murder per capita closely followed by Kisii County. The data put on doesn’t reflect the total case load handled by the Directorate of Public Prosecution. Rather, cases reported on are only those raising most noticeable precedent-setting issues in law. This brings to fore an interesting concept in criminal law known as Judicial Precedence. Adopted from English common law, judicial precedence is a practice whereby judges follow previously decided cases where the facts are of sufficient similarity.

A case that sets new precedent has facts not encountered previously in a court law. Therefore, Kisii County has the highest number of precedent-setting cases – in lay terms, it has the highest number of ‘strange’ murder cases. For example, criminal murder case number 51 of 2015 (Scholastica Chebet Kirui vs The Republic). Mrs Scholastica was charged with the offence of murder contrary to section 203 of the penal code of which she was accused of causing the death of John Kirui Sang’ara.

The most difficult crime to track is the one which is purposeless – Sherlock Holmes

The facts of the case are that the deceased and the accused were involved in a brawl which led to the deceased chasing everyone from his home. At 10:00 pm, his house was on fire, neighbours rushed in the compound but didn’t see anyone in the vicinity. At daybreak, villagers and the deceased’s family including his wife (accused) returned to the scene and while clearing the debris stumbled on the burnt dead body of the deceased.  Mrs Scholastica was acquitted of the charge since other evidence alluded to the fire being started by the deceased.

How to Get Away with Murder
Kenya is no country for murderers. According to Katto, the overall conviction rate for all class types have risen from 75% in 2011-2013 to 95% in 2015-2016. This improvement has been the sharpest of any National Prosecution Authority in the continent and is barely behind South Africa. Despite the sharp increase in conviction rate, there are still people who get to beat the system. How do they do it?

Acquittals generally occur due to conflicting post-mortem reports, conflicting eye witness testimony, conflict between the cause of death as per medical report and what is the import of the overall testimony of witnesses, failure or change of stay by some witness, and witness fatigue.  I opted to use machine learning to classify whether a murder case would end as a conviction or acquittal, and in the process understand factors that lead to convictions/acquittal.

To get started, I defined and extracted 31 variables related to the cases. These include:

  • Time of incident
  • Gender of accused
  • Gender of victim
  • Type of weapon
  • Eye witness
  • Number of witnesses
  • Motive
  • Cause of death

Next, I chose the J48 classification algorithm which works well with binary classification problems that have only two possible outcomes, in this case, conviction or acquittal. Instead of running the algorithm on all features, I selected the features with the highest prediction power using the information gain algorithm then built my decision tree one feature at a time.

From the mini tree above, the J48 algorithm chose primary witness (eye witness) as the most important variable in predicting a murder case. When there’s an eye-witness to a murder, the probability of a conviction shoots to 90%, while when there is no eye witness there it’s a 45% chance that a conviction will be attained. That noted, if the prediction model only relied on eye-witness as a variable it would achieve a 72% prediction accuracy. A low accuracy rate given the cost of making a wrong conviction/acquittal is quite high.

I introduced the second highest ranked variable to improve the prediction. The variable is known as statement in which it notes whether an accused person made a sworn, unsworn or no statement to the police. The diagram below shows the resultant model.

If you observe the right side of the model, you’ll notice the condition when an eye witness is present has changed (always leads to conviction). However, when there’s no eye-witness to a murder, what else should a judge consider to make a ruling? The model puts statement, in the absence of an eye-witness, an accused person who makes no statement is always acquitted. If he/she makes a sworn statement, then the chances of conviction without eye witness shoots to 60%. If they make an unsworn statement, the conviction chance pushes to 65%. The overall model improves to 80%, still not good enough.

To bolster the model prediction, I threw in the top 5 variable – the diagram below shows part of the resultant model.

Now, the model becomes complex and interesting. If we were to model a judge’s thinking process, this how it would look like. The gender of the accused dislodges eye witness as the most important variable. From the diagram, if the accused is female, the only other thing to consider is their statement. However, when the accused is male, then the decision process checks whether there was a witness, if not checks if they are jointly accused after then consider the weapon used before making the judgment call.

This model does reveal that women partake in murder such that it is easy to make a decision while men involve themselves in complex murder schemes that require consideration of many variables before rendering a judgment. The model accuracy rate sits at 93% – that’s justice served with an algorithm.

In John Kiriamiti’s book ‘My Life in Prison’, he lists advice given by fellow inmates before facing the judge.

(i). Do not fake an alibi you cannot prove.
(ii). Do not call a witness you cannot rely on.
(iii). Do not give a sworn statement because, when you do, you will be open to a cross-examination. While being cross-examined you might very easily contradict yourself.
(iv). In mitigation, do not beg for leniency for that will imply that you are guilty. Stick to your plea.
(v). Never, in the field of crime, plead guilty even if they promise you total acquittal.

You can read two engrossing murder cases here:

(1) Murder at Crooked Q Restaurant
(2) The Assassination in Gigiri

Don’t kill anyone who owes you money, you may be sentenced to 15 years in jail. Instead, call Third Eye Debt Collectors – the leading debt collectors in East Africa.

Cover image by

  1. My take away: dont explain anything to a cop… any statement is a bad statement.
    Good job Chris!!!



    1. Thanks. Remember the golden statement……….You have the right to remain silent. Anything you say shall be used against you in a court of law.



  2. One, I am happy with the conviction rate for murderers in Kenya although I know there are lots of cases where murderers have slipped through the dragnet.

    The main issue in Kenya is that in the absence of any eyewitness, the investigation simply stalls and the murderer walks free. No one takes the time to go through cold cases and try to piece up the evidence together. Did you find any case where judges relied on forensic evidence such as DNA or fingerprint tests to convict? I have always thought that is an area where Kenya need to make some serious improvements to lock up even more murderers.

    The over-reliance on primary witnesses in conviction can be problematic because in certain crimes, witness testimony may often turn out to be unreliable and people lose memory with time and begin filling in details to suit a pre-determined assumption.



    1. Hi,

      Thank you for your comment.

      Yes, there’s a case in Northern Kenya where a person killed and later eaten by wild animals. The prosecution relied on DNA evidence to make a conviction.







    1. Thank you for the kind words. If the data is available I’d be happy to do the analysis



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: