How althariqfairuz/tubes-ml-2 works
Project Type and Purpose
• This is a research-style machine-learning experiment repository, not a web or full-stack application. Its goal is to implement and benchmark three deep-learning architectures (CNN, RNN, LSTM) “from scratch” using NumPy, compare them against Keras/TensorFlow baselines, and systematically explore hyperparameter settings.
File Structure
• Top-level directories:
• datasets/ ‑ raw CSV files (train, valid, test)
• models/ ‑ saved model binaries (.h5, .keras) from Keras runs
• src/ ‑ source code grouped by algorithm: cnn/, rnn/, lstm/, plus shared utils/
• docs/ ‑ static report PDF
• In each algorithm folder (e.g., src/cnn/):
• \*_from_scratch.py: pure-NumPy implementation
• model_training.py: training scripts that wrap both scratch and Keras variants
• .ipynb: Jupyter notebook that orchestrates experiments, visualization, and evaluation
• Shared utils: data_preprocessing.py handles tokenization and sequence/vector preparation for text.
README for Additional Insights
• Confirms that:
• CNN is applied to CIFAR-10 image classification.
• RNN and LSTM are applied to NusaX-Sentiment text classification.
• Experiments compare depth, width, pooling, bidirectionality.
• Metrics: training/validation loss curves, macro F1-score, Keras vs scratch difference ≤0.001.
Main Components of the System
a. Data Layer:
• Raw datasets in CSV form (text)
• CIFAR-10 auto-download module (inside TensorFlow calls in notebooks)
b. Preprocessing Layer (utils):
• Text tokenization, sequence padding (src/utils/data_preprocessing.py)
• Image scaling / batch preparation (built into model_training notebooks)
c. Model Implementation Layer:
• Scratch implementations (cnn_from_scratch.py, rnn_from_scratch.py, lstm_from_scratch.py)
• Keras/TensorFlow implementations (inside model_training.py)
d. Training & Evaluation Layer:
• model_training.py orchestrates data → model → training loop → evaluation metrics
• Experiment notebooks (.ipynb) that call training scripts, plot curves, compute F1
e. Persistence Layer:
• models/ directory stores serialized checkpoints/configurations
f. Reporting & Visualization:
• Jupyter notebooks generate plots (Matplotlib/Seaborn) and result tables
• docs/K01-G65-Laporan.pdf contains the formal write-up
Relationships and Data Flow
• Data (CSV or CIFAR-10) → Preprocessing Utilities → Two parallel paths:
• Scratch Model Implementation → Training Loop → Evaluation → Model Checkpoint
• Keras Model Implementation → Training Loop → Evaluation → Model Checkpoint
• Both paths feed results back into the Notebooks for visualization and comparison.
Architectural Patterns and Design Principles
• Modular separation: one folder per algorithm prevents cross-contamination and eases extension.
• Reusability: shared preprocessing utilities.
• Experimentation pipelines: notebooks drive parameter sweeps and visual feedback.
Relevant Technologies and Frameworks
• Core: Python 3.8+, NumPy (scratch math), Pandas (CSV), Scikit-learn (metrics), Matplotlib/Seaborn (plots)
• Deep Learning: TensorFlow/Keras (baseline models, CIFAR-10 loader)
• Environment: Jupyter notebooks for interactive runs