Skip to content

satyapalsinh10/2D_Classification_And_Regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Implemention of Classification and Regression by designing NLL and MSE Loss functions

This repository contains the implementation of a fully-connected network using PyTorch to solve a classification and Regression problems.

Problem 1: Classification for Gaussian Dataset

1.1 Dataset Generation

The dataset is generated by creating 4 two-dimensional Gaussian distributions, each representing a different class. The means and standard deviations for the Gaussians can be customized as per requirements. The dataset is then randomly permuted to ensure randomness during training and testing. We have designed a fully-connected neural network with at two hidden layers to solve this classification problem.

1.2 Network Architecture and Implementation

The implemented network is a fully-connected neural network with two hidden layer. The implementation is done using the PyTorch framework. The steps followed in solving the classification problem are as follows:

  • Generated the dataset consisting of four two-dimensional Gaussians representing four different classes.
  • Randomly permuted the dataset to create training and testing sets.
  • Designed and defined the architecture of the fully-connected network.
  • Implemented the network using PyTorch, specifying the layers, activation functions, and other necessary components.
  • Trained the network using the training dataset, optimizing the weights using the negative log-likelihood (NLL) loss function.
  • Monitored the training process by plotting the train and test loss as a function of training time. Calculated the loss after each data mini-batch.
  • Evaluated the final training and test accuracy of the network.

1.3 Results

Problem 2: Regression for 2-D Dataset

This repository contains the implementation of a fully-connected neural network using PyTorch to predict the value of a given function f(x, y) = x^2 + xy + y^2.

2.1 Dataset

The dataset consists of 5000 data points randomly generated from a uniform distribution within the range [-10, 10] for both x and y values. Each data point is associated with a target value calculated using the function f(x, y) = x^2 + xy + y^2.

2.2 Architecture Training and Testing

The neural network is designed as a fully-connected feedforward network with at two hidden layer. The dataset is split into training and testing sets with a ratio of 90:10. 90% of the data is used for training the network, while the remaining 10% is used for evaluating its performance.

Implemented mean-squared error (MSE) loss function to measure the difference between the predicted values and the ground truth targets. The training loss and test loss are calculated and monitored during the training process.

Followed the below steps to solve the problem:

  • Implement the fully-connected neural network using PyTorch.
  • Split the data into training and testing sets, with 10% of the data reserved for testing.
  • Use the mean-squared error (MSE) as the loss function.
  • Plot the train and test loss as a function of the training time, reporting the loss after each data mini-batch.
  • Calculate and report the final training and test loss.

2.3 Results

Disclaimer

This implementation is for solving the given classification and regression problem. It is important to understand the problem requirements and customize the network architecture, hyperparameters, and other components accordingly. The accuracy and performance of the network may vary depending on the specific dataset and problem complexity.

About

Classification of 2D Gaussians using Negative log-likelihood

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published