Skip to content

Commit 9935191

Browse files
author
Shammamah Hossain
authored
Merge pull request plotly#101 from plotly/dash-svm
Dash svm
2 parents 0714c15 + 4c4fcb2 commit 9935191

File tree

12 files changed

+1625
-0
lines changed

12 files changed

+1625
-0
lines changed

apps/dash-svm/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn --pythonpath apps/dash-svm app:server

apps/dash-svm/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Support Vector Machine (SVM) Explorer [![Mentioned in Awesome Machine Learning](https://awesome.re/mentioned-badge.svg)](https://github.com/josephmisiti/awesome-machine-learning)
2+
3+
This is a learning tool and exploration app made using the Dash interactive Python framework developed by [Plotly](https://plot.ly/).
4+
5+
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](https://plot.ly/dash).
6+
7+
Try out the [demo app here](https://dash-svm.plot.ly/).
8+
9+
![alt text](images/screenshot.png "Screenshot")
10+
11+
12+
## Getting Started
13+
### Using the demo
14+
This demo lets you interactive explore Support Vector Machine (SVM).
15+
16+
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.
17+
18+
The other dropdowns and sliders lets you change the parameters of your classifier, such that it could increase or decrease its accuracy.
19+
20+
### Running the app locally
21+
22+
First create a virtual environment with conda or venv inside a temp folder, then activate it.
23+
24+
```
25+
virtualenv dash-svm-venv
26+
27+
# Windows
28+
dash-svm-venv\Scripts\activate
29+
# Or Linux
30+
source venv/bin/activate
31+
```
32+
33+
Clone the git repo, then install the requirements with pip
34+
```
35+
git clone https://github.com/plotly/dash-sample-apps/apps/dash-svm.git
36+
cd dash-sample-apps/apps/dash-svm
37+
pip install -r requirements.txt
38+
```
39+
40+
Run the app
41+
```
42+
python app.py
43+
```
44+
45+
## About the app
46+
### How does it work?
47+
48+
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.
49+
50+
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.
51+
52+
### What is an SVM?
53+
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](https://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf).
54+
55+
## Built With
56+
* [Dash](https://dash.plot.ly/) - Main server and interactive components
57+
* [Plotly Python](https://plot.ly/python/) - Used to create the interactive plots
58+
* [Scikit-Learn](http://scikit-learn.org/stable/documentation.html) - Run the classification algorithms and generate datasets
59+
60+
61+
## Authors
62+
63+
* **Xing Han Lu** - *Initial Work* - [@xhlulu](https://github.com/xhlulu)
64+
* **Matthew Chan** - *Code Review* - [@matthewchan15](https://github.com/matthewchan15)
65+
* **Yunke Xiao** - *Redesign* - [@YunkXiao](https://github.com/YunkeXiao)
66+
* **celinehuang** - *Code Review* - [@celinehuang](https://github.com/celinehuang)
67+
68+
69+
## Acknowledgments
70+
The heatmap configuration is heavily inspired from the [scikit-learn Classification Comparison Tutorial](http://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html). Please go take a look!
71+
72+
The idea of the [ROC Curve, the Matrix Pie Chart and Thresholding](https://github.com/nicolaskruchten/dash-roc) came from @nickruchten. The app would not have been as complete without his insightful advice.
73+

0 commit comments

Comments
 (0)