GithubHelp home page GithubHelp logo

simple_perceptron's Introduction

Simple Perceptron Learning Algorithm (PLA) Coding Challenge

This is a Python script that implements the Perceptron Learning Algorithm (PLA) for a binary classification problem. The script allows you to train a simple perceptron model on a training dataset and evaluate its performance on a testing dataset. Additionally, it provides a visualization of the classification results in a 2D plot.

How to Run the Script

  1. Ensure you have Python installed on your system.

  2. Clone or download this repository to your local machine.

  3. Open a terminal or command prompt and navigate to the directory where the script is located.

  4. Run the script using the following command: python simple_pla.py

  5. Follow the on-screen prompts to provide input for the training and testing datasets.

Input Format

The script expects input in the following format:

<num_examples> <num_features>
<feature1_value> <featurex_value> <class_label>
<feature1_value> <featurex_value> <class_label>

Where:
num_examples: The number of input samples in the dataset.
num_features: The number of features for each input sample.
feature1_value, feature2_value, ...: The values of the features for each input sample.
class_label: The class label for each input sample, which should be either -1 or 1 for binary classification.

Example input

Here is an example training set:

6 2
77 66 1
86 14 1
50 21 -1
42 82 1
28 78 1
22 32 -1

And a testing set:

10 2
23 47 -1
26 2 -1
96 78 1
1 65 -1
64 40 1
13 68 1
24 5 -1
69 32 1
21 19 -1
65 88 1

Output

  • The script will display the accuracy of the perceptron model on the testing dataset.
  • It will also generate a 2D plot to visualize the classification results. The plot shows correctly classified points in green and incorrectly classified points in red.
  • If you input more than 2 features you will be asked to provide two feature indices for the plotting.

simple_perceptron's People

Contributors

dimiz51 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.