Skip to content

Commit 81f484f

Browse files
committed
Added plotting functionality
1 parent 84aa505 commit 81f484f

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tools/model.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from scipy.optimize import lsq_linear
1212
from sklearn.ensemble import HistGradientBoostingRegressor
1313
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
14-
14+
import plotext as plt
1515

1616
NL_LUT_BINS = 8
1717

@@ -408,6 +408,18 @@ def main(args) -> None:
408408
if train_df.empty or len(train_df) < 40:
409409
raise RuntimeError("Not enough usable rows (need >= 40 after filtering)")
410410

411+
if args.plot:
412+
x = train_df["timestamp"].tolist()
413+
y = train_df["target_uj"].tolist()
414+
415+
plt.clear_data()
416+
plt.plot(x, y, marker='dot')
417+
plt.title("Energy of time")
418+
plt.xlabel("Time")
419+
plt.ylabel(TARGET_COL)
420+
plt.show()
421+
return
422+
411423
# Gather test data
412424
if args.test_data:
413425
test_df = gather_rows([args.test_data], args.mode, args.min_target_uj)
@@ -581,6 +593,7 @@ def main(args) -> None:
581593
parser.add_argument("--trim-upper-quantile", type=float, default=0.999)
582594
parser.add_argument("--random-seed", type=int, default=42)
583595
parser.add_argument("--target", type=str, choices=["rapl_psys_sum_uj", "rapl_core_sum_uj"], default="rapl_psys_sum_uj")
596+
parser.add_argument("--plot", action='store_true')
584597

585598
args = parser.parse_args()
586599

0 commit comments

Comments
 (0)