Spaces:
Running
Running
Andrea Maldonado
commited on
Commit
·
065d4e7
1
Parent(s):
d614255
WIP: Fixes combinatorial. Triangle values
Browse files- utils/config_fabric.py +24 -7
utils/config_fabric.py
CHANGED
@@ -85,6 +85,7 @@ def create_objectives_grid(df, objectives, n_para_obj=2, method="combinatorial")
|
|
85 |
sel_features = df.index.to_list()
|
86 |
parameters_o = "objectives, "
|
87 |
parameters = get_ranges_from_stats(df, sorted(objectives))
|
|
|
88 |
tasks = f"list(itertools.product({parameters}))[0]"
|
89 |
|
90 |
elif method=="range-from-csv":
|
@@ -126,12 +127,28 @@ def set_generator_experiments(generator_params):
|
|
126 |
|
127 |
def handle_combinatorial(sel_features, stats, tuple_values):
|
128 |
triangular_option = double_switch("Square", "Triangular")
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
return experiments
|
136 |
|
137 |
def handle_grid_option(grid_option, df, sel_features):
|
@@ -139,7 +156,7 @@ def set_generator_experiments(generator_params):
|
|
139 |
combinatorial = double_switch("Range", "Combinatorial")
|
140 |
if combinatorial:
|
141 |
add_quantile = st.slider('Add %-quantile', min_value=0.0, max_value=100.0, value=50.0, step=5.0)
|
142 |
-
stats = df.describe().transpose()
|
143 |
stats[f"{int(add_quantile)}%"] = df.quantile(q=add_quantile / 100)
|
144 |
st.write(stats)
|
145 |
tuple_values = st.multiselect("Tuples including", list(stats.columns)[3:], default=['min', 'max'])
|
|
|
85 |
sel_features = df.index.to_list()
|
86 |
parameters_o = "objectives, "
|
87 |
parameters = get_ranges_from_stats(df, sorted(objectives))
|
88 |
+
objectives = sorted(sel_features)
|
89 |
tasks = f"list(itertools.product({parameters}))[0]"
|
90 |
|
91 |
elif method=="range-from-csv":
|
|
|
127 |
|
128 |
def handle_combinatorial(sel_features, stats, tuple_values):
|
129 |
triangular_option = double_switch("Square", "Triangular")
|
130 |
+
if triangular_option:
|
131 |
+
experiments = []
|
132 |
+
elements = sel_features
|
133 |
+
# List to store all combinations
|
134 |
+
all_combinations = []
|
135 |
+
|
136 |
+
# Generate combinations of length 1, 2, and 3
|
137 |
+
for r in range(1, len(elements) + 1):
|
138 |
+
# Generate combinations of length r
|
139 |
+
combinations_r = list(combinations(elements, r))
|
140 |
+
# Extend the list of all combinations
|
141 |
+
all_combinations.extend(combinations_r)
|
142 |
+
st.write(all_combinations)
|
143 |
+
all_combinations = [combinations(sel_features, r) for r in range(1, len(sel_features) + 1)]
|
144 |
+
all_combinations = [comb for sublist in all_combinations for comb in sublist]
|
145 |
+
|
146 |
+
# Print or use the result as needed
|
147 |
+
for comb in all_combinations:
|
148 |
+
sel_stats = stats.loc[list(comb)]
|
149 |
+
experiments += create_objectives_grid(sel_stats, tuple_values, n_para_obj=len(tuple_values), method="combinatorial")
|
150 |
+
else:
|
151 |
+
experiments = create_objectives_grid(stats, tuple_values, n_para_obj=len(tuple_values))
|
152 |
return experiments
|
153 |
|
154 |
def handle_grid_option(grid_option, df, sel_features):
|
|
|
156 |
combinatorial = double_switch("Range", "Combinatorial")
|
157 |
if combinatorial:
|
158 |
add_quantile = st.slider('Add %-quantile', min_value=0.0, max_value=100.0, value=50.0, step=5.0)
|
159 |
+
stats = df.describe().transpose().sort_index()
|
160 |
stats[f"{int(add_quantile)}%"] = df.quantile(q=add_quantile / 100)
|
161 |
st.write(stats)
|
162 |
tuple_values = st.multiselect("Tuples including", list(stats.columns)[3:], default=['min', 'max'])
|