# alibi\_detect.utils.data

## `Bunch`

*Inherits from:* `dict`

Container object for internal datasets

Dictionary-like object that exposes its keys as attributes.

### Constructor

```python
Bunch(self, **kwargs)
```

## Functions

### `create_outlier_batch`

```python
create_outlier_batch(data: numpy.ndarray, target: numpy.ndarray, n_samples: int, perc_outlier: int) -> Union[alibi_detect.utils.data.Bunch, Tuple[numpy.ndarray, numpy.ndarray]]
```

Create a batch with a defined percentage of outliers.

| Name           | Type            | Default | Description |
| -------------- | --------------- | ------- | ----------- |
| `data`         | `numpy.ndarray` |         |             |
| `target`       | `numpy.ndarray` |         |             |
| `n_samples`    | `int`           |         |             |
| `perc_outlier` | `int`           |         |             |

**Returns**

* Type: `Union[alibi_detect.utils.data.Bunch, Tuple[numpy.ndarray, numpy.ndarray]]`

### `sample_df`

```python
sample_df(df: pandas.core.frame.DataFrame, n: int)
```

Sample n instances from the dataframe df.

| Name | Type                          | Default | Description |
| ---- | ----------------------------- | ------- | ----------- |
| `df` | `pandas.core.frame.DataFrame` |         |             |
| `n`  | `int`                         |         |             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seldon.ai/alibi-detect/api-reference/utils/data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
