Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -144,6 +144,8 @@ def fit_outputs_constraints(x, hardness_target, ys_target):
|
|
144 |
|
145 |
def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
146 |
|
|
|
|
|
147 |
continuous_variables = ['PROPERTY: Calculated Density (g/cm$^3$)',
|
148 |
'PROPERTY: Calculated Young modulus (GPa)']
|
149 |
categorical_variables = list(one_hot.columns)
|
@@ -151,7 +153,7 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
|
151 |
categorical_variables.remove(c)
|
152 |
|
153 |
domain = []
|
154 |
-
for c in
|
155 |
if c in continuous_variables:
|
156 |
if c == continuous_variables[0]:
|
157 |
domain.append({'name': str(c), 'type': 'continuous', 'domain': (0.528, 0.528)})#(0.,1.)})
|
@@ -162,7 +164,7 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
|
162 |
|
163 |
constraints = []
|
164 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
165 |
-
|
166 |
for constraint in constrained_columns:
|
167 |
sum_string = ''
|
168 |
for i in range (len(one_hot_columns)):
|
@@ -173,7 +175,7 @@ def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
|
173 |
constraints.append({'name': constraint + "-1", 'constraint': '-1*(' + sum_string + ')+1'})
|
174 |
|
175 |
def fit_outputs(x):
|
176 |
-
return fit_outputs_constraints(x,
|
177 |
|
178 |
opt = GPyOpt.methods.BayesianOptimization(f = fit_outputs, # function to optimize
|
179 |
domain = domain, # box-constraints of the problem
|
|
|
144 |
|
145 |
def predict_inverse(hardness_target, ys_target, request: gr.Request):
|
146 |
|
147 |
+
one_hot_colums = utils.return_feature_names()
|
148 |
+
|
149 |
continuous_variables = ['PROPERTY: Calculated Density (g/cm$^3$)',
|
150 |
'PROPERTY: Calculated Young modulus (GPa)']
|
151 |
categorical_variables = list(one_hot.columns)
|
|
|
153 |
categorical_variables.remove(c)
|
154 |
|
155 |
domain = []
|
156 |
+
for c in one_hot_columns:
|
157 |
if c in continuous_variables:
|
158 |
if c == continuous_variables[0]:
|
159 |
domain.append({'name': str(c), 'type': 'continuous', 'domain': (0.528, 0.528)})#(0.,1.)})
|
|
|
164 |
|
165 |
constraints = []
|
166 |
constrained_columns = ['Single/Multiphase', 'Preprocessing method', 'BCC/FCC/other']#, 'Microstructure']
|
167 |
+
|
168 |
for constraint in constrained_columns:
|
169 |
sum_string = ''
|
170 |
for i in range (len(one_hot_columns)):
|
|
|
175 |
constraints.append({'name': constraint + "-1", 'constraint': '-1*(' + sum_string + ')+1'})
|
176 |
|
177 |
def fit_outputs(x):
|
178 |
+
return fit_outputs_constraints(x, hardness_target, ys_target)
|
179 |
|
180 |
opt = GPyOpt.methods.BayesianOptimization(f = fit_outputs, # function to optimize
|
181 |
domain = domain, # box-constraints of the problem
|