- fixed training_remain
- added total rms error after training
This commit is contained in:
+6
-1
@@ -11,7 +11,7 @@ class Entity:
|
|||||||
self.params = params
|
self.params = params
|
||||||
|
|
||||||
def train(self, batch: np.ndarray, cd_func: Callable, status: Status):
|
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)
|
batch_size = min(self.params.mini_batch_size, training_remain)
|
||||||
if batch_size == 0:
|
if batch_size == 0:
|
||||||
batch_size = training_remain
|
batch_size = training_remain
|
||||||
@@ -60,6 +60,11 @@ class Entity:
|
|||||||
|
|
||||||
progress += d_progress*batch_size_remain
|
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:
|
def v_to_ph(self, v: np.ndarray) -> np.ndarray:
|
||||||
state = self.state.v_to_h(v)
|
state = self.state.v_to_h(v)
|
||||||
if self.params.do_gaussian_hidden:
|
if self.params.do_gaussian_hidden:
|
||||||
|
|||||||
Reference in New Issue
Block a user