# mohamedadhil10/faang-predict-stock-prices architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedadhil10/faang-predict-stock-prices
- Repository: https://github.com/mohamedadhil10/faang-predict-stock-prices

## Overview

##### Project Type & Purpose
- This is a data science/machine learning application with a web-based UI deployed via Streamlit.
- Its primary purpose is to predict the closing stock prices of FAANG stocks using a RandomForestRegressor model, while also integrating MLflow for experiment tracking and model logging.

##### File Structure
- The project contains only a few files: a dataset (FAANG.csv), the main app (FAANG.py), a requirements.txt file listing dependencies, and a README file.
- All functionality is integrated in a single Python file (FAANG.py), which serves both the ML pipeline and web app interface. This indicates a streamlined architecture rather than a segregated frontend/backend system.
- Configuration/deployment related aspects are handled externally (e.g., via requirements.txt for dependencies).

##### Key Components and Their Relationships
a. Data Input & Preprocessing:
- FAANG.csv serves as the dataset.
- Data cleaning, handling missing values, removing outliers, and feature standardization are performed as a preprocessing step.
b. Exploratory Data Analysis (EDA):
c. ML Model Training & Evaluation:
- A RandomForestRegressor is trained on historical data.
- The training process includes hyperparameter tuning using both randomized search and grid search techniques.
- Performance metrics (MAE, RMSE, R² Score) are calculated to evaluate the model.
d. Experiment Tracking with MLflow:
- MLflow is integrated to log experiments, track hyperparameters, and save the best performing model.
e. Streamlit-based Deployment:
- FAANG.py is a Streamlit application that provides a simple UI where users input stock features (Open, High, Low, Volume) and receive predictions for the closing price.
- This component ties together the preprocessing, model prediction, and user interaction.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    DataSource(("FAANG.csv")):::data
    Preprocessing["Data Processing & EDA"]:::data
    ModelTraining["ML Model Training & Evaluation"]:::ml
    MLflow["MLflow Experiment Tracking"]:::ml
    Deployment["Streamlit Web App"]:::ui

    %% Connections
    DataSource -->|"CleanedData"| Preprocessing
    Preprocessing -->|"ExtractedFeatures"| ModelTraining
    ModelTraining -->|"LoggedModel"| MLflow
    ModelTraining -->|"PredictionOutput"| Deployment

    %% Click Events
    click DataSource "https://github.com/mohamedadhil10/faang-predict-stock-prices/blob/main/FAANG.csv"
    click Preprocessing "https://github.com/mohamedadhil10/faang-predict-stock-prices/blob/main/FAANG.py"
    click ModelTraining "https://github.com/mohamedadhil10/faang-predict-stock-prices/blob/main/FAANG.py"
    click MLflow "https://github.com/mohamedadhil10/faang-predict-stock-prices/blob/main/FAANG.py"
    click Deployment "https://github.com/mohamedadhil10/faang-predict-stock-prices/blob/main/FAANG.py"

    %% Styles
    classDef data fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef ml fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef ui fill:#ffcc99,stroke:#333,stroke-width:2px;
```
