xlearn
xlearn copied to clipboard
xlearn from Juyter notebook
Hi. I'm trying to run xlearn's demo python code from Jupyter notebook.
The code runs with no problem from python interpreter. However when I try to run it from the notebook, the notebook's kernel crashes on the linear_model.fit(param, './model.out')
line with the following error :
Kernel Restarting
The kernel appears to have died. It will restart automatically.
Before that line, the following code ran without any problem import xlearn as xl
# Training task linear_model = xl.create_linear() # Use linear model linear_model.setTrain("./agaricus_train.txt") # Training data linear_model.setValidate("./agaricus_test.txt") # Validation data
# param: # 0. Binary classification # 1. learning rate: 0.2 # 2. lambda: 0.002 # 3. evaluation metric: accuarcy # 4. Use sgd optimization method param = {'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'acc', 'opt':'sgd'}
Can you please advise, what can be the problem and how to fix it? I use xlearn version '0.2.0', which I cloned from git.
Thank you, Zaven.
seems that I can run it successfully on jupyter 4.3.0 and Python 3. What's your environment?
I use Jupyter 4.3.0 and python 3.6.3. I understand what was the problem. There was a 'model.out' file already created using root. But the jupyter works under my account, which has no privileges to overwrite the old file. After creating model from the notebook it was trying to overwrite the old model and failed. I deleted the old 'model.out' file and it started working.
However, there is still other issue: all output from xlearn functions are shown in OS console (the output from jupyterhub command) but not in jupyter notebook. For example output of training process, ffm_model.show() or ffm_model.predict() functions shows nothing in the notebook. Can you please advise how can I see output of the functions in my notebook?
@znavoyan For now, xLearn can only print message to console. We will update it to show message in notebook as soon as possible.
I have a similar problem. Kernel restarts as soon as I execute ffm_model.fit(param, "model.out")
in Ubuntu14.04 and Python3.5.2
I have the same problem, I have tried on kaggle kernels, google colab, it's failing everywhere. What to do?
I also have the same problem , but it resets when I call the model.predict() method.
Xlearn c++ code uses multi-threading, so while accessing the hardware it need the user variable in the environment. And because if c compiler version issue the init_log() parameter is empty. So we have to initialize it by ourselves.
So basically write user = 'Test' before the command.
Or if you are running the python package of xlearn
set os.environ['USER'] = 'test'
the kernel restarting issue is not resolved with os.environ['USER'] = 'test'.
env: Ubuntu 18.04.2 LTS and Ubuntu 18.04.2 LTS
just updating my comments from yesterday. it looks like the issue was that the data sets cannot be found in the "current" directory set in the original code. the code runs ok after the directory is reset to explicitly point to the directory holding the sample data.
Wow; I faced the same error today. Turns out I'm not alone. I have been working directly through scripts right now, looks easier.