diff --git a/KNN_Mark1.py b/KNN_Mark1.py index ae8825e..4215af4 100644 --- a/KNN_Mark1.py +++ b/KNN_Mark1.py @@ -1,8 +1,9 @@ from tkinter import * -def lancer(): - lecture("pic-journalier-consommation.csv") - kPlusProches(value1, donnees_point,temp_jour) +def lancer(date, temp_moy, temp_ref): + moyenne_liste() + donnees_point = [date, temp_moy, temp_ref] + kPlusProches(k, donnees_point,temp_num_jour) estBissextile(an) def lecture(fichier): @@ -84,7 +85,7 @@ def numeroJour(date): return num_jour def moyenne_liste(): - temp_jour, = lecture("pic-journalier-consommation.csv") + temp_jour = lecture("pic-journalier-consommation.csv") temp_num_jour = [] for i in range(365): temp_jour[i][0] = numeroJour(temp_jour[i][0]) @@ -104,6 +105,7 @@ def moyenne_liste(): moy_conso += lst_conso[n] moy_temp_moy += lst_temp_moy[n] moy_temp_ref += lst_temp_ref[n] + print(lst_conso) moy_conso = moy_conso / len(lst_conso) moy_temp_moy = moy_temp_moy / len(lst_temp_moy) moy_temp_ref = moy_temp_ref / len(lst_temp_ref) @@ -121,25 +123,29 @@ def distance(temp_jour, donneespoint): return dist def PuissanceMoyenne(lst,distance): - """Fonction qui calcule la moyenne de distances entre les points """ + """Calcule la moyenne de distances entre les points """ lecture("pic-journalier-consommation.csv") moy = sum() / len() def recup1(): - voisins = value1.get() - label5.configure(text=voisins) + k = value1.get() + label5.configure(text=k) + return k def recup2(): date = value2.get() label6.configure(text=date) + return date def recup3(): temp_moy = value3.get() label6.configure(text=temp_moy) + return temp_moy def recup4(): temp_ref = value4.get() label6.configure(text=temp_ref) + return temp_ref #def calc_conso(): # Conso = @@ -179,7 +185,7 @@ entree4.grid() label8 = Label(fenetre, text="Conso", bg="yellow") -bouton1 = Button(canvas1, text="Tester", command=lancer(), width=15, height=2, bg="cyan").grid(pady=10) +bouton1 = Button(canvas1, text="Tester", command=lancer(value2.get, value3.get, value4.get), width=15, height=2, bg="cyan").grid(pady=10) canvas1.grid() label8.grid(pady=10)