MurathanKurfali commited on
Commit ·
ba77815
1
Parent(s): 0c22e02
welcome exeter
Browse files- exeter/claim/test.csv +3 -0
- exeter/claim/training.csv +3 -0
- exeter/claim/validation.csv +3 -0
- exeter/prepare_exeter.py +69 -0
- exeter/sub_claim/test.csv +3 -0
- exeter/sub_claim/training.csv +3 -0
- exeter/sub_claim/validation.csv +3 -0
exeter/claim/test.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf6ea2931b74c808766c6e9e26a061a9d0f787425c710a7eb02f5c580ed136c6
|
| 3 |
+
size 1083238
|
exeter/claim/training.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69b9100e00f331f2be3a47dc334f77138b79f0be0a933e79856b91466ced7368
|
| 3 |
+
size 7674594
|
exeter/claim/validation.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2944ac63de014df01074ca0da2c5707df21a6c5d5383931b2c2193fe38e7b3b
|
| 3 |
+
size 857223
|
exeter/prepare_exeter.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import ast
|
| 3 |
+
import numpy as np
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import argparse
|
| 7 |
+
|
| 8 |
+
# path="/home/rjalota/climabench_data/CARDS2_multisource_multilabel_data.csv"
|
| 9 |
+
# path = "/home/rjalota/climabench_data/data/training"
|
| 10 |
+
claim_mapping = {
|
| 11 |
+
"0": "No claim",
|
| 12 |
+
"1": "Global warming is not happening",
|
| 13 |
+
"2": "Human greenhouse gases are not causing climate change",
|
| 14 |
+
"3": "Climate impacts/global warming is beneficial/not bad",
|
| 15 |
+
"4": "Climate solutions won’t work",
|
| 16 |
+
"5": "Climate movement/science is unreliable"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
subclaim_mapping = {
|
| 20 |
+
"0_0": "No claim",
|
| 21 |
+
"1_1": "Ice/permafrost/snow cover isn’t melting",
|
| 22 |
+
"1_2": "We’re heading into an ice age/global cooling",
|
| 23 |
+
"1_3": "Weather is cold/snowing",
|
| 24 |
+
"1_4": "Climate hasn’t warmed/changed over the last (few) decade(s)",
|
| 25 |
+
"1_6": "Sea level rise is exaggerated/not accelerating",
|
| 26 |
+
"1_7": "Extreme weather isn’t increasing/has happened before/isn’t linked to climate change",
|
| 27 |
+
"2_1": "It’s natural cycles/variation",
|
| 28 |
+
"2_3": "There’s no evidence for greenhouse effect/carbon dioxide driving climate change",
|
| 29 |
+
"3_1": "Climate sensitivity is low/negative feedbacks reduce warming",
|
| 30 |
+
"3_2": "Species/plants/reefs aren’t showing climate impacts/are benefiting from climate change",
|
| 31 |
+
"3_3": "CO2 is beneficial/not a pollutant",
|
| 32 |
+
"4_1": "Climate policies (mitigation or adaptation) are harmful",
|
| 33 |
+
"4_2": "Climate policies are ineffective/flawed",
|
| 34 |
+
"4_4": "Clean energy technology/biofuels won’t work",
|
| 35 |
+
"4_5": "People need energy (e.g. from fossil fuels/nuclear)",
|
| 36 |
+
"5_1": "Climate-related science is unreliable/uncertain/unsound (data, methods & models)",
|
| 37 |
+
"5_2": "Climate movement is unreliable/alarmist/corrupt"
|
| 38 |
+
}
|
| 39 |
+
def parse_args():
|
| 40 |
+
parser = argparse.ArgumentParser(description='run binary classifer')
|
| 41 |
+
parser.add_argument("--path", default="data/training", help="path to exeter training dir. containing train, test, validation splits")
|
| 42 |
+
parser.add_argument("--out", default="climaEval/exeter/", help="output directory path")
|
| 43 |
+
return parser.parse_args()
|
| 44 |
+
|
| 45 |
+
if __name__ == '__main__':
|
| 46 |
+
args = parse_args()
|
| 47 |
+
for filename in os.listdir(args.path):
|
| 48 |
+
print(filename)
|
| 49 |
+
f = os.path.join(args.path, filename)
|
| 50 |
+
df = pd.read_csv(f, header=0)
|
| 51 |
+
# print(df.head())
|
| 52 |
+
|
| 53 |
+
df.rename(columns={"claim": "sub_claim_code"}, inplace=True)
|
| 54 |
+
df["claim_code"] = df["sub_claim_code"].str.split("_").str[0]
|
| 55 |
+
|
| 56 |
+
df["claim"] = df["claim_code"].map(claim_mapping)
|
| 57 |
+
df["sub_claim"] = df["sub_claim_code"].map(subclaim_mapping)
|
| 58 |
+
|
| 59 |
+
claim_df = df[['text', 'claim_code', 'claim']]
|
| 60 |
+
subclaim_df = df[['text', 'sub_claim_code', 'sub_claim']]
|
| 61 |
+
claim_df = claim_df.dropna()
|
| 62 |
+
Path(f"{args.out}/claim/").mkdir(parents=True, exist_ok=True)
|
| 63 |
+
Path(f"{args.out}/sub_claim/").mkdir(parents=True, exist_ok=True)
|
| 64 |
+
claim_df.to_csv(f"{args.out}/claim/{filename}", index=False)
|
| 65 |
+
subclaim_df.to_csv(f"{args.out}/sub_claim/{filename}", index=False)
|
| 66 |
+
#print(claim_df.claim.value_counts())
|
| 67 |
+
print("---")
|
| 68 |
+
print(claim_df.claim_code.value_counts())
|
| 69 |
+
print(sorted(list(subclaim_df["sub_claim_code"].unique())))
|
exeter/sub_claim/test.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a43dd4341a4fa101422a163df06fba98c034dbace1774ad375e089c948277a78
|
| 3 |
+
size 1110581
|
exeter/sub_claim/training.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:988564d3591b1ea8bec8f6650b9e1cb06292b360b3505033279a524c99a5cb65
|
| 3 |
+
size 7853166
|
exeter/sub_claim/validation.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:41abbeaeefc35d95e6198651209ec87bb5f5d636b455d3fcad6d7f638ac64cbe
|
| 3 |
+
size 877077
|