Spaces:
Running
Running
added combinatorial option for manual
Browse files- utils/config_fabric.py +28 -1
utils/config_fabric.py
CHANGED
@@ -170,12 +170,39 @@ def set_generator_experiments(generator_params):
|
|
170 |
def handle_manual_option(sel_features, grid_option):
|
171 |
if sel_features:
|
172 |
if grid_option:
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
else:
|
175 |
experiment = {sel_feature: float(st.text_input(sel_feature, generator_params['experiment'][sel_feature])) for sel_feature in sel_features}
|
176 |
return [experiment]
|
177 |
return []
|
178 |
|
|
|
179 |
grid_option, csv_option = double_switch("Point-", "Grid-based", third_label="Manual", fourth_label="From CSV")
|
180 |
|
181 |
if csv_option:
|
|
|
170 |
def handle_manual_option(sel_features, grid_option):
|
171 |
if sel_features:
|
172 |
if grid_option:
|
173 |
+
combinatorial = double_switch("Range", "Combinatorial")
|
174 |
+
if combinatorial:
|
175 |
+
num_values = st.number_input('How many values to define?', min_value=1, step=1)
|
176 |
+
|
177 |
+
# Dictionary to store the values for each feature
|
178 |
+
feature_values_dict = {}
|
179 |
+
for feature in sel_features:
|
180 |
+
st.write(f"Define {num_values} values for feature: {feature}")
|
181 |
+
feature_values = []
|
182 |
+
|
183 |
+
for i in range(int(num_values)):
|
184 |
+
value = st.text_input(f"Value {i+1} for {feature}", key=f"value_{feature}_{i}")
|
185 |
+
feature_values.append(value)
|
186 |
+
|
187 |
+
# Store the list of values for the feature
|
188 |
+
feature_values_dict[feature] = feature_values
|
189 |
+
|
190 |
+
# Generate the cartesian product of all possible combinations
|
191 |
+
cartesian_product = list(itertools.product(*feature_values_dict.values()))
|
192 |
+
|
193 |
+
# Convert each combination into a dictionary with the appropriate feature keys
|
194 |
+
experiments = [dict(zip(sel_features, values)) for values in cartesian_product]
|
195 |
+
|
196 |
+
return experiments
|
197 |
+
|
198 |
+
else:
|
199 |
+
return create_objectives_grid(generator_params['experiment'], sel_features, n_para_obj=len(sel_features), method="range-manual")
|
200 |
else:
|
201 |
experiment = {sel_feature: float(st.text_input(sel_feature, generator_params['experiment'][sel_feature])) for sel_feature in sel_features}
|
202 |
return [experiment]
|
203 |
return []
|
204 |
|
205 |
+
|
206 |
grid_option, csv_option = double_switch("Point-", "Grid-based", third_label="Manual", fourth_label="From CSV")
|
207 |
|
208 |
if csv_option:
|