Azure machine learning에서 model을 학습해봅시다.
azure에서 제공해주는 associated credit card dataset을 이용해 이번 실습을 수행해 보겠습니다. [dataset Link]
Workspaces는 동료들과 머신러닝 아티팩트들을 생성하고 관련된 작업들을 그룹화하는 협업을 수행하는 장소입니다. 이 장소에는 experiments, jobs, datasets, models, components, inference endpoints 등이 있습니다. 여기서 작업을 하기 위해서는 먼저 생성을 해줘야겠죠?
workspace 생성
먼저 Azure Machine Learning Studio 에 로그인합니다.
create workspace 버튼을 눌러 workspace를 생성합니다.
리소스 그룹 등 Azure 서비스에 대한 설명은 DevOps[2] github action으로 클라우드 서비스 (Azure)로의 빌드 / 배포 자동화 에서 다뤘습니다


코드에서 workspace를 다루기
workspace는 azure.ai.ml의 MLClient 객체를 이용해 다룰 수 있습니다. 이 객체는 resources와 jobs를 관리합니다.
그러려면 먼저 이 패키지를 설치해줘야겠죠?
참고 : https://learn.microsoft.com/ko-kr/python/api/overview/azure/ai-ml-readme?view=azure-python
$ pip install azure-ai-ml
$ pip install azure-identity
TokenCredential implementations의 집합을 제공하며, 이는 Azure AD token authentication을 지원하는 Azure SDK clients를 구축할 때 사용될 수 있다.DefaultAzureCredential을 사용하여 credentials (자격 증명)에 액세스합니다. 토큰이 필요할 때 복수 ID(EnvironmentCredential, ManagedIdentityCredential, SharedTokenCacheCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential)를 차례로 사용하여 토큰을 요청하고 토큰을 제공하면 중지합니다.DefaultAzureCredential 은 대부분의 Azure SDK 인증 시나리오를 처리할 수 있는 기본 자격 증명입니다.from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
# authenticate
credential = DefaultAzureCredential()
# Azure 리소스 그룹 생성
# Azure Machine Learning Service 워크스페이스 생성
# Get a handle to the workspace
ml_client = MLClient(
credential=credenial,
subscription_id="b9#8##4-2###-4a##-####-7##e6##5a###", # subscription_id - 구독id는 Azure Portal -> Subscription 항목에서 확인 가능
resource_group_name="resource group name",
workspace_name="workspace name",
)