From 525ec6cde1b9c704b2ed305c6d597882cb7e0126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Parafi=C5=84ski?= Date: Tue, 9 Jun 2020 01:52:24 +0000 Subject: [PATCH] DecisionTree --- decisionTree.sav | Bin 0 -> 2166 bytes injectCode.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 decisionTree.sav create mode 100644 injectCode.py diff --git a/decisionTree.sav b/decisionTree.sav new file mode 100644 index 0000000000000000000000000000000000000000..0b036404bf9cdef9c619fccfc2b9ae1eea07a307 GIT binary patch literal 2166 zcma)8&1)M+6kpkrEn9YQ0*;-2;fq1eK_mtnA7ZqL4S`H6yNL;eP=?iNlv%Rc-OSF~ zF>ydS#KADPObb2szbLea^xXfTh2ldF$-(5%d)qg=GwRBUi1whj@4er9^FDqWsayR1 zaoI{AF&{tniNk^#XN1(S>pO8wVks_f6W5EqFxUh8ma=+nk1+XKuDp=XWmQbM%;SUs zLW)Tea27^~Qk3J!_c++4C^kvVrI_kCPjQPxoXUo{*zp1!JDtcUF;1ZpjfuIu6{=}V zR1k~GctE^Il;bvYTn;DU)OkBA-Lk}t%H1XoPZ-qP5HrjPT44vr+~EZD3(Buza1gdq z#JtMtb)p1{KZLSeMx2<)|5IM-17sya;&d*$97sGF!GR%z_NJjVMqD_r1--g%gdIPk zPA+35=#_{iDvIdQp($U=NfXdN*VjCiuwdUQHbz1-H zx6iuEzns+%^7-C;XPf+nKt|7C%l6Uz^@Yl__x1IBoP}(~%>46@Ry6F5fzO(kR9+o9 zZY3Yr-5xpaWW{{jk5Y_xp$XT0X9OXXNv~%*R=qBgZZF#ckN>1u?Pj_z7IRANlI3JL;9B4^D3V zY^c<|XQxSE8(FeVEgx#Rk;wsEh93O9s_`b@AR@D9+%Wffd#}Fp4y^+#hIl?<9@6j7 zC^MH~0F%%7_56(5ljm_g$0uI0EhkMehxH|n_X$(~8sJCkT5WZ;wpxqAm|vGkv-Te! CEmT+l literal 0 HcmV?d00001 diff --git a/injectCode.py b/injectCode.py new file mode 100644 index 0000000..87828bc --- /dev/null +++ b/injectCode.py @@ -0,0 +1,33 @@ +import pickle +import sys + + +def prediction(warzywo, nawoz ,srodek, stan_wzrostu): + filename = 'pliki/decisionTree.sav' + tree = pickle.load(open(filename, 'rb')) + val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]])) + save(val) + +def save(prediction): + pred = str(prediction) + plik = open('pliki/dec.txt', 'w') + plik.write(pred[1]) + plik.close() + +def decision(prediction): + if prediction == 0: + return "Nie_podejmuj_dzialania" + elif prediction == 1: + return "Zastosuj_nawoz" + elif prediction == 2: + return "Zastosuj_srodek" + elif prediction == 4: + return "Zbierz" + elif prediction == 5: + return "Roslina_juz_zgnila__zbierz_i_wyrzuc" + + + +if __name__ == '__main__': + # Map command line arguments to function arguments. + prediction(*sys.argv[1:]) \ No newline at end of file