Beispiel #1
0
def test_input_type_error():
    x = 'unknown'
    input_node = node.Input()
    with pytest.raises(TypeError) as info:
        input_node.fit(x)
        x = input_node.transform(x)
    assert 'Expect the data to Input to be numpy' in str(info.value)
Beispiel #2
0
def test_input_numerical():
    x = np.array([[['unknown']]])
    input_node = node.Input()
    with pytest.raises(TypeError) as info:
        input_node.fit(x)
        x = input_node.transform(x)
    assert 'Expect the data to Input to be numerical' in str(info.value)
Beispiel #3
0
def test_two_classes():
    y = np.array(['a', 'a', 'a', 'b'])
    head = head_module.ClassificationHead(name='a')
    head.fit_transform(y)
    head.output_shape = (1, )
    head.build(kerastuner.HyperParameters(),
               node_module.Input(shape=(32, )).build())
    assert head.loss == 'binary_crossentropy'