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, recons = IEM(trialbyvoxel,features,stim_max=180,is_circular=True)
# use "help(IEM)" for more information on required inputs, 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
# recons: trial-by-trial reconstructions (matrix of num_trials x stim_max)
## 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.0.2.tar.gz
(73.7 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.0.2.tar.gz.
File metadata
- Download URL: inverted_encoding-0.0.2.tar.gz
- Upload date:
- Size: 73.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e9a3194ca3ec0432a4275be1a3eb1ab9e6daa2b608b9e9710632e3c73a7d842
|
|
| MD5 |
b3c2ca6bfbce710777a3df1fdc4a0cf2
|
|
| BLAKE2b-256 |
7b6303c0e27e9af62c7d0b986b0e9b2946587044c9e49b78a2c7c470bfc1aa89
|
File details
Details for the file inverted_encoding-0.0.2-py2-none-any.whl.
File metadata
- Download URL: inverted_encoding-0.0.2-py2-none-any.whl
- Upload date:
- Size: 26.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ad4f9ec3528c81531ddde2ca45d292fb2e18bc887921f79d0ae6671ca907ec
|
|
| MD5 |
bb006b57f604fba4a914e79bf642b6c1
|
|
| BLAKE2b-256 |
9c23fd251dfead3fa7ae1270488ca5717f3495a9eada612fce53727fc2be2446
|