mirror of
https://github.com/Ladebeze66/ft_linear_regression.git
synced 2026-11-09 13:47:18 +01:00
gui
This commit is contained in:
@@ -13,6 +13,7 @@ def load_and_process_data(file_path):
|
||||
df["km_norm"] = (df["km"] - km_min) / (km_max - km_min)
|
||||
df["price_norm"] = (df["price"] - price_min) / (price_max - price_min)
|
||||
|
||||
print("Normalisation en cours...")
|
||||
df.to_csv("data/data_normalized.csv", index=False)
|
||||
print("Données nettoyées et normalisées suvegardées dans 'data/data_normalized.csv' !")
|
||||
plot_raw_data(df) # Affichage des données normalisées
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import numpy as np
|
||||
from src.cost_function import compute_cost
|
||||
from cost_function import compute_cost
|
||||
|
||||
def gradient_descent(X, y, theta_0, theta_1, learning_rate, iterations):
|
||||
"""Applique la descente de gradient et retourne les paramètres optimisés."""
|
||||
|
||||
36
src/gui.py
Normal file
36
src/gui.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox
|
||||
|
||||
def show_gui(predict_price):
|
||||
"""Affiche l'interface graphique Tkinter pour entrer un kilométrage et voir le prix estimé."""
|
||||
|
||||
def estimate_price():
|
||||
try:
|
||||
km = float(entry_km.get()) # Récupère la valeur entrée
|
||||
price = predict_price(km) # Prédiction du prix
|
||||
label_result.config(text=f"Prix estimé : {price:.2f} €", fg="green") # Affiche le prix
|
||||
except ValueError:
|
||||
messagebox.showerror("Erreur", "Veuillez entrer un kilométrage valide.")
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("Estimation de prix de voiture")
|
||||
|
||||
frame = tk.Frame(root, padx=20, pady=20)
|
||||
frame.pack()
|
||||
|
||||
label_title = tk.Label(frame, text="Estimation de prix de voiture", font=("Arial", 14, "bold"))
|
||||
label_title.pack()
|
||||
|
||||
label_km = tk.Label(frame, text="Entrez le kilométrage :")
|
||||
label_km.pack()
|
||||
|
||||
entry_km = tk.Entry(frame)
|
||||
entry_km.pack()
|
||||
|
||||
btn_estimate = tk.Button(frame, text="Estimer le prix", command=estimate_price)
|
||||
btn_estimate.pack()
|
||||
|
||||
label_result = tk.Label(frame, text="", font=("Arial", 12))
|
||||
label_result.pack()
|
||||
|
||||
root.mainloop()
|
||||
@@ -1,8 +1,8 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from src.data_process import load_and_process_data
|
||||
from src.gradient_descent import gradient_descent
|
||||
from src.visualization import plot_cost_history, plot_regression_line
|
||||
from data_process import load_and_process_data
|
||||
from gradient_descent import gradient_descent
|
||||
from visualization import plot_cost_history, plot_regression_line
|
||||
|
||||
def train_model():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user