# khanhnamle1994/movielens architecture

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

- Interactive diagram: https://gitdiagram.com/khanhnamle1994/movielens
- Repository: https://github.com/khanhnamle1994/movielens

## Overview

##### Project type and purpose
- This is a data-science demonstration project showcasing four movie recommendation engines (Content-Based & Collaborative Filtering, SVD, Deep Learning) built against the MovieLens 1M dataset.
- It is organized as Jupyter Notebooks plus a utility script (CFModel.py), data files, and saved model weights.

##### File structure
- Top level:
- Notebooks: Data_Processing.ipynb, Content_Based_and_Collaborative_Filtering_Models.ipynb, SVD_Model.ipynb, Deep_Learning_Model.ipynb
- Utility script: CFModel.py (likely encapsulates shared functions or runs experiments in script form)
- Raw data folder “dat/”: users.dat, movies.dat, ratings.dat
- Derived CSVs: users.csv, movies.csv, ratings.csv
- Model artifact: weights.h5 (deep model weights)
- No separate frontend/backend—this is a batch‐style ML pipeline.

##### Key insights from README
- Four distinct modeling approaches, each in its own notebook, all operating on the same preprocessed data.
- Dependencies reflect data handling (pandas, numpy), classical ML (scikit-learn, surprise), deep learning (keras, h5py), and visualization (matplotlib, seaborn, wordcloud).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    subgraph "Raw Data Sources"
        RawUsers["users.dat"]:::data
        RawMovies["movies.dat"]:::data
        RawRatings["ratings.dat"]:::data
    end

    %% Data Processing
    subgraph "Data Processing"
        DataProc["Data_Processing.ipynb\n(pandas, numpy)"]:::processing
    end

    %% Processed Data
    subgraph "Processed CSV Outputs"
        CSVUsers["users.csv"]:::data
        CSVMovies["movies.csv"]:::data
        CSVRatings["ratings.csv"]:::data
    end

    %% Recommendation Engines
    subgraph "Recommendation Engines"
        CB["Content-Based & Collaborative Filtering\n(scikit-learn, surprise, wordcloud)"]:::modeling
        SVD["SVD Model\n(surprise)"]:::modeling
        DL["Deep Learning Model\n(keras, h5py)"]:::modeling
        CFScript["CFModel.py\n(orchestration)"]:::modeling
    end

    %% Artifacts & Outputs
    subgraph "Model Artifacts & Visualization"
        Weights["weights.h5"]:::artifact
        Images["images/"]:::artifact
    end

    %% Documentation
    subgraph "Project Documentation"
        Readme["README.md"]:::artifact
        License["LICENSE"]:::artifact
    end

    %% Connections
    RawUsers --> DataProc
    RawMovies --> DataProc
    RawRatings --> DataProc

    DataProc --> CSVUsers
    DataProc --> CSVMovies
    DataProc --> CSVRatings

    CSVUsers --> CB
    CSVMovies --> CB
    CSVRatings --> CB

    CSVUsers --> SVD
    CSVMovies --> SVD
    CSVRatings --> SVD

    CSVUsers --> DL
    CSVMovies --> DL
    CSVRatings --> DL

    CSVUsers --> CFScript
    CSVMovies --> CFScript
    CSVRatings --> CFScript
    DataProc --> CFScript

    CFScript --> CB
    CFScript --> SVD
    CFScript --> DL

    DL --> Weights

    CB --> Images
    SVD --> Images
    DL --> Images
    CFScript --> Images

    %% Click Events
    click RawUsers "https://github.com/khanhnamle1994/movielens/blob/master/dat/users.dat"
    click RawMovies "https://github.com/khanhnamle1994/movielens/blob/master/dat/movies.dat"
    click RawRatings "https://github.com/khanhnamle1994/movielens/blob/master/dat/ratings.dat"
    click DataProc "https://github.com/khanhnamle1994/movielens/blob/master/Data_Processing.ipynb"
    click CSVUsers "https://github.com/khanhnamle1994/movielens/blob/master/users.csv"
    click CSVMovies "https://github.com/khanhnamle1994/movielens/blob/master/movies.csv"
    click CSVRatings "https://github.com/khanhnamle1994/movielens/blob/master/ratings.csv"
    click CB "https://github.com/khanhnamle1994/movielens/blob/master/Content_Based_and_Collaborative_Filtering_Models.ipynb"
    click SVD "https://github.com/khanhnamle1994/movielens/blob/master/SVD_Model.ipynb"
    click DL "https://github.com/khanhnamle1994/movielens/blob/master/Deep_Learning_Model.ipynb"
    click CFScript "https://github.com/khanhnamle1994/movielens/blob/master/CFModel.py"
    click Weights "https://github.com/khanhnamle1994/movielens/blob/master/weights.h5"
    click Images "https://github.com/khanhnamle1994/movielens/tree/master/images/"
    click Readme "https://github.com/khanhnamle1994/movielens/blob/master/README.md"
    click License "https://github.com/khanhnamle1994/movielens/tree/master/LICENSE"

    %% Styles
    classDef data fill:#D0E8FF,stroke:#0B5394,color:#000
    classDef processing fill:#D0FFD6,stroke:#38761D,color:#000
    classDef modeling fill:#FFF8B0,stroke:#B59F00,color:#000
    classDef artifact fill:#FFE0B2,stroke:#A64D00,color:#000
```
