# aymenmed96/predicting_sleep-dreaming_for_mammals architecture

> Architecture diagram of the GitHub repository aymenmed96/predicting_sleep-dreaming_for_mammals, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aymenmed96/predicting_sleep-dreaming_for_mammals
- Repository: https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals

## Overview

##### Project Type & Purpose
- Type: Jupyter-based data science / ML project
- Purpose:
– Part 1: Predict total sleep time for each mammal species
– Part 2: Predict dreaming (REM) time for each mammal species
– Part 3: Correlate biological & ecological features

A. Data Sources
– Famille_Taxonomie.xlsx (taxonomy metadata)
– sleep_merged.tsv (merged features & sleep data)
B. Data Ingestion & Preprocessing
– Missing-value handling (Totalsleep-Fill-NA notebooks, Totalsleep-NA delete)
– Data merging & cleaning
C. Exploratory Data Analysis (EDA)
– Correlation analysis workbook (Correlation between Biological and Ecological attributes.ipynb)
– Visualization libraries (Matplotlib, Seaborn, etc.)
D. ML Pipelines (two parallel flows)
1. Total-Sleep Prediction Pipeline
- Notebook: Totalsleep-Prediction notebooks
- Steps: feature selection → train/test split → model training (e.g., RandomForest, SVR) → evaluation
- Dependencies: requirements-totalsleep-prediction.txt
2. Dreaming-Time Prediction Pipeline
- Notebook: Dreaming_prediction.ipynb
- Steps: same as above, different target
- Dependencies: requirements-dreaming_prediction.txt
E. Reporting & Outputs
– PDF report (Report_ML Project_BENGARAA_TOUATI_KHERARBA_COLLIN.pdf)
– Figures & tables embedded in notebooks or exported images
F. Environment & Tools
– Jupyter Notebook server
– Python runtime & virtual environments per requirements-*.txt

##### Relationships & Data Flows
- Data Sources → Ingestion/Preprocessing
- Preprocessing → EDA and both ML pipelines
- ML pipelines → Evaluation & Reporting
– Show that the preprocessing step feeds all three parts (total sleep, dreaming, correlation) in parallel.

##### Architectural Patterns & Tech Stack
– Pattern: Linear/Branching Data Pipeline (Ingestion → Processing → Modeling → Reporting)
– Libraries: pandas, numpy, scikit-learn, matplotlib, seaborn, openpyxl (for Excel), TSV reader
– Environment management: requirements files for each sub-project

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Jupyter Notebook Server"
    subgraph "Data Sources"
      Famille["Famille_Taxonomie.xlsx"]:::data
      Sleep["sleep_merged.tsv"]:::data
    end

    subgraph "Data Ingestion & Preprocessing"  
      NA_Family["Totalsleep-Fill-NA-Family.ipynb"]:::process
      NA_Order["Totalsleep-Fill-NA-Order.ipynb"]:::process
      NA_Delete["Totalsleep-NA delete.ipynb"]:::process
    end

    Merged["cleaned DataFrame"]:::data

    subgraph "Exploratory Data Analysis (EDA)"
      Corr["Correlation between Biological and Ecological attributes.ipynb"]:::eda
      ReqCorr["requirements-correlation-biological-ecological-attributes.txt"]:::config
    end

    subgraph "ML Pipelines"
      subgraph "Total-Sleep Prediction Pipeline"
        ReqTS["requirements-totalsleep-prediction.txt"]:::config
        TSNotebook["Totalsleep-Prediction Notebook(s)"]:::model
      end
      subgraph "Dreaming-Time Prediction Pipeline"
        DreamNB["Dreaming_prediction.ipynb"]:::model
        ReqDream["requirements_Dreaming_prediction.txt"]:::config
      end
    end

    subgraph "Reporting & Outputs"
      Report["Report_ML Project_BENGARAA_TOUATI_KHERARBA_ COLLIN.pdf"]:::report
    end

    README["README.md"]:::config
  end

  Famille -->|reads raw data| NA_Family
  Sleep -->|reads raw data| NA_Family
  Famille -->|reads raw data| NA_Order
  Sleep -->|reads raw data| NA_Order
  Famille -->|reads raw data| NA_Delete
  Sleep -->|reads raw data| NA_Delete

  NA_Family -->|outputs cleaned DataFrame| Merged
  NA_Order -->|outputs cleaned DataFrame| Merged
  NA_Delete -->|outputs cleaned DataFrame| Merged

  Merged -->|provides data| Corr
  Merged -->|provides features| TSNotebook
  Merged -->|provides features| DreamNB

  ReqCorr -->|dependency| Corr
  ReqTS -->|dependency| TSNotebook
  ReqDream -->|dependency| DreamNB

  Corr -->|analysis plots| Report
  TSNotebook -->|model objects & metrics| Report
  DreamNB -->|model objects & metrics| Report

  README -->|environment info| NA_Family
  README -->|environment info| Corr
  README -->|environment info| TSNotebook
  README -->|environment info| DreamNB

  click Famille "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Famille_Taxonomie.xlsx"
  click Sleep "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/sleep_merged.tsv"
  click NA_Family "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Totalsleep-Fill-NA-Family.ipynb"
  click NA_Order "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Totalsleep-Fill-NA-Order.ipynb"
  click NA_Delete "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Totalsleep-NA delete.ipynb"
  click Corr "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Correlation between Biological and Ecological attributes.ipynb"
  click ReqCorr "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/requirements-correlation-biological-ecological-attributes.txt"
  click ReqTS "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/requirements-totalsleep-prediction.txt"
  click DreamNB "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Dreaming_prediction.ipynb"
  click ReqDream "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/requirements_Dreaming_prediction.txt"
  click Report "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/Report_ML Project_BENGARAA_TOUATI_KHERARBA_ COLLIN.pdf"
  click README "https://github.com/aymenmed96/predicting_sleep-dreaming_for_mammals/blob/main/README.md"

  classDef data fill:#ccf,stroke:#333,stroke-width:1px
  classDef process fill:#cce,stroke:#333,stroke-width:1px
  classDef eda fill:#cfc,stroke:#333,stroke-width:1px
  classDef model fill:#fcf,stroke:#333,stroke-width:1px
  classDef config fill:#eee,stroke:#333,stroke-width:1px
  classDef report fill:#fdd,stroke:#333,stroke-width:1px
```
