> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-dependabot-github-actions-actions-cache-6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Experiments Overview

> 실험 추적과 artifact 관리를 위한 W&B Python SDK의 기본 클래스를 사용합니다

이 클래스들은 머신 러닝 실험을 추적하고, artifact를 관리하며, SDK 동작을 설정하기 위한 핵심 구성 요소입니다. 이러한 기본 클래스들을 사용하면 메트릭을 로깅하고, 모델 체크포인트를 저장하고, 데이터셋의 버전을 관리하고, 완전한 재현성과 협업 기능을 바탕으로 실험 설정을 관리할 수 있습니다.

> ML 실험에서 이러한 클래스를 사용하는 방법에 대한 자세한 내용은 [Experiments](/ko/models/ref/python/experiments/) 및 [Artifacts](/ko/models/artifacts/) 문서를 참조하세요.

<div id="core-classes">
  ## 핵심 클래스
</div>

| 클래스                                                       | 설명                                                            |
| --------------------------------------------------------- | ------------------------------------------------------------- |
| [`Run`](/ko/models/ref/python/experiments/run/)           | W\&B에 로깅되는 기본 계산 단위로, 메트릭, 설정, 출력이 포함된 단일 ML 실험을 나타냅니다.       |
| [`Artifact`](/ko/models/ref/python/experiments/artifact/) | 자동 중복 제거와 리니지 추적을 지원하는, 데이터셋과 모델 버전 관리를 위한 유연하고 가벼운 구성 요소입니다. |
| [`Settings`](/ko/models/ref/python/experiments/settings/) | 로깅부터 API 상호작용까지의 동작을 제어하는 W\&B SDK의 설정 관리 기능입니다.              |

<div id="getting-started">
  ## 시작하기
</div>

<div id="track-an-experiment">
  ### 실험 추적하기
</div>

메트릭을 로깅하면서 머신 러닝 실험을 생성하고 추적합니다:

```python theme={null}
import wandb

# 새 run 초기화
with wandb.init(project="my-experiments", config={"learning_rate": 0.001}) as run:
    # 설정 접근
    config = run.config
    
    # 트레이닝 중 메트릭 로깅
    for epoch in range(10):
        metrics = train_one_epoch()  # 트레이닝 로직
        run.log({
            "loss": metrics["loss"],
            "accuracy": metrics["accuracy"],
            "epoch": epoch
        })
    
    # 요약 메트릭 로깅
    run.summary["best_accuracy"] = max_accuracy
```

<div id="version-a-model-artifact">
  ### 모델 artifact 버전 지정
</div>

메타데이터와 함께 버전이 지정된 모델 artifact를 생성하여 로깅합니다:

```python theme={null}
import wandb

with wandb.init(project="my-models") as run:
    # 모델 트레이닝
    model = train_model()
    
    # 모델에 대한 artifact 생성
    model_artifact = wandb.Artifact(
        name="my-model",
        type="model",
        description="ResNet-50 trained on ImageNet subset",
        metadata={
            "architecture": "ResNet-50",
            "dataset": "ImageNet-1K",
            "accuracy": 0.95
        }
    )
    
    # artifact에 모델 파일 추가
    model_artifact.add_file("model.pt")
    model_artifact.add_dir("model_configs/")
    
    # W&B에 artifact 로깅
    run.log_artifact(model_artifact)
```

<div id="configure-sdk-settings">
  ### SDK 설정하기
</div>

요구 사항에 맞게 W\&B SDK 동작을 사용자 지정하세요:

```python theme={null}
import wandb

# 프로그래밍 방식으로 설정 구성
wandb.Settings(
    project="production-runs",
    entity="my-team",
    mode="offline",  # 오프라인으로 실행, 나중에 동기화
    save_code=True,   # 소스 코드 저장
    quiet=True        # 콘솔 출력 감소
)

# 또는 환경 변수 사용
# export WANDB_PROJECT=production-runs
# export WANDB_MODE=offline

# 맞춤형 설정으로 초기화
with wandb.init() as run:
    # 실험 코드를 여기에 작성
    pass
```

<div id="link-artifacts-for-lineage-tracking">
  ### 리니지 추적을 위해 artifact 연결하기
</div>

데이터셋, 모델, 평가 사이의 관계를 추적하세요:

```python theme={null}
import wandb

with wandb.init(project="ml-pipeline") as run:
    # 데이터셋 artifact 사용
    dataset = run.use_artifact("dataset:v1")
    dataset_dir = dataset.download()
    
    # 데이터셋을 사용하여 모델 트레이닝
    model = train_on_dataset(dataset_dir)
    
    # 데이터셋 리니지가 포함된 모델 artifact 생성
    model_artifact = wandb.Artifact(
        name="trained-model",
        type="model"
    )
    model_artifact.add_file("model.pt")
    
    # 자동 리니지 추적으로 로깅
    run.log_artifact(model_artifact)
```
