I want to to create GUI to choose data set file with QFileDialge and lanche the training of SVM with this data set using cross validation method.
The cross validation takes a lot a time when data is large and the GUI will crash. For that reason I use QThread for training. However when i set the number of job -1 to use all cores of my CPU sklearn returns the following warning and only uses 1 core.
\anaconda\lib\site-packages\sklearn\externals\joblib\parallel.py:547: UserWarning: Multiprocessing-backed parallel loops cannot be nested below threads, setting n_jobs=1 **self._backend_args)
from PyQt5.Qt import QThread
from sklearn.model_selection import cross_val_score
from sklearn import svm
class train(QThread):
def __init__(self,data,class_):
super().__init__()
self.data = data
self.cls = class_
def run(self):
self.score = cross_val_score(estimator=svm.SVC(), # smv
X=self.ata, y=self.cls, # data
cv=10, # number of partition
n_jobs=-1) # all the cores in cpu