~vonfry/cpipc-2020

4ab75a87816fc6afe751e3f7c2d1e93dffb6dfcf — Vonfry 2 years ago e0dc475
save 133 sample
1 files changed, 11 insertions(+), 4 deletions(-)

M 3optimization.py
M 3optimization.py => 3optimization.py +11 -4
@@ 73,7 73,7 @@ def calculate_minimum(rowindex):
    fix_args = row[unmodified_feature]
    fix_means = df[unmodified_feature].mean()
    fix_std = df[unmodified_feature].std()
    norm_fix_args = ((fix_args - fix_means) * fix_std).values.tolist()
    norm_fix_args = ((fix_args - fix_means) / fix_std).values.tolist()

    ga = GA(func=fitness(norm_fix_args, rowindex),
            size_pop=50, max_iter=800,


@@ 120,12 120,19 @@ df_std_ron_loss = df.std()['RON损失']
df_mean_ron_loss = df.mean()['RON损失']
pred_opted_133 = model.pred(np.array([df_original_best_x_norm[feature].iloc[132]]))[0]
optimization_133_analysis = pd.DataFrame({
    'optimized_s': pred_opted_133[1],
    'optimized_ron_loss': pred_opted_133[0],
    'ron_loss_rate': (pred_opted_133[0]- df_133_ron_loss_norm) / df_133_ron_loss_norm
    'optimized_s': [pred_opted_133[1] * df_std_s + df_mean_s],
    'optimized_ron_loss': [pred_opted_133[0] * df_std_ron_loss + df_mean_ron_loss],
    'ron_loss_rate': [(pred_opted_133[0]- df_133_ron_loss_norm) / df_133_ron_loss_norm]
})
optimization_133_analysis.to_csv('./data/optimization_133_analysis.csv')

optimization_and_original_133 = pd.DataFrame(
    np.array([opt, df[unmodified_feature + modified_feature].iloc[132]]),
    columns = unmodified_feature + modified_feature,
    index = ['optimized', 'original']
)
optimization_and_original_133.to_csv('./data/optimization-133-both.csv')

import matplotlib.pyplot as plt

fig_diff, axe_diff = plt.subplots()