Moved load_profile db to data

removed comments
fixed Bug in visualize.py (extra data empty)
removed dead cp
This commit is contained in:
Andreas
2024-10-05 09:11:41 +02:00
committed by Andreas
parent ec1dc87104
commit caf907a2e5
5 changed files with 28 additions and 100 deletions

View File

@@ -101,7 +101,7 @@ class LoadForecast:
# Example usage of the class
if __name__ == "__main__":
filepath = r"..\load_profiles.npz" # Adjust the path to the .npz file
filepath = r"..\data\load_profiles.npz" # Adjust the path to the .npz file
lf = LoadForecast(filepath=filepath, year_energy=2000)
specific_date_prices = lf.get_daily_stats("2024-02-16") # Adjust date as needed
specific_hour_stats = lf.get_hourly_stats(

View File

@@ -3,17 +3,6 @@ import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error, r2_score
# from sklearn.model_selection import train_test_split, GridSearchCV
# from sklearn.ensemble import GradientBoostingRegressor
# from xgboost import XGBRegressor
# from statsmodels.tsa.statespace.sarimax import SARIMAX
# from tensorflow.keras.models import Sequential
# from tensorflow.keras.layers import Dense, LSTM
# from tensorflow.keras.optimizers import Adam
# from sklearn.preprocessing import MinMaxScaler
# from sqlalchemy import create_engine
class LoadPredictionAdjuster:
def __init__(self, measured_data, predicted_data, load_forecast):
self.measured_data = measured_data

View File

@@ -338,8 +338,6 @@ class optimization_problem:
extra_data=extra_data,
)
os.system("cp visualisierungsergebnisse.pdf ~/")
# Return final results as a dictionary
return {
"discharge_hours_bin": discharge_hours_bin,

View File

@@ -110,7 +110,7 @@ def visualisiere_ergebnisse(
plt.figure(figsize=(14, 10))
if ist_dst_wechsel(datetime.now()):
if ist_dst_wechsel(datetime.datetime.now()):
hours = np.arange(start_hour, prediction_hours - 1)
else:
hours = np.arange(start_hour, prediction_hours)
@@ -262,31 +262,31 @@ def visualisiere_ergebnisse(
if n < 0.01
]
)
if filtered_losses.size != 0:
best_loss = min(filtered_losses)
worst_loss = max(filtered_losses)
best_balance = min(filtered_balance)
worst_balance = max(filtered_balance)
best_loss = min(filtered_losses)
worst_loss = max(filtered_losses)
best_balance = min(filtered_balance)
worst_balance = max(filtered_balance)
data = [filtered_losses, filtered_balance]
labels = ["Losses", "Balance"]
# Create plots
fig, axs = plt.subplots(
1, 2, figsize=(10, 6), sharey=False
) # Two subplots, separate y-axes
data = [filtered_losses, filtered_balance]
labels = ["Losses", "Balance"]
# Create plots
fig, axs = plt.subplots(
1, 2, figsize=(10, 6), sharey=False
) # Two subplots, separate y-axes
# First violin plot for losses
axs[0].violinplot(data[0], showmeans=True, showmedians=True)
axs[0].set_title("Losses")
axs[0].set_xticklabels(["Losses"])
# First violin plot for losses
axs[0].violinplot(data[0], showmeans=True, showmedians=True)
axs[0].set_title("Losses")
axs[0].set_xticklabels(["Losses"])
# Second violin plot for balance
axs[1].violinplot(data[1], showmeans=True, showmedians=True)
axs[1].set_title("Balance")
axs[1].set_xticklabels(["Balance"])
# Second violin plot for balance
axs[1].violinplot(data[1], showmeans=True, showmedians=True)
axs[1].set_title("Balance")
axs[1].set_xticklabels(["Balance"])
# Fine-tuning
plt.tight_layout()
# Fine-tuning
plt.tight_layout()
pdf.savefig() # Save the current figure state to the PDF
plt.close() # Close the figure