# lorenzomasoero/onlineactivitypredictionibp architecture

> Architecture diagram of the GitHub repository lorenzomasoero/onlineactivitypredictionibp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lorenzomasoero/onlineactivitypredictionibp
- Repository: https://github.com/lorenzomasoero/onlineactivitypredictionibp

## Overview

This repository reproduces research on online activity prediction while also maintaining a reusable Python model API. The principal workflow prepares public activity data, fits prediction models, evaluates new-user or trigger forecasts, and exports paper tables and figures. A separate maintained implementation supports independent analyses and simulations; the paper-fitting engine remains canonical for accepted public-data results. The README also documents hitting-time, rolling-window, reconstructed simulation, and proprietary mock branches. Relationships below rely on README statements and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/activity_prediction/experiments/fitting.py`](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/fitting.py) (Model fitting API), [`src/activity_prediction/models`](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/src/activity_prediction/models) (SSP models), [`paper_fitting/utils`](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/paper_fitting/utils) (Legacy model engine), [`scripts`](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/scripts) (Dataset analyses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_uci_prep["UCI preparation"]
  node_rees_prep["REES46 preparation"]
  node_rolling_prep["Rolling windows"]
end

subgraph group_paper["Paper fitting"]
  node_asos_fitting["ASOS fitting<br/>[fit_asos.py]"]
  node_uci_fitting["UCI fitting<br/>[fit_uci.py]"]
  node_rees_fitting["REES46 fitting<br/>[fit_rees46.py]"]
  node_paper_models["Legacy model engine"]
  node_hit_export["Hitting-time export"]
end

subgraph group_library["Maintained model API"]
  node_maintained_fit["Model fitting API<br/>[fitting.py]"]
  node_ssp_models["SSP models"]
  node_benchmark_models["Benchmark models"]
  node_optimization["Fit optimization<br/>[_optimization.py]"]
  node_hitting["Hitting-time analysis<br/>[hitting_times.py]"]
  node_metrics["Evaluation metrics<br/>[metrics.py]"]
  node_plotting["Plotting and style<br/>[style.py]"]
end

subgraph group_analysis["Analysis and results"]
  node_comparison["Result comparison"]
  node_paper_export["Paper outputs"]
  node_dataset_runs["Dataset analyses"]
  node_simulation_runs["Simulation studies<br/>[run_zipf.py]"]
  node_proprietary["Proprietary mock<br/>[run_proprietary.py]"]
  node_experiment_counts["Experiment counts"]
end

node_user(("Researcher"))

node_user -.->|"prepares data"| node_uci_prep
node_user -.->|"prepares data"| node_rees_prep
node_user -.->|"runs reproduction"| node_asos_fitting
node_asos_fitting -->|"fits models"| node_paper_models
node_uci_fitting -->|"fits models"| node_paper_models
node_rees_fitting -->|"fits models"| node_paper_models
node_user -.->|"runs independent analysis"| node_maintained_fit
node_maintained_fit -->|"fits SSPs"| node_ssp_models
node_maintained_fit -->|"fits benchmarks"| node_benchmark_models
node_ssp_models -->|"optimizes fits"| node_optimization
node_ssp_models -->|"optimizes fits"| node_optimization
node_maintained_fit -.->|"evaluates forecasts"| node_metrics
node_hitting -->|"uses models"| node_ssp_models
node_user -.->|"requests results"| node_hit_export
node_hit_export -->|"compares CSVs"| node_comparison
node_user -.->|"exports artifacts"| node_paper_export
node_dataset_runs -.->|"runs analyses"| node_maintained_fit
node_simulation_runs -.->|"runs simulations"| node_maintained_fit
node_dataset_runs -.->|"plots results"| node_plotting
node_simulation_runs -.->|"plots results"| node_plotting
node_user -.->|"constructs windows"| node_rolling_prep
node_rolling_prep -.->|"counts windows"| node_experiment_counts
node_user -.->|"runs mock workflow"| node_proprietary

click node_uci_prep "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/01_preprocess_uci.py"
click node_rees_prep "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/preprocess_rees46.py"
click node_rolling_prep "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/preprocess_rees46_rolling.py"
click node_asos_fitting "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_asos.py"
click node_uci_fitting "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_uci.py"
click node_rees_fitting "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_rees46.py"
click node_paper_models "https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/paper_fitting/utils"
click node_hit_export "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/export_hitting_time_csv.py"
click node_comparison "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/compare_hitting_time_csv.py"
click node_paper_export "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/export_paper_csv.py"
click node_maintained_fit "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/fitting.py"
click node_ssp_models "https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/src/activity_prediction/models"
click node_benchmark_models "https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/src/activity_prediction/models"
click node_optimization "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/models/_optimization.py"
click node_hitting "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/hitting_times.py"
click node_metrics "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/metrics.py"
click node_plotting "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/plotting/style.py"
click node_dataset_runs "https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/scripts"
click node_simulation_runs "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/scripts/run_zipf.py"
click node_proprietary "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/run_proprietary.py"
click node_experiment_counts "https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/reproducibility/gen_rees46_experiment_counts.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_uci_prep,node_rees_prep,node_rolling_prep toneBlue
class node_asos_fitting,node_uci_fitting,node_rees_fitting,node_paper_models,node_hit_export toneAmber
class node_maintained_fit,node_ssp_models,node_benchmark_models,node_optimization,node_hitting,node_metrics,node_plotting toneMint
class node_comparison,node_paper_export,node_dataset_runs,node_simulation_runs,node_proprietary,node_experiment_counts toneRose
class node_user toneIndigo
```

## Components

### Data preparation

- [UCI preparation](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/01_preprocess_uci.py): `preprocessing/01_preprocess_uci.py`
- [REES46 preparation](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/preprocess_rees46.py): `preprocessing/preprocess_rees46.py`
- [Rolling windows](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/preprocessing/preprocess_rees46_rolling.py): `preprocessing/preprocess_rees46_rolling.py`

### Paper fitting

- [ASOS fitting](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_asos.py): `paper_fitting/fit_asos.py`
- [UCI fitting](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_uci.py): `paper_fitting/fit_uci.py`
- [REES46 fitting](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/fit_rees46.py): `paper_fitting/fit_rees46.py`
- [Legacy model engine](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/paper_fitting/utils): `paper_fitting/utils`
- [Hitting-time export](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/export_hitting_time_csv.py): `paper_fitting/export_hitting_time_csv.py`

### Maintained model API

- [Model fitting API](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/fitting.py): `src/activity_prediction/experiments/fitting.py`
- [SSP models](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/src/activity_prediction/models): `src/activity_prediction/models`
- [Benchmark models](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/src/activity_prediction/models): `src/activity_prediction/models`
- [Fit optimization](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/models/_optimization.py): `src/activity_prediction/models/_optimization.py`
- [Hitting-time analysis](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/hitting_times.py): `src/activity_prediction/experiments/hitting_times.py`
- [Evaluation metrics](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/experiments/metrics.py): `src/activity_prediction/experiments/metrics.py`
- [Plotting and style](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/src/activity_prediction/plotting/style.py): `src/activity_prediction/plotting/style.py`

### Analysis and results

- [Result comparison](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/compare_hitting_time_csv.py): `paper_fitting/compare_hitting_time_csv.py`
- [Paper outputs](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/export_paper_csv.py): `paper_fitting/export_paper_csv.py`
- [Dataset analyses](https://github.com/lorenzomasoero/onlineactivitypredictionibp/tree/main/scripts): `scripts`
- [Simulation studies](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/scripts/run_zipf.py): `scripts/run_zipf.py`
- [Proprietary mock](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/paper_fitting/run_proprietary.py): `paper_fitting/run_proprietary.py`
- [Experiment counts](https://github.com/lorenzomasoero/onlineactivitypredictionibp/blob/main/reproducibility/gen_rees46_experiment_counts.py): `reproducibility/gen_rees46_experiment_counts.py`

### Other components

- **Researcher**

## Connections

- Researcher → UCI preparation: prepares data
- Researcher → REES46 preparation: prepares data
- Researcher → ASOS fitting: runs reproduction
- ASOS fitting → Legacy model engine: fits models (evidence: `paper_fitting/fit_asos.py`)
- UCI fitting → Legacy model engine: fits models (evidence: `paper_fitting/fit_uci.py`)
- REES46 fitting → Legacy model engine: fits models (evidence: `paper_fitting/fit_rees46.py`)
- Researcher → Model fitting API: runs independent analysis
- Model fitting API → SSP models: fits SSPs (evidence: `src/activity_prediction/experiments/fitting.py`)
- Model fitting API → Benchmark models: fits benchmarks (evidence: `src/activity_prediction/experiments/fitting.py`)
- SSP models → Fit optimization: optimizes fits (evidence: `src/activity_prediction/models/be_ssp.py`)
- SSP models → Fit optimization: optimizes fits (evidence: `src/activity_prediction/models/nb_ssp.py`)
- Model fitting API → Evaluation metrics: evaluates forecasts
- Hitting-time analysis → SSP models: uses models (evidence: `src/activity_prediction/experiments/hitting_times.py`)
- Researcher → Hitting-time export: requests results
- Hitting-time export → Result comparison: compares CSVs (evidence: `paper_fitting/export_hitting_time_csv.py`)
- Researcher → Paper outputs: exports artifacts
- Dataset analyses → Model fitting API: runs analyses
- Simulation studies → Model fitting API: runs simulations
- Dataset analyses → Plotting and style: plots results (evidence: `scripts/run_parameter_estimation.py`)
- Simulation studies → Plotting and style: plots results (evidence: `scripts/run_zipf.py`)
- Researcher → Rolling windows: constructs windows
- Rolling windows → Experiment counts: counts windows
- Researcher → Proprietary mock: runs mock workflow
