diff --git a/ecg/analyze-keras.py b/ecg/analyze-keras.py index 8b76fa73..f7124079 100644 --- a/ecg/analyze-keras.py +++ b/ecg/analyze-keras.py @@ -1,9 +1,18 @@ +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from builtins import zip +from builtins import open +from builtins import str +from future import standard_library +standard_library.install_aliases() import argparse import csv import json import os from tabulate import tabulate -from io import StringIO +from io import BytesIO def get_params_table(path, max_models=5): @@ -13,7 +22,7 @@ def process_params(parameters): del parameters["FOLDER_TO_SAVE"] return parameters - output = StringIO() + output = BytesIO() first = True visited_dirs = {} for loss, _, dirpath in get_best_models(path): diff --git a/ecg/data/irhythm/extract_data.py b/ecg/data/irhythm/extract_data.py index acfcc17b..928ccb9e 100644 --- a/ecg/data/irhythm/extract_data.py +++ b/ecg/data/irhythm/extract_data.py @@ -1,6 +1,13 @@ from __future__ import print_function from __future__ import division - +from __future__ import unicode_literals +from __future__ import absolute_import + +from builtins import zip +from builtins import int +from builtins import range +from future import standard_library +standard_library.install_aliases() import collections import json import numpy as np diff --git a/ecg/eval-keras.py b/ecg/eval-keras.py index 71e987dd..1ab8c349 100644 --- a/ecg/eval-keras.py +++ b/ecg/eval-keras.py @@ -1,3 +1,12 @@ +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from builtins import range +from builtins import open +from builtins import str +from future import standard_library +standard_library.install_aliases() import argparse import numpy as np from sklearn.metrics import classification_report, confusion_matrix diff --git a/ecg/loader.py b/ecg/loader.py index 46865541..8787ecc4 100644 --- a/ecg/loader.py +++ b/ecg/loader.py @@ -1,3 +1,12 @@ +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import absolute_import +from builtins import dict +from builtins import zip +from builtins import range +from future import standard_library +standard_library.install_aliases() import argparse import collections import numpy as np diff --git a/ecg/predict-keras.py b/ecg/predict-keras.py index 1fe3a24a..b0c63790 100644 --- a/ecg/predict-keras.py +++ b/ecg/predict-keras.py @@ -1,3 +1,11 @@ +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from builtins import open +from builtins import str +from future import standard_library +standard_library.install_aliases() import argparse import numpy as np from keras.models import load_model diff --git a/ecg/train-keras.py b/ecg/train-keras.py index d58025af..b754dc76 100644 --- a/ecg/train-keras.py +++ b/ecg/train-keras.py @@ -1,3 +1,13 @@ +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from builtins import open +from builtins import int +from builtins import str +from future import standard_library +standard_library.install_aliases() + import argparse import numpy as np import json @@ -36,7 +46,7 @@ def plot_model(model, start_time, net_type): def save_params(params, start_time, net_type): saving_filename = get_folder_name(start_time, net_type) + "/params.json" with open(saving_filename, 'w') as outfile: - json.dump(params, outfile) + outfile.write(unicode(json.dumps(params, ensure_ascii=False))) if __name__ == '__main__': diff --git a/requirements.txt b/requirements.txt index f9aaa231..a7429348 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,14 @@ cycler==0.10.0 docopt==0.6.2 +funcsigs==1.0.2 +future==0.16.0 h5py==2.6.0 joblib==0.10.3 Keras==1.2.0 +mock==2.0.0 numpy==1.11.3 pandas==0.19.2 +pbr==1.10.0 pprint==0.1 protobuf==3.1.0.post1 pydot-ng==1.0.0 @@ -17,6 +21,6 @@ scipy==0.18.1 six==1.10.0 sklearn==0.0 tabulate==0.7.7 -tensorflow==0.12.1 +tensorflow-gpu==0.12.1 Theano==0.8.2 tqdm==4.11.0