Skip to content

Interactive SVM Explorer, using Dash and scikit-learn

License

Notifications You must be signed in to change notification settings

VanessaKamara/dash-svm

 
 

Repository files navigation

Support Vector Machine (SVM) Explorer GitHub license Mentioned in Awesome Machine Learning

This is a learning tool and exploration app made using the Dash interactive Python framework developed by Plotly.

Dash abstracts away all of the technologies and protocols required to build an interactive web-based application and is a simple and effective way to bind a user interface around your Python code. To learn more check out our documentation.

Try out the demo app here.

animated1

Getting Started

Using the demo

This demo lets you interactive explore Support Vector Machine (SVM).

It includes a few artificially generated datasets that you can choose from the dropdown, and that you can modify by changing the sample size and the noise level of those datasets.

The other dropdowns and sliders lets you change the parameters of your classifier, such that it could increase or decrease its accuracy.

Running the app locally

First create a virtual environment with conda or venv inside a temp folder, then activate it.

virtualenv dash-svm-venv

# Windows
dash-svm-venv\Scripts\activate
# Or Linux
source venv/bin/activate

Clone the git repo, then install the requirements with pip

git clone https://github.com/plotly/dash-svm.git
cd dash-svm
pip install -r requirements.txt

Run the app

python app.py

About the app

How does it work?

This app is fully written in Dash + scikit-learn. All the components are used as input parameters for scikit-learn functions, which then generates a model with respect to the parameters you changed. The model is then used to perform predictions that are displayed on a contour plot, and its predictions are evaluated to create the ROC curve and confusion matrix.

In addition to creating models, scikit-learn is used to generate the datasets you see, as well as the data needed for the metrics plots.

What is an SVM?

An SVM is a popular Machine Learning model used in many different fields. You can find an excellent guide to how to use SVMs here.

Built With

  • Dash - Main server and interactive components
  • Plotly Python - Used to create the interactive plots
  • Scikit-Learn - Run the classification algorithms and generate datasets

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

The heatmap configuration is heavily inspired from the scikit-learn Classification Comparison Tutorial. Please go take a look!

The idea of the ROC Curve, the Matrix Pie Chart and Thresholding came from @nickruchten. The app would not have been as complete without his insightful advice.

Screenshots

About

Interactive SVM Explorer, using Dash and scikit-learn

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 67.3%
  • CSS 32.7%