evaluation: Edge evaluation pca-chosen#432
evaluation: Edge evaluation pca-chosen#432ntalluri wants to merge 11 commits intoReed-CompBio:mainfrom
Conversation
Documentation build overview
Show files changed (5 files in total): 📝 5 modified | ➕ 0 added | ➖ 0 deleted
|
Co-authored-by: Tristan F.-R. <pub.tristanf@gmail.com>
…s into edge-evaluation-pca-chosen
agitter
left a comment
There was a problem hiding this comment.
I left initial comments and have not run it locally yet. The pre-commit check test is failing.
| edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-not-provided_edges.png') | ||
| edge_output_png.unlink(missing_ok=True) | ||
|
|
||
| file_paths = [] |
There was a problem hiding this comment.
It took me a minute to remember what is "not provided" in these node and edge test cases. Adding a single line docstring or a comment to these empty file paths would help with that.
| node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.txt') | ||
| node_output_file.unlink(missing_ok=True) | ||
| node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.png') |
There was a problem hiding this comment.
| node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.txt') | |
| node_output_file.unlink(missing_ok=True) | |
| node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.png') | |
| node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-nodes.txt') | |
| node_output_file.unlink(missing_ok=True) | |
| node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-nodes.png') |
| edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.txt') | ||
| edge_output_file.unlink(missing_ok=True) | ||
| edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.png') |
There was a problem hiding this comment.
| edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.txt') | |
| edge_output_file.unlink(missing_ok=True) | |
| edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.png') | |
| edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-edges.txt') | |
| edge_output_file.unlink(missing_ok=True) | |
| edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-edges.png') |
| all_edges_mixed = y_true_mixed.union(y_pred) | ||
| y_true_mixed_binary = [1 if edge in y_true_mixed else 0 for edge in all_edges_mixed] | ||
| y_pred_mixed_binary = [1 if edge in y_pred else 0 for edge in all_edges_mixed] | ||
| # default to 0.0 if there is a divide by 0 error | ||
| # not using precision_recall_curve because thresholds are binary (0 or 1); rather we are directly | ||
| # calculating precision and recall per pathway | ||
| precision_mixed = precision_score(y_true_mixed_binary, y_pred_mixed_binary, zero_division=0.0) | ||
| recall_mixed = recall_score(y_true_mixed_binary, y_pred_mixed_binary, zero_division=0.0) | ||
| results.append({'Pathway': f, 'Precision': precision_mixed, 'Recall': recall_mixed, 'Gold_Standard_Type': "mixed"}) |
There was a problem hiding this comment.
This code block is repeated three times, right? Is there a way to reuse the same code three times and keep it this readable, or does it become harder to follow the logic? I do value the readability.
|
|
||
| else: | ||
| title = "PCA-Chosen Pathway Across All Algorithms Precision and Recall Plot" | ||
| if aggregate_per_algorithm : |
There was a problem hiding this comment.
| if aggregate_per_algorithm : | |
| if aggregate_per_algorithm: |
Adding the code for the edge specific visualization function for the PCA chosen pathways. Closes #374