# avinashrkrk/bitcoin-price-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/avinashrkrk/bitcoin-price-prediction
- Repository: https://github.com/avinashrkrk/bitcoin-price-prediction

## Overview

##### Main Components
- Data Source & Preprocessing:
- Historical Bitcoin price data as the input. This component includes the raw data and the preprocessing steps (normalization, formatting for time-series).
- Data Analysis & Model Training:
- In the Jupyter Notebook (“cryptocurrency_data_analysis_and_prediction.ipynb”), show the steps from exploratory data analysis to training the LSTM neural network. Emphasize the use of libraries such as NumPy, Pandas, Matplotlib, and Scikit-learn in this phase.
- LSTM Model:
- Interactive Prediction (Streamlit App):
- Streamlit application (“app.py”) as the interactive UI that consumes the pre-trained LSTM model. This layer receives user input (e.g., date ranges or feature inputs) and outputs real-time price predictions along with visualizations.
- Visualizations & Output:
- A component for output/visualization (referencing the images that show the dashboard, performance metrics, and detailed predictions).

##### Relationships & Interactions
- Flow of Data:
- Interaction between Model & User Interface:
- Feedback loop (optional):

##### Architectural Patterns & Design Principles
- Separation of concerns:
- Data preprocessing and model training are handled in the Jupyter Notebook.
- The model serving and user interaction are segregated in the Streamlit app.
- Notes on the use of PyTorch for deep learning and Streamlit for rapid UI development.
- That the overall design supports extensibility – for instance, possible future integration with live data feeds or alternative models (e.g., GRU, Transformer).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    data_input["Historical Bitcoin Data"]:::data

    %% Jupyter Notebook Operations Subgraph
    subgraph "Jupyter Notebook Operations"
        preprocessing["Data Preprocessing"]:::notebook
        training["LSTM Model Training"]:::notebook
        preprocessing --> training
    end

    saved_model["Trained LSTM Model (.pth)"]:::model
    streamlit_app["Interactive Prediction (Streamlit App)"]:::ui
    visualization["Output Visualization"]:::visualization
    user["User"]:::user

    %% Data Flow
    data_input --> preprocessing
    training --> saved_model
    saved_model --> streamlit_app
    streamlit_app --> visualization
    streamlit_app --> user
    streamlit_app -->|"feedback"| preprocessing

    %% Click Events
    click preprocessing "https://github.com/avinashrkrk/bitcoin-price-prediction/blob/main/cryptocurrency_data_analysis_and_prediction.ipynb"
    click training "https://github.com/avinashrkrk/bitcoin-price-prediction/blob/main/cryptocurrency_data_analysis_and_prediction.ipynb"
    click saved_model "https://github.com/avinashrkrk/bitcoin-price-prediction/blob/main/lstm_crypto_model.pth"
    click streamlit_app "https://github.com/avinashrkrk/bitcoin-price-prediction/blob/main/app.py"
    click visualization "https://github.com/avinashrkrk/bitcoin-price-prediction/tree/main/images"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef notebook fill:#FFE4B5,stroke:#000,stroke-width:1px;
    classDef model fill:#98FB98,stroke:#000,stroke-width:1px;
    classDef ui fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef visualization fill:#E6E6FA,stroke:#000,stroke-width:1px;
    classDef user fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
