diff --git a/src/rbm/entity.py b/src/rbm/entity.py index 163318b..d0dacda 100644 --- a/src/rbm/entity.py +++ b/src/rbm/entity.py @@ -11,7 +11,7 @@ class Entity: self.params = params def train(self, batch: np.ndarray, cd_func: Callable, status: Status): - training_remain = batch.shape[1] + training_remain = batch.shape[0] batch_size = min(self.params.mini_batch_size, training_remain) if batch_size == 0: batch_size = training_remain @@ -60,6 +60,11 @@ class Entity: progress += d_progress*batch_size_remain + # Update final status + err_rms = rms_error_accu(batch - self.h_to_pv(self.v_to_ph(batch))) + status.on_change({"progress": {"value": round(progress), "unit": "%"}, + "err_rms_total": {"value": err_rms, "unit": ""}}) + def v_to_ph(self, v: np.ndarray) -> np.ndarray: state = self.state.v_to_h(v) if self.params.do_gaussian_hidden: