Views
No views yet
1@inproceedings{cui-etal-2024-exploring,
2 title = "Exploring Defeasibility in Causal Reasoning",
3 author = "Cui, Shaobo and
4 Milikic, Lazar and
5 Feng, Yiyang and
6 Ismayilzada, Mete and
7 Paul, Debjit and
8 Bosselut, Antoine and
9 Faltings, Boi",
10 booktitle = "Findings of the Association for Computational Linguistics ACL 2024",
11 month = aug,
12 year = "2024",
13 address = "Bangkok, Thailand and virtual meeting",
14 publisher = "Association for Computational Linguistics",
15 url = "https://aclanthology.org/2024.findings-acl.384",
16 doi = "10.18653/v1/2024.findings-acl.384",
17 pages = "6433--6452",
18}pip install causal-strength1git clone https://github.com/cui-shaobo/causal-strength.git
2cd causal-strength
3pip install .1from causalstrength import evaluate
2
3# Test CESAR Model
4s1_cesar = "Tom is very hungry now."
5s2_cesar = "He goes to McDonald for some food."
6
7print("Testing CESAR model:")
8cesar_score = evaluate(s1_cesar, s2_cesar, model_name='CESAR', model_path='shaobocui/cesar-bert-large')
9print(f"CESAR Causal strength between \"{s1_cesar}\" and \"{s2_cesar}\": {cesar_score:.4f}")1Testing CESAR model:
2CESAR Causal strength between "Tom is very hungry now." and "He goes to McDonald for some food.": 0.4482evaluate function computes the causal strength between two statements.1from causalstrength import evaluate
2
3# Test CESAR Model
4s1_cesar = "Tom is very hungry now."
5s2_cesar = "He goes to McDonald for some food."
6
7print("Testing CESAR model:")
8cesar_score = evaluate(s1_cesar, s2_cesar, model_name='CESAR', model_path='shaobocui/cesar-bert-large')
9print(f"CESAR Causal strength between \"{s1_cesar}\" and \"{s2_cesar}\": {cesar_score:.4f}")1Testing CESAR model:
2CESAR Causal strength between "Tom is very hungry now." and "He goes to McDonald for some food.": 0.44821 from causalstrength import evaluate
2
3 # Test CEQ Model
4 s1_ceq = "Tom is very hungry now."
5 s2_ceq = "He goes to McDonald for some food."
6
7 print("\nTesting CEQ model:")
8 ceq_score = evaluate(s1_ceq, s2_ceq, model_name='CEQ')
9 print(f"CEQ Causal strength between \"{s1_ceq}\" and \"{s2_ceq}\": {ceq_score:.4f}")1Testing CEQ model:
2CEQ Causal strength between "Tom is very hungry now." and "He goes to McDonald for some food.": 0.0168s1 (str): The cause statement.s2 (str): The effect statement.model_name (str): The name of the model to use ('CESAR', 'CEQ', etc.).model_path (str): Hugging Face model identifier or local path to the model.1from causalstrength import evaluate
2
3# Test CESAR Model
4s1_cesar = "Fire starts quickly."
5s2_cesar = "House burns to ashes."
6
7print("Testing CESAR model:")
8cesar_score = evaluate(s1_cesar, s2_cesar, model_name='CESAR', model_path='shaobocui/cesar-bert-large',
9 plot_heatmap_flag=True, heatmap_path=f'./figures/causal_heatmap.png')1Testing CESAR model:
2The causal heatmap is saved to ./figures/causal_heatmap.png