본문 바로가기
IT & Tech 정보

AutoML 플랫폼: Vertex AI vs SageMaker 실전 데모

by 지식과 지혜의 나무 2025. 5. 25.
반응형


안녕하세요, 즐로그 운영자입니다!
오늘은 AutoML을 손쉽게 체험해볼 수 있는 두 구글·AWS 대표 플랫폼, Vertex AI와 Amazon SageMaker Autopilot을 실전 데모 형태로 비교해볼게요.
데모용 간단 데이터셋부터 모델 배포까지, 코드 스니펫과 함께 단계별로 따라 해보세요~ 😉



📋 목차
1. AutoML 플랫폼 개요
2. 실전 준비: 공통 사전 사항
3. Vertex AI 실전 데모
4. SageMaker Autopilot 실전 데모
5. 비교 포인트 정리
6. 추천 활용 시나리오



1️⃣ AutoML 플랫폼 개요

구분 Vertex AI (Google) SageMaker Autopilot (AWS)
지원 타입 분류·회귀·클래스터링·객체 감지 분류·회귀·탐색적 데이터 분석
인터페이스 Python SDK · Cloud Console Python SDK(boto3) · Console
커스터마이징 하이퍼파라미터·파이프라인 편집 자동화 단계 조절·메트릭 선택
배포 Endpoint·Batch Prediction Endpoint·Batch Transform
비용 구조 학습 시간∙노드 타입 기준 과금 학습 시간∙인스턴스 기준 과금




2️⃣ 실전 준비: 공통 사전 사항
1. 데이터셋:
• 예제: 고객 이탈 예측용 churn.csv
• 컬럼: customer_id, age, monthly_spend, churned(0/1)
2. 환경 설정:
• Python ≥3.8
• 공통 라이브러리: pandas, numpy 설치
• GCP: google-cloud-aiplatform
• AWS: boto3, sagemaker
3. 인증 정보:
• GCP: 서비스 계정 키(JSON)
• AWS: AWS CLI 구성 (aws configure)



3️⃣ Vertex AI 실전 데모

# 1) 라이ブラ리 로드 및 인증
from google.cloud import aiplatform
aiplatform.init(project="YOUR_PROJECT_ID", location="us-central1")

# 2) 데이터 업로드
dataset = aiplatform.TabularDataset.create(
    display_name="churn_dataset",
    gcs_source=["gs://your-bucket/churn.csv"]
)

# 3) AutoML 분류 작업 생성
job = aiplatform.AutoMLTabularTrainingJob(
    display_name="churn_classification_job",
    optimization_prediction_type="classification",
    optimization_objective="roc_auc"
)
model = job.run(
    dataset=dataset,
    target_column="churned",
    training_fraction_split=0.8,
    validation_fraction_split=0.1,
    test_fraction_split=0.1,
    budget_milli_node_hours=1_000  # 약 1 시간 노드 사용
)

# 4) 엔드포인트 배포
endpoint = model.deploy(
    machine_type="n1-standard-4",
    min_replica_count=1, max_replica_count=1
)

# 5) 예측 테스트
prediction = endpoint.predict(instances=[{"age":35,"monthly_spend":120.5}])
print(prediction)

• 포인트:
• budget_milli_node_hours로 예산 제어
• optimization_objective를 AUC 등 업무 목표에 맞춰 설정
• deploy()로 간단하게 실시간 예측 가능



4️⃣ SageMaker Autopilot 실전 데모

import boto3
import sagemaker
from sagemaker import AutoML

# 1) 세이지메이커 세션 초기화
sess = sagemaker.Session()
role = "arn:aws:iam::123456789012:role/SageMakerRole"

# 2) S3에 데이터 업로드
input_s3 = sess.upload_data("churn.csv", bucket="your-bucket", key_prefix="autopilot")

# 3) Autopilot 작업 생성
auto_ml = AutoML(
    role=role,
    target_attribute_name="churned",
    problem_type="Binary Classification",
    max_runtime_per_training_job=3600,  # 1시간
    max_candidates=5
)
auto_ml_job = auto_ml.fit(
    inputs={"train": f"s3://your-bucket/autopilot/churn.csv"},
    job_name="churn-autopilot-job"
)

# 4) 최적 후보 모델 조회
best_candidate = auto_ml_job.describe_auto_ml_job()["BestCandidate"]
model_name = best_candidate["CandidateName"]

# 5) 모델 배포
predictor = auto_ml.deploy(
    initial_instance_count=1,
    instance_type="ml.m5.large",
    candidate=best_candidate
)

# 6) 예측 테스트
response = predictor.predict({"age": 35, "monthly_spend": 120.5})
print(response)

• 포인트:
• max_candidates로 탐색 범위 설정
• 후보별 리더보드 확인하여 직접 모델 선택 가능
• deploy()에 candidate 지정해 바로 배포



5️⃣ 비교 포인트 정리

항목 Vertex AI SageMaker Autopilot
시작 편의성 Console·SDK 직관적 Console 가이드 중심
탐색 제어 예산·목표 지표 세밀 제어 가능 후보 수·시간 제한 설정 가능
모델 가시성 훈련 로그·메트릭 대시보드 제공 후보별 성능 리포트 자동 생성
배포 유연성 서버리스 예측·배치 지원 다양한 인스턴스 타입 선택 가능
비용 최적화 노드 시간 기반 세분 과금 후보별 리소스 자동 조정




6️⃣ 추천 활용 시나리오
• 빠른 PoC:
• Vertex AI – Cloud Console만으로도 5분 내 모델 생성 & 배포 가능
• 세밀한 후보 비교:
• SageMaker – 후보 모델 리더보드 보고 직접 선택 & 튜닝
• 예산 제약 환경:
• Vertex AI – 예산(노드시간)으로 학습 리소스 완전 제어
• 엔터프라이즈 통합:
• SageMaker – AWS 생태계(Glue, IAM, CloudWatch)와 원활 연동



👉 마무리

AutoML 플랫폼 선택은 **“얼마나 빠르게, 얼마나 세밀히, 얼마나 통합”**이 핵심입니다.
두 데모를 직접 실행해보며 당신 조직의 사용성과 비용·운영 조건에 맞는 플랫폼을 골라 보세요! 다음 포스트에서는 OCR·NLP·CV 서비스(Azure vs GCP) 편으로 찾아뵙겠습니다~

즐거운 AI 실험 되세요! 👋

반응형