Skip to main content

Implementation of inverted encoding model as described in Scotti, Chen, & Golomb

Project description

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)

Project details


Download files

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

Files for inverted-encoding, version 0.0.20
Filename, size File type Python version Upload date Hashes
Filename, size inverted_encoding-0.0.20-py2-none-any.whl (26.6 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size inverted_encoding-0.0.20.tar.gz (82.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page