A tool for visualizing the decision boundary of a machine learning model.
Project description
Short Description
This is the package provides functionality for visualizing the classifiers decision boundaries.
It is based on the work of Cristian Grosu for the master thesis project for 2023 at Utrecht University.
If you use this package, please cite the following paper:
[PLACEHOLDER FOR THE PAPER](http://google.com/)
The package is available on PyPI and can be installed using pip: pip install decision-boundary-mapper
Documentation
See more details at https://decisionboundarymapper.000webhostapp.com/
Usage exmaples
- This package comes with a simple GUI that allows you to visualize the decision boundaries of a classifier. The GUI is based on the
PySimpleGUI
package and can be started by running the following code:
from decision_boundary_mapper import GUI
GUI().start()
- The package comes with two examples of complete pipelines for visualizing the decision boundaries of a classifier.
Both examples use
MNIST
(handwritten digits) dataset. The first exampleDBM_usage_example
usest-SNE
to project the data from thenD
space to the2D
space, then neural network is trained to fit the inverse projection from2D
tonD
and the decision boundaries are visualized using the2D
projection. The second exampleSDBM_usage_example
uses a neural network with an autoencoder architecture to learn the projection and the inverse projection. After which a simple classifier is used to color each point of the2D
projection. The examples can be found in theexamples
folder.
from decision_boundary_mapper import DBM_usage_example, SDBM_usage_example
DBM_usage_example() # run the first example
SDBM_usage_example() # run the second example
- The package main functionality comes in two classes
DBM
(i.e. learns inverse projection when a 2D projection is given) andSDBM
(i.e. learns both the projection and the inverse projection). The classes can be used as follows:
from decision_boundary_mapper import DBM, SDBM
from matplotlib import pyplot as plt
# load the data
...
X_train, X_test, y_train, y_test = load_data()
...
# create a simple neural network
...
classifier = ... # for compatibility with the package the classifier should be constructed using tensorflow.keras
...
dbm = DBM(classifier) # create a DBM object
img, img_confidence, _, _ = dbm.generate_decision_boundary(X_train, y_train, X_test, y_test, resolution = 256) # generate the decision boundary
sdbm = SDBM(classifier) # create a SDBM object
img, img_confidence, _, _ = sdbm.generate_decision_boundary(X_train, y_train, X_test, y_test, resolution = 256) # generate the decision boundary
...
# visualize the decision boundaries
plt.imshow(img)
plt.show()
Created by Cristian Grosu for the master thesis project for 2023 at Utrecht University
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for decision-boundary-mapper-0.6.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e28d53ab37357adbb8ee7f1657bc6e38124d5ecfb0a260b78209a4f98a71b5a0 |
|
MD5 | 0d3793758e70e2497f075be538df0fe7 |
|
BLAKE2b-256 | 46fcab381a875cc752b6184abfd481360d11aed527837210a13ad275e051a996 |