Skip to content

Commit ca4b0eb

Browse files
FIX data loading depending on Python version (#262)
* And corrections in notebooks to match latest updates --------- Co-authored-by: Vincent Auriau <auriau.vincent@gmail.com>
1 parent 366a3de commit ca4b0eb

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

choice_learn/datasets/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ def get_path(data_file_name, module=DATA_MODULE):
3535
"""
3636
import sys
3737

38-
if sys.version >= "3.9":
38+
if int(sys.version.split(".")[1]) >= 9:
3939
return resources.files(module.replace("/", ".")) / data_file_name
40-
4140
# with resources.path(module, data_file_name) as path:
4241
# return path
43-
path = Path(module).resolve() / data_file_name
42+
path = Path(os.path.join("../..", module)).resolve() / data_file_name
4443
return path.as_posix()
4544

4645

notebooks/introduction/4_model_customization.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@
223223
" self,\n",
224224
" add_exit_choice=False, # Whether to add exit choice with utility=1\n",
225225
" optimizer=\"lbfgs\", # Optimizer to use\n",
226-
" tolerance=1e-8, # Absolute function tolerance for optimality if lbfgs is used\n",
226+
" lbfgs_tolerance=1e-8, # Absolute function tolerance for optimality if lbfgs is used\n",
227227
" lr=0.001, # learning rate if stochastic gradient descent optimizer\n",
228228
" epochs=1000, # maximum number of epochs\n",
229229
" batch_size=32, # batch size if stochastic gradient descent optimizer\n",
230230
" ):\n",
231231
" \"\"\"Model coefficients instantiation.\"\"\"\n",
232232
" super().__init__(add_exit_choice=add_exit_choice,\n",
233233
" optimizer=optimizer,\n",
234-
" tolerance=tolerance,\n",
234+
" lbfgs_tolerance=lbfgs_tolerance,\n",
235235
" lr=lr,\n",
236236
" epochs=epochs,\n",
237237
" batch_size=batch_size)\n",
@@ -592,7 +592,7 @@
592592
],
593593
"metadata": {
594594
"kernelspec": {
595-
"display_name": "tf_env",
595+
"display_name": "base",
596596
"language": "python",
597597
"name": "python3"
598598
},

0 commit comments

Comments
 (0)