[WIP] Add a rule to parse targets.

Does nothing for now.
labels
junos 2022-04-06 17:47:03 +02:00
parent baa94c4c4e
commit ac86221662
4 changed files with 21 additions and 1 deletions

View File

@ -415,11 +415,15 @@ for provider in config["ALL_CLEANING_OVERALL"]["PROVIDERS"].keys():
# Baseline features # Baseline features
if config["PARAMS_FOR_ANALYSIS"]["BASELINE"]["COMPUTE"]: if config["PARAMS_FOR_ANALYSIS"]["BASELINE"]["COMPUTE"]:
files_to_compute.extend(expand("data/raw/baseline_merged.csv")) files_to_compute.extend("data/raw/baseline_merged.csv")
files_to_compute.extend(expand("data/raw/{pid}/participant_baseline_raw.csv", pid=config["PIDS"])) files_to_compute.extend(expand("data/raw/{pid}/participant_baseline_raw.csv", pid=config["PIDS"]))
files_to_compute.extend(expand("data/interim/{pid}/baseline_questionnaires.csv", pid=config["PIDS"])) files_to_compute.extend(expand("data/interim/{pid}/baseline_questionnaires.csv", pid=config["PIDS"]))
files_to_compute.extend(expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"])) files_to_compute.extend(expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"]))
# Targets (labels)
if config["PARAMS_FOR_ANALYSIS"]["TARGET"]["COMPUTE"]:
files_to_compute.extend(expand("data/processed/targets/{pid}/parsed_targets.csv", pid=config["PIDS"]))
rule all: rule all:
input: input:
files_to_compute files_to_compute

View File

@ -649,5 +649,6 @@ PARAMS_FOR_ANALYSIS:
CATEGORICAL_FEATURES: [gender] CATEGORICAL_FEATURES: [gender]
TARGET: TARGET:
COMPUTE: True
SCALE: [positive_affect, negative_affect] SCALE: [positive_affect, negative_affect]

View File

@ -27,3 +27,12 @@ rule baseline_features:
features="data/processed/features/{pid}/baseline_features.csv" features="data/processed/features/{pid}/baseline_features.csv"
script: script:
"../src/data/baseline_features.py" "../src/data/baseline_features.py"
rule parse_targets:
input:
targets = "data/processed/features/{pid}/phone_esm.csv",
time_segments_labels = "data/interim/time_segments/{pid}_time_segments_labels.csv"
output:
"data/processed/targets/{pid}/parsed_targets.csv"
script:
"../src/models/parse_targets.py"

View File

@ -0,0 +1,6 @@
import pandas as pd
targets = pd.read_csv(snakemake.input["targets"])
targets.to_csv(snakemake.output[0], index=False)