# dev-armaan/autism-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/dev-armaan/autism-prediction
- Repository: https://github.com/dev-armaan/autism-prediction

## Overview

##### Main Components
- Data Input: Represented by the train.csv file, which contains the training and test data sourced from Kaggle.
- Data Preprocessing and Feature Engineering: This part of the notebook handles cleaning the data, managing imbalances (e.g., via SMOTE from imblearn), and encoding categorical variables (with the encoders.pkl file used in preprocessing).
- Model Building and Training: The ASD_prediction_model.ipynb notebook contains the code to train the models (Decision Tree and Random Forest classifiers) and evaluate them. Display a dedicated model training component.
- Model Persistence: The best performing model is saved as best_model.pkl. This indicates that the trained model is serialized for later use.
- Visualization & Evaluation: Components responsible for generating correlation heatmaps, visualizations of model accuracy, and possibly grid search hyperparameter tuning steps based on the screenshots in the README.

##### Relationships and Interactions
- Data flows from the train.csv file into the preprocessing module, where data is cleaned, features are engineered, and encoders are applied.
- Preprocessed data is then fed into the training component, where different supervised learning algorithms are applied.
- Once the model is trained, the best performing model gets persisted as best_model.pkl along with the preprocessing encoders.
- Visualization components both derive from the analyses done during preprocessing and modeling, showing model performance and data correlations.
- Optionally, note that users can experiment by tweaking hyperparameters and re-running the notebook to see how predictions change.

##### Important Architectural Patterns/Design Principles
- Separation of concerns: Each component (data ingestion, preprocessing, training, persistence, and visualization) is clearly delineated.
- Reusability: The persistence of encoding objects (encoders.pkl) and the model (best_model.pkl) enables reuse for making predictions with new input data.
- Modularity: The system (hosted as a Jupyter Notebook on platforms like Google Colab) demonstrates a modular workflow, useful in prototyping and experimentation.

##### Relevant Technologies, Frameworks, and Libraries
- Python as the core programming language.
- Libraries such as NumPy, Pandas for numerical and data frame operations.
- Scikit-learn (sklearn) and imblearn for model building, preprocessing, and balancing datasets.
- Matplotlib and Seaborn for visualization.
- Pickle for saving (`best_model.pkl` and `encoders.pkl`) the model and its components.
- Google Colab as a potential environment for running this notebook.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Acquisition Layer"
        A["Data Input (train.csv)"]:::dataInput
    end

    subgraph "Preprocessing & Feature Engineering Layer"
        B["Preprocessing & Encoding (encoders.pkl, SMOTE)"]:::preprocessing
    end

    subgraph "Modeling & Evaluation Layer"
        C["Model Training (Decision Tree & Random Forest)"]:::training
        D["Model Persistence (best_model.pkl)"]:::persistence
        E["Visualization & Evaluation (Correlation, Accuracy,GridSearch)"]:::visualization
    end

    A -->|"feeds_data"| B
    B -->|"processed_data"| C
    C -->|"save_model"| D
    C -->|"generate_visuals"| E
    E -->|"feedback_loop"| C

    click A "https://github.com/dev-armaan/autism-prediction/blob/main/train.csv"
    click B "https://github.com/dev-armaan/autism-prediction/blob/main/encoders.pkl"
    click C "https://github.com/dev-armaan/autism-prediction/blob/main/ASD_prediction_model.ipynb"
    click D "https://github.com/dev-armaan/autism-prediction/blob/main/best_model.pkl"
    click E "https://github.com/dev-armaan/autism-prediction/blob/main/ASD_prediction_model.ipynb"

    classDef dataInput fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef preprocessing fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef training fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef persistence fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef visualization fill:#DDA0DD,stroke:#000,stroke-width:2px;
```
