Compatibility with GridSearchCV and n_jobs > 1
Opened this issue · 2 comments
rth commented
Issue reported by @gkjegan,
I started using pysofia and got the following error. Not sure how to resolve. Can you please help?
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\gkjeg\\AppData\\Local\\Temp\\tmp9i54w65j'
The error trace
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in apply_async(self, func, callback)
109 def apply_async(self, func, callback=None):
110 """Schedule a func to be run"""
--> 111 result = ImmediateResult(func)
112 if callback:
113 callback(result)
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in __init__(self, batch)
330 # Don't delay the application, to avoid keeping the input
331 # arguments in memory
--> 332 self.results = batch()
333
334 def get(self):
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
132
133 def __len__(self):
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in <listcomp>(.0)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
132
133 def __len__(self):
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\cross_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, error_score)
1673 estimator.fit(X_train, **fit_params)
1674 else:
-> 1675 estimator.fit(X_train, y_train, **fit_params)
1676
1677 except Exception as e:
C:\ProgramData\Anaconda3\lib\site-packages\pysofia\compat.py in fit(self, X, y, query_id)
26 self.coef_ = svm_train(X, y, query_id, self.alpha, n_samples, n_features,
27 learner_type.sgd_svm, loop_type.rank, eta_type.basic_eta,
---> 28 max_iter=self.max_iter)
29 return self
C:\ProgramData\Anaconda3\lib\site-packages\pysofia\sofia_ml.py in svm_train(X, y, b, alpha, n_samples, n_features, learner, loop, eta, max_iter, step_probability)
98
99 with tempfile.NamedTemporaryFile() as f:
--> 100 datasets.dump_svmlight_file(X, y, f.name, query_id=b)
101 w = _sofia_ml.train(f.name, n_features, alpha, max_iter, False,
102 learner.value, loop.value, eta.value, step_probability)
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\datasets\svmlight_format.py in dump_svmlight_file(X, y, f, zero_based, comment, query_id, multilabel)
478 _dump_svmlight(X, y, f, multilabel, one_based, comment, query_id)
479 else:
--> 480 with open(f, "wb") as f:
481 _dump_svmlight(X, y, f, multilabel, one_based, comment, query_id)
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\gkjeg\\AppData\\Local\\Temp\\tmp9i54w65j'
rth commented
@gkjegan Thanks for reporting this issue. I imagine you are using GridSearchCV
from scikit-learn with n_jobs
parameter larger than 1?
Could you please provide a sample of code that raised this exception. Also please provide the output of the following commands,
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import sklearn; print("Scikit-Learn", sklearn.__version__)
import pysofia; print("PySofia", pysofia.__version__)
Thanks.
gkjegan commented
Hi Roman,
Thanks for the response.
here is the output
Windows-10-10.0.15063-SP0
Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC
v.1900 64 bit (AMD64)]
NumPy 1.13.3
SciPy 0.19.1
Scikit-Learn 0.19.1
PySofia 0.9
I am trying just same as example
%pylab inline
from sklearn import cross_validation
from pysofia.compat import RankSVM, RankSVMCV
scores = cross_validation.cross_val_score(RankSVM(max_iter=200), X, y)
print(scores)
print(np.mean(scores))
Regards,
Jegan GK
…On Thu, Nov 30, 2017 at 9:11 AM, Roman Yurchak ***@***.***> wrote:
@gkjegan <https://github.com/gkjegan> Thanks for reporting this issue. I
imagine you are using GridSearchCV from scikit-learn with n_jobs
parameter larger than 1?
Could you please provide a sample of code that raised this exception. Also
please provide the output of the following commands,
import platform; print(platform.platform())import sys; print("Python", sys.version)import numpy; print("NumPy", numpy.__version__)import scipy; print("SciPy", scipy.__version__)import sklearn; print("Scikit-Learn", sklearn.__version__)import pysofia; print("PySofia", pysofia.__version__)
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABgkvN6wWXBX8piYc91eote94uhxP5k8ks5s7sW4gaJpZM4Qwsgd>
.