-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
levy on Python 3 #1
Comments
Hi, thanks for reporting this error. I did everything for Python 2, so I
This is a generated file, do not edit.import numpy, base64 pdf = numpy.loads(base64.decodestring( with
This is a generated file, do not edit.import numpy, base64 pdf = numpy.loads(base64.b64decode( You have to make the same changes in _make_approx_data_file. I don't have time to check it now, but if you can run it, please let me best, On Thu, May 26, 2016 at 6:21 PM, lukast008 notifications@github.com wrote:
|
Thanks José, Best regards, |
On Tuesday I will take a look to it, thanks! best On Fri, May 27, 2016 at 10:01 PM, lukast008 notifications@github.com
|
I had to do a few more things to make it work under python 3.5. |
Hi, thanks for the interest, I should definitively take a look at these
issues.
Honestly, the dump of the data is something inherited from the previous
version of the code. It is in deed somewhat odd, but, it is _very_ fast; in
fact, pickle is the slowest methods, json is very good, but the data is
very structured (is a matrix after all, for all the alpha, beta
combinations), and this thing works better.
Only recently I began working with python 3, and I see that is superior in
handling the different encodings. I will check the shelve and numpy.savez
and come back with a solution.
best regards, and thanks
Jose
…On Fri, Feb 17, 2017 at 1:43 AM, Alexandre Avanian ***@***.*** > wrote:
I had to do a few more things to make it work under python 3.5.
I'm not very familiar with writing python 2 backward compatible,
especially re. encodings so no PR at this stage. That being said,
@josemiotto <https://github.com/josemiotto>, any reason why you dump the
limit, pdf and cdf data this way instead of using a pickle, json file or
a shelve or numpy.savez? That would bypass this issue in a transparent way,
allows built-in compression in the case of savez, etc...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQp0nAmXFFBDWrQHkKoUFRFfWGyBPuCks5rdO0tgaJpZM4Intve>
.
|
Actually, the code already uses pickle (
Here is a notebook with a quick benchmark but it's not terribly relevant:
|
thanks aavanian! that's great, I'm switching to the numpy.savez method. The new version, which hopefully I push today, is also py3 compatible. |
Hello, thanks for this lib :)
I'm trying to run this code using Python 3.4, but I'm getting errors with base64 encoding.
Could you check this:
Traceback (most recent call last):
File "C:\Python34\lib\base64.py", line 519, in _input_type_check
m = memoryview(s)
TypeError: memoryview: str object does not have the buffer interface
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<pyshell#23>", line 1, in
levy.fit_levy(x)
File "C:\Python34\lib\site-packages\levy.py", line 369, in fit_levy
alpha, beta, mu, sigma = parameters.get_all()
File "C:\Python34\lib\site-packages\scipy\optimize\optimize.py", line 377, in fmin
res = _minimize_neldermead(func, x0, args, callback=callback, *_opts)
File "C:\Python34\lib\site-packages\scipy\optimize\optimize.py", line 435, in minimize_neldermead
fsim[0] = func(x0)
File "C:\Python34\lib\site-packages\scipy\optimize\optimize.py", line 285, in function_wrapper
return function((wrapper_args + args))
File "C:\Python34\lib\site-packages\levy.py", line 367, in neglog_density
return np.sum(neglog_levy(x, alpha, beta, mu, sigma))
File "C:\Python34\lib\site-packages\levy.py", line 315, in neglog_levy
return -np.log(np.maximum(1e-100, levy(x, alpha, beta, mu, sigma, par=par)))
File "C:\Python34\lib\site-packages\levy.py", line 270, in levy
import levy_data
File "C:\Python34\lib\site-packages\levy_data.py", line 71588, in
"""))
File "C:\Python34\lib\base64.py", line 561, in decodestring
return decodebytes(s)
File "C:\Python34\lib\base64.py", line 553, in decodebytes
_input_type_check(s)
File "C:\Python34\lib\base64.py", line 522, in _input_type_check
raise TypeError(msg) from err
TypeError: expected bytes-like object, not str
The text was updated successfully, but these errors were encountered: