Spaces:
Sleeping
Sleeping
Andrea Maldonado
commited on
Commit
·
2ea3878
1
Parent(s):
28a1922
Fixes library bug
Browse files- utils/config_fabric.py +8 -6
utils/config_fabric.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from copy import deepcopy
|
2 |
from importlib import reload
|
3 |
-
from itertools import product
|
|
|
4 |
from pylab import *
|
5 |
import itertools
|
6 |
import json
|
@@ -85,7 +86,7 @@ def create_objectives_grid(df, objectives, n_para_obj=2, method="combinatorial")
|
|
85 |
parameters_o = "objectives, "
|
86 |
parameters = get_ranges_from_stats(df, sorted(objectives))
|
87 |
objectives = sorted(sel_features)
|
88 |
-
tasks = f"list(
|
89 |
|
90 |
elif method=="range-from-csv":
|
91 |
tasks = ""
|
@@ -96,20 +97,21 @@ def create_objectives_grid(df, objectives, n_para_obj=2, method="combinatorial")
|
|
96 |
with max_col:
|
97 |
selcted_max = st.slider('max', min_value=selcted_min, max_value=float(df[objective].max()), value=df[objective].quantile(0.9), step=0.1, key=objective+"max")
|
98 |
with step_col:
|
99 |
-
step_value = st.slider('step', min_value=float(df[objective].min()), max_value=float(df[objective].quantile(0.9)), value=df[objective].median()/df[objective].min(), step=0.01, key=objective+"step")
|
100 |
tasks += f"np.around(np.arange({selcted_min}, {selcted_max}+{step_value}, {step_value}),2), "
|
101 |
else :#method=="range-manual":
|
102 |
experitments = []
|
103 |
tasks=""
|
104 |
if objectives != None:
|
105 |
-
cross_labels = [feature[0]+': '+feature[1] for feature in list(
|
106 |
-
cross_values = [round(eval(str(combination[0])+combination[1]), 2) for combination in list(
|
107 |
ranges = zip(objectives, split_list(list(input_multicolumn(cross_labels, cross_values, n_cols=3)), n_para_obj))
|
108 |
for objective, range_value in ranges:
|
109 |
selcted_min, selcted_max, step_value = range_value
|
110 |
tasks += f"np.around(np.arange({selcted_min}, {selcted_max}+{step_value}, {step_value}),2), "
|
111 |
|
112 |
-
|
|
|
113 |
experiments = [{key: value[idx] for idx, key in enumerate(objectives)} for value in cartesian_product]
|
114 |
return experiments
|
115 |
|
|
|
1 |
from copy import deepcopy
|
2 |
from importlib import reload
|
3 |
+
from itertools import product as cproduct
|
4 |
+
from itertools import combinations
|
5 |
from pylab import *
|
6 |
import itertools
|
7 |
import json
|
|
|
86 |
parameters_o = "objectives, "
|
87 |
parameters = get_ranges_from_stats(df, sorted(objectives))
|
88 |
objectives = sorted(sel_features)
|
89 |
+
tasks = f"list(cproduct({parameters}))[0]"
|
90 |
|
91 |
elif method=="range-from-csv":
|
92 |
tasks = ""
|
|
|
97 |
with max_col:
|
98 |
selcted_max = st.slider('max', min_value=selcted_min, max_value=float(df[objective].max()), value=df[objective].quantile(0.9), step=0.1, key=objective+"max")
|
99 |
with step_col:
|
100 |
+
step_value = st.slider('step', min_value=float(df[objective].min()), max_value=float(df[objective].quantile(0.9)), value=df[objective].median()/(df[objective].min()+0.0001), step=0.01, key=objective+"step")
|
101 |
tasks += f"np.around(np.arange({selcted_min}, {selcted_max}+{step_value}, {step_value}),2), "
|
102 |
else :#method=="range-manual":
|
103 |
experitments = []
|
104 |
tasks=""
|
105 |
if objectives != None:
|
106 |
+
cross_labels = [feature[0]+': '+feature[1] for feature in list(cproduct(objectives,['min', 'max', 'step']))]
|
107 |
+
cross_values = [round(eval(str(combination[0])+combination[1]), 2) for combination in list(cproduct(list(df.values()), ['*1', '*2', '/3']))]
|
108 |
ranges = zip(objectives, split_list(list(input_multicolumn(cross_labels, cross_values, n_cols=3)), n_para_obj))
|
109 |
for objective, range_value in ranges:
|
110 |
selcted_min, selcted_max, step_value = range_value
|
111 |
tasks += f"np.around(np.arange({selcted_min}, {selcted_max}+{step_value}, {step_value}),2), "
|
112 |
|
113 |
+
#import pdb; pdb.set_trace()
|
114 |
+
cartesian_product = list(cproduct(*eval(tasks)))
|
115 |
experiments = [{key: value[idx] for idx, key in enumerate(objectives)} for value in cartesian_product]
|
116 |
return experiments
|
117 |
|