A Python implementation of active inference for Markov Decision Processes

Related tags

Deep Learningpymdp
Overview

A Python package for simulating Active Inference agents in Markov Decision Process environments. Please see our companion preprint on arxiv for an overview of the package, its structure, and a mathematical overview of active inference in partially-observable Markov Decision Processes: "pymdp: A Python library for active inference in discrete state spaces".

This package is hosted on the infer-actively GitHub organization, which was built with the intention of hosting open-source active inference and free-energy-principle related software.

Most of the low-level mathematical operations are NumPy ports of their equivalent functions from the SPM implementation in MATLAB. We have benchmarked and validated most of these functions against their SPM counterparts.

Status

status PyPI version

pymdp in action

Here's a visualization of pymdp agents in action. One of the defining features of active inference agents is the drive to maximize "epistemic value" (i.e. curiosity). Equipped with such a drive in environments with uncertain yet disclosable hidden structure, active inference can ultimately allow agents to simultaneously learn about the environment as well as maximize reward.

The simulation below (see associated notebook here) demonstrates what might be called "epistemic chaining," where an agent (here, analogized to a mouse seeking food) forages for a chain of cues, each of which discloses the location of the subsequent cue in the chain. The final cue (here, "Cue 2") reveals the location a hidden reward. This is similar in spirit to "behavior chaining" used in operant conditioning, except that here, each successive action in the behavioral sequence doesn't need to be learned through instrumental conditioning. Rather, active inference agents will naturally forage the sequence of cues based on an intrinsic desire to disclose information. This ultimately leads the agent to the hidden reward source in the fewest number of moves as possible.

You can run the code behind simulating tasks like this one and others in the Examples section of the official documentation.


Cue 2 in Location 1, Reward on Top


Cue 2 in Location 3, Reward on Bottom

Quick-start: Installation and Usage

In order to use pymdp to build and develop active inference agents, we recommend installing it with the the package installer pip, which will install pymdp locally as well as its dependencies. This can also be done in a virtual environment (e.g. with venv).

When pip installing pymdp, use the package name inferactively-pymdp:

pip install inferactively-pymdp

Once in Python, you can then directly import pymdp, its sub-packages, and functions.

import pymdp
from pymdp import utils
from pymdp.agent import Agent

num_obs = [3, 5] # observation modality dimensions
num_states = [3, 2, 2] # hidden state factor dimensions
num_controls = [3, 1, 1] # control state factor dimensions
A_matrix = utils.random_A_matrix(num_obs, num_states) # create sensory likelihood (A matrix)
B_matrix = utils.random_B_matrix(num_states, num_controls) # create transition likelihood (B matrix)

C_vector = utils.obj_array_uniform(num_obs) # uniform preferences

# instantiate a quick agent using your A, B and C arrays
my_agent = Agent( A = A_matrix, B = B_matrix, C = C_vector)

# give the agent a random observation and get the optimized posterior beliefs

observation = [1, 4] # a list specifying the indices of the observation, for each observation modality

qs = my_agent.infer_states(observation) # get posterior over hidden states (a multi-factor belief)

# Do active inference

q_pi, neg_efe = my_agent.infer_policies() # return the policy posterior and return (negative) expected free energies of each policy as well

action = my_agent.sample_action() # sample an action

# ... and so on ...

Getting started / introductory material

We recommend starting with the Installation/Usage section of the official documentation for the repository, which provides a series of useful pedagogical notebooks for introducing you to active inference and how to build agents in pymdp.

For new users to pymdp, we specifically recommend stepping through following three Jupyter notebooks (can also be used on Google Colab):

Special thanks to Beren Millidge and Daphne Demekas for their help in constructing these tutorials, which were originally based on a set of tutorial notebooks written by Alec Tschantz.

Contributing

This package is under active development. If you would like to contribute, please refer to this file

If you would like to contribute to this repo, we recommend using venv and pip

cd <path_to_repo_fork>
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install -e ./ # This will install pymdp as a local dev package

You should then be able to run tests locally with pytest

pytest test

Authors

Comments
  • einsum while calculating free energy

    einsum while calculating free energy

    hi, guys, i have a question about calculating the free energy. While calculating einsum, why only sum to the first dim:

    arg_list = [X, list(range(X.ndim))] + list(chain(*([x[xdim_i],[dims[xdim_i]]] for xdim_i in range(len(x))))) + [[0]]

    and then use:

    spm_dot(likelihood, qs)[0]

    to fetch only the first level of s0 (suppose hidden state s is factorized as s0, s1, ... ) ?

    in my opinion, we should sum over all the tensor by removing the last + [[0]] and the Y should just be a scalar. am I totally wrong, if i am, please correct me, thanks a lot!

    opened by lqiang2003cn 4
  • Is it possible to do model fitting using this package?

    Is it possible to do model fitting using this package?

    Hi~

    I want to know if this package can fit model to behavior datas collected by my experiment? Or will there be future plans to implement this functionality?

    Thanks~

    question 
    opened by yaowang1111 4
  • Bump pillow from 8.2.0 to 8.3.2

    Bump pillow from 8.2.0 to 8.3.2

    Bumps pillow from 8.2.0 to 8.3.2.

    Release notes

    Sourced from pillow's releases.

    8.3.2

    https://pillow.readthedocs.io/en/stable/releasenotes/8.3.2.html

    Security

    • CVE-2021-23437 Raise ValueError if color specifier is too long [hugovk, radarhere]

    • Fix 6-byte OOB read in FliDecode [wiredfool]

    Python 3.10 wheels

    • Add support for Python 3.10 #5569, #5570 [hugovk, radarhere]

    Fixed regressions

    • Ensure TIFF RowsPerStrip is multiple of 8 for JPEG compression #5588 [kmilos, radarhere]

    • Updates for ImagePalette channel order #5599 [radarhere]

    • Hide FriBiDi shim symbols to avoid conflict with real FriBiDi library #5651 [nulano]

    8.3.1

    https://pillow.readthedocs.io/en/stable/releasenotes/8.3.1.html

    Changes

    8.3.0

    https://pillow.readthedocs.io/en/stable/releasenotes/8.3.0.html

    Changes

    ... (truncated)

    Changelog

    Sourced from pillow's changelog.

    8.3.2 (2021-09-02)

    • CVE-2021-23437 Raise ValueError if color specifier is too long [hugovk, radarhere]

    • Fix 6-byte OOB read in FliDecode [wiredfool]

    • Add support for Python 3.10 #5569, #5570 [hugovk, radarhere]

    • Ensure TIFF RowsPerStrip is multiple of 8 for JPEG compression #5588 [kmilos, radarhere]

    • Updates for ImagePalette channel order #5599 [radarhere]

    • Hide FriBiDi shim symbols to avoid conflict with real FriBiDi library #5651 [nulano]

    8.3.1 (2021-07-06)

    • Catch OSError when checking if fp is sys.stdout #5585 [radarhere]

    • Handle removing orientation from alternate types of EXIF data #5584 [radarhere]

    • Make Image.array take optional dtype argument #5572 [t-vi, radarhere]

    8.3.0 (2021-07-01)

    • Use snprintf instead of sprintf. CVE-2021-34552 #5567 [radarhere]

    • Limit TIFF strip size when saving with LibTIFF #5514 [kmilos]

    • Allow ICNS save on all operating systems #4526 [baletu, radarhere, newpanjing, hugovk]

    • De-zigzag JPEG's DQT when loading; deprecate convert_dict_qtables #4989 [gofr, radarhere]

    • Replaced xml.etree.ElementTree #5565 [radarhere]

    ... (truncated)

    Commits
    • 8013f13 8.3.2 version bump
    • 23c7ca8 Update CHANGES.rst
    • 8450366 Update release notes
    • a0afe89 Update test case
    • 9e08eb8 Raise ValueError if color specifier is too long
    • bd5cf7d FLI tests for Oss-fuzz crash.
    • 94a0cf1 Fix 6-byte OOB read in FliDecode
    • cece64f Add 8.3.2 (2021-09-02) [CI skip]
    • e422386 Add release notes for Pillow 8.3.2
    • 08dcbb8 Pillow 8.3.2 supports Python 3.10 [ci skip]
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 4
  • Action indices need to be cast to `int` in T-maze learning demo

    Action indices need to be cast to `int` in T-maze learning demo

    Thanks @conorheins and @Arun-Niranjan, things getting better. The A-matrix worked with your my-A-matrix but B-matrix was not fixed I think. A sample pandas matrix might help. An issue remained with T-maze-learning (T-maze-demo works fine), that I pase it here but I can open an issue if needed. image

    Best

    Originally posted by @osaaso3 in https://github.com/infer-actively/pymdp/issues/26#issuecomment-877800539

    bug 
    opened by conorheins 4
  • Fix warnings in unit tests

    Fix warnings in unit tests

    This PR adds the optional dtype=object argument to np.array(...) when the input lists/arrays are of different dimensions in order to suppress warnings when running tests.

    We should revisit how arrays of different dimensions are handled in general, it is likely that an abstraction exists which will be safer and easier to use/test

    opened by Arun-Niranjan 4
  • Sampling action when using deep policy

    Sampling action when using deep policy

    Hi, thank you for this package I'm really enjoying learning about active inference.

    I deeply appreciate the contributors to this package.

    However, I have a question when I tried to implement the explore-exploit task in this article (Smith et al., A step-by-step tutorial on active inference and its application to empirical data, https://doi.org/10.1016/j.jmp.2021.102632) which is already implemented in MATLAB and "pymdp".

    I tried to run a loop for active inference of deep policy (two time-steps) according to the "complete recipe for active inference" as written in the "pymdp" tutorial notebook, but I found that the "sample_action" method of the "Agent" class only sample action from the first timestep of policy (each policy has the shape of (2,2), the first dim is the number of timesteps and the second dim is the number of factors) using "control.sample_policy" function as below:

    (line 674-675, control.py)

    for factor_i in range(num_factors):
         selected_policy[factor_i] = policies[policy_idx][0, factor_i]
    

    My setting of the agent class was:

    timepoints = [0,1,2]
    agent = Agent(
        A = A_gm,
        B = B,
        C = C,
        D = D_gm,
        E = E,
        pA = pA,
        pD = pD,
        policies = policies,
        policy_len = policies[0].shape[0],
        inference_horizon = len(timepoints),  
        inference_algo="MMP",
        sampling_mode="full",
        modalities_to_learn=[1],
        use_BMA = True,
        policy_sep_prior = False,
    )
    

    In my thought, to sample the action of the other timestep in each policy, line 675 would be better if changed like this:

    selected_policy[factor_i] = policies[policy_idx][timestep, factor_i]
    

    If I didn't understand this package well, then please let me know how to correct it.

    Thank you!

    good first issue 
    opened by sunghwan87 2
  • Incorrect error message when ensuring normalized A/B matrices

    Incorrect error message when ensuring normalized A/B matrices

    In line 95 of agent.py

    assert utils.is_normalized(self.B), "A matrix is not normalized (i.e. A.sum(axis = 0) must all equal 1.0"

    I believe this is an error, as it should be the B matrix not the A matrix.

    Originally posted by @mahault in https://github.com/infer-actively/pymdp/discussions/4#discussioncomment-2575940

    better_errors 
    opened by conorheins 2
  • Paper branch

    Paper branch

    • JOSS manuscript now in paper folder
    • initial changes based on reviews from @seankmartin (added Summary section to paper, added documentation for Agent API)
    • other minor tweaks (some minor variable renaming in the internals of Agent)
    opened by conorheins 2
  • Note Arxiv reference

    Note Arxiv reference

    The following new Arxiv reference may be noted in the readme and/or docs, etc.:

    https://arxiv.org/abs/2201.03904

    pymdp: A Python library for active inference in discrete state spaces

    documentation enhancement 
    opened by impredicative 2
  • A matrix stub bug

    A matrix stub bug

    Hi, Will this new method fix the error I get with A-Matrix and B-Matrix examples?


    AssertionError Traceback (most recent call last) in ----> 1 A = utils.convert_A_stub_to_ndarray(A_stub, model_labels)

    ~\pymdp\core\utils.py in convert_A_stub_to_ndarray(A_stub, model_labels) 490 for g, modality_name in enumerate(model_labels['observations'].keys()): 491 A[g] = A_stub.loc[modality_name].to_numpy().reshape(num_obs[g], *num_states) --> 492 assert (A[g].sum(axis=0) == 1.0).all(), 'A matrix not normalized! Check your initialization....\n' 493 494 return A

    AssertionError: A matrix not normalized! Check your initialization....

    or unrelated? Thanks

    Originally posted by @osaaso3 in https://github.com/infer-actively/pymdp/issues/26#issuecomment-876492249

    bug 
    opened by conorheins 2
  • lack of time symmetry in run_mmp when creating messages

    lack of time symmetry in run_mmp when creating messages

    When going through mmpwith @conorheins yesterday, I noticed this section:

                    # past message
                    if t == 0:
                        lnB_past = spm_log(prior[f])
                    else:
                        past_msg = B[f][:, :, int(policy[t - 1, f])].dot(qs_seq[t - 1][f])
                        lnB_past = spm_log(past_msg)
    
                    # future message
                    if t >= future_cutoff:
                        lnB_future = qs_T[f]
                    else:
                        future_msg = trans_B[f][:, :, int(policy[t, f])].dot(qs_seq[t + 1][f])
                        lnB_future = spm_log(future_msg)
    

    I am not sure if the past_msgand future_msglines are consistent with their use of t-1, t and t +1. I think this is worth checking against 1) the original SPM to see what they do and 2) deciding what the correct behaviour should be.

    question 
    opened by Arun-Niranjan 2
  • Habit learning and precision

    Habit learning and precision

    Hello! I couldn't find implementation of habit learning (updating of prior over policies E) and precision(gamma) updating through betta prior. Am I missing it? And if not, is it planned for future releases? Thanks!

    enhancement help wanted open 
    opened by PetrAnokhin 4
  • Better error messages for MMP

    Better error messages for MMP

    Add better error /warning messages when you try to initialise an Agent() instance with the MMP inference algorithm (inference_algo="MMP") , but that choice doesn't make sense (inconsistent other choices of policy_depth, etc.).

    better_errors 
    opened by conorheins 0
  • State inference: Considerable performance difference with MATLAB implementation?

    State inference: Considerable performance difference with MATLAB implementation?

    Hi all,

    First of, many thanks for your work, it looks very promising!

    I was comparing some simple agents between the current and matlab implementation and noticed that in terms of reversal learning, the pymdp version appears to adapt considerably slower. I've played around with a variety of setups and hyperparameters but the difference is quite significant.

    Example setup: slot machine task without hints 2 actions: 'button' 0 and 'button' 1 A 'button 0 is better' context and a 'button 1 is better' context.

    40 trials, with the hidden context switching after 20 trials. Here I plot the state posterior (black) of 100 agents starting with flat context priors, compared to the true but unknown state/context (red). Below I'll include the pymdp code. I'm assuming I'm using the package wrong, and would love to know my misunderstanding.

    image image

    import pymdp
    from pymdp import utils
    from pymdp.agent import Agent
    import numpy as np
    import matplotlib.pyplot as plt
    
    num_obs = [3, 3] # 3 Rewards, 3 choice observations
    num_states = [3, 2] # 3 choice states, 2 hidden states
    num_factors = len(num_states)
    
    # Press one of two buttons
    num_controls = [2, 1] 
    
    A_shapes = [[o_dim] + num_states for o_dim in num_obs]
    
    # initialize the A array to all 0's
    A = utils.obj_array_zeros(A_shapes)
    
    # reward probabilities
    r1=0.9
    r2=0.9
    
    # Reward observations
    # STATE 1     Start a0 a1
    A[0][0,:,0] = [0, 1-r1, r2  ] # Positive reward
    A[0][1,:,0] = [0, r1  , 1-r2] # Negative reward
    A[0][2,:,0] = [1, 0   , 0   ] # Neutral (start state)
    # STATE 2     Start a0 a1
    A[0][0,:,1] = [0, r1  , 1-r2] # Positive
    A[0][1,:,1] = [0, 1-r1, r2  ] # Negative
    A[0][2,:,1] = [1, 0   , 0   ] # Neutral (start state)
    
    # No uncertainty about choice observations
    A[1][:,:,0] = np.eye(num_obs[1])
    A[1][:,:,1] = np.eye(num_obs[1])
    
    
    B_shapes = [[s_dim, s_dim, num_controls[f]] for f, s_dim in enumerate(num_states)]
    
    B = utils.obj_array_zeros(B_shapes)
    
    for i in range(2):
        B[0][0,:,i] = np.ones(3)
        
    B[0][:,0,0] = [0, 1, 0] # action 0: Start  -> a0
    B[0][:,0,1] = [0, 0, 1]  # action 1: Start  -> a1
    
    B[1][:,:,0] = np.eye(num_states[1])
    
    C = utils.obj_array_zeros(num_obs)
    C[0] = np.array([1, -1, 0]) # Prefer rewards
    
    D = utils.obj_array_uniform(num_states)
    D[0] = np.array([1, 0, 0]) # Start in the 'start'-state
    
    # ENVIRONMENT
    class my_env():
        
        def __init__(self, A):
            
            self.A = A
            
        def step(self, action, state):
                    
            obs = utils.sample(self.A[0][:, action[0].astype(int)+1, state])
                
            return [obs, action[0].astype(int)+1]
    
    # SIMULATIONS
    T = 40
    alpha = 16
    gamma = 16
    AS = "deterministic"
    
    for run in range(100):
        D2 = D.copy()
    
        model = Agent(A=A, B=B, C=C, D=D, policy_len=1, action_selection=AS)
        switches = [20,40,50]
        state = 0
        states = []
        pstate = []
        pact = []
        e = my_env(A)
    
        model.infer_states([2,0]) # 2 = neutral obs, 0 = start state
    
        for t in range(T):
    #         if t > 0: 
    #             D2[1] = model.qs[1]
    #             model = Agent(A=A, B=B, C=C, D=D2, policy_len=1, action_selection=AS)
    
            if t in switches:
                state = 1 - state
            states.append(state)
    
            # Start position for the trial (I believe you don't use this in the tutorial, but it doesnt seem to matter much)
            model.infer_states([2,0]) # 2 = neutral reward, 0 = start state observation
    
            q_pi, neg_efe = model.infer_policies()
    
            action = model.sample_action()
    
            obs = e.step(action, state=state)
            model.infer_states(obs)
    
            # Save belief and output
            pstate.append(model.qs[1][0])
            pact.append(q_pi[0])
    
        plt.plot([1-s for s in pstate], label="p(s)", linewidth=3, alpha=0.1, color='k')
        
    plt.plot([s*1.1-0.05 for s in states], label="s", color="r", linewidth=3)
    plt.xlabel("trial")
    plt.ylim([-0.05, 1.05])
    plt.title("Python")
    
    question 
    opened by SamGijsen 4
  • Incorrect error message when ensuring normalization of D array/vectors

    Incorrect error message when ensuring normalization of D array/vectors

    In line 180 of agent.py, error message should be changed to:

    "D vector is not normalized (i.e. D[f].sum() must all equal 1.0)"
    

    Originally posted by @helenegu in https://github.com/infer-actively/pymdp/issues/73#issuecomment-1165899263

    better_errors 
    opened by conorheins 0
  • B matrix navigation problem

    B matrix navigation problem

    Hello,

    Thanks so much with your work on bringing Active Inference to Python.

    While going through your epistemic chaining demo, it appears there is a problem with the agent navigation. When I moved cue1 location from (2,0) to (0,1), the agent takes two moves downward and then tries to move "left" into the wall. The agent never recovers from this and doesn't seem to know to try a different direction.

    I assume this is a problem with the B Matrix but I'm not smart enough to figure out if this is some challenge in the agent class or in the rules set up during the demo itself for (["UP", "DOWN", "LEFT", "RIGHT", "STAY"]); elif

    Any help/advice would be greatly appreciated! Please see the output log from the agent movements below . The only change I make to your demo is the my_env section where I change the cue1_loc to (0,1) - you'll see that once it completes the second action it tries to go LEFT... then STAY, then tries LEFT a few more times:

    Action at time 0: DOWN Grid location at time 0: (1, 0) Reward at time 0: Null Action at time 1: DOWN Grid location at time 1: (2, 0) Reward at time 1: Null Action at time 2: LEFT Grid location at time 2: (2, 0) Reward at time 2: Null Action at time 3: STAY Grid location at time 3: (2, 0) Reward at time 3: Null Action at time 4: STAY Grid location at time 4: (2, 0) Reward at time 4: Null Action at time 5: STAY Grid location at time 5: (2, 0) Reward at time 5: Null Action at time 6: LEFT Grid location at time 6: (2, 0) Reward at time 6: Null Action at time 7: LEFT Grid location at time 7: (2, 0) Reward at time 7: Null Action at time 8: LEFT Grid location at time 8: (2, 0) Reward at time 8: Null Action at time 9: LEFT Grid location at time 9: (2, 0) Reward at time 9: Null

    question 
    opened by thanos927 1
  • Polish tutorial 2

    Polish tutorial 2

    I really enjoyed this tutorial, overall. It shows the power of Agent. I think it's a little hard to read in some places, and I wanted to flag some of these issues:

    1. It's a non-standard bandit task, because there's a third action, HINT. It would be nice to indicate this in the intro - or to refer to a version of the task which includes the hint action, because there's no indication in the only reference, which is the Wikipedia link.
    2. Going from tutorial 1 to tutorial 2, there's an unexplained shift in the definition of A. In tutorial 1, it was a two-dimensional array p(o|s), but now it's a four-dimensional array. I realized a bit late in the process that this was all explained in the pymdp fundamentals part of the doc - a backlink would be nice.
    3. Generally I find using raw arrays to define states difficult to read. I presume that this is an artifact of the history of the package (Matlab cell arrays). It would be helpful to remind people the definition of the axes as we go along. OTOH, I did find the diagrams very helpful.
    4. I found the last part about manipulating the reward very confusing. I had to go back to definitions to figure out that the last manipulation changed the loss into a reward (+5) - if I just look at the output, it looks like the agent always picks the arm resulting in a loss.

    One thing that's not explained here is how the agent's inference mechanism differs from those of other, more well-known agents from the RL literature. Having read the first few chapters of Richard Sutton's book eons ago, I wondered whether the inference was equivalent to a finite horizon dynamic programming solution, or similar in spirit to an agent that uses a UCB heuristic or Thompson sampling. If you could have a few references in the tutorial about this, it would be great.

    documentation 
    opened by patrickmineault 1
Releases(v0.0.7)
  • v0.0.7(Dec 8, 2022)

    What's Changed

    • plot_beliefs, plot_likelihood now functions in utils.py
    • Bug fix in calculation of variational free energy during message passing routines (see #98)
    • Allow optional distributional observations in agent.infer_states(obs) with a new optional boolean argument distrib_obs, for use in hierarchical set-ups
    • added two new environments (envs.visual_foraging.SceneConstruction and envs.visual_foraging.RandomDotMotion)
    • added functions for quickly initialising empty A and B arrays

    Full Changelog: https://github.com/infer-actively/pymdp/compare/v0.0.6...v0.0.7

    Source code(tar.gz)
    Source code(zip)
  • v0.0.6(Aug 24, 2022)

    What's Changed

    • Bug fixes (see #84, #86)
    • Optional action sampling precision as input to Agent (equivalent of alpha parameter in SPM) to address Issue #81: https://github.com/infer-actively/pymdp/pull/88
    • Can sample directly from policy posterior using new sample_policy() function in control.py: https://github.com/infer-actively/pymdp/pull/89
    • Fixed failing documentation: https://github.com/infer-actively/pymdp/pull/92

    Full Changelog: https://github.com/infer-actively/pymdp/compare/v0.0.5...v0.0.6

    Source code(tar.gz)
    Source code(zip)
  • v0.0.5(Apr 25, 2022)

    Release notes

    • bug fixes, notably fix in B matrix learning (pymdp.learning.update_state_likelihood_dirichlet()), see here
    • more full documentation based on JOSS reviews, see here
    • include archived version (using Zenodo) with 0.0.5 release (doi: 10.5281/zenodo.6484849), for simultaneous publication of JOSS paper
    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Jan 10, 2022)

    Updates include:

    • Read the Docs / Sphinx-based documentation, with references thereto in a cleaned-up/shortened README.md
    • new epistemic chaining demo (on README.md and in documentation)
    • renaming of many inference.py and learning.py functions to make them more understandable

    BUG FIXES:

    • corrected action sampling routine (in pymdp.control.sample_action()) so that when marginalizing posterior probabilities from each policy, per action, we only sum the probabilities assigned to action for the next / successive timestep, not for all timesteps. Before this fix, this can lead to maladaptive behavior in many scenarios where temporally-deep planning is required.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Oct 27, 2021)

    Updates include:

    • more demo colab notebooks now linked on main page
    • model checks in when constructing an Agent() (e.g. normalization checks)
    • D vector learning / bayesian model reduction
    • can pass in E vector (prior over policies) to Agent() constructor
    • time-varying prior preferences (i.e. C can now be a matrix rather than having to be a vector)
    • updated dependencies in setup.py to allow forwards compatibility with newer versions of various packages
    Source code(tar.gz)
    Source code(zip)
Repository aimed at compiling code, papers, demos etc.. related to my PhD on 3D vision and machine learning for fruit detection and shape estimation at the university of Lincoln

PhD_3DPerception Repository aimed at compiling code, papers, demos etc.. related to my PhD on 3D vision and machine learning for fruit detection and s

lelouedec 2 Oct 06, 2022
Generalized hybrid model for mode-locked laser diodes with an extended passive cavity

GenHybridMLLmodel Generalized hybrid model for mode-locked laser diodes with an extended passive cavity This hybrid simulation strategy combines a tra

Stijn Cuyvers 3 Sep 21, 2022
PerfFuzz: Automatically Generate Pathological Inputs for C/C++ programs

PerfFuzz Performance problems in software can arise unexpectedly when programs are provided with inputs that exhibit pathological behavior. But how ca

Caroline Lemieux 125 Nov 18, 2022
Real-time LIDAR-based Urban Road and Sidewalk detection for Autonomous Vehicles 🚗

urban_road_filter: a real-time LIDAR-based urban road and sidewalk detection algorithm for autonomous vehicles Dependency ROS (tested with Kinetic and

JKK - Vehicle Industry Research Center 180 Dec 12, 2022
Unofficial pytorch implementation of the paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution"

DFSA Unofficial pytorch implementation of the ICCV 2021 paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution" (p

2 Nov 15, 2021
This repository contains the code used in the paper "Prompt-Based Multi-Modal Image Segmentation".

Prompt-Based Multi-Modal Image Segmentation This repository contains the code used in the paper "Prompt-Based Multi-Modal Image Segmentation". The sys

Timo Lüddecke 305 Dec 30, 2022
CKD - Collaborative Knowledge Distillation for Heterogeneous Information Network Embedding

Collaborative Knowledge Distillation for Heterogeneous Information Network Embed

zhousheng 9 Dec 05, 2022
68 keypoint annotations for COFW test data

68 keypoint annotations for COFW test data This repository contains manually annotated 68 keypoints for COFW test data (original annotation of CFOW da

31 Dec 06, 2022
Code for ACL2021 paper Consistency Regularization for Cross-Lingual Fine-Tuning.

xTune Code for ACL2021 paper Consistency Regularization for Cross-Lingual Fine-Tuning. Environment DockerFile: dancingsoul/pytorch:xTune Install the f

Bo Zheng 42 Dec 09, 2022
Convert onnx models to pytorch.

onnx2torch onnx2torch is an ONNX to PyTorch converter. Our converter: Is easy to use – Convert the ONNX model with the function call convert; Is easy

ENOT 264 Dec 30, 2022
A simple baseline for 3d human pose estimation in PyTorch.

3d_pose_baseline_pytorch A PyTorch implementation of a simple baseline for 3d human pose estimation. You can check the original Tensorflow implementat

weigq 312 Jan 06, 2023
Code for "Modeling Indirect Illumination for Inverse Rendering", CVPR 2022

Modeling Indirect Illumination for Inverse Rendering Project Page | Paper | Data Preparation Set up the python environment conda create -n invrender p

ZJU3DV 116 Jan 03, 2023
LBK 35 Dec 26, 2022
《Image2Reverb: Cross-Modal Reverb Impulse Response Synthesis》(2021)

Image2Reverb Image2Reverb is an end-to-end neural network that generates plausible audio impulse responses from single images of acoustic environments

Nikhil Singh 48 Nov 27, 2022
🚩🚩🚩

My CTF Challenges 2021 AIS3 Pre-exam / MyFirstCTF Name Category Keywords Difficulty ⒸⓄⓋⒾⒹ-①⑨ (MyFirstCTF Only) Reverse Baby ★ Piano Reverse C#, .NET ★

6 Oct 28, 2021
Open source hardware and software platform to build a small scale self driving car.

Donkeycar is minimalist and modular self driving library for Python. It is developed for hobbyists and students with a focus on allowing fast experimentation and easy community contributions.

Autorope 2.4k Jan 04, 2023
Liquid Warping GAN with Attention: A Unified Framework for Human Image Synthesis

Liquid Warping GAN with Attention: A Unified Framework for Human Image Synthesis, including human motion imitation, appearance transfer, and novel view synthesis. Currently the paper is under review

2.3k Jan 05, 2023
Self-supervised Product Quantization for Deep Unsupervised Image Retrieval - ICCV2021

Self-supervised Product Quantization for Deep Unsupervised Image Retrieval Pytorch implementation of SPQ Accepted to ICCV 2021 - paper Young Kyun Jang

Young Kyun Jang 71 Dec 27, 2022
CSKG is a commonsense knowledge graph that combines seven popular sources into a consolidated representation

CSKG: The CommonSense Knowledge Graph CSKG is a commonsense knowledge graph that combines seven popular sources into a consolidated representation: AT

USC ISI I2 85 Dec 12, 2022
Unsupervised Image Generation with Infinite Generative Adversarial Networks

Unsupervised Image Generation with Infinite Generative Adversarial Networks Here is the implementation of MICGANs using DCGAN architecture on MNIST da

16 Dec 24, 2021