This commit is contained in:
2023-07-08 16:23:44 +08:00
parent b17dec4dbe
commit dc025066f7
18 changed files with 866 additions and 65 deletions

View File

@@ -110,49 +110,16 @@ def anova(lst_col_seg, n_level, oa_file, result_file, alpha=0.1):
if __name__ == '__main__':
# prep data
str_sql = """
select * from
(select distinct idx_scenario, n_max_trial, crit_supplier,
firm_pref_request, firm_pref_accept, netw_pref_cust_n,
netw_pref_cust_size, cap_limit, diff_new_conn, diff_remove
from iiabmdb.with_exp_experiment) as a
inner join
(
select idx_scenario,
sum(n_disrupt_s) as n_disrupt_s, sum(n_disrupt_t) as n_disrupt_t from
iiabmdb.with_exp_experiment as a
inner join
(
select e_id, count(n_s_disrupt_t) as n_disrupt_s,
sum(n_s_disrupt_t) as n_disrupt_t from
iiabmdb.with_exp_sample as a
inner join
(select a.s_id as s_id, count(id) as n_s_disrupt_t from
iiabmdb.with_exp_result as a
inner join
(select distinct s_id from iiabmdb.with_exp_result where ts > 0) as b
on a.s_id = b.s_id
group by s_id
) as b
on a.id = b.s_id
group by e_id
) as b
on a.id = b.e_id
group by idx_scenario) as b
on a.idx_scenario = b.idx_scenario;
"""
result = pd.read_sql(sql=str_sql,
con=engine)
result = pd.read_csv("experiment_result.csv", index_col=None)
result.drop('idx_scenario', 1, inplace=True)
df_oa = pd.read_csv("oa_with_exp.csv", index_col=None)
result = pd.concat(
scenario_result = pd.concat(
[result.iloc[:, 0:10],
df_oa.iloc[:, -4:],
result.iloc[:, -2:]], axis=1)
result.to_csv('analysis\\experiment_result.csv')
# 9 factors (X), 4 for error (E), and 2 indicators (Y)
the_lst_col_seg = [10, 3, 2]
# 10 factors (X), 13 for error (E), and 9 indicators (Y)
the_lst_col_seg = [10, 13, 9]
the_n_level = 3
anova(the_lst_col_seg, the_n_level, "oa25.txt", result, 0.1)