Giter VIP home page Giter VIP logo

svc-demo's Introduction

SVC-Demo

This project enables users to play around with a linear SVM (Support Vector Machine). Users provide labeled and unlabeled data points that are rendered on a Cartesian plane (powered by React & Chart.js). This data is served to a sklearn SVC model on the backend (FastAPI) that returns metrics around SVM performance + data necessary to render the decision boundary and margins. The purpose of this demo is to help demystify SVMs โœจ

Tech Stack

Frontend: React, Chart.js, react-chart-js-2
Backend: FastAPI, scikit-learn

Running the Project Locally

Requirements

  • npm v8 or higher
  • Python v3.8.13 or higher
  • node v16 or higher

Setup

Fork and clone this repository

Frontend

From parent directory...

cd client
npm install
npm start

This will spin up the React frontend on http://localhost:3000

Backend

From parent directory...

cd backend

Create python virtual environment

  • For users with conda distribution:
    • conda create --name <venv> python=3.8
    • conda deactivate
    • conda activate <venv>
  • For other distributions:
    • pip install virtualenv (if not already installed)
    • python3 -m venv <virtual-environment-name>
    • source env/bin/activate

Next, install the necessary python packages in your virtual environment

pip install fastapi
pip install uvicorn
pip install scikit-learn

And finally...

uvicorn server:app --reload

This starts the server on http://localhost:8000

Using the app

  1. Choose x and y values for at least two points. (The model requires at least 1 labeled and 1 unlabeled point to generate a response)
  2. Hit Submit!
  3. Take a look at 1) the chart -- the legend describes what the different colors and shadings represent (SV = Support Vector), and 2) the SVC Metrics section -- this contains "Fit Status", "Model Accuracy", and "Margin Value" information.
  4. Play around with the demo! (add points, remove points, or change points to see how the SVM responds)

Resources & Credits

If you want to learn more about SVMs, please check out Serafeim Loukas' "Support Vector Machines (SVM) clearly explained: A python tutorial for classification problems with 3D plots" or Alex Kataev's "SVM Classification with sklearn.svm.SVC: How To Plot A Decision Boundary With Margins in 2D Space" -- both of these articles helped make SVMs more intuitive for me, and I hope they do the same for you!

Contact

If you have feedback or are interested in collaborating, I'd love to connect! My email is [email protected]. Or if you prefer LinkedIn, drop me a DM ๐Ÿ™‚

svc-demo's People

Contributors

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