-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dawith
committed
Oct 19, 2025
1 parent
894a9eb
commit 2a0e53e
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -- coding: utf-8 -*- | ||
""" | ||
This script takes the model metric results stored as csv and generates plots to | ||
visualize the performance based on the choice of hyperparameters. | ||
""" | ||
|
||
import pandas as pd | ||
|
||
from visualize import plot | ||
|
||
def main(): | ||
metric = pd.read_csv("/app/workdir/metrics.csv") | ||
print(metric.head()) | ||
hyperparam_keys = metric.columns.tolist() | ||
metric_keys = ["test_accuracy", "test_loss"] | ||
[hyperparam_keys.remove(key) for key in metric_keys] | ||
|
||
for key in hyperparam_keys: | ||
for metric_key in metric_keys: | ||
plot.lineplot( | ||
data=metric, | ||
x=key, | ||
y=metric_key, | ||
) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
||
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# --*- coding: utf-8 -*- | ||
|
||
import matplotlib.pyplot as plt | ||
import seaborn as sns | ||
|
||
def lineplot(data=None, x=None, y=None): | ||
if data is None or x is None or y is None: | ||
raise ValueError("Data, x, and y parameters must be provided.") | ||
|
||
sns.lineplot(data=data, x=x, y=y) | ||
plt.title(f"{y} by {x}") | ||
plt.xlabel(x) | ||
plt.ylabel(y) | ||
plt.savefig(f"/app/workdir/figures/lineplot_{y}_by_{x}.png") | ||
plt.close() | ||
|
||
|
||
# EOF |