Skip to content

RealNath/student-placement-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Student Placement Predictor (TUGAS BESAR 1 IF3270 Pembelajaran Mesin)

Deskripsi Singkat Program - Description

Repositori ini berisi implementasi Feedforward Neural Network (FFNN) from scratch menggunakan Python dan NumPy untuk melakukan analisis dan pemodelan pada Global Student Placement & Salary Dataset (datasetml_2026.csv). Implementasi ini berisikan berbagai fungsi aktivasi, forward propagation, backpropagation, metode inisialisasi bobot, regularisasi L1/L2, optimizer SGD dan Adam, normalisasi RMSNorm, fitur untuk save/load model, serta notebook berisikan pengujian yang dilengkapi oleh visualisasi hasil.

This repository contains the implementation of Feedforward Neural Network from scratch with Python and Numpy for analyzing and modelling the neural network based on Global Student Placement & Salary Dataset (datasetml_2026.csv). This implementation contains various activation functions, forward propagation, backward propagation, weight initialization methods, L1/L2 regularization, SGD and Adam optimizers, RMSNorm (Root Mean Square Normalization), feature for saving/loading model, as well as notebook for testing with visualization of results.

Fitur-Fitur yang Tersedia - Features

  • Arsitektur FFNN yang fleksibel dengan jumlah layer dan neuron yang dapat dikonfigurasi secara dinamis
    Flexible FFNN architectures with dynamically configurable layer and neuron counts

  • Fungsi aktivasi: Linear, ReLU, Sigmoid, Tanh, Softmax, Leaky ReLU dan ELU (beserta turunannya)
    Activation functions: Linear, ReLU, Sigmoid, Tanh, Softmax, Leaky ReLU, and ELU (as well as their derivatives)

  • Inisialisasi bobot: Zero, Distribusi Uniform, Distribusi Normal, Xavier Uniform, Xavier Normal dan He
    Weight initialization: Zero, Uniform Distribution, Normal Distribution, Uniform Xavier, Normal Xavier, Kaiming He

  • Loss function: Mean Squared Error (MSE), Binary Cross-Entropy, Categorical Cross-Entropy

  • Regularisasi: L1 dan L2 dengan parameter lambda_reg yang dapat dikonfigurasi
    Regularization: L1 and L2 with configurable lambda_reg

  • Optimizer: SGD, Adam (Adaptive Moment Estimation)

  • Normalisasi RMSNorm (Root Mean Square)
    Root Mean Square Normalization

  • Mini-batch gradient descent dengan ukuran batch yang dapat dikonfigurasi
    Mini-batch gradient descent with configurable batch size

  • Visualisasi distribusi bobot, bias dan gradien tiap layer
    Visualization of weight, bias, gradient distributions of each layer

  • Fitur save dan load model
    Save and load model

  • Ekspor plot distribusi bobot dan gradien ke file PNG
    Export weight and gradient distribution plots to PNG

Bonus yang Dikerjakan - Bonuses

  • Fungsi aktivasi tambahan: Leaky ReLU dan ELU beserta turunannya
    Additional activation functions: Leaky ReLU and ELU; with their derivatives

  • Metode inisialisasi bobot tambahan: Xavier (Uniform dan Normal) dan He initialization
    Additional weight initialization methods: Xavier (Uniform and Normal) and He initialization

  • Normalisasi RMSNorm dengan analisis perbandingan performa model dengan dan tanpa normalisasi
    RMSNorm normalization with comparison of performance with vs without normalization

  • Adam (Adaptive Moment Estimation) optimizer dengan analisis perbandingan performa dan konvergensi terhadap SGD Adam optimizer with comparison of performance and convergence using Adam vs SGD

Cara Setup dan Run Program - How to Setup and Run the Program

  1. Pertama-tama, clone repository di bawah ini:
    Clone the repository first

    git clone https://github.com/RealNath/student-placement-predictor.git
  2. Setelah itu, install seluruh dependency yang diperlukan
    Install the needed dependencies

    pip install -r requirements.txt
  3. Kemudian, Anda dapat menjalankan program dengan dua cara, yaitu:
    You may run the program with one of the methods below:
    Opsi 1: Menjalankan main.py - Option 1: Run main.py

    cd src
    python main.py

    Program akan melatih model, menampilkan hasil akurasi final pada test set, menyimpan hasil prediksi ke data/results.csv, serta menampilkan plot distribusi bobot dan gradien ke dalam bentuk file PNG.
    The program may train the model, display the final accuracy of the test set, save the prediction's results to data/results.csv, as well as display the plot of weight and gradient distribution in PNG

    Opsi 2: Jupyter Notebook - Option 2: Jupyter Notebook

    cd src/notebooks

    Buka salah satu dari delapan notebook yang tersedia di folder notebooks/ sesuai eksperimen yang ingin dijalankan. Setelah itu, Anda dapat menjalankan seluruh isi dari file dalam notebook tersebut dengan menekan tombol "Run All". Kemudian, kode akan dijalankan dan menampilkan hasil dan visualisasi pengujian.
    Open one of the 8 notebooks in notebooks/ based on the experiment wanted. You may run the entire code cells in the notebook files by clicking "Run All". The codes will then be executed and display the results and visualization of the experiments

Struktur Repository - Repository Structure

student-placement-predictor/
│
├── data/
│   ├── datasetml_2026.csv
│   ├── results.csv
│   ├── results_from_scratch.csv
│   └── results_sklearn.csv
│
├── src/
│   ├── notebooks/
│   │   ├── activation_function.ipynb
│   │   ├── adam_vs_sgd.ipynb
│   │   ├── depth_and_width.ipynb
│   │   ├── learning_rate.ipynb
│   │   ├── regularization.ipynb
│   │   ├── rmsnorm_vs_normal.ipynb
│   │   ├── sklearn_vs_scratch.ipynb
│   │   └── weight_initialization.ipynb
│   │
│   ├── utils/
│   │   ├── activation_functions.py
│   │   └── neural.py
│   │
│   └── main.py
│
├── reports/
│   ├── gradient_distribution.png
│   └── weight_distribution.png
│
├── README.md
└── LICENSE

Penjelasan Singkat File

  • src/utils/activation_functions.py: Berisi implementasi fungsi aktivasi dan turunannya yang digunakan dalam model FFNN, yaitu Linear, ReLU, Sigmoid, Tanh, Softmax, Leaky ReLU dan ELU, serta helper function get_activation() untuk mapping fungsi aktivasi berdasarkan nama.
  • src/utils/neural.py: Berisi implementasi utama kelas FFNN yang berisikan forward propagation, backpropagation, berbagai metode inisialisasi bobot, loss function, regularisasi L1/L2, optimizer SGD dan Adam, normalisasi RMSNorm, serta fitur save/load model dan visualisasi distribusi bobot dan gradien.
  • src/main.py: Berisi skrip utama untuk menjalankan pipeline, mulai dari loading dan preprocessing dataset, split data, pelatihan model, evaluasi pada test set, hingga plot distribusi bobot dan gradien ke PNG.
  • src/notebooks/activation_function.ipynb: Notebook ini berisi pengujian yang dilakukan untuk menguji pengaruh pemilihan fungsi aktivasi terhadap performa model FFNN.
  • src/notebooks/learning_rate.ipynb: Notebook ini berisi pengujian yang dilakukan untuk menguji pengaruh variasi learning rate terhadap konvergensi dan performa model FFNN.
  • src/notebooks/sklearn_vs_scratch.ipynb: Notebook ini berisi pengujian yang dilakukan untuk membandingkan performa model FFNN from scratch dengan implementasi MLPClassifier dari Scikit-learn menggunakan konfigurasi yang identik.
  • src/notebooks/adam_vs_sgd.ipynb: Notebook ini berisi pengujian yang dilakukan untuk membandingkan performa dan kecepatan konvergensi antara optimizer SGD dan Adam pada model FFNN.
  • src/notebooks/rmsnorm_vs_normal.ipynb: Notebook ini berisi pengujian yang dilakukan untuk membandingkan performa model FFNN dengan dan tanpa penggunaan RMSNorm pada proses training.
  • src/notebooks/regularization.ipynb: Notebook ini berisi pengujian yang dilakukan untuk membandingkan dampak tiga kondisi regularisasi (tanpa regularisasi, L1, dan L2) terhadap performa dan konvergensi model FFNN.
  • src/notebooks/weight_initialization.ipynb: Notebook ini berisi pengujian yang dilakukan untuk membandingkan pengaruh enam metode inisialisasi bobot, yaitu Zero, Uniform, Normal, Xavier Uniform, Xavier Normal dan He terhadap performa dan kecepatan konvergensi model FFNN.
  • src/notebooks/depth_and_width.ipynb: Notebook ini berisi pengujian yang dilakukan untuk menguji pengaruh variasi width dan depth arsitektur terhadap performa model FFNN.

Anggota Kelompok

Kelompok: 01

NIM Nama Pembagian Tugas
13523132 Jonathan Levi Mengimplementasi struktur awal program (prosedural), implementasi awal forward dan backward propagation, inisialisasi Xavier Normal, fungsi aktivasi utama beserta 2 fungsi bonus (Leaky ReLU & ELU) dan turunannya, Adam optimizer, pengujian dan visualisasi dalam notebook, laporan
13523141 Jovandra Otniel P. S. Mengimplementasikan turunan fungsi aktivasi utama, implementasi awal backward propagation, regularisasi L1/L2, loss function, pengujian dan visualisasi dalam notebook, debugging, laporan
13523157 Natalia Desiany Nursimin Refactor kode ke dalam bentuk OOP, pengembangan forward dan backward propagation, inisialisasi He dan Xavier Uniform, normalisasi RMSNorm, tampilan plot distribusi bobot dan gradien bobot, fitur save/load model, pengujian, laporan

About

A feedforward neural network model that predicts student's placements based on Global Student Placement & Salary Dataset

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors