~vonfry/cpipc-2020

1ebbd5f2a2ea165fd6684d920bf98edfa9b059ee — Vonfry 2 years ago d488fce
rename again
1 files changed, 7 insertions(+), 7 deletions(-)

M 3optimization.py
M 3optimization.py => 3optimization.py +7 -7
@@ 119,7 119,7 @@ df_std_s = df.std()['_硫含量']
df_mean_s = df.mean()['_硫含量']
df_std_ron_loss = df.std()['RON损失']
df_mean_ron_loss = df.mean()['RON损失']
pred_opted_sample = model.pred(np.array([df_original_best_x_norm[feature].iloc[sample]]))[0]
pred_opted_sample = model.pred(np.array([df_original_best_x_norm[feature].iloc[sample_index]]))[0]
optimization_sample_analysis = pd.DataFrame({
    'optimized_s': [pred_opted_sample[1] * df_std_s + df_mean_s],
    'optimized_ron_loss': [pred_opted_sample[0] * df_std_ron_loss + df_mean_ron_loss],


@@ 128,7 128,7 @@ optimization_sample_analysis = pd.DataFrame({
optimization_sample_analysis.to_csv('./data/optimization_sample_analysis.csv')

optimization_and_original_sample = pd.DataFrame(
    np.array([opt, df[unmodified_feature + modified_feature].iloc[sample]]),
    np.array([opt, df[unmodified_feature + modified_feature].iloc[sample_index]]),
    columns = unmodified_feature + modified_feature,
    index = ['optimized', 'original']
)


@@ 144,14 144,14 @@ axe_diff.boxplot(diff_norm.drop(['饱和烃'], axis=1).T,
axe_diff.hlines(0, 0.5, 16.5, colors='C8', zorder=3)
fig_diff.savefig('./output/optimization-diff.jpg')

fig_133, axe_133 = plt.subplots()
width_133 = 0.35
fig_sample, axe_sample = plt.subplots()
width_sample = 0.35
x = np.arange(1, len(feature) + 1)
rects1 = axe_133.bar(x - width_133/2, df_norm[feature].iloc[132].values, width_133, label='Original')
rects2 = axe_133.bar(x + width_133/2, df_original_best_x_norm[feature].iloc[132].values, width_133, label='Optimized')
rects1 = axe_sample.bar(x - width_sample/2, df_norm[feature].iloc[sample_index].values, width_sample, label='Original')
rects2 = axe_sample.bar(x + width_sample/2, df_original_best_x_norm[feature].iloc[sample_index].values, width_sample, label='Optimized')
axe_133.set_xticks(x)
axe_133.set_xticklabels([ 'D' + str(i + 1) for i in range(0, len(feature))])
axe_133.set_ylabel('norm values')
axe_133.legend()
fig_133.tight_layout()
fig_133.savefig('./output/optimization-133.jpg')
fig_133.savefig('./output/optimization-sample.jpg')