Update heatmap of correlation matrix

pull/147/head
Meng Li 2021-06-16 17:10:08 -04:00
parent 4d37696158
commit f436f1f530
2 changed files with 9 additions and 1 deletions

View File

@ -65,6 +65,7 @@ rule heatmap_feature_correlation_matrix:
input: input:
all_sensor_features = "data/processed/features/all_participants/all_sensor_features.csv" # before data cleaning all_sensor_features = "data/processed/features/all_participants/all_sensor_features.csv" # before data cleaning
params: params:
time_segments_type = config["TIME_SEGMENTS"]["TYPE"],
min_rows_ratio = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["MIN_ROWS_RATIO"], min_rows_ratio = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["MIN_ROWS_RATIO"],
corr_threshold = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["CORR_THRESHOLD"], corr_threshold = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["CORR_THRESHOLD"],
corr_method = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["CORR_METHOD"] corr_method = config["HEATMAP_FEATURE_CORRELATION_MATRIX"]["CORR_METHOD"]

View File

@ -17,12 +17,19 @@ def getCorrMatrixHeatmap(corr_matrix, time_segment, html_file):
html_file.write(fig.to_html(full_html=False, include_plotlyjs="cdn")) html_file.write(fig.to_html(full_html=False, include_plotlyjs="cdn"))
time_segments_type = snakemake.params["time_segments_type"]
min_rows_ratio = snakemake.params["min_rows_ratio"] min_rows_ratio = snakemake.params["min_rows_ratio"]
corr_threshold = snakemake.params["corr_threshold"] corr_threshold = snakemake.params["corr_threshold"]
corr_method = snakemake.params["corr_method"] corr_method = snakemake.params["corr_method"]
features = pd.read_csv(snakemake.input["all_sensor_features"]) features = pd.read_csv(snakemake.input["all_sensor_features"])
if time_segments_type == "FREQUENCY":
features["local_segment_label"] = features["local_segment_label"].str.split("\d+", expand=True, n=1)[0]
if time_segments_type == "EVENT":
features["local_segment_label"] = "event"
time_segments = set(features["local_segment_label"]) time_segments = set(features["local_segment_label"])
html_file = open(snakemake.output[0], "a", encoding="utf-8") html_file = open(snakemake.output[0], "a", encoding="utf-8")