You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Data-Science-For-Beginners/translations/kn/5-Data-Science-In-Cloud/19-Azure/notebook.ipynb

325 lines
13 KiB

{
"cells": [
{
"cell_type": "markdown",
"source": [
"# ಕ್ಲೌಡ್‌ನಲ್ಲಿ ಡೇಟಾ ಸೈನ್ಸ್: \"ಅಜೂರ್ ಎಂಎಲ್ ಎಸ್‌ಡಿಕೆ\" ವಿಧಾನ\n",
"\n",
"## ಪರಿಚಯ\n",
"\n",
"ಈ ನೋಟ್ಬುಕ್‌ನಲ್ಲಿ, ನಾವು ಅಜೂರ್ ಎಂಎಲ್ ಮೂಲಕ ಮಾದರಿಯನ್ನು ತರಬೇತಿ, ನಿಯೋಜನೆ ಮತ್ತು ಬಳಕೆ ಮಾಡಲು ಅಜೂರ್ ಎಂಎಲ್ ಎಸ್‌ಡಿಕೆ ಅನ್ನು ಹೇಗೆ ಬಳಸುವುದು ಎಂದು ಕಲಿಯುತ್ತೇವೆ.\n",
"\n",
"ಪೂರ್ವಾಪೇಕ್ಷಿತಗಳು:\n",
"1. ನೀವು ಅಜೂರ್ ಎಂಎಲ್ ವರ್ಕ್‌ಸ್ಪೇಸ್ ಅನ್ನು ರಚಿಸಿದ್ದೀರಿ.\n",
"2. ನೀವು [ಹಾರ್ಟ್ ಫೇಲ್ಯೂರ್ ಡೇಟಾಸೆಟ್](https://www.kaggle.com/andrewmvd/heart-failure-clinical-data) ಅನ್ನು ಅಜೂರ್ ಎಂಎಲ್‌ಗೆ ಲೋಡ್ ಮಾಡಿದ್ದೀರಿ.\n",
"3. ನೀವು ಈ ನೋಟ್ಬುಕ್ ಅನ್ನು ಅಜೂರ್ ಎಂಎಲ್ ಸ್ಟುಡಿಯೋಗೆ ಅಪ್‌ಲೋಡ್ ಮಾಡಿದ್ದೀರಿ.\n",
"\n",
"ಮುಂದಿನ ಹಂತಗಳು:\n",
"\n",
"1. ಇರುವ ವರ್ಕ್‌ಸ್ಪೇಸ್‌ನಲ್ಲಿ ಒಂದು ಪ್ರಯೋಗವನ್ನು ರಚಿಸಿ.\n",
"2. ಒಂದು ಕಂಪ್ಯೂಟ್ ಕ್ಲಸ್ಟರ್ ರಚಿಸಿ.\n",
"3. ಡೇಟಾಸೆಟ್ ಅನ್ನು ಲೋಡ್ ಮಾಡಿ.\n",
"4. AutoMLConfig ಬಳಸಿ AutoML ಅನ್ನು ಸಂರಚಿಸಿ.\n",
"5. AutoML ಪ್ರಯೋಗವನ್ನು ಚಾಲನೆ ಮಾಡಿ.\n",
"6. ಫಲಿತಾಂಶಗಳನ್ನು ಅನ್ವೇಷಿಸಿ ಮತ್ತು ಉತ್ತಮ ಮಾದರಿಯನ್ನು ಪಡೆಯಿರಿ.\n",
"7. ಉತ್ತಮ ಮಾದರಿಯನ್ನು ನೋಂದಣಿ ಮಾಡಿ.\n",
"8. ಉತ್ತಮ ಮಾದರಿಯನ್ನು ನಿಯೋಜಿಸಿ.\n",
"9. ಎಂಡ್‌ಪಾಯಿಂಟ್ ಅನ್ನು ಬಳಸಿ.\n",
"\n",
"## ಅಜೂರ್ ಮೆಷಿನ್ ಲರ್ನಿಂಗ್ SDK-ನಿರ್ದಿಷ್ಟ ಆಮದುಗಳು\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"from azureml.core import Workspace, Experiment\n",
"from azureml.core.compute import AmlCompute\n",
"from azureml.train.automl import AutoMLConfig\n",
"from azureml.widgets import RunDetails\n",
"from azureml.core.model import InferenceConfig, Model\n",
"from azureml.core.webservice import AciWebservice"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಕಾರ್ಯಸ್ಥಳವನ್ನು ಪ್ರಾರಂಭಿಸಿ\n",
"ಸ್ಥಿರಗೊಂಡ ಸಂರಚನೆಯಿಂದ ಕಾರ್ಯಸ್ಥಳ ವಸ್ತುವನ್ನು ಪ್ರಾರಂಭಿಸಿ. .\\config.json ನಲ್ಲಿ ಸಂರಚನಾ ಕಡತವು ಇರುವುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"ws = Workspace.from_config()\n",
"print(ws.name, ws.resource_group, ws.location, ws.subscription_id, sep = '\\n')"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## Azure ML ಪ್ರಯೋಗವನ್ನು ರಚಿಸಿ\n",
"\n",
"ನಾವು ಇತ್ತೀಚೆಗೆ ಪ್ರಾರಂಭಿಸಿದ ವರ್ಕ್‌ಸ್ಪೇಸ್‌ನಲ್ಲಿ 'aml-experiment' ಎಂಬ ಪ್ರಯೋಗವನ್ನು ರಚಿಸೋಣ.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"experiment_name = 'aml-experiment'\n",
"experiment = Experiment(ws, experiment_name)\n",
"experiment"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಕಂಪ್ಯೂಟ್ ಕ್ಲಸ್ಟರ್ ರಚಿಸಿ\n",
"ನೀವು ನಿಮ್ಮ AutoML ರನ್‌ಗಾಗಿ [ಕಂಪ್ಯೂಟ್ ಗುರಿ](https://docs.microsoft.com/azure/machine-learning/concept-azure-machine-learning-architecture#compute-target) ರಚಿಸಬೇಕಾಗುತ್ತದೆ.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"aml_name = \"heart-f-cluster\"\n",
"try:\n",
" aml_compute = AmlCompute(ws, aml_name)\n",
" print('Found existing AML compute context.')\n",
"except:\n",
" print('Creating new AML compute context.')\n",
" aml_config = AmlCompute.provisioning_configuration(vm_size = \"Standard_D2_v2\", min_nodes=1, max_nodes=3)\n",
" aml_compute = AmlCompute.create(ws, name = aml_name, provisioning_configuration = aml_config)\n",
" aml_compute.wait_for_completion(show_output = True)\n",
"\n",
"cts = ws.compute_targets\n",
"compute_target = cts[aml_name]"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಡೇಟಾ\n",
"ನೀವು ಡೇಟಾಸೆಟ್ ಅನ್ನು Azure ML ಗೆ ಅಪ್‌ಲೋಡ್ ಮಾಡಿರುವುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ ಮತ್ತು ಕೀ ಡೇಟಾಸೆಟ್‌ನ ಅದೇ ಹೆಸರಾಗಿರಬೇಕು.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"key = 'heart-failure-records'\n",
"dataset = ws.datasets[key]\n",
"df = dataset.to_pandas_dataframe()\n",
"df.describe()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## AutoML ಸಂರಚನೆ\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"automl_settings = {\n",
" \"experiment_timeout_minutes\": 20,\n",
" \"max_concurrent_iterations\": 3,\n",
" \"primary_metric\" : 'AUC_weighted'\n",
"}\n",
"\n",
"automl_config = AutoMLConfig(compute_target=compute_target,\n",
" task = \"classification\",\n",
" training_data=dataset,\n",
" label_column_name=\"DEATH_EVENT\",\n",
" enable_early_stopping= True,\n",
" featurization= 'auto',\n",
" debug_log = \"automl_errors.log\",\n",
" **automl_settings\n",
" )"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## AutoML ರನ್\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"remote_run = experiment.submit(automl_config)"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"RunDetails(remote_run).show()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಅತ್ಯುತ್ತಮ ಮಾದರಿಯನ್ನು ಉಳಿಸಿ\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"best_run, fitted_model = remote_run.get_output()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"best_run.get_properties()"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"model_name = best_run.properties['model_name']\n",
"script_file_name = 'inference/score.py'\n",
"best_run.download_file('outputs/scoring_file_v_1_0_0.py', 'inference/score.py')\n",
"description = \"aml heart failure project sdk\"\n",
"model = best_run.register_model(model_name = model_name,\n",
" description = description,\n",
" tags = None)"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಅತ್ಯುತ್ತಮ ಮಾದರಿಯನ್ನು ನಿಯೋಜಿಸಿ\n",
"\n",
"ಅತ್ಯುತ್ತಮ ಮಾದರಿಯನ್ನು ನಿಯೋಜಿಸಲು ಕೆಳಗಿನ ಕೋಡ್ ಅನ್ನು ಚಾಲನೆ ಮಾಡಿ. ನಿಯೋಜನೆಯ ಸ್ಥಿತಿಯನ್ನು ನೀವು Azure ML ಪೋರ್ಟಲ್‌ನಲ್ಲಿ ನೋಡಬಹುದು. ಈ ಹಂತಕ್ಕೆ ಕೆಲವು ನಿಮಿಷಗಳು ಬೇಕಾಗಬಹುದು.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"inference_config = InferenceConfig(entry_script=script_file_name, environment=best_run.get_environment())\n",
"\n",
"aciconfig = AciWebservice.deploy_configuration(cpu_cores = 1,\n",
" memory_gb = 1,\n",
" tags = {'type': \"automl-heart-failure-prediction\"},\n",
" description = 'Sample service for AutoML Heart Failure Prediction')\n",
"\n",
"aci_service_name = 'automl-hf-sdk'\n",
"aci_service = Model.deploy(ws, aci_service_name, [model], inference_config, aciconfig)\n",
"aci_service.wait_for_deployment(True)\n",
"print(aci_service.state)"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## ಎಂಡ್ಪಾಯಿಂಟ್ ಅನ್ನು ಬಳಸಿ\n",
"ನೀವು ಕೆಳಗಿನ ಇನ್‌ಪುಟ್ ಮಾದರಿಗೆ ಇನ್‌ಪುಟ್‌ಗಳನ್ನು ಸೇರಿಸಬಹುದು.\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"data = {\n",
" \"data\":\n",
" [\n",
" {\n",
" 'age': \"60\",\n",
" 'anaemia': \"false\",\n",
" 'creatinine_phosphokinase': \"500\",\n",
" 'diabetes': \"false\",\n",
" 'ejection_fraction': \"38\",\n",
" 'high_blood_pressure': \"false\",\n",
" 'platelets': \"260000\",\n",
" 'serum_creatinine': \"1.40\",\n",
" 'serum_sodium': \"137\",\n",
" 'sex': \"false\",\n",
" 'smoking': \"false\",\n",
" 'time': \"130\",\n",
" },\n",
" ],\n",
"}\n",
"\n",
"test_sample = str.encode(json.dumps(data))"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"response = aci_service.run(input_data=test_sample)\n",
"response"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n\n<!-- CO-OP TRANSLATOR DISCLAIMER START -->\n**ಅಸ್ವೀಕಾರ**: \nಈ ದಸ್ತಾವೇಜು AI ಅನುವಾದ ಸೇವೆ [Co-op Translator](https://github.com/Azure/co-op-translator) ಬಳಸಿ ಅನುವಾದಿಸಲಾಗಿದೆ. ನಾವು ನಿಖರತೆಯಿಗಾಗಿ ಪ್ರಯತ್ನಿಸುತ್ತಿದ್ದರೂ, ಸ್ವಯಂಚಾಲಿತ ಅನುವಾದಗಳಲ್ಲಿ ದೋಷಗಳು ಅಥವಾ ಅಸತ್ಯತೆಗಳು ಇರಬಹುದು ಎಂದು ದಯವಿಟ್ಟು ಗಮನಿಸಿ. ಮೂಲ ಭಾಷೆಯಲ್ಲಿರುವ ಮೂಲ ದಸ್ತಾವೇಜನ್ನು ಅಧಿಕೃತ ಮೂಲವೆಂದು ಪರಿಗಣಿಸಬೇಕು. ಮಹತ್ವದ ಮಾಹಿತಿಗಾಗಿ ವೃತ್ತಿಪರ ಮಾನವ ಅನುವಾದವನ್ನು ಶಿಫಾರಸು ಮಾಡಲಾಗುತ್ತದೆ. ಈ ಅನುವಾದ ಬಳಕೆಯಿಂದ ಉಂಟಾಗುವ ಯಾವುದೇ ತಪ್ಪು ಅರ್ಥಮಾಡಿಕೊಳ್ಳುವಿಕೆ ಅಥವಾ ತಪ್ಪು ವಿವರಣೆಗಳಿಗೆ ನಾವು ಹೊಣೆಗಾರರಾಗುವುದಿಲ್ಲ.\n<!-- CO-OP TRANSLATOR DISCLAIMER END -->\n"
]
}
],
"metadata": {
"orig_nbformat": 4,
"language_info": {
"name": "python"
},
"coopTranslator": {
"original_hash": "af42669556d5dc19fc4cc3866f7d2597",
"translation_date": "2025-12-19T17:10:35+00:00",
"source_file": "5-Data-Science-In-Cloud/19-Azure/notebook.ipynb",
"language_code": "kn"
}
},
"nbformat": 4,
"nbformat_minor": 2
}