Skip to content

Commit

Permalink
Use relative paths to retrieve files
Browse files Browse the repository at this point in the history
  • Loading branch information
dfdazac committed Apr 24, 2023
1 parent 7c210c2 commit 26c8eb8
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 38 deletions.
103 changes: 68 additions & 35 deletions notebooks/07_04_03_eval_lp_node_degree_effect-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"cell_type": "code",
"execution_count": 1,
"id": "29e67efe",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:56:07.555240Z",
"end_time": "2023-04-24T12:56:07.654588Z"
}
},
"outputs": [],
"source": [
"%load_ext autoreload\n",
Expand All @@ -23,25 +28,20 @@
"cell_type": "code",
"execution_count": 2,
"id": "c91dbf0f",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/jovyan/.conda/envs/bioblp-env/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:56:07.665999Z",
"end_time": "2023-04-24T12:56:11.760124Z"
}
],
},
"outputs": [],
"source": [
"import json\n",
"from IPython.display import Image\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"from pathlib import Path\n",
"import seaborn as sns\n",
"import time\n",
"from tqdm import tqdm\n",
"from typing import List\n",
Expand All @@ -55,9 +55,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 11,
"id": "6c6d1fbe",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:58:43.581560Z",
"end_time": "2023-04-24T12:58:43.679575Z"
}
},
"outputs": [],
"source": [
"from nb_utils.eval_utils import TEST, VALID, TRAIN, DUMMY\n",
Expand Down Expand Up @@ -100,9 +105,14 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 12,
"id": "5cdcb04e",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:58:44.923602Z",
"end_time": "2023-04-24T12:58:44.962174Z"
}
},
"outputs": [],
"source": [
"ROTATE = \"rotate-otxtubeb\"\n",
Expand All @@ -116,9 +126,14 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 13,
"id": "d5659268",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:58:46.093501Z",
"end_time": "2023-04-24T12:58:46.127011Z"
}
},
"outputs": [],
"source": [
"toml_path = ARTIFACT_REGISTRY_TOML_PATH\n",
Expand All @@ -129,9 +144,14 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 14,
"id": "6cde741b",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:58:47.702451Z",
"end_time": "2023-04-24T12:58:47.777860Z"
}
},
"outputs": [],
"source": [
"graph_cfg = GraphRegistryConfig.from_toml(ARTIFACT_REGISTRY_TOML_PATH)\n"
Expand Down Expand Up @@ -617,10 +637,14 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 16,
"id": "fa14cf52",
"metadata": {
"tags": []
"tags": [],
"ExecuteTime": {
"start_time": "2023-04-24T12:59:28.194293Z",
"end_time": "2023-04-24T12:59:28.252411Z"
}
},
"outputs": [],
"source": [
Expand All @@ -630,25 +654,34 @@
"from nb_utils.eval_utils import INVERSE_HARMONIC_MEAN_RANK\n",
"from nb_utils.eval_utils import HITS_AT_1, HITS_AT_3, HITS_AT_10\n",
"from nb_utils.plot_utils import merge_and_plot_node_degree_analysis_multimodel_lp_eval_diff\n",
"import matplotlib.ticker as ticker\n",
"import seaborn as sns"
"import matplotlib.ticker as ticker"
]
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 17,
"id": "5de3f34a",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:59:29.602505Z",
"end_time": "2023-04-24T12:59:29.667129Z"
}
},
"outputs": [],
"source": [
"from nb_utils.eval_utils import NodeDegreeEvalAnalyser\n"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 19,
"id": "3c1c192f",
"metadata": {},
"metadata": {
"ExecuteTime": {
"start_time": "2023-04-24T12:59:50.223480Z",
"end_time": "2023-04-24T12:59:50.287397Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -661,7 +694,7 @@
}
],
"source": [
"NODE_DEGREE_EVAL_RESULTS_DIR = Path(\"/home/jovyan/BioBLP/notebooks/metrics/node_degree_eval_lp/combined_spotlight_ent_as_src_and_tgt\")\n",
"NODE_DEGREE_EVAL_RESULTS_DIR = Path(\"metrics/node_degree_eval_lp/combined_spotlight_ent_as_src_and_tgt\")\n",
"ent_type_specific_models = {\n",
" DISEASE: [ROTATE, BIOBLP_D],\n",
" PROTEIN: [ROTATE, BIOBLP_P],\n",
Expand Down Expand Up @@ -1733,10 +1766,10 @@
"evalue": "name 'results_by_node_degree_dicts_rotate_prot' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[26], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m EVAL_OUT_DIR_NODE_DEGREE_ANALYSIS \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m./data/imgs/node-degree-analysis-rotate-and-bioblpp\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 2\u001b[0m model_result_dicts \u001b[38;5;241m=\u001b[39m {ROTATE: \u001b[43mresults_by_node_degree_dicts_rotate_prot\u001b[49m[EVAL_NODE_HEAD],\n\u001b[1;32m 3\u001b[0m BIOBLP_P: results_by_node_degree_dicts_bioblpp[EVAL_NODE_HEAD]}\u001b[38;5;66;03m#results_by_node_degree_dicts_bioblp}\u001b[39;00m\n\u001b[1;32m 4\u001b[0m x \u001b[38;5;241m=\u001b[39m plot_metric_vs_degree_scatterplot_multi_models(metric_name\u001b[38;5;241m=\u001b[39mHITS_AT_10, results_by_node_degree_dicts_combined\u001b[38;5;241m=\u001b[39mmodel_result_dicts,\n\u001b[1;32m 5\u001b[0m eval_out_dir\u001b[38;5;241m=\u001b[39mEVAL_OUT_DIR_NODE_DEGREE_ANALYSIS)\n",
"\u001b[0;31mNameError\u001b[0m: name 'results_by_node_degree_dicts_rotate_prot' is not defined"
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mNameError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[26], line 2\u001B[0m\n\u001B[1;32m 1\u001B[0m EVAL_OUT_DIR_NODE_DEGREE_ANALYSIS \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m./data/imgs/node-degree-analysis-rotate-and-bioblpp\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m----> 2\u001B[0m model_result_dicts \u001B[38;5;241m=\u001B[39m {ROTATE: \u001B[43mresults_by_node_degree_dicts_rotate_prot\u001B[49m[EVAL_NODE_HEAD],\n\u001B[1;32m 3\u001B[0m BIOBLP_P: results_by_node_degree_dicts_bioblpp[EVAL_NODE_HEAD]}\u001B[38;5;66;03m#results_by_node_degree_dicts_bioblp}\u001B[39;00m\n\u001B[1;32m 4\u001B[0m x \u001B[38;5;241m=\u001B[39m plot_metric_vs_degree_scatterplot_multi_models(metric_name\u001B[38;5;241m=\u001B[39mHITS_AT_10, results_by_node_degree_dicts_combined\u001B[38;5;241m=\u001B[39mmodel_result_dicts,\n\u001B[1;32m 5\u001B[0m eval_out_dir\u001B[38;5;241m=\u001B[39mEVAL_OUT_DIR_NODE_DEGREE_ANALYSIS)\n",
"\u001B[0;31mNameError\u001B[0m: name 'results_by_node_degree_dicts_rotate_prot' is not defined"
]
}
],
Expand Down Expand Up @@ -2057,9 +2090,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "bioblp-env",
"name": "python3",
"language": "python",
"name": "bioblp-env"
"display_name": "Python 3 (ipykernel)"
},
"language_info": {
"codemirror_mode": {
Expand Down
2 changes: 1 addition & 1 deletion notebooks/nb_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
PROTEIN = 'protein'


ARTIFACT_REGISTRY_TOML_PATH = "/home/jovyan/BioBLP/notebooks/nb_utils/artifact_registry.toml"
ARTIFACT_REGISTRY_TOML_PATH = "nb_utils/artifact_registry.toml"


class EntityType(str, Enum):
Expand Down
1 change: 0 additions & 1 deletion notebooks/nb_utils/eval_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pathlib import Path
from pykeen.triples import TriplesFactory
from pykeen.evaluation import RankBasedEvaluator
import seaborn as sns
import torch
from tqdm import tqdm
import wandb
Expand Down
1 change: 0 additions & 1 deletion notebooks/nb_utils/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pykeen.triples import TriplesFactory
from pykeen.evaluation import RankBasedEvaluator
import matplotlib.ticker as ticker
import seaborn as sns
from tqdm import tqdm
import wandb
import time
Expand Down

0 comments on commit 26c8eb8

Please sign in to comment.