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 / Machine learning 
    contamination=0.4,

    # Rt (Reproduction Number)
    limiar_rt=1.25,
    window_rt=5,
    gamma=0.2,

    # Machine learning (Isolation Forest, Local Outiler Factor, One class SVM )
    isf_n_estimators=500,
    lof_n_neighbors=500,
    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[df["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=xxxxxx)

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.2.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.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmaing_aesop-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0e5695aae38412282c4962921b22d8399530e4c713804e1d4441a575ba55b09a
MD5 8a2f7ef85239067c0024c7a901c58275
BLAKE2b-256 183bd7e585363c3b1c66da040096a5e25aa24ad7b424c704d9a7f05fdeda2ead

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmaing_aesop-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d46450924462ad5cf6128e863a30641a86e5f1f7fae6e1db52f19b2f8c5d870b
MD5 a4344aab360b180746482941b9ae2bef
BLAKE2b-256 032032eff658dfa146ff728bc9bc9dc622ca4ca7e64d5931594c0405240d589b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 files

0.2.1

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