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.3.tar.gz
(126.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inverted_encoding-0.1.3.tar.gz.
File metadata
- Download URL: inverted_encoding-0.1.3.tar.gz
- Upload date:
- Size: 126.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86c0cb198e89061984723359a26857d768e30ff502fcb8c63c9fec9a02f2db68
|
|
| MD5 |
9973cdd226e36ac4ca1b948d8bdd704b
|
|
| BLAKE2b-256 |
3bde1a8803aa9dbebd05a3d10fa47b2f10df950ac003b984da1e4e8d6482a3c9
|
File details
Details for the file inverted_encoding-0.1.3-py2-none-any.whl.
File metadata
- Download URL: inverted_encoding-0.1.3-py2-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ded4a0a62d9efc844e481f63acd7572b8f4b5be68b605dbb556a9cd7cd86df9b
|
|
| MD5 |
408ee8a365528ec2013e0365e28e146e
|
|
| BLAKE2b-256 |
2deedc2d7a03ee87cd597bc909b4dd3e7727b1273c7d37fe9095df4226392439
|