From c367252da2303a14af3e2dd095e506422e905db1 Mon Sep 17 00:00:00 2001 From: HaoYizhi Date: Sun, 11 Jun 2023 20:28:51 +0800 Subject: [PATCH] db_name_prefix with or without exp --- .vscode/launch.json | 2 +- __pycache__/controller_db.cpython-38.pyc | Bin 7714 -> 7128 bytes __pycache__/model.cpython-38.pyc | Bin 13499 -> 13397 bytes __pycache__/orm.cpython-38.pyc | Bin 3924 -> 3924 bytes __pycache__/product.cpython-38.pyc | Bin 1382 -> 1382 bytes conf_db_prefix.yaml | 2 +- controller_db.py | 55 ++++++++++++----------- xv_with_exp.csv | 6 +-- xv_without_exp.csv | 2 +- 9 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 8e969cf..80f4077 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,7 +14,7 @@ "args": [ "--exp", "without_exp", "--reset_db", "True", - "--job", "30" + "--job", "24" ] } ] diff --git a/__pycache__/controller_db.cpython-38.pyc b/__pycache__/controller_db.cpython-38.pyc index 5c25c250b14fce9028efb14e63612f55bb1dc1bc..4125943e48e1cd721d6831c6341f94a7e1536aee 100644 GIT binary patch delta 1444 zcmZ`(U2oe|81``-$8i!TX+HXywxShK3WaXf22&-<7;J1~zzRYtbXMx)c6PkFId*9) zj;W?ngg}Lf!l!osNm3A=(%|))YfbFYEbzh|NG*?%ML!u0q_cJ`xAw+7^_K8q(3C&W4 z>U(mean04JOw&}|lZlk%a!0xCEYG?rApa$^t`15r%uv!I*1?qK z8axdqiXDmPczRZ9{|MD3uJc?6$CvkefLFNQAsrIsljRCjN~{zTW*jkt8{2Lb2)rXz zc)_hvtsmlLd}Bx+?aC(XN-}7L)1U2^^a^m9@k{_E9n*e#(xHI-$*&zY)Y~XO-HUaVGRl&k4dcG$HA4Qowmg)uSX6byO9w?Z>vDe;d! zEoO2L2rKvU*buZ&;sv?{AQ7GP5F@3K646MW)PWmA;@8|?m2;3~=MgR-Tm%q~HX^gL zhkxdeljC>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JJN z_W?rGdI_b7A|4R?G)lT%xcWS@3srmsYydq50$zG{9APWMM+nyd!jvDFfn(Kd_<5!* zV)Y3+aaL?u{MdhEUwftvvrbK)?Lj+I3H7=i%zA8UjvYYT7{Vh69SDVp&({Nk{{Zdv BCawSg diff --git a/__pycache__/model.cpython-38.pyc b/__pycache__/model.cpython-38.pyc index aeb2b87fa6c8ed8b8a95d0512691478fc0766609..055949670e25f16265603adca2966ec411993fa3 100644 GIT binary patch delta 786 zcmXYu-%Aux6vy}8Z6_OdLql6vEZuUoF%);TDC|kBC=%3EXws(Hox8d@J2Tz6o30sI z*4Fxv)`j)Oh=`!K$_WaB@L%X5q6wlu!Ka8I=pJogKAi9QeP%x9zD!5PA`v+to_EXl zjnTJ}<46t*6%?1vsSh2kJ#tn>A?l&C}&fiU^kPycX{^e(zlfqGKeveVfOCBoW zVD&!4Kebkd=fr4rf5s%brKL&MrbJ`8JkeZ69C}j(>6Czv7@YvI0GJ0{23UYG0e_dv zY)3(K$$Obt3rgF`Mc%I*jopTvNdV09ce~StY}O>y;w9z0*zdE_istz*rMn&`(YpWx zzyOQ9uj6pjRWL6BP6BMe1p!5-OMJegfR??jju=KOT<+`_JqJ6Z6Qd&T8vg-b^u_St#t?nd#0TF^Oq^4kWPbadGvCfRGrOB3?-f_S z%jMwM_&6~y^{l(vk;Ba*3!8eoaT>YpWtKtzB|dMR3giOa+@fXBK~p=vprCQWaT1{| zy0~*mBx&hTE_`L+5hr!#nu^cEw=9y!$Fa;2rd*&_?Q^uw+3e17YwBYTaT3?ZiARld z&PFFPjcZi{Xm8f7VKts0%9t#~B}vGZ2t*aKRw1ck;SUl-&G_uw;A_oNqQ)d8L89fl zOk!zOl4Ef~urib(vThnr{hbJz^n1-;uW8k=k|w58!twD~S|;NvzDl?Dgjr2b?He8y zj1PeYzSI`9?n1juXm9-znxa4J{cW@C60pKxB7!eNa2+rM7zALzc?PpYC#ohQTrfHs zmMylTd75tSZ}!~)PYf^x#!`JGlT4;$jHyrTVJ%8xJ({6;vBe9O@J&DxFaemSpTs)< z5Xg&wg8&_Hia~VX0(CWI(0yaB$;YD=x*9yj_WTyC6b9J3$t#j+O{keP*=~Ir-i!bg zS{bUXnFW(AsiX*NXa({Q01pB8XkVzs1E-7H;B+xkEJs5D>s^*Kjd!62z8v?1w~9gJ zaRul;`uo6JM=z6AJPXg#^_GR|+psbY0P8kQFNzCdtECmbb4>rCpImG)+e$9i9R>ELw_~ z7ERUhOZqzEbw7h0ie>Xm(XWxb_YS1)0hR$z0C}2i?H1u9uwLS6DX!yT2(0PMs5Xf& ZFdeo3|B)tGb3a=5+16MROSGb`>mPKd@{<4n diff --git a/__pycache__/orm.cpython-38.pyc b/__pycache__/orm.cpython-38.pyc index 4c7a771e6610d66f1cd1a1e7451132e7286c6c24..ed5e1b56d99370713f88a502a0522c115dc7a23b 100644 GIT binary patch delta 19 Zcmca2cSVjXl$V!_0SJVfHgb9K0{|~i1Q7rL delta 19 Zcmca2cSVjXl$V!_0SN4>H*$IL0{}2C1T_Ev diff --git a/__pycache__/product.cpython-38.pyc b/__pycache__/product.cpython-38.pyc index 5a8864c59bec77492656540a25042d036251aadb..72ed28cfec4b4a443412e37a70cf8e741d5d18ab 100644 GIT binary patch delta 20 acmaFH^^A) 0 group by s_id) as b " \ - "on a.id = b.s_id " \ - "group by e_id) as b " \ - "on a.id = b.e_id " \ - "order by count desc;" - result = pd.read_sql(sql=str_sql, con=engine) - result['dct_lst_init_remove_firm_prod'] = \ - result['dct_lst_init_remove_firm_prod'].apply( - lambda x: pickle.loads(x)) - list_dct = result.loc[result['count'] >= 9, - 'dct_lst_init_remove_firm_prod'].to_list() + assert self.db_name_prefix in ['test', 'without_exp', 'with_exp'], \ + "db name not in test, without_exp, with_exp" + + list_dct = [] + if self.db_name_prefix in ['test', 'without_exp']: + for _, row in Firm.iterrows(): + code = row['Code'] + row = row['1':] + for product_code in row.index[row == 1].to_list(): + dct = {code: [product_code]} + list_dct.append(dct) + elif self.db_name_prefix in ['with_exp']: + str_sql = "select e_id, count, max_max_ts, " \ + "dct_lst_init_remove_firm_prod from " \ + "iiabmdb.without_exp_experiment as a " \ + "inner join " \ + "(select e_id, count(id) as count, max(max_ts) as max_max_ts "\ + "from iiabmdb.without_exp_sample as a " \ + "inner join (select s_id, max(ts) as max_ts from " \ + "iiabmdb.without_exp_result where ts > 0 group by s_id) as b "\ + "on a.id = b.s_id " \ + "group by e_id) as b " \ + "on a.id = b.e_id " \ + "order by count desc;" + result = pd.read_sql(sql=str_sql, con=engine) + result['dct_lst_init_remove_firm_prod'] = \ + result['dct_lst_init_remove_firm_prod'].apply( + lambda x: pickle.loads(x)) + list_dct = result.loc[result['count'] >= 9, + 'dct_lst_init_remove_firm_prod'].to_list() # list_dct = [{'140': ['1.4.5.1']}] # list_dct = [{'133': ['1.4.4.1']}] # list_dct = [{'2': ['1.1.3']}] diff --git a/xv_with_exp.csv b/xv_with_exp.csv index dc9bfa7..dc41e90 100644 --- a/xv_with_exp.csv +++ b/xv_with_exp.csv @@ -1,4 +1,4 @@ n_max_trial,firm_req_prf_size,firm_req_prf_conn,cap_limit_prob_type,cap_limit_level,firm_acc_prf_size,firm_acc_prf_conn,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_sply_prf_n,netw_sply_prf_size,netw_cust_prf_n,netw_cust_prf_size -15,TRUE,TRUE,uniform,5,TRUE,TRUE,0.3,2,0.5,0.4,3,TRUE,3,TRUE -10,FALSE,FALSE,normal,10,FALSE,FALSE,0.5,1,1,0.6,2,FALSE,2,FALSE -5,,,,15,,,0.7,0.5,2,0.8,1,,1, +15,TRUE,TRUE,uniform,5,TRUE,TRUE,0.3,2,0.5,0.3,3,TRUE,3,TRUE +10,FALSE,FALSE,normal,10,FALSE,FALSE,0.5,1,1,0.5,2,FALSE,2,FALSE +5,,,,15,,,0.7,0.5,2,0.7,1,,1, diff --git a/xv_without_exp.csv b/xv_without_exp.csv index d521c6b..065f822 100644 --- a/xv_without_exp.csv +++ b/xv_without_exp.csv @@ -1,2 +1,2 @@ n_max_trial,firm_req_prf_size,firm_req_prf_conn,cap_limit_prob_type,cap_limit_level,firm_acc_prf_size,firm_acc_prf_conn,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_sply_prf_n,netw_sply_prf_size,netw_cust_prf_n,netw_cust_prf_size -10,TRUE,TRUE,uniform,10,TRUE,TRUE,0.7,1,1,0.9,2,TRUE,2,TRUE +10,TRUE,TRUE,uniform,10,TRUE,TRUE,0.5,1,1,0,2,TRUE,2,TRUE