Skip to content

Commit

Permalink
Change name of persistence notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
giwankim committed Oct 17, 2020
1 parent 6e2047b commit d2289c1
Showing 1 changed file with 18 additions and 213 deletions.
231 changes: 18 additions & 213 deletions notebooks/00-dumb.ipynb → notebooks/00-persistence.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,138 +39,52 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 22;\n",
" var nbb_unformatted_code = \"from pathlib import Path\\n\\nimport cv2\\nimport numpy as np\\nimport pandas as pd\\nimport matplotlib.pyplot as plt\\nfrom tqdm.notebook import tqdm\";\n",
" var nbb_formatted_code = \"from pathlib import Path\\n\\nimport cv2\\nimport numpy as np\\nimport pandas as pd\\nimport matplotlib.pyplot as plt\\nfrom tqdm.notebook import tqdm\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"from pathlib import Path\n",
"\n",
"import cv2\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from pathlib import Path\n",
"from tqdm.notebook import tqdm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dumb baseline"
"## Persistence baseline"
]
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 18;\n",
" var nbb_unformatted_code = \"PATH = Path(\\\"../input\\\")\\nTEST_DIR = PATH / \\\"test\\\"\";\n",
" var nbb_formatted_code = \"PATH = Path(\\\"../input\\\")\\nTEST_DIR = PATH / \\\"test\\\"\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"PATH = Path(\"../input\")\n",
"TEST_DIR = PATH / \"test\""
"PATH = Path(\"../input\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 19;\n",
" var nbb_unformatted_code = \"files = list(TEST_DIR.glob(\\\"*.npy\\\"))\";\n",
" var nbb_formatted_code = \"files = list(TEST_DIR.glob(\\\"*.npy\\\"))\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"files = list(TEST_DIR.glob(\"*.npy\"))"
"files = list((PATH/\"test\").glob(\"*.npy\"))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "929b8de3e052491cb8e6442a665f7f7f",
"model_id": "f532e20a914344cfbf6a14dbcd69e453",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -187,33 +101,6 @@
"text": [
"\n"
]
},
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 23;\n",
" var nbb_unformatted_code = \"preds = []\\nfilenames = []\\nfor file in tqdm(files):\\n filenames.append(file.name)\\n data = np.load(file)\\n preds.append(data[:, :, -1])\";\n",
" var nbb_formatted_code = \"preds = []\\nfilenames = []\\nfor file in tqdm(files):\\n filenames.append(file.name)\\n data = np.load(file)\\n preds.append(data[:, :, -1])\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
Expand All @@ -227,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -236,36 +123,9 @@
"(2674, 14400)"
]
},
"execution_count": 27,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 27;\n",
" var nbb_unformatted_code = \"preds = np.stack(preds)\\npreds = preds.reshape(len(filenames), -1)\\npreds.shape\";\n",
" var nbb_formatted_code = \"preds = np.stack(preds)\\npreds = preds.reshape(len(filenames), -1)\\npreds.shape\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
Expand All @@ -276,51 +136,23 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 28;\n",
" var nbb_unformatted_code = \"subm = pd.DataFrame()\\nsubm[\\\"file_name\\\"] = filenames\";\n",
" var nbb_formatted_code = \"subm = pd.DataFrame()\\nsubm[\\\"file_name\\\"] = filenames\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"subm = pd.DataFrame()\n",
"subm[\"file_name\"] = filenames"
]
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "775f9bd61a3145959e86256a4ef5d63b",
"model_id": "8541e8fc2c8841bbb3647b2396572703",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -337,33 +169,6 @@
"text": [
"\n"
]
},
{
"data": {
"application/javascript": [
"\n",
" setTimeout(function() {\n",
" var nbb_cell_id = 30;\n",
" var nbb_unformatted_code = \"for i in tqdm(range(14400)):\\n subm[str(i)] = preds[:, i]\";\n",
" var nbb_formatted_code = \"for i in tqdm(range(14400)):\\n subm[str(i)] = preds[:, i]\";\n",
" var nbb_cells = Jupyter.notebook.get_cells();\n",
" for (var i = 0; i < nbb_cells.length; ++i) {\n",
" if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n",
" if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n",
" nbb_cells[i].set_text(nbb_formatted_code);\n",
" }\n",
" break;\n",
" }\n",
" }\n",
" }, 500);\n",
" "
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
Expand Down

0 comments on commit d2289c1

Please sign in to comment.