-
Notifications
You must be signed in to change notification settings - Fork 2
/
consts.py
57 lines (48 loc) · 1.53 KB
/
consts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import pandas as pd
LABEL_COLUMNS = ["location_traffic_convenience",
"location_distance_from_business_district",
"location_easy_to_find",
"service_wait_time",
"service_waiters_attitude",
"service_parking_convenience",
"service_serving_speed",
"price_level",
"price_cost_effective",
"price_discount",
"environment_decoration",
"environment_noise",
"environment_space",
"environment_cleaness",
"dish_portion",
"dish_taste",
"dish_look",
"dish_recommendation",
"others_overall_experience",
"others_willing_to_consume_again"]
LABEL_COLUMNS_ALL = []
for label in LABEL_COLUMNS:
LABEL_COLUMNS_ALL += [label+"_-2", label+"_-1", label+"_0", label+"_1"]
BERT_MODEL_NAME = 'bert-base-chinese'
MAX_TOKEN_COUNT = 512
N_EPOCHS = 1
BATCH_SIZE = 16
RANDOM_SEED = 42
ROOT = "."
DATASET = "/dataset"
DATA_PATH = ROOT + DATASET
THRESHOLD = 0.5
def func(x):
if x == -2:
return [1, 0, 0, 0]
if x == -1:
return [0, 1, 0, 0]
if x == 0:
return [0, 0, 1, 0]
if x == 1:
return [0, 0, 0, 1]
def read_xy(filename):
f = pd.read_csv(filename, encoding="utf-8", sep=",").iloc[0:1000, :]
LABEL_COLUMNS = f.columns.tolist()[2:]
for col in LABEL_COLUMNS:
f[col] = f[col].apply(func)
return f