Skip to main content

MuSTDrifter

Multi-Source Temporal Drifter

Unsupervised multidimensional discourse drift detection in Python.


License: CC BY 4.0

Overview

MuSTDrifter is a Python framework for quantifying how discourse evolves over time through multidimensional data drift analysis.

The framework models discourse evolution across:

  • Semantic dimensions
  • Lexical dimensions
  • Syntactic content
  • Syntactic style
  • Thematic distributions

and estimates temporal drift using complementary forms of:

  • Covariate shift detection
  • Prior probability shift detection

Features

  • Multidimensional discourse representations
  • Multiple drift metrics
  • Permutation-based significance estimation
  • Parallelized drift computation
  • Automatic heatmap reporting
  • Modular architecture
  • Reproducible analysis pipelines

Installation

Requires Python 3.12+.

pip install mustdrifter

Quick Example

import pandas as pd

from mustdrifter import MuSTDrifter

df = pd.DataFrame({
    "doc_id": [1, 2, 3],
    "content": [
        "Political text A",
        "Political text B",
        "Political text C",
    ],
    "period_id": [1, 1, 2]
})

drifter = MuSTDrifter(
    df=df,
    df_name="example",
    results_path="./results",
)

# Generate discourse representations
drifter.generate_drift_dimensions()

# Compute multidimensional drift
drifter.calculate_drift()

# Generate heatmaps
drifter.report_heatmaps(
    export=True,
    aggregate_by="dimension"
)

Documentation

Full documentation is available here.

Including:

  • Installation
  • Quickstart
  • API Reference
  • Drift metrics
  • Reporting utilities

Drift Dimensions

Dimension Description
Semantic Embedding distribution drift
Lexical Content-word lemma drift
Syntactic Content POS-rule structural drift
Syntactic Style Conditional POS transition drift
Thematic Topic distribution drift

Drift Metrics

Semantic Drift

  • Maximum Mean Discrepancy (MMD)
  • Cosine Drift
  • Kolmogorov–Smirnov (KS)

Lexical, Syntactic, and Thematic Drift

  • Jensen–Shannon Divergence (JS)
  • Kullback–Leibler Divergence (KL)
  • Log-Likelihood divergence

Citation

@article{Guillen-Pacho2026,
  author={Guill{\'e}n-Pacho, Ibai  and Badenes-Olmedo, Carlos and Corcho, Oscar},
  title={An unsupervised multidimensional data drift framework for measuring multilingual and cross-national political discourse shifts},
  journal={Social Network Analysis and Mining},
  year={2026},
  abstract={Political discourse on social networks continuously evolves across electoral cycles and communicative contexts, producing measurable changes in discourse distributions over time. This work introduces an unsupervised framework for detecting and quantifying these changes through multidimensional drift analysis. The approach models discourse evolution across semantic, lexical, thematic, and syntactic dimensions by combining complementary drift detection techniques over text, enabling systematic and reproducible analyses of discourse change. The framework is applied to multilingual political discourse published on party manifestos and Facebook between 2014 and 2023 across multiple electoral cycles and institutional levels in Spain and France. Results show that the proposed framework is able to detect, in a fully unsupervised manner, structural patterns consistent with known dynamics of political communication, including stable distinctions between campaign and routine discourse. At the same time, the framework provides measurable and objective indicators that enable more systematic analyses of discourse evolution across comparable political scenarios.},
  issn={},
  doi={10.1007/s13278-026-01646-9},
  html={https://doi.org/10.1007/s13278-026-01646-9},
  month = {Sep}
}

License

Creative Commons Attribution 4.0 International License CC BY 4.0


Author

Ibai Guillén Pacho

Metadata

Release files for mustdrifter 1.0.2

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

Source distribution (sdist)

Source distribution for mustdrifter 1.0.2
File Size Uploaded Provenance Actions
mustdrifter-1.0.2.tar.gz 40.2 kB With provenance Details for mustdrifter-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mustdrifter 1.0.2
File Interpreter ABI Platform Actions
mustdrifter-1.0.2-py3-none-any.whl Python 3 none any Details for mustdrifter-1.0.2-py3-none-any.whl

Total release size: 87.3 kB

Release files / mustdrifter-1.0.2.tar.gz

Download URL mustdrifter-1.0.2.tar.gz
Size 40.2 kB
Tags Source
SHA-256 checksum
How to use checksums
94ee2a8b067146d7f13b6f25887f745e44dc4e4fbe96d45971a32b8e6f8a6a69
BLAKE2b-256 checksum
How to use checksums
b1a87ad618ccbf16068c543bcd68eb2753028a2d12a47883cff5b81f58998df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / mustdrifter-1.0.2-py3-none-any.whl

Download URL mustdrifter-1.0.2-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc7e7c237d6afbf6b46b15debba4071e11d6dde9e4442f7fdcbf910de8cee1fa
BLAKE2b-256 checksum
How to use checksums
0d3112da7c1bfa23b8452fa0d1e09056af28dbfebd416bc0ff6c637be0d6e445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for mustdrifter 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mustdrifter-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files Full provenance

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