# useradmn/berkeleyaiml-capstone architecture

> Architecture diagram of the GitHub repository useradmn/berkeleyaiml-capstone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/useradmn/berkeleyaiml-capstone
- Repository: https://github.com/useradmn/berkeleyaiml-capstone

## Overview

##### Project Type and Purpose
This is a machine learning analysis project focused on healthcare outcomes, specifically predicting and preventing hospital readmissions for diabetic patients. The project uses classification techniques and counterfactual explanations to identify factors that contribute to readmissions.

##### Main Components

A. Data Layer:
- Input Data Source (diabetic_data.csv)
- Feature Processing Components
- Data Preprocessing Pipeline

B. Model Layer:
- Logistic Regression Classifier
- Decision Tree Classifier
- Counterfactual Analysis Engine (DICE ML)

C. Analysis Layer:
- Feature Importance Calculator
- Prediction Engine
- Counterfactual Explanation Generator

D. Output Layer:
- Readmission Prediction Results
- Feature Importance Visualizations
- Counterfactual Recommendations

**[Data Sources] → [Preprocessing] → [Model Training] → [Analysis] → [Outputs]**
- ↓              ↓                    ↓              ↓            ↓
**[CSV Files]    [Feature Engineering] [ML Models]   [Evaluation]  [Recommendations]**

##### Important Connections

- Data flow between components
- Model training pipeline
- Feedback loops for model improvement
- Integration points with counterfactual analysis

##### The healthcare-specific nature of the predictions

This system design should help stakeholders understand how the project processes patient data to generate actionable insights for reducing hospital readmissions among diabetic patients.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef data fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef process fill:#90EE90,stroke:#333,stroke-width:2px
    classDef model fill:#ffeb99,stroke:#333,stroke-width:2px
    classDef analysis fill:#ffb366,stroke:#333,stroke-width:2px
    classDef output fill:#e6b3ff,stroke:#333,stroke-width:2px

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        RawData["Raw Patient Data"]:::data
        CSV["Diabetic Dataset"]:::data
        FeatProc["Feature Processing"]:::process
    end

    %% Model Layer
    subgraph ModelLayer["Model Layer"]
        LogReg["Logistic Regression"]:::model
        DecTree["Decision Tree"]:::model
        DICE["DICE ML Engine"]:::model
    end

    %% Analysis Layer
    subgraph AnalysisLayer["Analysis Layer"]
        FeatImp["Feature Importance"]:::analysis
        PredEng["Prediction Engine"]:::analysis
        CountGen["Counterfactual Generator"]:::analysis
    end

    %% Output Layer
    subgraph OutputLayer["Output Layer"]
        ReadPred["Readmission Predictions"]:::output
        FeatVis["Feature Importance Viz"]:::output
        CountRec["Counterfactual Recommendations"]:::output
    end

    %% Connections
    RawData --> CSV
    CSV --> FeatProc
    FeatProc --> LogReg
    FeatProc --> DecTree
    LogReg --> FeatImp
    DecTree --> FeatImp
    LogReg --> PredEng
    DecTree --> PredEng
    PredEng --> DICE
    DICE --> CountGen
    FeatImp --> FeatVis
    PredEng --> ReadPred
    CountGen --> CountRec

    %% Click Events
    click CSV "https://github.com/useradmn/BerkeleyAIML-Capstone/blob/main/data/diabetic_data.csv"
    click LogReg "https://github.com/useradmn/BerkeleyAIML-Capstone/blob/main/capstoneAIML.ipynb"
    click DecTree "https://github.com/useradmn/BerkeleyAIML-Capstone/blob/main/capstoneAIML.ipynb"
    click DICE "https://github.com/useradmn/BerkeleyAIML-Capstone/blob/main/capstoneAIML.ipynb"
    click FeatVis "https://github.com/useradmn/BerkeleyAIML-Capstone/tree/main/images/"
    click ReadPred "https://github.com/useradmn/BerkeleyAIML-Capstone/tree/main/images/"
    click CountRec "https://github.com/useradmn/BerkeleyAIML-Capstone/tree/main/images/"

    %% Legend
    subgraph Legend
        L1["Data Components"]:::data
        L2["Processing Components"]:::process
        L3["Model Components"]:::model
        L4["Analysis Components"]:::analysis
        L5["Output Components"]:::output
    end
```
