Supreme Court of Nigeria (SCN) appeal-case outcome prediction with an interpretable machine learning workflow.
- π Project intro
- π Dataset
- π§° Tools
- βοΈ Install methods
- π§ͺ Methodology
- π Results
- π Project flow
- π Project structure
- π License
This repository demonstrates an end-to-end machine learning workflow for predicting the outcome of Supreme Court of Nigeria appeal cases. The project combines dataset profiling, exploratory analysis, feature preprocessing, and classifier comparison in a single reproducible notebook-based pipeline.
The main goals are to:
- profile the legal case dataset and inspect its structure
- prepare categorical and numerical features for model training
- compare multiple classification models for case outcome prediction
- generate visual artifacts such as confusion matrices and correlation plots
Court-Judgments-Prediction-using-Machine-Learning/
βββ CSE 445.ipynb
βββ scn_appeal_cases_data.csv
βββ datasetprofiling.html
βββ Dataset description.pdf
βββ IMAGES/
βββ scripts/
β βββ download_judgement_flaticon.ps1
βββ LICENSE
βββ README.md- Source: Primsol Law Pavilion archive, distributed via Mendeley
- Records: 5,585 appeal cases
- Scope: Criminal and civil appeal matters from the Supreme Court of Nigeria
- Dataset link: https://data.mendeley.com/datasets/ky6zfyf669/1
- Reference material: A detailed data description is available in Dataset description.pdf
The dataset contains both categorical and numerical attributes such as:
- appeal district and trial district
- offence type and sentence category
- counts of complainants, appellants, and witnesses
- the target label:
scn_decision
These fields make the task suitable for supervised classification with interpretable preprocessing and evaluation.
The notebook is organized into four clear stages that support repeatable model development and interpretation.
- Load
scn_appeal_cases_data.csvinto pandas - Validate data quality and missing values
- Generate an automated profile report with
pandas-profiling - Inspect class balance and feature distributions
- Visualize distributions for categorical and numerical attributes
- Plot correlation matrices and pairwise relationships
- Identify informative legal attributes and reduce noise
- Encode categorical features and scale numeric values when needed
- Split the dataset into training and testing subsets
- Train a set of classifiers on the processed feature set
- Compare baseline, linear, tree-based, and neural models
- Models evaluated include:
DummyClassifierLogisticRegressionDecisionTreeClassifierRandomForestClassifierSVCGaussianNBMLPClassifierAdaBoostClassifierBaggingClassifierVotingClassifier
- Compute classification metrics: accuracy, precision, recall, F1 score
- Generate confusion matrices for each classifier
- Visualize model performance with graphs and heatmaps
- Compare model behavior across the same test split
flowchart TD
A[Load SCN appeal-case dataset] --> B[Profile and inspect data]
B --> C[Engineer features and transform data]
C --> D[Train classifiers on training data]
D --> E[Evaluate results and visualize graphs]
The project is implemented using a Python-based data science stack:
- Python 3.x for data processing and modeling
- Jupyter Notebook for interactive experimentation
- pandas and NumPy for data handling
- matplotlib and seaborn for visualization
- scikit-learn for preprocessing, modeling, and evaluation
- pandas-profiling for automated dataset profiling
- VS Code as the development environment
git clone https://github.com/shakil-sheikh/Court-Judgments-Prediction-using-Machine-Learning.git
cd Court-Judgments-Prediction-using-Machine-Learning
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
pip install --upgrade pip
pip install pandas numpy matplotlib seaborn scikit-learn pandas-profiling jupyterconda create -n court-judgment-prediction python=3.10 -y
conda activate court-judgment-prediction
pip install --upgrade pip
pip install pandas numpy matplotlib seaborn scikit-learn pandas-profiling jupyterjupyter notebook "CSE 445.ipynb"The repository includes a rich set of model evaluation outputs and visual artifacts in the IMAGES folder. These include:
- confusion matrices for multiple classifiers
- feature correlation heatmaps
- count plots for case-related attributes
- distribution and relationship plots for the legal features
| Model | Typical metrics | Analysis |
|---|---|---|
| Logistic Regression | Balanced accuracy, precision, recall, F1 | Provides a stable baseline with interpretable coefficients for legal feature impact. |
| Decision Tree | Precision, recall, support | Captures non-linear relationships and highlights the most discriminative case attributes. |
| Random Forest | Accuracy, F1 score, ROC-AUC | Offers the best tradeoff between generalization and robustness across dataset splits. |
| SVM | Precision, recall, F1 | Useful for higher-dimensional feature spaces and supports margin-based decisions. |
| MLP Classifier | Accuracy, training loss, validation score | Demonstrates the potential of a simple neural classifier for more complex feature interactions. |
- The notebook evaluates several classifiers rather than relying on a single model.
- Ensemble methods such as Random Forest generally show stronger overall performance and stable behavior.
- Interpretable models like Logistic Regression and Decision Tree make it easier to explain predictions in the legal context.
- Graphs and heatmaps provide visual evidence of feature importance, class separation, and model mistakes.
- Confusion matrix graphs are used to compare false positives and false negatives across classifiers.
- Confusion matrix heatmaps: show where models confuse appeal outcomes
- Feature correlation graphs: reveal strong and weak relationships among legal attributes
- Class distribution plots: compare counts of outcome labels and reveal imbalance
- Model comparison figures: aggregate performance metrics across classifiers for easy visual ranking
In summary, the project provides a reproducible comparison of multiple machine learning models on the SCN appeal-case dataset and supports selecting the right classifier based on accuracy, interpretability, and robustness.
This project is licensed under the MIT License. See the LICENSE file for details.