Skip to content

GeoTecINIT/LIA_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LIA_System

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.

Repository layout

  • 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.

Quick start

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/data

Run the standalone demo:

docker compose up --build

The demo starts:

  • mqtt-broker: local Mosquitto broker.
  • server: federated aggregation server for cluster1.
  • client-1 and client-2: federated clients reading SQLite histories from examples/data.

Python usage

After installation, run the aggregation server:

python -m lia_system.server.cluster_server

Run a federated client:

SENSOR_ID=client-1 python -m lia_system.node.cluster_node

Generate local synthetic data without installing by setting PYTHONPATH:

PYTHONPATH=src python -m lia_system.examples.generate_synthetic_data --output-dir examples/data

Data contract

Clients 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.

MQTT contract

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.

Tests

python -m pytest

The 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.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors