def __init__(self, callbacks=list([]), early_stopping_patience=12, batch_size=64, num_epochs=100, validation_fraction=0.1, shuffle=True, learning_rate=0.0001, optimizer=None, verbose=0): self.batch_size = batch_size Validation.check_is_positive_integer_greaterequals_1( num_epochs, var_name="num_epochs") self.num_epochs = num_epochs Validation.check_is_fraction(validation_fraction, var_name="validation_fraction") self.validation_fraction = validation_fraction self.shuffle = shuffle self.learning_rate = learning_rate self.optimizer = optimizer self.verbose = verbose self.callbacks = callbacks self.early_stopping_patience = early_stopping_patience
def test_check_is_fraction(self): with self.assertRaises(ValueError): Validation.check_is_fraction(-1.0) with self.assertRaises(ValueError): Validation.check_is_fraction(1.01) with self.assertRaises(ValueError): Validation.check_is_fraction(-0.01) Validation.check_is_fraction(1.0) Validation.check_is_fraction(0.0) Validation.check_is_fraction(0.00000001) Validation.check_is_fraction(1.0 - 0.00000001)