Skip to main content

Inverted Encoding

Python package for easy implementation of inverted encoding modeling as described in Scotti, Chen, & Golomb (in-prep).

Contact: scottibrain@gmail.com (Paul Scotti)


Installation

Run the following to install:

pip install inverted-encoding

Usage

from inverted_encoding import IEM, permutation, circ_diff
import numpy as np

predictions, confidences, aligned_at_prediction_recons, aligned_at_zero_recons = IEM(trialbyvoxel,features,stim_max=180,is_circular=True)
# use "help(IEM)" for more information, below is a summary:
# trialbyvoxel: your matrix of brain activations, does not necessarily have to be voxels
# features: array of your stimulus features (must be integers within range defined by stim_max)
# stim_max=180 means that your stimulus space ranges 0-179° degrees
# is_circular=True for a circular stimulus space, False for non-circular stimulus space
# predictions: array of predicted stimulus for each trial
# confidences: array of goodness of fit values for each trial
# aligned_at_prediction_recons: trial-by-trial reconstructions (matrix of num_trials x stim_max) such that
# when plotted ideally each reconstruction is centered at the original trial stimulus
# aligned_at_zero_recons: trial-by-trial reconstructions aligned at zero, such that when
# plotted ideally each reconstruction is centered at zero on the x axis (e.g., plt.plot(aligned_at_zero_recons[trial,:]))

## Compute mean absolute error (MAE) by doing the following, then compare to null distribution:
if is_circular: # if your stimulus space is circular, need to compute circular differences
    mae = np.mean(np.abs(circ_diff(predictions,features,stim_max))) 
else:
    mae = np.mean(np.abs(predictions-features)) 
null_mae_distribution = permutation(features,stim_max=180,num_perm=1000,is_circular=True)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inverted_encoding-0.1.1.tar.gz (109.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inverted_encoding-0.1.1-py2-none-any.whl (26.8 kB view details)

Uploaded Python 2

File details

Details for the file inverted_encoding-0.1.1.tar.gz.

File metadata

  • Download URL: inverted_encoding-0.1.1.tar.gz
  • Upload date:
  • Size: 109.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for inverted_encoding-0.1.1.tar.gz
Algorithm Hash digest
SHA256 da04014ab5d6715ef40885c27268625f7daeb81d5b174eb5b0ee5f75b98ea21d
MD5 e6cecac2c1851b1ac6c7041c6754c7ba
BLAKE2b-256 58be2bb5c52cb5e9e8520e0cdb04cc77a38ab2710c056a29d4d35acf7bdfde8b

See more details on using hashes here.

File details

Details for the file inverted_encoding-0.1.1-py2-none-any.whl.

File metadata

  • Download URL: inverted_encoding-0.1.1-py2-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for inverted_encoding-0.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 db9edbb3fdb5dd26a3d3b81999439c4f0dc0dd16aa87b68a68474b513c98e7aa
MD5 da426c1ad3a814c2d3d0e24894fb9f3f
BLAKE2b-256 043a68ed4eebe1594f47ec287d92c58f1e1fb121e1d67bc3a206530870cf4011

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.2

2 files

0.0.1

2 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