# DVC Experiments and Remote Storage

Once a DVC pipeline is reproducible, you can use it to compare different parameter choices and preserve the resulting experiment state.

## Run a parameter experiment

Suppose `max_depth` is defined in `params.yaml`. You can run an experiment with a different value:

```bash
dvc exp run -S max_depth=10
```

The `-S` option means set a parameter. It is shorthand for `--set-param`; it does not mean save.

DVC runs the pipeline using the changed parameter and records the experiment so its results can be compared.

Use:

```bash
dvc exp show
```

to inspect experiment parameters and metrics.

## Apply an experiment

When you decide to use an experiment's result:

```bash
dvc exp apply <experiment>
```

This applies the experiment's workspace state, including relevant parameter and pipeline state. It does not automatically create a Git commit.

DVC experiments are useful for short-lived comparisons. For a permanent release marker, use Git commits and tags.

## Remote storage

DVC can store data and model outputs in remote object storage. For an S3-compatible service, configure the bucket and endpoint for the remote.

A common operational mistake is putting credentials under one remote name while another remote is configured as the default. The credentials must be configured for the remote DVC actually uses.

## DVC and MLflow together

DVC and MLflow are complementary:

- DVC focuses on data, pipeline dependencies, and reproducible execution.
- MLflow focuses on recording experiment runs, metrics, parameters, artifacts, and models.

**Takeaway:** use DVC to preserve the inputs and workflow behind an experiment. Use experiment comparisons to understand how parameter changes affect its outputs.
