# ❖ Targeted Sampling

The **Targeted Sampling** bundle allows you to create synthetic data that is specific and targeted to your usage. You can use targeted sampling to:

:star: **Create minimum viable synthetic test sets** for software testing and QA. Define the exact values that you need across multiple tables, and let SDV handle the rest.

:star: **De-bias and rebalance your datasets**. Adjust the proportions of values to generate in the synthetic data to create a more balanced, fairer representation of the data you'd like to use for ML development.

:star: **Generate hypothetical scenarios.** Create edge cases and situations that don't exist in the real data — but are theoretically possible to observe.

## Included Features

The Targeted Sampling bundle currently supports [**multi-table conditional sampling**](https://docs.sdv.dev/sdv/multi-table-data/sampling/conditional-sampling) for the HSA and Independent Synthesizers.

```python
from sdv.sampling import Condition, MultiTableCondition

# Step 1: Create Single-Table Conditions
resort_hotels = Condition(
    num_rows=10,
    table_name='hotels',
    column_values={'classification': 'RESORT'})

suite_guests_with_rewards = Condition(
    table_name='guests'
    column_values={'room_type': 'SUITE', 'has_rewards': True})

# Step 2: Compose Multi-Table Conditions    
suites_in_resorts = MultiTableCondition(
    conditions=[resort_hotels, suite_guests_with_rewards])

# Step 3: Sample Synthetic Data
synthetic_data = synthesizer.sample_from_conditions([suite_guests_with_rewards])
```

## Installation

Use your SDV Enterprise credentials to install SDV Enterprise and all bundles that you have access to.

```bash
% pip install sdv-installer --upgrade
% sdv-installer install --upgrade
```

```
Username: <email>
License Key: ********************************

Installing SDV Enterprise:
sdv-enterprise (version 0.30.0) - Installed!

Installing Bundles:
bundle-cag - Installed!
bundle-xsynthesizers - Installed!

Success! All packages have been installed. You are ready to use SDV Enterprise.
```


---

# 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.sdv.dev/sdv/explore/sdv-bundles/targeted-sampling.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.
