# 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:
`[Decision Boundary Maps for Supporting User-Driven Pseudo-labeling](https://drive.google.com/file/d/12PlvWEYmDpdhF0HefwSeEEbx4VUFtDGA/view?usp=sharing)`
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
1. 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:
```python
from decision_boundary_mapper import GUI
GUI().start()
```
2. 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 example `DBM_usage_example` uses `t-SNE` to project the data from the `nD` space to the `2D` space, then neural network is trained to fit the inverse projection from `2D` to `nD` and the decision boundaries are visualized using the `2D` projection. The second example `SDBM_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 the `2D` projection.
The examples can be found in the `examples` folder.
```python
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
```
1. The package main functionality comes in two classes `DBM` (i.e. learns inverse projection when a 2D projection is given) and `SDBM` (i.e. learns both the projection and the inverse projection).
The classes can be used as follows:
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/cristi2019255/MasterThesis2023",
"name": "decision-boundary-mapper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Decision Boundary Mapper",
"author": "Cristian Grosu",
"author_email": "c.grosu@students.uu.nl",
"download_url": "https://files.pythonhosted.org/packages/25/89/7c85982766e0c64fcb1dc53c9b26b1f406e5a45dda794b9cb3a2856ad723/decision-boundary-mapper-1.0.1.tar.gz",
"platform": null,
"description": "# Short Description\n\nThis is the package provides functionality for visualizing the classifiers decision boundaries.\n\nIt is based on the work of Cristian Grosu for the master thesis project for 2023 at Utrecht University.\nIf you use this package, please cite the following paper:\n`[Decision Boundary Maps for Supporting User-Driven Pseudo-labeling](https://drive.google.com/file/d/12PlvWEYmDpdhF0HefwSeEEbx4VUFtDGA/view?usp=sharing)`\n\nThe package is available on PyPI and can be installed using pip: `pip install decision-boundary-mapper`\n\n## Documentation\n\nSee more details at `https://decisionboundarymapper.000webhostapp.com/`\n\n## Usage exmaples\n\n1. 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:\n\n```python\nfrom decision_boundary_mapper import GUI\n\nGUI().start()\n```\n\n2. The package comes with two examples of complete pipelines for visualizing the decision boundaries of a classifier.\nBoth examples use `MNIST` (handwritten digits) dataset.\nThe first example `DBM_usage_example` uses `t-SNE` to project the data from the `nD` space to the `2D` space, then neural network is trained to fit the inverse projection from `2D` to `nD` and the decision boundaries are visualized using the `2D` projection. The second example `SDBM_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 the `2D` projection.\nThe examples can be found in the `examples` folder.\n\n```python\nfrom decision_boundary_mapper import DBM_usage_example, SDBM_usage_example\n\nDBM_usage_example() # run the first example\nSDBM_usage_example() # run the second example\n```\n\n1. The package main functionality comes in two classes `DBM` (i.e. learns inverse projection when a 2D projection is given) and `SDBM` (i.e. learns both the projection and the inverse projection).\nThe classes can be used as follows:\n\n```python\nfrom decision_boundary_mapper import DBM, SDBM\nfrom matplotlib import pyplot as plt\n\n# load the data\n...\nX_train, X_test, y_train, y_test = load_data() \n...\n# create a simple neural network\n...\nclassifier = ... # for compatibility with the package the classifier should be constructed using tensorflow.keras\n...\n\ndbm = DBM(classifier) # create a DBM object\nimg, img_confidence, _, _ = dbm.generate_decision_boundary(X_train, y_train, X_test, y_test, resolution = 256) # generate the decision boundary\n\nsdbm = SDBM(classifier) # create a SDBM object\nimg, img_confidence, _, _ = sdbm.generate_decision_boundary(X_train, y_train, X_test, y_test, resolution = 256) # generate the decision boundary\n...\n# visualize the decision boundaries\nplt.imshow(img)\nplt.show()\n\n```\n\nCreated by Cristian Grosu for the master thesis project for 2023 at Utrecht University",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool for visualizing the decision boundary of a machine learning model.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/cristi2019255/MasterThesis2023"
},
"split_keywords": [
"decision",
"boundary",
"mapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25897c85982766e0c64fcb1dc53c9b26b1f406e5a45dda794b9cb3a2856ad723",
"md5": "a1b24a7bc4a3f161c7c16ef8c8d1a548",
"sha256": "64693263fe3f47869bf3e1eb1b5b4c30a1783495f672d359d6d4bb965d7d6e65"
},
"downloads": -1,
"filename": "decision-boundary-mapper-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "a1b24a7bc4a3f161c7c16ef8c8d1a548",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 145781,
"upload_time": "2023-12-14T12:54:25",
"upload_time_iso_8601": "2023-12-14T12:54:25.428362Z",
"url": "https://files.pythonhosted.org/packages/25/89/7c85982766e0c64fcb1dc53c9b26b1f406e5a45dda794b9cb3a2856ad723/decision-boundary-mapper-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-14 12:54:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cristi2019255",
"github_project": "MasterThesis2023",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "decision-boundary-mapper"
}