You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from knn import kPlusProches
|
|
|
|
from lecture import lecture
|
|
|
|
|
|
|
|
def lancerTest(nombre_voisins, point_a_verifier):
|
|
|
|
"""effectue prédiction"""
|
|
|
|
|
|
|
|
fichier_apprentissage = lecture("data/pic-journalier-consommation.csv")
|
|
|
|
k_plus_proches = kPlusProches(point_a_verifier, \
|
|
|
|
fichier_apprentissage, \
|
|
|
|
nombre_voisins)
|
|
|
|
|
|
|
|
conso_prevue = 0
|
|
|
|
liste_indices = [elem[1] for elem in k_plus_proches]
|
|
|
|
for indice in liste_indices:
|
|
|
|
pic_conso = fichier_apprentissage[indice][1]
|
|
|
|
conso_prevue += pic_conso
|
|
|
|
return conso_prevue / len(k_plus_proches)
|
|
|
|
|