Code Monkey home page Code Monkey logo

multilabelclassifierpytorch's Introduction

PyTorch Multi-Label Classifier for Even MNIST dataset

Overview

This project delves into the intricacies of multi-label classification, leveraging the powerful PyTorch framework to construct and train a neural network. The focus is on the Even MNIST dataset—a modified version of the famous MNIST dataset, comprising only the even digits. By reducing the image resolution for expedited training, this endeavor seeks not only to accurately classify these digits but also to serve as an explorative journey into the capabilities and utilization of neural networks within the domain of machine learning.

Features

  • Neural Network Model: Utilizes a fully connected deep neural network, designed and implemented in PyTorch, for the classification task.
  • Custom Dataset Handling: Demonstrates the process of dataset preparation and loading within PyTorch, tailored for a specific classification problem.
  • Dynamic Parameter Adjustment: Employs a JSON-based configuration system to easily tweak hyperparameters, allowing for flexible experimentation.
  • Performance Visualization: Includes functionality to generate visual reports of the model's performance, detailing both loss and accuracy over time.

Results

Performance_graphs

The performance of the neural network model is summarized through two key metrics: loss and accuracy. These metrics are visualized over the training epochs for both the training and test datasets.

Loss Performance

The loss graph presents a sharp decline in the initial epoch, indicating a significant improvement in the model's learning capability at the beginning of the training process. Following this rapid descent, the curve flattens, suggesting that the model quickly reaches a point of diminishing returns with each subsequent epoch. Both the training and test loss exhibit a convergent behavior, with the test loss slightly higher than the training loss, a common and expected phenomenon due to the model being more familiar with the training data.

Accuracy Performance

The accuracy graph showcases a swift ascent to high accuracy levels, reflecting the model's effectiveness at correctly classifying the even digits from the MNIST dataset. The training accuracy slightly outperforms the test accuracy, which may indicate a good fit to the data without significant overfitting. The model achieves near-peak accuracy rapidly, and further epochs bring marginal gains, indicating that the model efficiently captures the underlying patterns in the dataset.

Overall, the performance charts demonstrate a successful training phase, with the model achieving high levels of accuracy while maintaining a manageable difference between the training and test metrics, suggesting a balanced fit to the data. This balance between learning from the training data and generalizing to unseen test data is crucial for the robust performance of a machine learning model.

Getting Started

Prerequisites

  • Python 3.x
  • PyTorch
  • numpy
  • matplotlib
  • tqdm

Data Files

The project utilizes the even_mnist.csv dataset located in the data directory. This file contains grayscale images of even digits from the MNIST dataset, resized to 14x14 pixels for efficient training. Each row represents a flattened image followed by its label.

Configuration Files

Model and training hyperparameters are defined in a JSON file located in the param directory. This allows for easy adjustments to parameters such as the learning rate, batch size, and the number of epochs without altering the main script.

Example parameters.json:

{
	"learning rate": 0.001,
	"num iter": 10,
	"img_rows": 14,
	"img_cols": 14,
	"batch_size" : 128,
	"num_classes": 10	
}

Installation

Clone this repository to your local machine:

git clone https://github.com/YourUsername/MultiLabelClassifierPyTorch.git

Navigate to the project directory:

cd MultiLabelClassifierPyTorch

Install the required dependencies:

pip install -r requirements.txt

Usage

To train the model and evaluate its performance, run:

python Scripts/main.py param/parameters.json

multilabelclassifierpytorch's People

Contributors

satvikvarshney avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.