Skip to main content

fermi

The FitnEss, The Relatedness and The other MetrIcs

License: MIT Python Build Tests


fermi is a modular Python framework for analyzing the main Economic Complexity metrics and features. It provides tools to explore the hidden structure of economies through:

  • 📊 Matrix preprocessing: raw cleaning, sparse conversion, Comparative advantage RCA/ICA, transformation and thresholding.
  • 🧠 Fitness & complexity: compute Fitness, Complexity ECI, PCI and other metrics via multiple methods.
  • 🌐 Relatedness metrics: product space, taxonomy, assist matrix.
  • 📈 Prediction models: GDP forecasting, density models, XGBoost.
  • ✅ Validation metrics: AUC, confusion matrix, prediction@k.

📦 Getting Started

Requirements

⚠️ Requires Python ≥ 3.0 To correnctly install and use the package, you need to have

numpy ≥ 1.24
pandas ≥ 1.5
scikit-learn ≥ 1.2
scipy ≥ 1.9
matplotlib ≥ 3.5
seaborn
bokeh ≥ 2.4
tqdm
networkx ≥ 2.6
bicm ≥ 3.3.1

To install fermi directly from PyPI in a virtual environment:

python -m venv fermi-env
source fermi-env/bin/activate  # or fermi-env\Scripts\activate on Windows
pip install fermi-cref

Using fermi-cref on Google Colab

To use fermi on Colab, you can install it directly from PyPI with:

!pip install fermi-cref

🚀 Basic functionalities

Fitness and Complexity module

The main module to generate an Economic Complexity object and initialize it (with a biadjacency matrix):

import fermi
myefc = fermi.efc()
myefc.load(my_biadjacency_matrix, *possible kwargs*)

To compute the Revealed Comparative Advantage (Balassa index) and binarize its value

myefc.compute_rca().binarize()

To compute the Fitness and the Complexity (using the original [Tacchella2012] algorithm)

fitness, complexity = myefc.get_fitness_complexity()

To compute the diversification and the ubiquity

div, ubi = myefc.get_diversification_ubiquity()

To compute the ECI index (using the eigenvalue method)

eci, pci = myefc.get_eci_pci()

Relatedness module

The module to generate cooccurrences and similar relatedness measures is

myproj = fermi.RelatednessMetrics()
myproj.load(my_biadjacency_matrix, *possible kwargs*)

The cooccurrence can be evaluated using

relatedness = myproj.get_projection(projection_method="cooccurrence")
validated_relatedness, validated_values = myproj.get_bicm_projection(projection_method="cooccurrence", validation_method="fdr")

See a more detailed description in the API in the documentation.


🌐 How to cite

If you use the fermi modules, please cite its location on Github https://github.com/EFC-data/fermi

References

[Tacchella2012] A. Tacchella, M. Cristelli, G. Caldarelli, A. Gabrielli, L. Pietronero , A New Metrics for Countries' Fitness and Products' Complexity, SciRep vol. 2, 723 (2012)

[Zaccaria2014] Zaccaria A, Cristelli M, Tacchella A, Pietronero L, How the Taxonomy of Products Drives the Economic Development of Countries, PLoS ONE, (2014), 9(12): e113770

[Tacchella2018] Tacchella A., Mazzilli D., Pietronero L. A dynamical systems approach to gross domestic product forecasting. Nature Phys 14, 861–865 (2018)

[Pugliese2019] Pugliese E., Cimini G., Patelli A. et al. Unfolding the innovation system for the development of countries: coevolution of Science, Technology and Production. Sci Rep vol. 9, 16440 (2019)

[Mazzilli2024] D Mazzilli, M S Mariani, F Morone and A Patelli, Equivalence between the Fitness-Complexity and the Sinkhorn-Knopp algorithms, J. Phys. Complex. 5 015010 (2024)

Credits

Authors: CREF Team

Acknowledgements

We gratefully acknowledge the invaluable contributions, support, and foundational code provided by Andrea Tacchella, Emanuele Pugliese, Dario Mazzilli, and Andrea Zaccaria.

Metadata

Release files for fermi-cref 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fermi-cref 0.2.0
File Size Uploaded
fermi_cref-0.2.0.tar.gz 52.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fermi-cref 0.2.0
File Interpreter ABI Platform
fermi_cref-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 106.3 kB

Release files / fermi_cref-0.2.0.tar.gz

Download URL fermi_cref-0.2.0.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8b54a4eae0baff9ab2fb4114feea6674a69b19c87f85982503070cd08aa8d0ae
BLAKE2b-256 checksum
How to use checksums
43773279b013cb4ea1e9c8e0f4b82a490a784b3884b2a66e480ea6cd0d2e0e99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / fermi_cref-0.2.0-py3-none-any.whl

Download URL fermi_cref-0.2.0-py3-none-any.whl
Size 53.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
524f3d847f96fa81f21fc9671ba7b82848acffd4d33bbe91e97a4ac9b18104f6
BLAKE2b-256 checksum
How to use checksums
190180be8cf7ead8a996fc0be5098625313c4d14579e4d5c7c8475f45f12fee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page