def test_logistic_zero(self): r = RBM(10, 10) self.assertEquals(r._RBM__logistic(0), 0.5)
def test_regenerate_negative_samples(self): r = RBM(5, 10) data = [[1,1,1,1,1]] with self.assertRaises(UnboundLocalError): v,h = r.regenerate(data, -1)
def test_rbm(self): r = RBM(10, 10)
def test_regenerate(self): r = RBM(5, 10) data = [[1,1,1,1,1]] v,h = r.regenerate(data, 1)
def test_regenerate_wrong_shape(self): r = RBM(5, 10) data = [[1,1,1,1]] with self.assertRaises(ValueError): v,h = r.regenerate(data, 1)
def test_train_rbm_negative_batches(self): r = RBM(5, 10) data = [[1,1,1,1,1],[0,0,0,0,0]] with self.assertRaises(ValueError): r.train(data,1,-1)
def test_train_rbm_wrong_shape(self): r = RBM(5, 10) data = [[0,0,0,0]] with self.assertRaises(ValueError): r.train(data,1,1)
def train_rbm(self): r = RBM(5, 10) data = [[1,1,1,1,1],[0,0,0,0,0]] r.train(data,1,1)
def test_negative_visible_constructor(self): with self.assertRaises(ValueError): r = RBM(-10, 10)
def test_negative_hidden_constructor(self): with self.assertRaises(ValueError): r = RBM(10, -10)