- layer: only calculate rms_error_accu() if status report is necessary

- Status: added wants_report
This commit is contained in:
2025-12-18 11:39:45 +01:00
parent 28fee91ec7
commit 905ae8da81
3 changed files with 14 additions and 14 deletions
+3 -1
View File
@@ -69,8 +69,10 @@ class Layer:
self.state.w_hv += inc_whv
# Calculate error
if status.want_report(round(training_seen*d_progress)):
err_rms = rms_error_accu(mini_batch - self.h_to_pv(self.v_to_ph(v_states)))
if not status.on_change({"progress": {"value": round(training_seen*d_progress), "unit": "%"}, "err_rms": {"value": err_rms, "unit": ""}}):
if not status.on_change({"progress": {"value": round(training_seen * d_progress), "unit": "%"},
"err_rms": {"value": err_rms, "unit": ""}}):
keep_running = False
break
+1 -1
View File
@@ -13,7 +13,7 @@ def cv_show(name: str, vec: np.array, shape):
class MyStatus(Status):
def __init__(self, _stack: StackDeep, _batch: np.ndarray):
Status.__init__(self, update_interval=2)
Status.__init__(self, update_interval=10)
self.stack = _stack
self.batch = _batch
self.index = 0
+6 -8
View File
@@ -15,17 +15,15 @@ class Status:
print(f"{key} : {value}{unit}")
def on_change(self, status: dict) -> bool:
do_continue = True
if status == {}:
self.progress = -1
if "progress" in status.keys():
progress = status["progress"]['value']
if self.progress < 0 or progress - self.progress >= self.update_interval:
self.progress = progress
do_continue = self.on_report(status=status)
return do_continue
def want_report(self, progress) -> bool:
if self.progress < 0 or progress - self.progress >= self.update_interval:
self.progress = progress
return True
return False
def on_report(self, status: dict) -> bool:
return True