|
@@ -3,6 +3,7 @@ import numpy as np
|
|
|
import pandas as pd
|
|
import pandas as pd
|
|
|
import os
|
|
import os
|
|
|
|
|
|
|
|
|
|
+import pickle
|
|
|
|
|
|
|
|
def build_plot_data(df_data, df_fit_index, alpha, lg, n_grid=100, verbose=False):
|
|
def build_plot_data(df_data, df_fit_index, alpha, lg, n_grid=100, verbose=False):
|
|
|
"""
|
|
"""
|
|
@@ -260,13 +261,6 @@ def plot_from_dataframes(
|
|
|
plt.show()
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
-import os
|
|
|
|
|
-import pickle
|
|
|
|
|
-import numpy as np
|
|
|
|
|
-import pandas as pd
|
|
|
|
|
-import matplotlib.pyplot as plt
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
def load_or_build_bootstrap_pars(
|
|
def load_or_build_bootstrap_pars(
|
|
|
df_data,
|
|
df_data,
|
|
|
lg,
|
|
lg,
|
|
@@ -287,8 +281,12 @@ def load_or_build_bootstrap_pars(
|
|
|
result_file = os.path.join(results_path, filename)
|
|
result_file = os.path.join(results_path, filename)
|
|
|
|
|
|
|
|
if os.path.isfile(result_file):
|
|
if os.path.isfile(result_file):
|
|
|
|
|
+
|
|
|
|
|
+ if verbose: print("Loading existing file.")
|
|
|
|
|
+
|
|
|
with open(result_file, "rb") as f:
|
|
with open(result_file, "rb") as f:
|
|
|
boots_pars_results = pickle.load(f)
|
|
boots_pars_results = pickle.load(f)
|
|
|
|
|
+
|
|
|
return boots_pars_results
|
|
return boots_pars_results
|
|
|
|
|
|
|
|
boots_pars_results = {}
|
|
boots_pars_results = {}
|
|
@@ -305,7 +303,14 @@ def load_or_build_bootstrap_pars(
|
|
|
print(f"\tmethod: {method}")
|
|
print(f"\tmethod: {method}")
|
|
|
|
|
|
|
|
par_fun = getattr(lg, f"get_{method}_pars")
|
|
par_fun = getattr(lg, f"get_{method}_pars")
|
|
|
- boots_pars_results[(scale, dataset, method)] = par_fun(X, Y, m=n_boots)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ try:
|
|
|
|
|
+ pars_res = par_fun(X, Y, m=n_boots)
|
|
|
|
|
+ except:
|
|
|
|
|
+ if verbose: print("Fatal problem!")
|
|
|
|
|
+ pars_res = None
|
|
|
|
|
+
|
|
|
|
|
+ boots_pars_results[(scale, dataset, method)] = pars_res
|
|
|
|
|
|
|
|
with open(result_file, "wb") as f:
|
|
with open(result_file, "wb") as f:
|
|
|
pickle.dump(boots_pars_results, f)
|
|
pickle.dump(boots_pars_results, f)
|