Added standardization on SO features.
parent
2acf6ff9fb
commit
2c7ac21465
|
@ -4,4 +4,3 @@ PSQL_STRAW:
|
||||||
password: kizi-x2yf-mate
|
password: kizi-x2yf-mate
|
||||||
host: 212.235.208.113
|
host: 212.235.208.113
|
||||||
port: 5432
|
port: 5432
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from utils.utils import fetch_provider_features, run_provider_cleaning_script
|
from utils.utils import fetch_provider_features, run_provider_cleaning_script
|
||||||
|
from sklearn.preprocessing import StandardScaler
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -9,12 +10,7 @@ provider = snakemake.params["provider"]
|
||||||
provider_key = snakemake.params["provider_key"]
|
provider_key = snakemake.params["provider_key"]
|
||||||
sensor_key = snakemake.params["sensor_key"]
|
sensor_key = snakemake.params["sensor_key"]
|
||||||
|
|
||||||
calc_windows = False
|
calc_windows = True if (provider.get("WINDOWS", False) and provider["WINDOWS"].get("COMPUTE", False)) else False
|
||||||
try:
|
|
||||||
calc_windows = provider["WINDOWS"]["COMPUTE"]
|
|
||||||
except KeyError:
|
|
||||||
print("WINDOWS COMPUTE key not found in config.yaml!")
|
|
||||||
|
|
||||||
|
|
||||||
if sensor_key == "all_cleaning_individual" or sensor_key == "all_cleaning_overall":
|
if sensor_key == "all_cleaning_individual" or sensor_key == "all_cleaning_overall":
|
||||||
# Data cleaning
|
# Data cleaning
|
||||||
|
@ -26,8 +22,14 @@ else:
|
||||||
|
|
||||||
if calc_windows:
|
if calc_windows:
|
||||||
window_features, second_order_features = fetch_provider_features(provider, provider_key, sensor_key, sensor_data_files, time_segments_file, calc_windows=True)
|
window_features, second_order_features = fetch_provider_features(provider, provider_key, sensor_key, sensor_data_files, time_segments_file, calc_windows=True)
|
||||||
second_order_features.to_csv(snakemake.output[0], index=False)
|
|
||||||
|
# Z-score SO features by columns
|
||||||
|
if provider["WINDOWS"].get("STANDARDIZE_SO_FEATURES", False):
|
||||||
|
second_order_features[second_order_features.columns[4:]] = StandardScaler().fit_transform(second_order_features[second_order_features.columns[4:]])
|
||||||
|
|
||||||
window_features.to_csv(snakemake.output[1], index=False)
|
window_features.to_csv(snakemake.output[1], index=False)
|
||||||
|
second_order_features.to_csv(snakemake.output[0], index=False)
|
||||||
|
|
||||||
elif "empatica" in sensor_key:
|
elif "empatica" in sensor_key:
|
||||||
pd.DataFrame().to_csv(snakemake.output[1], index=False)
|
pd.DataFrame().to_csv(snakemake.output[1], index=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue