def METHOD_NAME():
    """Test that output can be written to a directory."""
    n_samples = 20
    n_features = 3
    n_classes = 2
    np.random.seed(123)
    ids = np.arange(n_samples)
    X = np.random.rand(n_samples, n_features)
    y = np.random.randint(n_classes, size=(n_samples,))
    w = np.ones((n_samples,))
    dataset = dc.data.NumpyDataset(X, y, w)
    balancing_transformer = dc.trans.BalancingTransformer(dataset=dataset)
    with tempfile.TemporaryDirectory() as tmpdirname:
        dataset = balancing_transformer.transform(dataset, out_dir=tmpdirname)
        balanced_dataset = dc.data.DiskDataset(tmpdirname)
        X_t, y_t, w_t, ids_t = (balanced_dataset.X, balanced_dataset.y,
                                balanced_dataset.w, balanced_dataset.ids)
    # Check ids are unchanged.
    for id_elt, id_t_elt in zip(ids, ids_t):
        assert id_elt == id_t_elt
    # Check X is unchanged since this is a w transformer
    np.testing.assert_allclose(X, X_t)
    # Check y is unchanged since this is a w transformer
    np.testing.assert_allclose(y, y_t)
    y_task = y_t
    w_task = w_t
    w_orig_task = w
    # Assert that entries with zero weight retain zero weight
    np.testing.assert_allclose(w_task[w_orig_task == 0],
                               np.zeros_like(w_task[w_orig_task == 0]))
    # Check that sum of 0s equals sum of 1s in transformed for each task
    assert np.isclose(np.sum(w_task[y_task == 0]), np.sum(w_task[y_task == 1]))