- added image module with sub image and normalize
- improved tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from rbm.matrix import Mat, np
|
||||
from rbm.entity import Entity, EntityParams, TrainingParams
|
||||
from rbm.model import Model
|
||||
from rbm.image import normalize
|
||||
|
||||
WORK_DIR = "../../results"
|
||||
USE_OPTIMIZER = True
|
||||
@@ -45,12 +46,10 @@ def linear():
|
||||
training_batch = np.random.randn(N_CASES, N_VIS, dtype=np.float64)
|
||||
|
||||
# Normalize training data
|
||||
mean_training_batch = np.reshape(np.repeat(np.mean(training_batch, axis=1), N_VIS, axis=0), training_batch.shape)
|
||||
var_training_batch = np.reshape(np.repeat(np.std(training_batch, axis=1), N_VIS, axis=0), training_batch.shape)
|
||||
training_batch = (training_batch - mean_training_batch) / var_training_batch
|
||||
training_batch_norm = normalize(training_batch)
|
||||
|
||||
# Train layer
|
||||
model.train(training_batch)
|
||||
model.train(training_batch_norm)
|
||||
|
||||
# Save weights
|
||||
model.save()
|
||||
|
||||
Reference in New Issue
Block a user