Skor / app.py
drmurataltun's picture
Upload 3 files
9d754f1 verified
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import streamlit as st
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error, r2_score
def calculate_rmse(actual, predicted):
return np.sqrt(mean_squared_error(actual, predicted))
def calculate_r2(actual, predicted):
return r2_score(actual, predicted)
def main():
st.title("RMSE ve R2 Skoru Hesaplama")
# Kontrol dosyasını yükleme
control_file_path = "test_reel.csv"
control_data = pd.read_csv(control_file_path)
# Tahmin dosyasını yükleme
prediction_file = st.file_uploader("Tahmin dosyasını yükleyin", type="csv")
if prediction_file is not None:
prediction_data = pd.read_csv(prediction_file)
# Price sütunlarını seçme
control_price = control_data["Price"].values
prediction_price = prediction_data["Price"].values
# RMSE skoru hesaplama
rmse_score = calculate_rmse(control_price, prediction_price)
# R2 skoru hesaplama
r2_score_val = calculate_r2(control_price, prediction_price)
# Sonuçları gösterme
st.write("RMSE Skoru:", rmse_score)
st.write("R2 Skoru:", r2_score_val)
if __name__ == "__main__":
main()