-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0-selection_dataframe.py
More file actions
78 lines (61 loc) · 2.42 KB
/
Copy path0-selection_dataframe.py
File metadata and controls
78 lines (61 loc) · 2.42 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Select the models and operations from the original hctsa df_TS_DataMat_diff used for the analysis, previous to the roubstness
# as the time series have length of 5000 steps
import numpy as np
import pandas as pd
import os
from pathlib import Path
cwd = os.getcwd()
# Write down models (same order as the one in INP_file_generation.py)
models = ['AR1_UNO', 'ARMA11_UNO', #ARMA
'HEN', 'LOGISTIC4', 'QUADRATIC', # chaos
'HEN_SUM', # sum chaos
'MODA', 'LLOG', # other deterministic
'SINE_STOCH'] # other stochastic
model_keywords = {'AR1_UNO': ['irreversible'], 'ARMA11_UNO': ['irreversible'],
'HEN': ['irreversible'], 'LOGISTIC4': ['irreversible'], 'QUADRATIC': ['irreversible'],
'HEN_SUM': ['irreversible'],
'MODA': ['irreversible'], 'LLOG': ['irreversible'],
'SINE_STOCH': ['irreversible']}
# operations (24)
ops = ['AC_nl_001_abs', 'AC_nl_01_abs',
'AC_nl_001',
'AC_nl_013',
'CO_glscf_1_2_1',
'CO_glscf_1_10_2',
'CO_StickAngles_y_mean_p',
'CO_StickAngles_y_skewness_n',
'CO_Embed2_Basic_1_parabdown05_n1',
'PH_Walker_biasprop_01_05_w_mean',
'PH_Walker_prop_05_sw_meanabsdiff',
'FC_LocalSimple_mean3_gofr2',
'FC_LocalSimple_mean4_meanabserr',
'MF_armax_1_1_05_1_normksstat',
'MF_steps_ahead_ar_2_6_mabserr_1',
'EX_MovingThreshold_01_01_medianq',
'NL_MS_nlpe_fnn_mi_normksstat',
'SB_BinaryStats_diff_diff21stretch1',
'SB_BinaryStats_diff_diff21stretch0',
'SB_BinaryStats_diff_meanstretch1',
'SB_BinaryStats_diff_meanstretch0',
'SB_MotifTwo_diff_uu',
'SB_MotifTwo_diff_dd',
'SB_MotifTwo_diff_u']
# folder where this script lives
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
path_base = str(BASE_DIR)
REPO_DIR = Path(BASE_DIR).parents[2]
DATA_MAIN_DIR = REPO_DIR / 'data-tr' / 'main-analysis' / 'data-analysis'
path_data= str(DATA_MAIN_DIR)
SAVE_DIR = REPO_DIR / 'data-tr' / 'robustness-analysis' / 'data-analysis'
path_save = str(SAVE_DIR)
if not os.path.exists(path_save):
os.makedirs(path_save)
df = pd.read_csv(path_data + '/df_TS_DataMat_diff.csv')
df.set_index('Model', inplace=True)
# Extract rows models
df = df[df.index.isin(models)]
# Select columns in ops
df = df.loc[:, ops]
print(df.shape) # (900, 24)
# Save
df.to_csv(path_save + '/df_TS_DataMat_diff_5000.csv')