Skip to content

Commit

Permalink
feat(tester)!: swap infer parameters
Browse files Browse the repository at this point in the history
Closes #8
  • Loading branch information
Caceresenzo committed May 11, 2023
1 parent e9ae749 commit 203d29a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
2 changes: 1 addition & 1 deletion crunch/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__title__ = 'crunch-cli'
__description__ = 'crunch-cli - CLI of the CrunchDAO Platform'
__version__ = '1.1.3'
__version__ = '1.2.0'
__author__ = 'Enzo CACERES'
__author_email__ = '[email protected]'
__url__ = 'https://github.com/crunchdao/crunch-cli'
4 changes: 2 additions & 2 deletions crunch/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def run(
y_train_loop = y_train[y_train.index < moon - embargo].reset_index()
train_handler(x_train_loop, y_train_loop, model_directory_path)

logging.warn('handler: infer(%s, %s)', model_directory_path, x_test_path)
logging.warn('handler: infer(%s, %s)', x_test_path, model_directory_path)
x_test_loop = x_test[x_test.index == moon].reset_index()
prediction = infer_handler(model_directory_path, x_test_loop)
prediction = infer_handler(x_test_loop, model_directory_path)
prediction = ensure.return_infer(prediction)

predictions.append(prediction)
Expand Down
31 changes: 3 additions & 28 deletions examples/test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,13 @@
"crunch = crunch_cli.load_notebook(__name__)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def data_process(\n",
" x_train: pandas.DataFrame,\n",
" y_train: pandas.DataFrame,\n",
" x_test: pandas.DataFrame\n",
") -> typing.Tuple[pandas.DataFrame, pandas.DataFrame, pandas.DataFrame]:\n",
" \"\"\"\n",
" Do your data processing here.\n",
" This function will always be executed.\n",
" \"\"\"\n",
" \n",
" print(\"data_process\")\n",
" print(\"x_train\", len(x_train))\n",
" print(\"y_train\", len(y_train))\n",
" print(\"x_test\", len(x_test))\n",
"\n",
" return x_train, y_train, x_test"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x_train, y_train, x_test = crunch.load_data()\n",
"x_train, y_train, x_test = data_process(x_train, y_train, x_test)\n",
"len(x_train), len(y_train), len(x_test)"
]
},
Expand Down Expand Up @@ -117,8 +92,8 @@
"outputs": [],
"source": [
"def infer(\n",
" model_directory: pandas.DataFrame,\n",
" x_test: pandas.DataFrame\n",
" x_test: pandas.DataFrame,\n",
" model_directory: str,\n",
") -> pandas.DataFrame:\n",
" \"\"\"\n",
" Do your inference here.\n",
Expand All @@ -139,7 +114,7 @@
"metadata": {},
"outputs": [],
"source": [
"prediction = infer(crunch.model_directory, x_test)\n",
"prediction = infer(x_test, crunch.model_directory)\n",
"len(prediction)"
]
},
Expand Down

0 comments on commit 203d29a

Please sign in to comment.