LIBTwinSVM
LIBTwinSVM copied to clipboard
Kernel Restarting The kernel appears to have died. It will restart automatically.
from libtsvm.estimators import TSVM from tensorflow.keras import backend as K m_temp = tf.keras.Model(inputs=model.input, outputs=model.get_layer('drop_out').output) t = m_temp.predict(train_ids) arr = K.eval(t)
lssvc_concat = TSVM(kernel='linear') # Class instantiation
lssvc_concat.fit(arr, train_labels.ravel()) # Fitting the mode
This is my code. I have taken the weights from some deep learning model and I am trying to add the classifier TSVM. Until class instantiation, it is working fine. But while fitting, I am getting like "The kernel appears to have died. It will restart automatically". Kindly help me in this regard.
Thanks in advance...
Thanks for using LIBTwinSVM and reporting an issue.
Mentioning the kernel, I assume that you are using a Jupyter notebook.
To further debug the issue, I would suggest monitoring the memory usage of your kernel process using htop
on Linux or Task Manager on Windows. A kernel usually dies due to the out-of-memory error.
Also, what is the dimension of your input dataset, arr
?
from libtsvm.optimizer import clipdcd ImportError: cannot import name 'clipdcd' from 'libtsvm.optimizer' (/Users/zepu/Documents/LIBTwinSVM/libtsvm/optimizer/init.py)
No clipdcd module
OS: Mac Python Version: py3.8.3
cd optimizer
$ ls
__init__.py __pycache__ armadillo-code setup.py src
@xizepu
Have you installed LibTwinSVM using pip
?
Also, note that the optimizer
module may not work with macOS. At the moment, we do not have compiled binary wheels for macOS.
@mir-am Hi, I reinstall LibTwinSVM using pip and success run in macOS. Many thanks!
Now I install LibTwinSVM for Windows11
C:\WINDOWS\system32>pip install numpy cython
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (1.21.4)
Requirement already satisfied: cython in c:\programdata\anaconda3\lib\site-packages (0.29.28)
the errors:
Building wheels for collected packages: LIBTwinSVM
Building wheel for LIBTwinSVM (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [83 lines of output]
Added LAPACK and BLAS DLLs to the wheel for Windows platform.
Maybe the git subprocess?
Maybe the Python version is not suit for it. I install
C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM>python --version
Python 3.8.10
the errors is
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
let me install python 3.7.
Unfortunately, I have not tested LibTwinSVM with Python 3.8 and newer. It is tested up to Python 3.7.
@mir-am OK, many thanks! Great jobs!
@mir-am Hi, the same errors on Python 3.7
1st, I try to install LIBTwinSVM from the source, but the compile errors.
2nd, I install LIBTwinSVM from pip install libtsvm
:
LIBTwinSVM 0.3.0
In python
(LIBTwinSVM) C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM>python
Python 3.7.13 (default, Mar 28 2022, 08:03:21) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtsvm
>>> help(libtsvm)
Help on package libtsvm:
NAME
libtsvm
DESCRIPTION
# LIBTwinSVM: A Library for Twin Support Vector Machines
# Developers: Mir, A. and Mahdi Rahbar
# License: GNU General Public License v3.0
However, when I try GUI, the errors:
(LIBTwinSVM) C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM>python -m libtsvm
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\LIBTwinSVM\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\ProgramData\Anaconda3\envs\LIBTwinSVM\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM\libtsvm\__main__.py", line 8, in <module>
from libtsvm.app import main
File "C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM\libtsvm\app.py", line 13, in <module>
from libtsvm.model import UserInput
File "C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM\libtsvm\model.py", line 12, in <module>
from libtsvm.estimators import TSVM, LSTSVM
File "C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM\libtsvm\estimators.py", line 14, in <module>
from libtsvm.optimizer import clipdcd
ImportError: cannot import name 'clipdcd' from 'libtsvm.optimizer' (C:\Users\Lenovo\Desktop\SciLab\LIBTwinSVM\libtsvm\optimizer\__init__.py)
@xizepu
Note that you should NOT run python -m libtsvm
in the project repository root. Run the command in another folder, e.g., C:\Users\Lenovo\Desktop\
.