126 lines
5.3 KiB
Markdown
126 lines
5.3 KiB
Markdown
# Praktikum Deep Learning - Kelompok 3
|
|
|
|
Repository ini berisi implementasi tugas dan eksperimen Deep Learning, mencakup perbandingan arsitektur Multi-Layer Perceptron (MLP), teknik regularisasi (Batch Normalization & Dropout), studi kasus pemilihan model (*Model Selection*), serta implementasi Convolutional Neural Network (CNN) pada dataset MNIST.
|
|
|
|
---
|
|
|
|
## 📁 Struktur Folder Proyek
|
|
|
|
Struktur direktori dirapikan secara modular dan terkelompok berdasarkan topik tugas:
|
|
|
|
```text
|
|
kelompok3-deeplearning/
|
|
├── .gitignore # Konfigurasi file & folder yang diabaikan git
|
|
├── requirements.txt # Daftar pustaka / dependensi Python
|
|
├── README.md # Dokumentasi utama proyek
|
|
├── docs/ # Dokumentasi dan analisis laporan
|
|
│ ├── laporan_akhir.md
|
|
│ ├── PRESENTATION.md
|
|
│ ├── model_selection.md
|
|
│ └── analisis_evaluasi_model_sentimen_gap.md
|
|
├── src/ # Modul reusable / fungsi pembantu bersama
|
|
│ ├── __init__.py
|
|
│ ├── data_loader.py # Loader & preprocessor dataset MNIST (MLP & CNN)
|
|
│ ├── models.py # Definisi arsitektur model (MLP, Regularized MLP, CNN)
|
|
│ └── utils.py # Callback timer, manajemen folder, plotting helper
|
|
├── tasks/ # Skrip tugas yang dikelompokkan berdasarkan topik
|
|
│ ├── mlp/ # Topik 1: Multi-Layer Perceptron (MNIST)
|
|
│ │ ├── 01_mlp_comparison.py # Eksperimen perbandingan 3 arsitektur MLP
|
|
│ │ ├── 02_regularization.py # Eksperimen regularisasi (BatchNorm + Dropout)
|
|
│ │ └── 03_model_selection.py # Studi kasus pemilihan arsitektur model
|
|
│ ├── cnn/ # Topik 2: Convolutional Neural Network (MNIST)
|
|
│ │ ├── 04_cnn_mnist.py # Baseline CNN vs MLP
|
|
│ │ ├── 05_cnn_full_pipeline.py # Pipeline CNN lengkap (Loss/Acc curve, Confusion Matrix)
|
|
│ │ ├── 06_cnn_deeper.py # Eksplorasi kedalaman CNN (2 blok vs 3 blok)
|
|
│ │ └── 07_cnn_evaluation.py # Evaluasi mendalam (per-class metrics, confidence, misclassified)
|
|
│ └── nlp_sentiment/ # Topik 3: NLP Analisis Sentimen (Tokopedia)
|
|
│ └── 08_sentimen_gap.py # Klasifikasi sentimen ulasan Tokopedia (GlobalAveragePooling1D)
|
|
└── results/ # Output terorganisir per kelompok tugas
|
|
├── 01_mlp/
|
|
│ ├── figures/ # Visualisasi grafik MLP & regularisasi
|
|
│ ├── models/ # Model terlatih MLP (.keras)
|
|
│ └── reports/ # Laporan & ringkasan metrik MLP (.csv)
|
|
├── 02_cnn/
|
|
│ ├── figures/ # Visualisasi grafik, confusion matrix, error analysis CNN
|
|
│ ├── models/ # Model terlatih CNN (.keras)
|
|
│ └── reports/ # Classification report (.txt, .csv) & evaluasi CNN
|
|
└── 03_nlp_sentiment/
|
|
├── figures/ # Distribusi label, kurva training, confusion matrix GAP
|
|
├── models/ # Model terlatih sentiment GAP (.keras)
|
|
└── reports/ # Classification report sentimen (.txt)
|
|
```
|
|
|
|
---
|
|
|
|
## 🚀 Panduan Instalasi & Menjalankan
|
|
|
|
### 1. Buat dan Aktifkan Virtual Environment
|
|
|
|
```bash
|
|
# Linux / macOS
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
|
|
# Windows (Command Prompt / PowerShell)
|
|
python -m venv .venv
|
|
.venv\Scripts\activate
|
|
```
|
|
|
|
### 2. Install Dependensi
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### 3. Menjalankan Tugas
|
|
|
|
#### 🔹 Topik 1: Multi-Layer Perceptron (MLP)
|
|
```bash
|
|
python tasks/mlp/01_mlp_comparison.py
|
|
python tasks/mlp/02_regularization.py
|
|
python tasks/mlp/03_model_selection.py
|
|
```
|
|
|
|
#### 🔹 Topik 2: Convolutional Neural Network (CNN)
|
|
```bash
|
|
python tasks/cnn/04_cnn_mnist.py
|
|
python tasks/cnn/05_cnn_full_pipeline.py
|
|
python tasks/cnn/06_cnn_deeper.py
|
|
python tasks/cnn/07_cnn_evaluation.py
|
|
```
|
|
|
|
#### 🔹 Topik 3: NLP Analisis Sentimen
|
|
```bash
|
|
python tasks/nlp_sentiment/08_sentimen_gap.py
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Ringkasan Hasil Eksperimen
|
|
|
|
### 1. Perbandingan Arsitektur MLP (Tugas 1)
|
|
- **Model A (1 Hidden Layer - 64)**: ~97.06% Akurasi, 50,890 Parameter
|
|
- **Model B (2 Hidden Layers - 128 → 64)**: ~97.24% Akurasi, 109,386 Parameter
|
|
- **Model C (3 Hidden Layers - 256 → 128 → 64)**: ~97.64% Akurasi, 242,762 Parameter
|
|
|
|
### 2. Regularisasi pada Model C (Tugas 2)
|
|
- Penambahan **Batch Normalization** dan **Dropout (0.3)** terbukti menstabilkan proses training dan menekan *generalization gap* / overfitting pada kurva validasi.
|
|
|
|
### 3. Keunggulan CNN vs MLP pada MNIST (Tugas 4)
|
|
| Metrik | MLP Terbaik (Model C) | CNN Sederhana | Perubahan |
|
|
| :--- | :--- | :--- | :--- |
|
|
| **Test Accuracy** | 97.64% | **99.03%** | **+1.39%** |
|
|
| **Error Rate** | 2.36% | **0.97%** | **-58.9% (relatif)** |
|
|
| **Jumlah Parameter** | 242,762 | **121,930** | **-49.8% (lebih efisien)** |
|
|
| **Salah Klasifikasi** | 236 / 10,000 | **97 / 10,000** | **139 gambar lebih sedikit** |
|
|
|
|
---
|
|
|
|
## 🛠️ Teknologi & Framework
|
|
- Python 3.10+
|
|
- TensorFlow / Keras
|
|
- NumPy & Pandas
|
|
- Matplotlib & Seaborn
|
|
- XGBoost & Scikit-Learn
|
|
|