1. Azure ML ์์ ์์ญํ๊ณ ์ฐ๊ฒฐ
import azureml.core
from azureml.core import Workspace
# check core SDK version number
print("Azure ML SDK Version: ", azureml.core.VERSION)
# load workspace configuration from the config.json file in the current folder.
ws = Workspace.from_config()
print(ws.name, ws.location, ws.resource_group, ws.location, sep = '\t')
2. ์คํ ๋ง๋ฌ - ๋ถ๋ฌ์จ ์์ ์์ญ ws์ ์คํ ์ด๋ฆ ์ ํ๊ณ ๋ง๋ฌ
experiment_name = 'sklearn-mnist'
from azureml.core import Experiment
exp = Experiment(workspace=ws, name=experiment_name)
3. AML ์ปดํจํ ๋ง๋ค๊ธฐ or ์ฐ๊ฒฐ
- ์ปดํจํ ์ฌ์ฉ : Azure ๊ฐ์๋จธ์ ํด๋ฌ์คํฐ์์ ๊ธฐ๊ณํ์ต ๋ชจ๋ธ ํ์ต ๊ฐ๋ฅ (ex) GPU์ง์๋๋ VM ์์
- ์ปดํจํ ๋ง๋๋๋ฐ ์ฝ 5๋ถ ์์๋จ.
from azureml.core.compute import AmlCompute
from azureml.core.compute import ComputeTarget
import os
# choose a name for your cluster
compute_name = os.environ.get("AML_COMPUTE_CLUSTER_NAME", "cpucluster")
compute_min_nodes = os.environ.get("AML_COMPUTE_CLUSTER_MIN_NODES", 0)
compute_max_nodes = os.environ.get("AML_COMPUTE_CLUSTER_MAX_NODES", 4)
# This example uses CPU VM. For using GPU VM, set SKU to STANDARD_NC6
vm_size = os.environ.get("AML_COMPUTE_CLUSTER_SKU", "STANDARD_D2_V2")
if compute_name in ws.compute_targets:
compute_target = ws.compute_targets[compute_name]
if compute_target and type(compute_target) is AmlCompute:
print('found compute target. just use it. ' + compute_name)
else:
print('creating a new compute target...')
provisioning_config = AmlCompute.provisioning_configuration(vm_size = vm_size,
min_nodes = compute_min_nodes,
max_nodes = compute_max_nodes)
# create the cluster
compute_target = ComputeTarget.create(ws, compute_name, provisioning_config)
# can poll for a minimum number of nodes and for a specific timeout.
# if no min node count is provided it will use the scale settings for the cluster
compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)
# For a more detailed view of current AmlCompute status, use get_status()
print(compute_target.get_status().serialize())
4. ํด๋ผ์ฐ๋์ ๋ฐ์ดํฐ ์ ๋ก๋
ds = ws.get_default_datastore()
print(ds.datastore_type, ds.account_name, ds.container_name)
ds.upload(src_dir=data_folder, target_path='mnist', overwrite=True, show_progress=True)
5. ์๊ฒฉ ํด๋ฌ์คํฐ์์ ํ์ต
6. ์๊ฒฉ ์คํ ๋ชจ๋ํฐ๋ง
7. ๋ชจ๋ธ ๋ฑ๋ก
https://docs.microsoft.com/ko-kr/azure/machine-learning/service/tutorial-train-models-with-aml
์ด๋ฏธ์ง ๋ถ๋ฅ ์์ต์: ๋ชจ๋ธ ํ์ต - Azure Machine Learning service
Azure Machine Learning Service๋ฅผ ์ฌ์ฉํ๋ Python Jupyter Notebook์์ scikit-Learn์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง ๋ถ๋ฅ ๋ชจ๋ธ์ ํ์ต์ํค๋ ๋ฐฉ๋ฒ์ ์์๋ด ๋๋ค. ์ด ์์ต์๋ 2๋ถ๋ก ๊ตฌ์ฑ๋ ์๋ฆฌ์ฆ ์ค ์ 1๋ถ์ ๋๋ค.
docs.microsoft.com
'Machine Learning > Azure ML' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ฐ์ดํฐ ๋ก๋ (0) | 2019.07.22 |
---|---|
AKS ํด๋ฌ์คํฐ ๋ง๋ค๊ธฐ (0) | 2019.06.25 |
Azure Machine Learning (0) | 2019.05.15 |