LIA_System is a standalone extraction of the federated learning runtime used for communities of interest experiments. It contains an MQTT-based aggregation server, federated clients, shared model/protocol utilities, synthetic data generation, and a Docker Compose demo.
src/lia_system/shared: model architecture, SQLite data loading, FedAvg, MQTT protocol, and weight chunking.src/lia_system/server: aggregation server runtime.src/lia_system/node: federated client runtime.src/lia_system/platform_adapter.py: optional Docker helper functions for integrating with an external platform.src/lia_system/examples/generate_synthetic_data.py: synthetic SQLite sensor history generator.docker-compose.yml: local demo with Mosquitto, one server, and two clients.
Install the package and create synthetic sensor histories:
python -m pip install -e ".[test]"
python -m lia_system.examples.generate_synthetic_data --output-dir examples/dataRun the standalone demo:
docker compose up --buildThe demo starts:
mqtt-broker: local Mosquitto broker.server: federated aggregation server forcluster1.client-1andclient-2: federated clients reading SQLite histories fromexamples/data.
After installation, run the aggregation server:
python -m lia_system.server.cluster_serverRun a federated client:
SENSOR_ID=client-1 python -m lia_system.node.cluster_nodeGenerate local synthetic data without installing by setting PYTHONPATH:
PYTHONPATH=src python -m lia_system.examples.generate_synthetic_data --output-dir examples/dataClients train from a SQLite database at SENSOR_DB_PATH, defaulting to
/app/data/sensor_history.db. The preferred table is:
CREATE TABLE sensor_readings (
timestamp TIMESTAMP PRIMARY KEY,
value REAL
);The legacy table lecturas(timestamp, temperatura) remains supported.
Federated messages use the topic prefix:
fl/{cluster_id}/...
The current protocol keeps schema version 1, GRU architecture metadata,
chunked model weight transfer, client status messages, and weighted FedAvg
aggregation by local sample counts.
python -m pytestThe migrated tests cover history normalization, SQLite data loading, weight serialization/chunking, FedAvg-related behavior, synthetic data generation, and the optional platform adapter with Docker mocked.