← Projects

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

  1. Initial review

    Duplicates, special characters, empty values, simplified column names and corrected data types: text with units into numbers and dates into date format.

  2. Splitting fields

    Estado is split into register status and status date; Puerto base into postcode, port, province and region. The thirty-plus census categories are grouped into seven gear types.

  3. 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.

  4. 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.

Vessels on the register at the end of each year

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
YearNumber of vessels
198919,829
199019,776
199119,437
199219,082
199318,889
199418,893
199518,376
199618,141
199717,967
199817,533
199917,309
200016,666
200115,444
200214,947
200314,422
200414,078
200513,698
200613,358
200713,009
200811,421
200911,124
201010,851
201110,509
201210,121
20139,875
20149,633
20159,400
20169,317
20179,154
20188,980
20198,880
20208,788
20218,618
20228,451
20238,180
20247,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.csv in 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’s scripts/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.

Final model (LightGBM with SMOTE) on 5,473 test vessels
MetricValueWhat it means
Mean per-class recall0.71Simple average of each gear type’s hit rate; every class weighs the same.
Mean per-class F10.68Balance between precision and recall, also unweighted.
Weighted F10.88Weighted by class size: lifted by small-scale gear (3,637 vessels, F1 0.95).
Accuracy0.87Share 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.

Authorship

Shared work

  • Cleaning, exploratory analysis, models, tests and report: Julio Úbeda Quesada and Lucas Zamora Vera, who signed the assignment.
  • Public data from the Spanish Ministry of Agriculture, Fisheries and Food and the European Commission fleet register.

On this site

  • I computed the yearly series in the interactive chart for this portfolio from the project’s clean base, with the script scripts/flota/generar_serie.py.
  • The reading of the metrics in this case follows the outputs of the repository notebook.

← Back to home

Ask about my work

Checking the service…

Write any question about my background, projects, education or publications. Answers are based only on the content of this site and link to their sources.

To get started

0 of 500 charactersAnswers generated by a language model from this site. The conversation is not stored.