Academic project, done in a pair · MSc in Data Science (UOC)
From the vessel register to a base for analysing the fishing fleet
- Main result
- The register’s 27,364 vessels became a clean, analysable base. A LightGBM classifier predicts the fishing gear with a mean per-class recall of 71%: it does well on small-scale gear and trawling and worse on longline, fixed gear and pole-and-line.
- Authorship
- Shared work with Lucas Zamora Vera: cleaning, analysis, modelling and report signed by both.
Project facts and contents
Facts
- Type
- Assignment 2 of “Data typology and life cycle”, MSc in Data Science (UOC)
- Authors
- Julio Úbeda Quesada and Lucas Zamora Vera
- Data
- 27,364 vessels from the Spanish fishing fleet register · registered 1987–2025
- Tools
- Python · pandas · scikit-learn · LightGBM · CatBoost · imbalanced-learn · Keras
- Code licence
- GPL-3.0
- Code
- GitHub
Where the data come from
The starting point is the dataset built in the previous assignment by web scraping the EU and Spanish vessel registers: one row per vessel, identified by its CFR, with 16 fields as they appear on the register website.
That format works for looking up one vessel, not for analysing the fleet: measurements carry units inside the text (“10,75 m”, “202,26 kW (275,0 CV)”), the status and its date share a field, and the home port mixes postcode, town, province and region.
From register to analysable base
Initial review
Duplicates, special characters, empty values, simplified column names and corrected data types: text with units into numbers and dates into date format.
Splitting fields
Estadois split into register status and status date;Puerto baseinto postcode, port, province and region. The thirty-plus census categories are grouped into seven gear types.Anomalous values
Zero or inconsistent lengths, tonnages and engine powers are imputed, and extreme values are reviewed. For example, the first vessel in the register is listed with a length of 0.00 m and has an imputed value in the clean base.
New variables
Each vessel’s age is computed and columns without analytical value are dropped. The result is 14 columns per vessel, ready to explore and model.
Explore the fleet series
This chart rebuilds, from the clean base, how many vessels were on the register at the end of each year. Choose the gear type, the home-port region, the measure and the period; the text under the chart summarises the change.
Number of vessels on 31 December · All gear types · All regions
All gear types · All regions: between 1989 and 2024 the figure went from 19,829 vessels to 7,881 vessels (−60 %). The highest value in the period was 19,829 vessels, in 1989.
Show the data as a table
| Year | Number of vessels |
|---|---|
| 1989 | 19,829 |
| 1990 | 19,776 |
| 1991 | 19,437 |
| 1992 | 19,082 |
| 1993 | 18,889 |
| 1994 | 18,893 |
| 1995 | 18,376 |
| 1996 | 18,141 |
| 1997 | 17,967 |
| 1998 | 17,533 |
| 1999 | 17,309 |
| 2000 | 16,666 |
| 2001 | 15,444 |
| 2002 | 14,947 |
| 2003 | 14,422 |
| 2004 | 14,078 |
| 2005 | 13,698 |
| 2006 | 13,358 |
| 2007 | 13,009 |
| 2008 | 11,421 |
| 2009 | 11,124 |
| 2010 | 10,851 |
| 2011 | 10,509 |
| 2012 | 10,121 |
| 2013 | 9,875 |
| 2014 | 9,633 |
| 2015 | 9,400 |
| 2016 | 9,317 |
| 2017 | 9,154 |
| 2018 | 8,980 |
| 2019 | 8,880 |
| 2020 | 8,788 |
| 2021 | 8,618 |
| 2022 | 8,451 |
| 2023 | 8,180 |
| 2024 | 7,881 |
What each figure means and how to reproduce it
- Unit. Each bar is the situation on 31 December of that year: number of vessels registered in the Spanish fishing fleet register, their total engine power in megawatts (1 MW = 1,000 kW) or their total gross tonnage in thousands of GT.
- Rule. A vessel counts in a year if it was registered before 31 December and had no removal (permanent or temporary) dated earlier.
- Categories. Gear type is the project’s grouping of the census category, and the region is that of the home port. Both are the latest recorded in 2025: a vessel that changed category always appears in the latest one.
- Period. It starts in 1989, the first full year after the register’s initial load, and ends in 2024, the last full year before extraction (April 2025).
- Source.
data/data_clean_v2.csvin the ml-flota-pesquera repository (27,364 vessels; public data from the Spanish Ministry of Agriculture, Fisheries and Food). The series is computed with this portfolio’sscripts/flota/generar_serie.py.
The project’s exploratory analysis shows a fleet dominated by small vessels, with right-skewed distributions of length, tonnage and power, many vessels over 30 years old, and new, larger and more powerful vessels joining in the last 10–15 years.
Models
Gear classification. The goal is to predict a vessel’s gear type from its technical and administrative features. Since about 90% of the fleet uses small-scale gear, the team used balanced accuracy, which weights each class equally. Four tree-based classifiers were compared (decision tree, random forest, LightGBM and CatBoost); LightGBM was tuned with grid search and 5-fold cross-validation and retrained with SMOTE oversampling.
| Metric | Value | What it means |
|---|---|---|
| Mean per-class recall | 0.71 | Simple average of each gear type’s hit rate; every class weighs the same. |
| Mean per-class F1 | 0.68 | Balance between precision and recall, also unweighted. |
| Weighted F1 | 0.88 | Weighted by class size: lifted by small-scale gear (3,637 vessels, F1 0.95). |
| Accuracy | 0.87 | Share of vessels classified correctly; misleading with imbalanced classes. |
By class, the model works well for small-scale gear (F1 0.95), trawling (0.80) and vessels with no census category (0.81), and worse for purse seine (0.69), longline (0.53), fixed gear (0.51) and pole-and-line (0.50, with only 11 test vessels). A dense neural network reached similar metrics (accuracy 0.86, mean F1 0.65), so LightGBM was kept. The repository README summarises the result as an “F1 of 86%”; the table uses the figures printed by the notebook.
Vessel clustering. With K-means (the README says “KNN”, but the notebook uses KMeans) the team tried 2 to 25 clusters, comparing inertia and silhouette. Although silhouette was higher with 18–19 clusters, 11 were chosen to avoid fragmenting the fleet. Medium and large vessel clusters are well separated; small vessel clusters overlap.
Hypothesis tests. Excluding small-scale gear, a chi-square test shows an association between region and gear type (χ² = 4,453, p < 10⁻¹⁶). Because length variances differ between gear types (Levene, p < 10⁻¹⁶), the relation between length and gear was tested with Kruskal-Wallis.
Limitations
- The census category and home port are the latest recorded for each vessel; their history is not kept here.
- Minority classes have few vessels with similar technical features, which limits their classification. The authors suggest adding GPS positions to tell gear types apart.
- Imputing zero or inconsistent values affects the power and tonnage totals.
- The silhouette of the chosen clustering is not printed in the notebook; the README puts it at about 0.4.