Updated thesis

This commit is contained in:
Victor Mylle
2024-05-20 19:49:03 +00:00
parent 7132aaa29a
commit d3b2bdf41c
25 changed files with 715 additions and 741 deletions

View File

@@ -314,6 +314,141 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Final Profits Overview"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"models_final = [\n",
" \"NAQR: Non-Linear\",\n",
" \"AQR: Linear\",\n",
" \"AQR: Non-Linear\",\n",
" \"AQR: GRU\",\n",
" \"Diffusion\",\n",
"]\n",
"\n",
"profits_final = [189982.08, 190501.34, 196999.03, 196655.36, 218170.75]\n",
"\n",
"improvement_final = [-4.43, -4.17, -0.91, -1.08, 9.74]\n",
"\n",
"# Yesterday and Perfect baselines for reference lines\n",
"yesterday_baseline = 198807.09\n",
"perfect_baseline = 230317.84\n",
"\n",
"# Create the final bar plot with the Yesterday NRV Baseline line changed to an even darker orange\n",
"fig, ax = plt.subplots(figsize=(14, 10))\n",
"\n",
"# Choose an even darker orange color for the Yesterday NRV Baseline line\n",
"yesterday_baseline_color = \"#FF4500\" # Darker orange color\n",
"\n",
"# Add horizontal striped lines for final baselines with larger line widths behind the bars\n",
"ax.axhline(\n",
" y=yesterday_baseline,\n",
" color=yesterday_baseline_color,\n",
" linestyle=\"--\",\n",
" linewidth=2,\n",
" zorder=0,\n",
" label=\"Yesterday NRV Baseline\",\n",
")\n",
"ax.axhline(\n",
" y=perfect_baseline,\n",
" color=\"green\",\n",
" linestyle=\"--\",\n",
" linewidth=2,\n",
" zorder=0,\n",
" label=\"Perfect NRV Baseline\",\n",
")\n",
"\n",
"# Bar plot for final profits with a single color and smaller bar width\n",
"bars_final = ax.bar(models_final, profits_final, color=\"skyblue\", width=0.5, zorder=2)\n",
"\n",
"# Annotate the final bars with the improvement percentages and profit values inside the bars at the top\n",
"for bar, profit, imp in zip(bars_final, profits_final, improvement_final):\n",
" if not np.isnan(profit):\n",
" height = bar.get_height()\n",
" ax.annotate(\n",
" f\"{imp:.2f}%\",\n",
" xy=(bar.get_x() + bar.get_width() / 2, height),\n",
" xytext=(\n",
" 0,\n",
" -10,\n",
" ), # 10 points vertical offset to place inside the bar at the top\n",
" textcoords=\"offset points\",\n",
" ha=\"center\",\n",
" va=\"top\",\n",
" fontsize=12,\n",
" color=\"black\",\n",
" fontweight=\"bold\",\n",
" )\n",
" ax.annotate(\n",
" f\"€{profit:,.2f}\",\n",
" xy=(bar.get_x() + bar.get_width() / 2, height / 2),\n",
" xytext=(0, 0), # No offset\n",
" textcoords=\"offset points\",\n",
" ha=\"center\",\n",
" va=\"center\",\n",
" color=\"black\",\n",
" fontsize=10,\n",
" fontweight=\"bold\",\n",
" )\n",
"\n",
"# Add price labels next to the horizontal lines with adjusted positions to avoid overlap\n",
"ax.text(\n",
" 0,\n",
" yesterday_baseline,\n",
" f\"€{yesterday_baseline:,.2f}\",\n",
" color=yesterday_baseline_color,\n",
" ha=\"left\",\n",
" va=\"bottom\",\n",
" fontsize=12,\n",
" fontweight=\"bold\",\n",
" bbox=dict(facecolor=\"white\", edgecolor=\"none\", pad=3),\n",
")\n",
"ax.text(\n",
" 0,\n",
" perfect_baseline,\n",
" f\"€{perfect_baseline:,.2f}\",\n",
" color=\"green\",\n",
" ha=\"left\",\n",
" va=\"bottom\",\n",
" fontsize=12,\n",
" fontweight=\"bold\",\n",
" bbox=dict(facecolor=\"white\", edgecolor=\"none\", pad=3),\n",
")\n",
"\n",
"# Set labels and title with larger font size\n",
"ax.set_ylabel(\"Test Profit (€)\", fontsize=14)\n",
"ax.set_title(\n",
" \"Comparison of Test Profits and Improvements over Yesterday NRV Baseline\",\n",
" fontsize=16,\n",
")\n",
"ax.legend(loc=\"upper right\", bbox_to_anchor=(1, 1.15), fontsize=12)\n",
"\n",
"# Add grid lines\n",
"ax.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5, alpha=0.7, zorder=1)\n",
"\n",
"# Rotate x-axis labels for better readability in the final plot\n",
"plt.xticks(rotation=45, ha=\"right\", fontsize=12)\n",
"plt.yticks(fontsize=12)\n",
"\n",
"# Adjust bar width and layout\n",
"plt.tight_layout()\n",
"\n",
"# Show the final plot with the Yesterday NRV Baseline line changed to an even darker orange\n",
"plt.show()\n"
]
}
],
"metadata": {

View File

@@ -5,7 +5,7 @@ clearml_helper = ClearMLHelper(
project_name="Thesis/NrvForecast"
)
task = clearml_helper.get_task(
task_name="NAQR: Non Linear (4 - 512)"
task_name="NAQR: Non Linear (2 - 256) + All"
)
task.execute_remotely(queue_name="default", exit_process=True)
@@ -31,16 +31,16 @@ from src.models.time_embedding_layer import TimeEmbedding
data_config = DataConfig()
data_config.NRV_HISTORY = True
data_config.LOAD_HISTORY = False
data_config.LOAD_FORECAST = False
data_config.LOAD_HISTORY = True
data_config.LOAD_FORECAST = True
data_config.WIND_FORECAST = False
data_config.WIND_HISTORY = False
data_config.WIND_FORECAST = True
data_config.WIND_HISTORY = True
data_config.PV_FORECAST = False
data_config.PV_HISTORY = False
data_config.PV_FORECAST = True
data_config.PV_HISTORY = True
data_config.NOMINAL_NET_POSITION = False
data_config.NOMINAL_NET_POSITION = True
data_config = task.connect(data_config, name="data_features")
@@ -68,8 +68,8 @@ else:
model_parameters = {
"learning_rate": 0.0001,
"hidden_size": 512,
"num_layers": 4,
"hidden_size": 256,
"num_layers": 2,
"dropout": 0.2,
}