Oracen-zz / MIDAS

Multiple imputation utilising denoising autoencoder for approximate Bayesian inference

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility with Python 2.7

fbertran opened this issue · comments

Greetings

In the midas class code, you use both yield and an non empty return, for instance in the function def batch_yield_samples:

            yield output_df
    return  self

It seems to be a nice feature of Python 3 yet it raises an error with Python 2.7.13. Is it possible to have a work around so that Midas could be used with Python 2.7.13? Indeed, in the readme, you seem to look for Python 2.7 compatibility.

In addition, the copy method is not defined for lists in Python 2.7. In that case the work around is very easy.

-> for that one
import copy
and use copy.copy(list)
instead of list.copy()

Another problem with the softmax loss computation is that it is 0 with P2.7 likely because you divide an int by an int and it is rounded (to 0 in that) to give an int (the remainder of the Euclidean division). In P3.6, I think that it returns a float with the floating point division of the two integers.

Best.

PS: Here is the error you get with Python 2.7.
File "midas.py", line 853
return self
SyntaxError: 'return' with argument inside generator

https://stackoverflow.com/questions/15809296/python-syntaxerror-return-with-argument-inside-generator?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

I'll leave this open for now. I thought it was compatible (and it was when I tested the original code) but I've basically reworked a lot between now and then. This is absolutely something I'm interested in, I just have a lot of other work on at the moment.

Apologies, and thanks for your patience.

Alex

Hi @fbertran,

Just to update you on this issue. We have now migrated MIDAS to this new repo where all future updates will be released.

We also now don't anticipate adding Python 2.X support given Python 2 is now at end of life, and receiving limited future support.

Best,
Tom