# LeapAnalysisConfiguration

`LeapAnalysisConfiguration` controls optional engine behaviors for a Tensorleap analysis run. It is set on the `leap_binder` object in your integration script, outside of any decorated function.

```python
@dataclass
class LeapAnalysisConfiguration:
    domain_gap_metadata: Optional[List[str]] = None
    feature_flags: Optional[List[str]] = None
    deterministic_results: Optional[bool] = None
```

<table><thead><tr><th width="230">Field</th><th></th></tr></thead><tbody><tr><td><code>domain_gap_metadata</code></td><td><em>(Optional[List[str]])</em> Names of metadata fields to use for domain gap analysis. Each name must match a registered <code>@tensorleap_metadata</code> field.</td></tr><tr><td><code>feature_flags</code></td><td><em>(Optional[List[str]])</em> List of engine feature flags to enable. See <a href="#feature-flags">Feature Flags</a> below.</td></tr><tr><td><code>deterministic_results</code></td><td><em>(Optional[bool])</em> When <code>True</code>, analysis results are fully deterministic across runs. This increases memory usage and runtime.</td></tr></tbody></table>

## Basic Usage

```python
from code_loader import leap_binder
from code_loader.contract.responsedataclasses import LeapAnalysisConfiguration

leap_binder.leap_analysis_configuration = LeapAnalysisConfiguration(
    deterministic_results=True,
    feature_flags=['FEATURE_FLAG_MISLABELED_ON_ALL_CATEGORICAL_METADATA'],
)
```

## Feature Flags

Feature flags are passed as strings in the `feature_flags` list. The following flags are supported:

<table><thead><tr><th width="420">Flag</th><th></th></tr></thead><tbody><tr><td><code>FEATURE_FLAG_MISLABELED_ON_ALL_CATEGORICAL_METADATA</code></td><td>Run mislabeled sample detection across all categorical metadata fields, not just the primary label.</td></tr><tr><td><code>FEATURE_FLAG_USE_PCA_IN_PRUNNING</code></td><td>Use a PCA-unified latent space when computing dataset pruning (similarity-based deduplication).</td></tr><tr><td><code>FEATURE_FLAG_TRAINING_RELEVANCE_SCORES</code></td><td>Compute relevance scores using the training set.</td></tr><tr><td><code>FEATURE_FLAG_TRAINING_DENSITY_WEIGHTS</code></td><td>Compute density weights using the training set.</td></tr><tr><td><code>FEATURE_FLAG_COMPUTE_PREDICTED_LOSS</code></td><td>Compute predicted loss scores per sample.</td></tr></tbody></table>

{% hint style="info" %}
All feature flags are disabled by default unless listed here.
{% endhint %}
