Preparation for cleaning & imputation

sociality-task
Primoz 2022-08-26 10:56:14 +00:00
parent a620def209
commit f78aa3e7b3
4 changed files with 6 additions and 9 deletions

View File

@ -551,9 +551,6 @@ if config["PARAMS_FOR_ANALYSIS"]["TARGET"]["COMPUTE"]:
files_to_compute.extend(expand("data/processed/models/population_model/z_input.csv")) files_to_compute.extend(expand("data/processed/models/population_model/z_input.csv"))
#files_to_compute.extend(expand("data/processed/models/individual_model/{pid}/output_{cv_method}/baselines.csv", pid=config["PIDS"], cv_method=config["PARAMS_FOR_ANALYSIS"]["CV_METHODS"])) #files_to_compute.extend(expand("data/processed/models/individual_model/{pid}/output_{cv_method}/baselines.csv", pid=config["PIDS"], cv_method=config["PARAMS_FOR_ANALYSIS"]["CV_METHODS"]))
# Put the for loop over STANDARDIZATION providers if all are COMPUTE == True
# then merge all that are set to True in z_all_sensors for all and each participant
# See the logic behind: in each sensor the "data/processed/features/all_participants/all_sensor_features.csv" is listed
rule all: rule all:
input: input:

View File

@ -1135,7 +1135,7 @@ rule clean_standardized_sensor_features_for_individual_participants:
script_extension = "{script_extension}", script_extension = "{script_extension}",
sensor_key = "all_cleaning_individual" sensor_key = "all_cleaning_individual"
output: output:
"data/processed/features/{pid}/z_all_sensor_features_cleaned_{provider_key}_{script_extension}.csv" # bo predstavljalo probleme za naprej (kako iskati datoteke + standardizacija itd.) "data/processed/features/{pid}/z_all_sensor_features_cleaned_{provider_key}_{script_extension}.csv"
script: script:
"../src/features/entry.{params.script_extension}" "../src/features/entry.{params.script_extension}"

View File

@ -30,7 +30,7 @@ rule baseline_features:
rule select_target: rule select_target:
input: input:
cleaned_sensor_features = "data/processed/features/{pid}/z_all_sensor_features_cleaned_rapids_R.csv" cleaned_sensor_features = "data/processed/features/{pid}/z_all_sensor_features_cleaned_straw_py.csv"
params: params:
target_variable = config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"] target_variable = config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"]
output: output:
@ -40,7 +40,7 @@ rule select_target:
rule merge_features_and_targets_for_population_model: rule merge_features_and_targets_for_population_model:
input: input:
cleaned_sensor_features = "data/processed/features/all_participants/z_all_sensor_features_cleaned_rapids_R.csv", cleaned_sensor_features = "data/processed/features/all_participants/z_all_sensor_features_cleaned_straw_py.csv",
demographic_features = expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"]), demographic_features = expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"]),
params: params:
target_variable=config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"] target_variable=config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"]
@ -51,7 +51,7 @@ rule merge_features_and_targets_for_population_model:
# rule select_target: # rule select_target:
# input: # input:
# cleaned_sensor_features = "data/processed/features/{pid}/all_sensor_features_cleaned_rapids_R.csv" # cleaned_sensor_features = "data/processed/features/{pid}/all_sensor_features_cleaned_straw_py.csv"
# params: # params:
# target_variable = config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"] # target_variable = config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"]
# output: # output:
@ -61,7 +61,7 @@ rule merge_features_and_targets_for_population_model:
# rule merge_features_and_targets_for_population_model: # rule merge_features_and_targets_for_population_model:
# input: # input:
# cleaned_sensor_features = "data/processed/features/all_participants/all_sensor_features_cleaned_rapids_R.csv", # cleaned_sensor_features = "data/processed/features/all_participants/all_sensor_features_cleaned_straw_py.csv",
# demographic_features = expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"]), # demographic_features = expand("data/processed/features/{pid}/baseline_features.csv", pid=config["PIDS"]),
# params: # params:
# target_variable=config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"] # target_variable=config["PARAMS_FOR_ANALYSIS"]["TARGET"]["LABEL"]

View File

@ -10,7 +10,7 @@ def retain_target_column(df_input: pd.DataFrame, target_variable_name: str):
if all(~target_variable_index): if all(~target_variable_index):
raise ValueError("The requested target (", target_variable_name, raise ValueError("The requested target (", target_variable_name,
")cannot be found in the dataset.", ")cannot be found in the dataset.",
"Please check the names of phone_esm_ columns in all_sensor_features_cleaned_rapids_R.csv") "Please check the names of phone_esm_ columns in z_all_sensor_features_cleaned_straw_py.csv")
sensor_features_plus_target = df_input.drop(esm_names, axis=1) sensor_features_plus_target = df_input.drop(esm_names, axis=1)
sensor_features_plus_target["target"] = df_input[esm_names[target_variable_index]] sensor_features_plus_target["target"] = df_input[esm_names[target_variable_index]]
# We will only keep one column related to phone_esm and that will be our target variable. # We will only keep one column related to phone_esm and that will be our target variable.