def create_mf_rbf(_independent_variables_low, _independent_variables_high, _dependent_variables_low, _dependent_variables_high): mf_rbf_stress_list = [] for _i_point in range(len(_dependent_variables_low)): mf_rbf_stress = MF_RBF() mf_rbf_stress.fit(_independent_variables_low, _dependent_variables_low[_i_point].reshape(-1, 1), _independent_variables_high, _dependent_variables_high[_i_point].reshape(-1, 1)) mf_rbf_stress_list.append(mf_rbf_stress) return mf_rbf_stress_list
def create_mf_rbf(_independent_variables_low, _independent_variables_high, _dependent_variables_low, _dependent_variables_high): mf_rbf_stress_list = [] low_model_stress_w_list = [] stds = None rbf_type = 'mq' x_high = None bf_sigma = None omega_list = [] for _i_point in range(len(_dependent_variables_low)): mf_rbf_stress = MF_RBF() mf_rbf_stress.fit( _independent_variables_low, _dependent_variables_low[_i_point].reshape(-1, 1), _independent_variables_high, _dependent_variables_high[_i_point].reshape(-1, 1), bf_type="G", ) mf_rbf_stress_list.append(mf_rbf_stress) low_model_stress_w_list.append(mf_rbf_stress.low_model.w.tolist()) if _i_point == 0: stds = mf_rbf_stress.low_model.std x_high = mf_rbf_stress.x_high.tolist() bf_sigma = mf_rbf_stress.bf_sigma.tolist() omega_list.append(mf_rbf_stress.omega.tolist()) dict_mf_rbf_model = { "low_model_w": low_model_stress_w_list, "stds": stds, "x_train": train_low.flatten().tolist(), "rbf_type": rbf_type, "x_high": x_high, "bf_sigma": bf_sigma, "omega": omega_list, } # json_rbf_model = json.dumps(dict_mf_rbf_model) # with open("C:/Users/asus/Desktop/multi_fidelity_truss_stress_mf_rbf.json", "w") as f: # json.dump(json_rbf_model, f) return mf_rbf_stress_list
def create_mf_rbf(_independent_variables_low, _independent_variables_high, _dependent_variables_low, _dependent_variables_high, deformation_or_stress): mf_rbf_list = [] low_model_w_list = [] stds = None rbf_type = 'mq' x_high = None bf_sigma = None omega_list = [] for _i_point in range(len(_dependent_variables_low)): mf_rbf = MF_RBF() mf_rbf.fit(_independent_variables_low, _dependent_variables_low[_i_point].reshape(-1, 1), _independent_variables_high, _dependent_variables_high[_i_point].reshape(-1, 1)) mf_rbf_list.append(mf_rbf) low_model_w_list.append(mf_rbf.low_model.w.tolist()) if _i_point == 0: stds = mf_rbf.low_model.std x_high = mf_rbf.x_high.tolist() bf_sigma = mf_rbf.bf_sigma.tolist() omega_list.append(mf_rbf.omega.tolist()) dict_mf_rbf_model = { "low_model_w_" + deformation_or_stress: low_model_w_list, "stds": stds, "x_train": train_low.flatten().tolist(), "rbf_type_" + deformation_or_stress: rbf_type, "x_high": x_high, "bf_sigma": bf_sigma, "omega_" + deformation_or_stress: omega_list, } return dict_mf_rbf_model