Git Product home page Git Product logo

fastdbm's Introduction

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:
from decision_boundary_mapper import GUI

GUI().start()
  1. 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.
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:
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

fastdbm's People

Contributors

cristi2019255 avatar cristiangrosu2022 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.