GithubHelp home page GithubHelp logo

pwc2 / perceptron Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 213.22 MB

Implementation of perceptron algorithm for binary classification using numpy. Online, average, and polynomial kernel models available.

Python 100.00%
perceptron perceptron-learning-algorithm kernel-methods

perceptron's Introduction

perceptron

perceptron contains implementations of the perceptron with online learning, the average perceptron, and a polynomial kernel perceptron.

Requirements:

  • numpy 1.17.2

  • pandas 0.25.1

  • progressbar2 3.37.1

Usage:

from models.perceptron import Perceptron

model = Perceptron(train='pa2_train_clean.csv',
                   validation='pa2_valid_clean.csv',
                   test='pa2_test_no_label_clean.csv',
                   label='label', # Specify target name
                   mod_type='online', # Choose model type
                   max_iter=15, # Set maximum iterations for training
                   p=None) # If using polynomial kernel, set degree

learned_model = model.train_model()

Data:

The data/ folder contains .csv files with training, validation, and test sets.

To run models:

  • run_part0.py runs pre-processing.
  • run_part1.py runs online perceptron.
  • run_part2.py runs average perceptron.
  • run_part3.py runs perceptron using a polynomial kernel.

python main.py will run all four parts in order, output will be saved in model_output folder.

perceptron's People

Contributors

pwc2 avatar

Stargazers

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