LAMDA employs large language models (LLMs) to generate influence diagrams.
This repository contains
- the implementation of LAMDA (in
src/) - the data used in the experiments (in
data/) - the scripts of minimal examples (in
scripts/) - the code for the experiments (in
experiments/) and analysis of results (inanalysis/) - the experiments outputs (in
output/) and results
pip install -r requirements.txtNotice:
- To properly install
pycid, Python version 3.9 is suggested. pycid==0.8.2depends on an earlier version ofpgmpy. You can installpgmpy==0.1.26afterpycidis installed.
To run the experiments, you need to set the API keys in APIKEYS/apiKeys.py. For example, you can set the OpenAI API key by replacing yourOpenaiApiKey with your actual API key.
openaiKey = "yourOpenaiApiKey"Then you can run the experiments by running the following scripts:
experiment/graphExtractExperiment.py: the influence diagram graph geration experimentexperiment/probabilityExtractExperiment.py: the conditional probability distribution assignment experimentexperiment/decisionExperiment.py: the decision-making experiment
To get familiar with the functionality of LAMDA, you can run the following scripts:
createInfluenceDiagram.py: create an influence diagram from JSON filesextractGraph.py: extract the graph from the textextractProbability.py: load existing graph, extract the probability from the text, and solve the influence diagram for optimal policytestDecisionMaker.py: test the decision makers used in the experiments (Vanilla,Cot,Sc,Dellma,Aid)
If you find this work useful, please cite: