[SciPy-User] lstsq/Scipy and python multiprocessing

Oleksandr Huziy guziy.sasha at gmail.com
Thu Dec 5 10:35:10 EST 2013


What about numpy and python?:
Python 2.7.5+
numpy:  '1.7.1'



2013/12/5 Charles Pierre <af.charles.pierre at gmail.com>

> Same as you,
>
> sklearn.__version__ =  '0.14.1'
> multiprocessing.__version__ = '0.70a1'
> scipy.__version__='0.12.0'
>
>
> 2013/12/5 Oleksandr Huziy <guziy.sasha at gmail.com>
>
>> My scipy version is '0.12.0', I do not know maybe it is a bug in
>> sklearn, scipy or multiprocessing, what are the versions you use?
>>
>>
>> 2013/12/5 Charles Pierre <af.charles.pierre at gmail.com>
>>
>>> Hi,
>>> Thanks for trying out the code.
>>> In my case, i get :
>>>
>>> [ -4.37499997e-01  -3.24074065e-04]
>>> [ -2.85439412e+14   2.11436597e+11]
>>>
>>> I am still confused on why i don't get the same result for both
>>> methods...
>>>
>>>
>>>
>>> 2013/12/5 Oleksandr Huziy <guziy.sasha at gmail.com>
>>>
>>>> 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
>>>>
>>>> _______________________________________________
>>>> SciPy-User mailing list
>>>> SciPy-User at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>>
>>>
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>>
>>
>>
>> --
>> Sasha
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
> _______________________________________________
> 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/b2dc905b/attachment.html>


More information about the SciPy-User mailing list