Holographic Declarative Memory for Python ACT-R

Overview

HDM

This is the repository for the Holographic Declarative Memory (HDM) module for Python ACT-R.

This repository contains:

  • documentation: a paper, conference poster, and slides that describe the theory and applications of HDM
  • example models: sample ACT-R models that use HDM
  • hdm.py the HDM module itself, which uses HRRs
  • hrr.py code for Holographic Reduced Representations (HRRs)

External links:

To install HDM for use on your own computer:

  1. pip install python_actr_hdm

  2. Create a Python ACT-R model (see Python ACT-R tutorials).

  3. Instead of creating an instance of DM, create an instance of HDM in your model (see example code in this repository).

USING HDM

To use HDM:

from python_actr import * from python_actr_hdm import *

...

retrieval=Buffer()

memory=HDM(retrieval)

The HDM module provides six methods for use by an ACT-R model:

  1. The constructor, which takes a retrieval buffer and creates an HDM: memory = HDM(retrieval)

  2. Add a chunk, which takes a chunk and adds it to HDM: memory.add(chunk)

  3. Request a chunk, which takes a chunk and finds the best match in HDM: memory.request(chunk)

  4. Get activation, which takes a chunk and returns the chunk's activation as a cosine in HDM: memory.get_activation(chunk)

  5. Get and 6. set methods for defining compositional relationships between the environmental stimuli represented as environment vectors: e.g., we can define the stimulus 'customer1' as a conjunction of the features 'a white person with long, blonde hair and moustache' DM.set('customer1', DM.get('moustache') + DM.get('blond') + DM.get('long_hair') + DM.get('white'))

PARAMETERS OF HDM SHARED WITH DM

  1. buffer

  2. latency

  3. threshold As in DM, threshold is the minimum activation threshold for a chunk to be retrieved. We recommend using lower thresholds for HDM than is standard for DM. The default threshold for DM is 0. The default threshold for HDM is -4.6. Internally, HDM uses cosines, which approximate the square root of the probability. Conversely DM uses log odds as activation. For compatibility with DM, the threshold parameter is in logodds. It is immediately converted to a cosine for internal use by HDM. The default threshold of -4.6 is converted to a cosine of 0.1.

  4. maximum_time

  5. finst_size

  6. finst_time

NEW PARAMETERS UNIQUE TO HDM

  1. N is the vector dimensionality. Defaults to 512 dimensions, which is plenty. We recommend setting N to values in the range from 32 to 2048. Smaller dimensions introduce more noise and error into the model. 32 dimensions will introduce a high amount of noise/error for small study sets. 2048 dimensions allows for good recall for millions of items.

  2. verbose defaults to false. When set to true, HDM reports its internal computations, allowing the user to understand what HDM is doing.

  3. forgetting controls the forgetting rate due to retroactive inhibition range [0 to 1] 1 = no forgetting 0 = no remembering When updating memory: memory vector = forgetting * memory vector + new information vector

  4. noise controls the amount of noise added to memory per time step. Gaussian noise is added to all memory vectors whenever Request or Add is called. When adding noise: memory vector = memory vector + noise * time since last update * noise vector Noise ranges from [0 ... ], where 0 is no noise and more is more noise

You might also like...
this is a basic python project that I made using python

this is a basic python project that I made using python. This project is only for practice because my python skills are still newbie.

Analisador de strings feito em Python // String parser made in Python

Este é um analisador feito em Python, neste programa, estou estudando funções e a sua junção com "if's" e dados colocados pelo usuário. Neste código,

Python with braces. Because Python is awesome, but whitespace is awful.

Bython Python with braces. Because Python is awesome, but whitespace is awful. Bython is a Python preprosessor which translates curly brackets into in

PSP (Python Starter Package) is meant for those who want to start coding in python but are new to the coding scene.

Python Starter Package PSP (Python Starter Package) is meant for those who want to start coding in python, but are new to the coding scene. We include

Py-Parser est un parser de code python en python encore en plien dévlopement.

PY - PARSER Py-Parser est un parser de code python en python encore en plien dévlopement. Une fois achevé, il servira a de nombreux projets comme glad

Simple, high-school-leveled sequence library written in Python / 간단한 고등학교 수준 수열 라이브러리 (Python)
A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz

A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz has some issues building with python 3.10

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning  Essence.
A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

Run python scripts and pass data between multiple python and node processes using this npm module

Run python scripts and pass data between multiple python and node processes using this npm module. process-communication has a event based architecture for interacting with python data and errors inside nodejs.

Comments
  • only works if noise = 0

    only works if noise = 0

    from python_actr import * from python_actr_hdm import *

    import python_actr log=python_actr.log()

    class MyEnvironment(Model): pass

    class MyAgent(ACTR):

    focus=Buffer()
    DMbuffer=Buffer()
    
    Use_HDM = True
    
    if Use_HDM: # standard latency = 0.05
        DM=HDM(DMbuffer,N=64,latency=0.5,threshold=-888,verbose=True,noise=0.000001,forgetting=0.0,finst_size=22,finst_time=100.0)
    else: # standard latency = 0.05
        DM=Memory(DMbuffer,latency=3.0,threshold=-8,finst_size=22,finst_time=100.0)     
                                                     # latency controls the relationship between activation and recall
                                                     # activation must be above threshold - can be set to none
            
        dm_n=DMNoise(DM,noise=0.0,baseNoise=0.0)         # turn on for DM subsymbolic processing
        dm_bl=DMBaseLevel(DM,decay=0.5,limit=None)       # turn on for DM subsymbolic processing
    
    
     
    focus.set('goal:recall')
    

    DM.add('animal tiger')

    DM.add('animal tiger')

    DM.add('animal tiger')

    DM.add('animal tiger')

    DM.add('animal tiger')

    DM.add('animal lion')
    DM.add('animal lion')
    DM.add('animal tiger')
    DM.add('animal tiger')
    
    
    def request(focus='goal:recall'):
        print("requesting")
        DM.request('animal ?')            
        focus.set('goal:retrieve')     
    
    def retrieve(focus='goal:retrieve',DMbuffer='animal ?B',DM='busy:False'): 
        print("retrieved")                       
        print (B)
        DMbuffer.set('nil')
        focus.set('goal:stop')
    

    tim=MyAgent()
    somewhere=MyEnvironment()
    somewhere.agent=tim
    log_everything(somewhere) somewhere.run()

    opened by rlwest 0
Owner
Carleton Cognitive Modeling Lab
Carleton Cognitive Modeling Lab
SimilarWeb for Team ACT v.0.0.1

SimilarWeb for Team ACT v.0.0.1 This module has been built to provide a better environment specifically for Similarweb in Team ACT. This module itself

Sunkyeong Lee 0 Dec 29, 2021
A python script developed to process Windows memory images based on triage type.

Overview A python script developed to process Windows memory images based on triage type. Requirements Python3 Bulk Extractor Volatility2 with Communi

CrowdStrike 245 Nov 24, 2022
python's memory-saving dictionary data structure

ConstDict python代替的Dict数据结构 若字典不会增加字段,只读/原字段修改 使用ConstDict可节省内存 Dict()内存主要消耗的地方: 1、Dict扩容机制,预留内存空间 2、Dict也是一个对象,内部会动态维护__dict__,增加slot类属性可以节省内容 节省内存大小

Grenter 1 Nov 3, 2021
Library for Memory Trace Statistics in Python

Memory Search Library for Memory Trace Statistics in Python The library uses tracemalloc as a core module, which is why it is only available for Pytho

Memory Search 1 Dec 20, 2021
Module for remote in-memory Python package/module loading through HTTP/S

httpimport Python's missing feature! The feature has been suggested in Python Mailing List Remote, in-memory Python package/module importing through H

John Torakis 220 Dec 17, 2022
Demo of using DataLoader to prevent out of memory

Demo of using DataLoader to prevent out of memory

null 3 Jun 25, 2022
This speeds up PyCharm's package index processes and avoids CPU & memory overloading

This speeds up PyCharm's package index processes and avoids CPU & memory overloading

null 1 Feb 9, 2022
Todos os exercícios do Curso de Python, do canal Curso em Vídeo, resolvidos em Python, Javascript, Java, C++, C# e mais...

Exercícios - CeV Oferecido por Linguagens utilizadas atualmente O que vai encontrar aqui? ?? Esse repositório é dedicado a armazenar todos os enunciad

Coding in Community 43 Nov 10, 2022
PyDy, short for Python Dynamics, is a tool kit written in the Python

PyDy, short for Python Dynamics, is a tool kit written in the Python programming language that utilizes an array of scientific programs to enable the study of multibody dynamics. The goal is to have a modular framework and eventually a physics abstraction layer which utilizes a variety of backends that can provide the user with their desired workflow

PyDy 307 Jan 1, 2023
A Python script made for the Python Discord Pixels event.

Python Discord Pixels A Python script made for the Python Discord Pixels event. Usage Create an image.png RGBA image with your pattern. Transparent pi

Stanisław Jelnicki 4 Mar 23, 2022