/Bayes-classifier-and-Nearest-Neighbour-classifier

In this repository, we will explore and compare different methods of classifiers such as Bayes classifier and Nearest Neighbour classifier.

Primary LanguagePythonMIT LicenseMIT

Language Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Pattern Recognition and Neural Networks

Classifiers and Sentiment analysis
Explore the repository»

View Problem Statement View Report

tags : bayes classifier, nearest neighbour classifier, EM algorithm, gaussian mixtures, density estimation, sentiment analysis, maximum likelihood estimation, tfidf, bag of words

About The Repository

This repository holds the python implementation files for Assignment #1 for E1 213 Pattern Recognition and Neural Networks offered at the Indian Institute of Science (IISc), Bangalore. In this assignment we will explore and compare different methods of classifiers. In all the problems, we have some data on which 2-class classifiers have to be learnt, and then its performance has to be assessed using a test set. The following methods have been implemented across the problems.

  • Bayes classifier
  • Nearest neighbour classifier
  • EM algorithm for Gaussian mixtures
  • Density estimation
  • Maximum Likelihood Estimation
  • Sentiment analysis (Movie review)

Problem 1 deals with the implementation of 2-class Bayes classifier, and nearest neighbour classifier using the values estimated by maximum likelihood and EM algorithm for GMM. Problem 2 deals with the implementation of 2-class Bayes classifier using the values estimated by maximum likelihood and nearest neighbour classifier. Problem 3 deals with implementation of Bayes classifier for Gaussian mixture class conditional densities. Problem 4 deals with the implementation of sentiment analysis of movie reviews using bag of words approach and TF-IDF approach.

Built With

This project was built with

  • python v3.7
  • The list of libraries used for developing this project is available at requirements.txt.

Getting Started

Clone the repository into a local machine using

git clone https://github.com/vineeths96/Bayes-classifier-and-Nearest-Neighbour-classifier

Prerequisites

Please install required libraries by running the following command (preferably within a virtual environment).

pip install -r requirements.txt

Instructions to run

There are four python files - problem_1.py, problem_2.py, problem_3.py , and problem_4.py - each corresponding to the particular problem in the Problem Statement. Each problem has their corresponding implementation files under a python package with the same name. Each package has python modules and functions to load data, train a model, test it, and write the performance metrics to an output file at ./results with the same file name.

Running the program
python problem_<QUES_NUM>.py

Results

View Report for the results and detailed discussions.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Vineeth S - vs96codes@gmail.com

Project Link: https://github.com/vineeths96/Bayes-classifier-and-Nearest-Neighbour-classifier