# tff.simulation.datasets.build_dataset_mixture

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Build a new dataset that probabilistically returns examples.

    tff.simulation.datasets.build_dataset_mixture(
        a, b, a_probability, seed=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `a` | The first [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset). |
| `b` | The second [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset). |
| `a_probability` | The `float` probability to select the next example from the `a` dataset. |
| `seed` | An optional `int` seed for creating a [`tf.random.Generator`](https://www.tensorflow.org/api_docs/python/tf/random/Generator). If set to `None`, the generator will be created via [`tf.random.Generator.from_non_deterministic_state`](https://www.tensorflow.org/api_docs/python/tf/random/Generator#from_non_deterministic_state). Note that setting a random seed alone is not enough to guarantee complete reproducibility of results. For example, random number generation is not guaranteed to be consistent across TensorFlow versions (see https://www.tensorflow.org/guide/versions#what_is_not_covered). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) that returns examples from dataset `a` with probability `a_probability`, and examples form dataset `b` with probability `(1 - a_probability)`. The dataset will yield the number of examples equal to the smaller of `a` or `b`. ||

<br />