Skip to main content

MMAING-AESOP

MMAING-AESOP is an early outbreak detection model based on the combination of:

  • $R_t$ (time-dependent reproduction number estimated using a Next-Generation Matrix approach)
  • An ensemble of machine learning models:
    • Isolation Forest
    • Local Outlier Factor (LOF)
    • One-Class Support Vector Machine (OCSVM)
    • COPOD

The model generates Early Warning Signals (EWS) from weekly primary healthcare time series.

If you use MMAING-AESOP in your research, please cite:

Borges, D. G. F., Coutinho, E. R., Cerqueira-Silva, T. et al. Combining machine learning and dynamic system techniques to early detection of respiratory outbreaks in routinely collected primary healthcare records. BMC Medical Research Methodology, 25, 99 (2025). https://doi.org/10.1186/s12874-025-02542-0


Installation

The mmaing_aesop package is available on PyPI.

Install it using:

pip install mmaing_aesop

Then import the package in Python:

from mmaing_aesop import MMAING

Example

from mmaing_aesop import MMAING

model = MMAING(
    # Ensemble
    vote_threshold=3,

    # Outlier detection
    contamination=0.4,

    # Rt
    limiar_rt=1.25,
    window_rt=5,
    gamma=0.2,

    # Machine learning
    isf_n_estimators=500,
    lof_n_neighbors=200,
    ocsvm_nu=0.8,
    ocsvm_kernel="rbf",
    ocsvm_gamma=0.001,

    # Statistical limits
    alpha=0.05,
    window_limit=5,

    # Baseline and detection period
    baseline_years=[2017, 2018, 2019],
    start_year_detection=2020
)

model.fit(df_real[df_real["co_ibge"] == xxxxxx])

model.plot(co_ibge=xxxxxx)

Required input columns

The input DataFrame must contain the following columns:

  • co_ibge: municipality IBGE code (six digits)
  • municipio: municipality name
  • ano: year
  • epiweek: epidemiological week
  • atend_ivas: number of primary healthcare encounters for respiratory syndromes

Example:

co_ibge    municipio     ano    epiweek    atend_ivas
355030     São Paulo     2017       1          125
355030     São Paulo     2017       2          138
355030     São Paulo     2017       3          142
...

Basic usage

Fit the model:

model.fit(df)

Retrieve all results:

results = model.get_results()

Retrieve only detected alerts:

alerts = model.get_alerts()

Plot the time series and MMAING alerts:

model.plot(co_ibge=355030)

Export the results to CSV:

model.to_csv("mmaing_results.csv")

Main parameters

Parameter Default Description
vote_threshold 3 Minimum number of votes required to generate an MMAING alert
contamination 0.4 Expected proportion of anomalies used by the outlier detection models
limiar_rt 1.25 Threshold used for the $R_t$ component
window_rt 5 Window used in the $R_t$ calculation
gamma 0.2 Recovery-rate parameter used in the dynamic model
isf_n_estimators 500 Number of trees in the Isolation Forest
lof_n_neighbors 500 Number of neighbors used by LOF
ocsvm_nu 0.8 nu parameter of the One-Class SVM
ocsvm_kernel "rbf" Kernel used by the One-Class SVM
ocsvm_gamma 0.001 Kernel coefficient used by the One-Class SVM
alpha 0.05 Significance level used to calculate statistical limits
window_limit 5 Window used for the recent statistical limit
baseline_years [2017, 2018, 2019] Years used as the historical baseline
start_year_detection 2020 First year included in the detection period

Citation

Borges, D.G.F., Coutinho, E.R., Cerqueira-Silva, T. et al.
Combining machine learning and dynamic system techniques to early detection
of respiratory outbreaks in routinely collected primary healthcare records.
BMC Med Res Methodol 25, 99 (2025).
https://doi.org/10.1186/s12874-025-02542-0

License

MMAING-AESOP is distributed under the Apache License 2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mmaing_aesop-0.2.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmaing_aesop-0.2.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file mmaing_aesop-0.2.1.tar.gz.

File metadata

  • Download URL: mmaing_aesop-0.2.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mmaing_aesop-0.2.1.tar.gz
Algorithm Hash digest
SHA256 de6dbee62df5766c06582823952521377842ab5730e83acf559867f1494aaec8
MD5 79621bca66bdfc5d006652cc44506af4
BLAKE2b-256 de8f9dfc8791088884d63ee5bc9fd005d4c6770532df456db384d7fa4823df6e

See more details on using hashes here.

File details

Details for the file mmaing_aesop-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mmaing_aesop-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mmaing_aesop-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b57fd5d5d13136ae76f8ba81220dd71b75cfc0bfde0e3abb077b297082c4bb66
MD5 881bf860c64d5b458ccef36ebb0f3507
BLAKE2b-256 e64ffbf8ef95984e48915fba688b34903100647965093b86e511c583dbaeaba0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page