{ "cells": [ { "cell_type": "markdown", "source": [ "# ക്ലൗഡിലെ ഡാറ്റാ സയൻസ്: \"Azure ML SDK\" വഴി\n", "\n", "## പരിചയം\n", "\n", "ഈ നോട്ട്‌ബുക്കിൽ, Azure ML ഉപയോഗിച്ച് ഒരു മോഡൽ ട്രെയിൻ ചെയ്യാനും, ഡിപ്ലോയ് ചെയ്യാനും, ഉപയോഗിക്കാനും Azure ML SDK എങ്ങനെ ഉപയോഗിക്കാമെന്ന് നാം പഠിക്കും.\n", "\n", "ആവശ്യമായ മുൻ‌പരിചയങ്ങൾ:\n", "1. നിങ്ങൾ ഒരു Azure ML വർക്ക്‌സ്പേസ് സൃഷ്ടിച്ചിട്ടുണ്ട്.\n", "2. നിങ്ങൾ [ഹാർട്ട് ഫെയില്യർ ഡാറ്റാസെറ്റ്](https://www.kaggle.com/andrewmvd/heart-failure-clinical-data) Azure ML-ലേക്ക് ലോഡ് ചെയ്തിട്ടുണ്ട്.\n", "3. നിങ്ങൾ ഈ നോട്ട്‌ബുക്ക് Azure ML സ്റ്റുഡിയോയിൽ അപ്‌ലോഡ് ചെയ്തിട്ടുണ്ട്.\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 മെഷീൻ ലേണിംഗ് 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": [ "## Initialize Workspace\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": [ "## Create an Azure ML experiment\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 റൺക്കായി ഒരു [compute target](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": [ "## Data\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ഈ രേഖ AI വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. നാം കൃത്യതയ്ക്ക് ശ്രമിച്ചെങ്കിലും, സ്വയം പ്രവർത്തിക്കുന്ന വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ തെറ്റുകൾ ഉണ്ടാകാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. അതിന്റെ മാതൃഭാഷയിലുള്ള യഥാർത്ഥ രേഖയാണ് പ്രാമാണികമായ ഉറവിടം എന്ന് പരിഗണിക്കേണ്ടതാണ്. നിർണായക വിവരങ്ങൾക്ക്, പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിക്കുന്നതിൽ നിന്നുണ്ടാകുന്ന ഏതെങ്കിലും തെറ്റിദ്ധാരണകൾക്കോ തെറ്റായ വ്യാഖ്യാനങ്ങൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളല്ല.\n\n" ] } ], "metadata": { "orig_nbformat": 4, "language_info": { "name": "python" }, "coopTranslator": { "original_hash": "af42669556d5dc19fc4cc3866f7d2597", "translation_date": "2025-12-19T17:10:08+00:00", "source_file": "5-Data-Science-In-Cloud/19-Azure/notebook.ipynb", "language_code": "ml" } }, "nbformat": 4, "nbformat_minor": 2 }