Giter VIP home page Giter VIP logo

okdotdev / k-nearest-neighbors-algorithm-implementation-java Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 9 KB

This project implements the K-Nearest Neighbors (KNN) algorithm for classification purposes. KNN is a simple and effective algorithm for classifying data points based on their similarity to other data points in a given dataset.

Java 100.00%
java java-8 knn knn-algorithm knn-classification knn-model knn-regression knn-java

k-nearest-neighbors-algorithm-implementation-java's Introduction

โœจ KNN (K-Nearest Neighbors) Algorithm Implementation

This project implements the K-Nearest Neighbors (KNN) algorithm for classification purposes. KNN is a simple and effective algorithm for classifying data points based on their similarity to other data points in a given dataset. This project was made for NAI (Tools Of Artificial Inteligence) class at Pjait.

๐Ÿ“ Project Overview

The project consists of two main classes:

  1. KNN Class: This class encapsulates the logic for performing KNN classification. It includes methods for predicting tags, finding nearest neighbors, determining tags based on neighbors, calculating Euclidean distance, and displaying correct predictions percentage.

  2. Main Class: The main class contains the entry point of the application. It loads training and test data from files, prompts the user for the value of parameter k, performs classification on test data using the KNN model, and displays the percentage of correct predictions. Additionally, it allows users to input their own data for classification.

๐Ÿš€ Usage

  1. Running the Application: Execute the Main.java file to start the application.
  2. Input: Provide the value of parameter k when prompted. The application will then classify test data using the KNN algorithm and display the percentage of correct predictions.
  3. Custom Input: After classification, the application allows users to input their own data for classification. Follow the prompts and input your data to see the predicted tag.

๐Ÿ“ Project Structure

  • KNN.java: Contains the implementation of the KNN algorithm.
  • Main.java: Entry point of the application, responsible for data loading, classification, and user interaction.
  • DataReader.java: Utility class for reading data from files.
  • Data.java: Class representing individual data instances.

๐Ÿ› ๏ธ Dependencies

  • Java 8 or higher

k-nearest-neighbors-algorithm-implementation-java's People

Contributors

okdotdev avatar

Stargazers

 avatar

Watchers

 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.