def test_structured_data_input_transform(): (x, _), _1 = common.dataframe_dataframe() input_node = node.StructuredDataInput() input_node.fit(x) input_node.transform(x) assert input_node.column_names[0] == 'sex' assert input_node.column_types == common.COLUMN_TYPES_FROM_CSV
def test_structured_data_input_name_type_mismatch(): (x, _), _1 = common.dataframe_dataframe() with pytest.raises(ValueError) as info: input_node = node.StructuredDataInput( column_types=common.COLUMN_TYPES_FROM_CSV) input_node.fit(x) assert 'Column_names and column_types are mismatched.' in str(info.value)
def test_structured_data_input_name_type_mismatch(): (x, _), _1 = common.dataframe_dataframe() column_types = copy.copy(common.COLUMN_TYPES_FROM_CSV) column_types['age_'] = column_types.pop('age') with pytest.raises(ValueError) as info: input_node = node.StructuredDataInput(column_types=column_types) input_node.transform(x) assert 'Column_names and column_types are mismatched.' in str(info.value)
def test_structured_data_from_dataframe_dataframe_classifier(tmp_dir): clf = ak.StructuredDataClassifier(directory=tmp_dir, max_trials=1) (x, y), (val_x, val_y) = common.dataframe_dataframe() clf.fit(x=x, y=y, epochs=2, validation_data=(val_x, val_y)) assert clf.predict(val_x).shape == (len(val_x), 1)