Skip to main content

Neural Response Map

Neural Response Map is a tool that allows you to graphically detect the activations of artificial neural networks. To do this, the correlation between neuron activations is calculated and then t-SNE is applied to reduce the dimension. In this way the correlated neurons are plotted close to each other. This process allows observing the activation of neurons and obtaining the response to different stimuli such as the graphs presented by DeepMind in his paper.

Instalation

To install you can use the following command

pip install neural-response-map

Quick Start

To make use of the tool, first import the components

from neural_response_map import NeuralResponseMap

Then you need to instantiate the class. For this you must pass the tensorflow model as a parameter

nrm = NeuralResponseMap(model)

Next you need to train the mapper. This function calculates the correlation between the neurons and performs the dimensionality reduction for subsequent graphs. For this you must pass the inputs as a parameter. The inputs are sample input data of the neural network, for example if your network is a VGG16, the inputs are images of your dataset. Also, if you wish, you can pass the layers you want to view as a parameter. If you don't pass the layers as a parameter, the visualization will use all the layers of the model.

nrm.TrainMap(inputs, model.layers[:2])

Finally you can visualize your Neural Response Map. To perform the visualization you must call GenerateMap and pass as a parameter the input examples that you want to visualize. If you pass more than one example, the display will be the average of all the Neural Response Maps of the input data.

nrm.GenerateMap(inputs[1:2])

GenerateMap allows other optional parameters:

  • method: this parameter controls the display method which can be linear or nearest. The linear method performs a linear interpolation between the values of the neuron's activations. Nearest, on the other hand, does not perform interpolation. The nearest method is the default value.
  • cmap: it is the color map that you want to use, by default it is viridis. If you want to know other visualization maps visit the following link.
  • size: it is the size of the image. This value is a tuple with (5,5) by default.
  • file: is the name and type of file in which you want to save the image (for example 'map.png'). If no path is passed the image is not saved.

Alternatively after the TrainMap call, you can call CircleProjection. This will make the Neural Response Map more circular in shape.

nrm.CircleProjection()
nrm.GenerateMap(inputs[1:2])

Authors

This package has been developed by:

Joan Alberto Cerretani

Metadata

Release files for neural-response-map 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neural-response-map 1.0.0
File Size Uploaded
neural_response_map-1.0.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neural-response-map 1.0.0
File Interpreter ABI Platform
neural_response_map-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / neural_response_map-1.0.0.tar.gz

Download URL neural_response_map-1.0.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e0e1621db8d29986d9d400a1d3b00df0fc1b0c0b063c4615bca8467ca1cc1774
BLAKE2b-256 checksum
How to use checksums
71115a1754ab6e901f18b68d3bf1d0c97ddfaadc8ec0fc52d41ad5c5f65181db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.8

Release files / neural_response_map-1.0.0-py3-none-any.whl

Download URL neural_response_map-1.0.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7b65c375a281ca8d8d0cf092ada8e09157e1b405f561671a296bb56eaacc251
BLAKE2b-256 checksum
How to use checksums
b0538e59969a4a0c0fe94c65e037fde44ae44ca8cddebcb39c70115185da5128
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page