/LoPS

Codes for the paper "Problem-Solving as a Language: A Computational Lens into Human and Monkey Intelligence"

Primary LanguagePython

LoPS Analysis Code Execution Guide

Usage:

The file main_script.py contains the functions to generate data and generate the main figures. main_script.py is divided into several sections: 1)Perform LoPS analysis by executing the generate_data function, the code will automatically call and save the data. 2)Execute the generate_img_data function to generate the data required for drawing based on the LoPS analysis results and automatically save it. 3)Execute the draw_img function to automatically read the data required for drawing and generate all the figures in the paper.

The BasicStrategy file includes functions such as generating strategy utility, fitting strategy weights, and generating strategy sequences. These functions are called through the generate_data function in main_script.py

The FeatureExtractor file mainly generates game-related information, such as game status information, process information, reward information, reaction events and other data.

The GrammarInduction file performs LoPS grammar induction based on the strategy sequence and game state information generated by the above files, and obtains the LoPS complexity of each participant.

The DrawImg file lincludes generate_data and plot_code. Generate_data is used to generate the data required for drawing, and plot_code contains the main code for drawing pictures in the paper.

The PGM file contains functions for structure learning of probabilistic graphical models.

Additionally, all data is required to run this script. We provide two examples of files required in 1.BasicStrategy. So you are free to inspect the code logic, but they may throw exceptions if you run the file.