{ "cells": [ { "cell_type": "markdown", "source": [ "# கிளவுடில் தரவியல் அறிவியல்: \"Azure ML SDK\" முறையில் \n", "\n", "## அறிமுகம்\n", "\n", "இந்த நோட்புக்கில், Azure ML SDK-ஐ பயன்படுத்தி ஒரு மாதிரியை பயிற்சி, பிரசாரம் மற்றும் பயன்பாடு செய்வது எப்படி என்பதை நாம் கற்றுக்கொள்வோம்.\n", "\n", "முன்னேற்பாடுகள்:\n", "1. நீங்கள் Azure ML வேலைவாய்ப்பகத்தை உருவாக்கியுள்ளீர்கள்.\n", "2. நீங்கள் [Heart Failure dataset](https://www.kaggle.com/andrewmvd/heart-failure-clinical-data)-ஐ Azure ML-க்கு ஏற்றியுள்ளீர்கள்.\n", "3. நீங்கள் இந்த நோட்புக்கை Azure ML Studio-க்கு பதிவேற்றியுள்ளீர்கள்.\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", "## Azure Machine Learning 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 கோப்பு .\\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": [ "## ஆட்டோஎம்எல் கட்டமைப்பு\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": [ "## ஆட்டோஎம்.எல் இயக்கம்\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\n**குறிப்பு**: \nஇந்த ஆவணம் [Co-op Translator](https://github.com/Azure/co-op-translator) என்ற AI மொழிபெயர்ப்பு சேவையைப் பயன்படுத்தி மொழிபெயர்க்கப்பட்டுள்ளது. நாங்கள் துல்லியத்திற்காக முயற்சிக்கிறோம், ஆனால் தானியங்கி மொழிபெயர்ப்புகளில் பிழைகள் அல்லது தவறான தகவல்கள் இருக்கக்கூடும் என்பதை கவனத்தில் கொள்ளவும். அதன் தாய்மொழியில் உள்ள மூல ஆவணம் அதிகாரப்பூர்வ ஆதாரமாகக் கருதப்பட வேண்டும். முக்கியமான தகவல்களுக்கு, தொழில்முறை மனித மொழிபெயர்ப்பு பரிந்துரைக்கப்படுகிறது. இந்த மொழிபெயர்ப்பைப் பயன்படுத்துவதால் ஏற்படும் எந்த தவறான புரிதல்கள் அல்லது தவறான விளக்கங்களுக்கு நாங்கள் பொறுப்பல்ல.\n" ] } ], "metadata": { "orig_nbformat": 4, "language_info": { "name": "python" }, "coopTranslator": { "original_hash": "af42669556d5dc19fc4cc3866f7d2597", "translation_date": "2025-10-11T16:18:08+00:00", "source_file": "5-Data-Science-In-Cloud/19-Azure/notebook.ipynb", "language_code": "ta" } }, "nbformat": 4, "nbformat_minor": 2 }