# ru-insane/compas-fairness-privacy-tradeoff-analysis architecture

> Architecture diagram of the GitHub repository ru-insane/compas-fairness-privacy-tradeoff-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ru-insane/compas-fairness-privacy-tradeoff-analysis
- Repository: https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis

## Overview

##### Major Components
- Data Layer – Represented by the “data” folder, which includes CSV files for training, testing, baseline results, logistic regression predictions, ROC curves, etc.
- Baseline Processing & Modeling – Found in “main/baseline”. This includes notebooks for data pre-processing, exploratory data analysis (EDA), and model training (both logistic regression and multi-layer perceptron).
- Fairness Analysis – Under “main/fairness”, which includes notebooks for fairness preprocessing, in-processing, and post-processing. This clearly delineates the component that adjusts or analyzes fairness measures.
- Privacy Analysis – Available in “main/privacy”, focusing on differential privacy methods, showing implementation of privacy adjustments to the modeling process.
- Merged Analysis – In “main/merged”, where fairness and privacy considerations are combined. This serves as an integration layer to evaluate tradeoffs.
- Model Artifact – The “model” folder, which contains the saved multi-layer perceptron model file (mlp_model.pth).
- Supplementary Documentation – Including “documentation” and “Research References” folders, they give context and the research basis for the experiments.

##### Relationships and Interactions
- Decision Branching: From the baseline component, the system diverges into separate paths — one focusing on fairness-related processing (pre-, in-, and post-processing), and another on applying privacy techniques.
- Integration: Both the fairness and privacy pipelines then converge into the “merged” component where tradeoffs are jointly analyzed and compared.
- Output and Model Persistence: The trained models (especially the MLP model) are saved in the “model” folder, which may then be used for further evaluation or deployment (if extended).

##### Architectural Patterns and Design Principles
- Modular Pipeline Structure: The clear separation into baseline, fairness, privacy, and merged experiments demonstrates a modular design that isolates different concerns (data processing, fairness adjustments, privacy controls, and integration analysis).
- Experimentation and Iterative Refinement: Notebooks indicate an iterative, exploratory process, and the division of notebooks signifies discrete experimental steps.
- Data-Driven Flow: The system is driven by structured inputs (CSV data) and has output evaluations (results, ROC curves, logs).

##### Relevant Technologies and Tools
- Jupyter Notebooks as the primary interface for experimentation.
- Data files in CSV format, indicating traditional data engineering methods.
- Python (implied by ".ipynb" notebooks and requirement.txt) along with machine learning frameworks (as seen in “mlp_model.pth” which likely results from a PyTorch-based implementation).
- Documentation and reference materials in standard document formats (DOCX, PDF, XLSX) that support comprehensive background research.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Experimental Pipeline"
        DL["Data Layer"]:::data
        BL["Baseline Processing & Modeling"]:::process
        FA["Fairness Analysis"]:::analysis
        PA["Privacy Analysis"]:::analysis
        MA["Merged Analysis"]:::process
    end

    subgraph "Model Output"
        ART["Model Artifact"]:::artifact
    end

    subgraph "Supplementary Information"
        DOC["Documentation"]:::doc
        RR["Research References"]:::doc
    end

    DL -->|"data_flow"| BL
    BL -->|"branch_fairness"| FA
    BL -->|"branch_privacy"| PA
    FA -->|"merge_with"| MA
    PA -->|"merge_with"| MA
    BL -->|"model_save"| ART
    MA -.->|"evaluation"| DOC
    MA -.->|"evaluation"| RR

    click DL "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/data"
    click BL "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/main/baseline"
    click FA "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/main/fairness"
    click PA "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/main/privacy"
    click MA "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/main/merged"
    click ART "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/model"
    click DOC "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/documentation"
    click RR "https://github.com/ru-insane/compas-fairness-privacy-tradeoff-analysis/tree/main/Research References"

    classDef data fill:#FEE,stroke:#333,stroke-width:2px;
    classDef process fill:#CFF,stroke:#333,stroke-width:2px;
    classDef analysis fill:#FFC,stroke:#333,stroke-width:2px;
    classDef artifact fill:#FCF,stroke:#333,stroke-width:2px;
    classDef doc fill:#EFE,stroke:#333,stroke-width:2px;
```
