multigeom.encoders.neural#

NeuralEncoder: an image-to-neural-response model made of a backbone and a readout, with the methods to use it:

    encoder = NeuralEncoder(backbone, n_neurons=50, readout="gaussian")   # build
    encoder.fit_readout(images, responses)       # fit the readout to neural data
    responses = encoder.predict(images)          # predict neural responses
    encoder.save("my_encoder.pt");  encoder = NeuralEncoder.load("my_encoder.pt")

    encoder = load_encoder("inception", area="V1")   # an encoder fitted to macaque V1

The input is the canonical image batch [B, 1, 64, 64] in [-1, 1]; the output is [B,
n_neurons]. A `NeuralEncoder` follows the encoder contract of
`multigeom.encoders.contract`, so it plugs into `compute_fisher`, `compute_g` and the
pipeline.

Functions

load_encoder(name_or_path[, area, device, ...])

Load an encoder that is already fitted.

Classes

NeuralEncoder(*args, **kwargs)

A backbone followed by a readout.