[SciPy-User] lstsq/Scipy and python multiprocessing
Oleksandr Huziy
guziy.sasha at gmail.com
Thu Dec 5 10:10:18 EST 2013
Hi:
This code gives me the same answer in both cases.
[ -2.85439413e+14 2.11436602e+11]
[ -2.85439413e+14 2.11436602e+11]
sklearn.__version__ = '0.14.1'
multiprocessing.__version__ = '0.70a1'
Cheers
2013/12/5 Charles Pierre <af.charles.pierre at gmail.com>
> I was trying to do some simple multivariate regression using
> sklearn.linear_model and mutliprocessing module when i found this really
> confusing behavior.
>
> For some reason, the linear regression seems to be broken for particular
> input vectors when using multiprocessing. Using the same training set
> without multiprocessing yields correct values ...
>
> Here a piece of code that demonstrates this weird behavior:
>
> import multiprocessingfrom sklearn import linear_model
> def test_without_multi(input_x,input_y):
> clf = linear_model.LinearRegression(normalize=True)
> clf.fit(input_x,
> input_y,
> n_jobs=1)
> print clf.coef_
> def test_with_multi(input_x,input_y):
> process = multiprocessing.Process(target=test_without_multi,args=(input_x,input_y))
> process.start()
> process.join()
> if __name__ == '__main__':
> input_x = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[1,1350]]
> input_y = [2,1,1,2,3,1,3,2,1]
> test_without_multi(input_x,input_y)
> test_with_multi(input_x,input_y)
>
> Does anyone know what is happening ?
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
--
Sasha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20131205/8c3646b5/attachment.html>
More information about the SciPy-User
mailing list