A minimal federated learning project to experiment with Flower before implementing FSC, FHR, and PCFL algorithms.
flower-fcl-sandbox/
├── README.md
├── pyproject.toml # Project config and dependencies
├── data/
│ └── generate_synthetic.py # Create non-IID synthetic health data
├── models/
│ └── risk_model.py # Simple risk prediction model
├── clients/
│ └── client.py # Flower client implementation
├── server/
│ └── strategies/
│ └── fsc_prototype.py # Your FSC algorithm skeleton
├── simulation.py # Run federated simulation
└── experiments/
└── run_experiment.py # Experiment runner with logging
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and enter project
git clone https://github.com/YOUR_USERNAME/flower-fcl-sandbox.git
cd flower-fcl-sandbox
# Create venv and install dependencies (uv does both in one step)
uv sync
# Run simulation with 5 clients
uv run python simulation.py --num_clients 5 --num_rounds 10
# Run with custom strategy
uv run python simulation.py --strategy fsc --num_clients 5# uv will automatically create venv and install deps on first run
uv run python simulation.py --num_clients 5 --num_rounds 10# Add a new package
uv add requests
# Add dev dependency
uv add --dev pytest
# Add optional dependency group
uv add --optional privacy opacus- Day 1: Run the basic simulation, understand client-server flow
- Day 2: Modify the model, observe convergence behavior
- Day 3: Implement non-IID data splits, see heterogeneity effects
- Day 4: Add EWC regularization to the client (FSC foundation)
- Day 5: Implement Fisher information aggregation in custom strategy
This sandbox uses a synthetic "CKD risk" dataset with features similar to what FLIP-IT will use:
- Age, blood pressure, creatinine, GFR estimates
- Binary classification (high risk / low risk)
- Non-IID splits simulate different practice populations
uv run pytest
uv run pytest --cov=. # with coverageuv run ruff check . # linting
uv run ruff format . # formatting
uv run mypy . # type checkingAfter mastering this sandbox:
- Replace synthetic data with MIMIC-IV subset
- Add differential privacy (
uv add --optional privacy opacus) - Implement temporal distribution shift simulation
- Scale to multi-GPU with Flower simulation