ActMS - python interface
This is a library to enable mental simulation of multiple cognitive models within the Cognitive Architecture ACT-R.
ACT-MS (ACT-R Mental Simulation) is an implementation based on the Python dispatcher included in ACT-R Version 7.13, which facilitates the use of ACT-R commands within a Python environment and vice versa. ACT-MS incorporates multiple functions relevant to coordinate the simultaneous simulation of multiple ACT-R models. An exemplary use case can be found in the below publication [1].
Overall, the library contains methods to:
- to forward and exchange parameters between the metamodel and the submodels.
- save the exchanged simulation parameters in a dictionary.
- enable utility learning over multiple ACT-R runs by saving the utility of one run respectively.
Installation
pip install pyactms
or
pip install git+https://github.com/seblum/actms
Usage
Take a look at the examples folder for an exemplary use case.
Call of the method simulate-submodel in a production of the metamodel to start the mental simulation of another specified ACT-R model middle-model.
(p simulate-middle-submodel
=goal>
state simulate-submodel
action =actionnumber
=imaginal>
==>
=imaginal>
=goal>
state free
action =actionnumber
!eval! ("simulate-submodel" "middle-model" =actionnumber)
)
Call of the method return-from-submodel in a production of the submodel to forward given parameters to the metamodel and save them within a specific slot of the imaginal chunk resultactionone.
(P action-retour-1
=goal>
state action-1
action 1
?manual>
state free
=imaginal>
response =duration
==>
+manual>
cmd press-key
key =duration
-imaginal>
=goal>
state idle
action idle
!eval! ("return-from-submodel" =duration 1 "retrieve-action" "resultactionone")
)
Initialization of ACT-MS. Saving the session number in the simulation results. Run of ACT-R model. Fetching the saved simulation / forwarded paramenters and saving them to a dataframe. Printing the dataframe.
import actr
import actms as ms
session = 1
actms = ActMS('mainmodelname')
actr.run_until_condition("end-program", True)
# return simulation results as df
printer = actms.Protocol("Session", session)
printer.to_csv('simulation_results.csv')
Files
-
actms.py - Contains the interface of ACT-MS and methods to load a user data set into the visicon of ACT-R.
-
actr.py - Contains the dispatcher of ACT-R version 7.12., which is necessary to form a connection between python and ACT-R (see http://act-r.psy.cmu.edu/).
Example
-
RUN-metamodel.py
-
EF-submodel-left.lisp
-
EF-metamodel.lisp
TODO
Possible additional feature to add:
- Add more dynamic and additional possibilites to save simulation parameters
- Add more possibilities to exchange parameters
- Add debugging support
Developing pyactms
To install pyactcv along with the tools to develop and run tests please run the following in your virtualenv:
$ pip install -e .[dev]
Bibliography
[1] new paper
Metadata
Release files for pyactms 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyactms-0.0.2.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyactms-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / pyactms-0.0.2.tar.gz
| Download URL | pyactms-0.0.2.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b6bcd893958cc2defe5c03d179e5c568280b7a80b3eb2f55e5474e0598bbfef
|
|
BLAKE2b-256 checksum How to use checksums |
518ada00bca10f71e5acdf24ec872aa0732aba80f1a06e3968d4ed6854b270eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.10
|
Release files / pyactms-0.0.2-py3-none-any.whl
| Download URL | pyactms-0.0.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93fca6d1e0937357c915a22b2e9d5d4f8570a7a5604c05015c7ca468eef5b82e
|
|
BLAKE2b-256 checksum How to use checksums |
bd45c096a4d516af709303a56056b205019ba870283b9fd194c1ef80a8ce390c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.10
|