{"id":27302492,"url":"https://github.com/vikpires/ds_predictive-sales","last_synced_at":"2026-02-16T23:34:10.466Z","repository":{"id":284104248,"uuid":"953527004","full_name":"vikpires/DS_predictive-sales","owner":"vikpires","description":"Exploring automated machine learning in Azure Machine Learning using a sales dataset.","archived":false,"fork":false,"pushed_at":"2025-06-23T03:50:04.000Z","size":326,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T15:58:17.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vikpires.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-23T15:18:29.000Z","updated_at":"2025-06-23T03:50:07.000Z","dependencies_parsed_at":"2025-06-23T04:36:42.112Z","dependency_job_id":null,"html_url":"https://github.com/vikpires/DS_predictive-sales","commit_stats":null,"previous_names":["vikpires/ds_predictive-sales"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vikpires/DS_predictive-sales","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpires%2FDS_predictive-sales","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpires%2FDS_predictive-sales/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpires%2FDS_predictive-sales/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpires%2FDS_predictive-sales/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikpires","download_url":"https://codeload.github.com/vikpires/DS_predictive-sales/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpires%2FDS_predictive-sales/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29524333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T21:45:09.491Z","status":"ssl_error","status_checked_at":"2026-02-16T21:44:58.452Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-12T02:47:40.440Z","updated_at":"2026-02-16T23:34:10.450Z","avatar_url":"https://github.com/vikpires.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Predictive sales using Azure Machine Learning\n\n\u003e Challenge created as part of the Microsoft Certification Challenge #3 DP-100 Bootcamp by DIO:\n\n## Scenario\n\nImagine that you own an ice cream shop called Gelato Magic in a seaside town. You know that the amount of ice cream you sell each day is strongly correlated with the ambient temperature. However, without proper planning, you may end up producing more ice cream than necessary and incur losses due to waste, or conversely, produce less and lose sales.\n\nTo solve this problem, you decide to use machine learning to predict how much ice cream will be sold based on temperature. With this model, you can anticipate demand and plan production efficiently.\n\n## Goal\n\nThe objective of this project is to develop a predictive regression model that allows:\n\n✅ Train a Machine Learning model to predict ice cream sales based on the day's temperature.\n\n✅ Register and manage the model using MLflow.\n\n✅ Implement the model for real-time forecasting in a cloud computing environment.\n\n✅ Create a structured pipeline to train and test the model, ensuring reproducibility.\n\n---\n\n## 1. Creating the database\n\nTo create the database was used a prompt in Copilot as below:\n\n```\nCreate a sample database with 100 rows simulating ice cream sales based on date, sales, and temperature. The spreadsheet should be in CSV format.\n```\n\nThe CSV file **gelato_database** can be found in the folder \u003ca href= './inputs/dataset'\u003edataset\u003c/a\u003e.\n\n\u003cbr /\u003e\n\n**Dataset Summary**\n\n| Date       | Sales (units) | Temperature (°C) |\n| ---------- | ------------- | ---------------- |\n| 2025-01-01 | 150           | 25               |\n| 2025-01-02 | 120           | 23               |\n| 2025-01-03 | 180           | 28               |\n| 2025-01-04 | 140           | 26               |\n| 2025-01-05 | 160           | 27               |\n| ...        | ...           | ...              |\n\n## 2. Step-by-step to create a project in Azure Machine Learning\n\n### 2.1. Setting the environment in Azure Machine Learning\n\n- First, create a new _resource group_ in Azure Portal\n\n- Search for _Machine Learning_ in the Azure portal and provision a new Azure Machine Learning resource.\n\n- Navigate to the Azure Machine Learning Studio to manage your machine learning resources.\n\n### 2.2. Setting compute instances and uploading the dataset\n\n- In Azure Machine Learning Studio, select the _Compute_ option and set an instance in **Compute instances** to tests and **Compute clusters** to model training.\n\n- Now, select the _Data_ option and create a new dataset. Upload the CSV file **gelato_database**.\n\n- In the *Schema* tab unselect the \"Date\" column, because won't be relevant to the model training.\n\n- To finish, create the data asset.\n\n- In this project, the prediction model has been created using both the _Designer_ option with a pipeline model and the _Automated ML_ option with an automated machine learning process.\n\n### 3. Pipeline Model\n\n#### 3.1. Setting the Pipeline Model\n\n- The first prediction model is using the _Designer_ option.\n\n- On the left-hand menu on the screen, select _Designer_.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./assets/designer_option.png\" title=\"Designer option\" width=\"40%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eDesigner option\u003c/div\u003e\n\u003cbr /\u003e\n\n- Create a **new pipeline using classic prebuilt components**.\n\n- On the search menu, select the dataset in *Data* and drop it into the pipeline board.\n\n- Then, search for **Select Columns in Dataset** and drop it into the pipeline connecting to data. Click in it and add the two columns in dataset: *Sales* and *Temperature*.\n\n- Then, search for **Split Data** and drop it into the pipeline connecting to *Select Columns in Dataset*. Click in the Split Data and set the **Fraction of rows in the first output dataset** option to **0.2**.\n\n- Search for **Train Model** and drop it into the pipeline connecting to *Split Data*\n\n- Search for **Linear Regression** and drop it into the pipeline connecting to *Train Model*. Click in the *Train Model*, then click in **Edit column** in *Label Column* and select the target column as *Sales*.\n\n- Search for **Score Model** and drop it into the pipeline connecting to *Train Model* and *Split Data*.\n\n- Finally, search for **Evaluate Model** and drop it into the pipeline connecting to *Score Model*.\n\n- To finish, click in **Configure \u0026 Submit** to start the training.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./inputs/pipeline_model.png\" title=\"Pipeline model\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003ePipeline model\u003c/div\u003e\n\n#### 3.2. Trained Model\n\n- The metrics of the model are shown below:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/pipeline_metrics.png\" title=\"Metrics of the pipeline\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eMetrics of the pipeline\u003c/div\u003e\n\u003cbr /\u003e\n\n- Below are the scored label values with a good accuracy:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/scored_dataset.png\" title=\"Scored dataset\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eScored dataset\u003c/div\u003e\n\n### 4. Automated Machine Learning\n\n#### 4.1. Setting the Automated Machine Learning process\n\n- On the left-hand menu on the screen, select _Automated ML_.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./assets/automl.png\" title=\"Automated ML option\" width=\"40%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eAutomated ML option\u003c/div\u003e\n\u003cbr /\u003e\n\n- Adjust the task settings, including:\n\n  - Metric definitions\n  - Allowed models\n  - Limits and settings for validation and testing\n\n- The used parameters is shown below:\n\n```\nTask settings:\n\n    Task type: Regression\n    Dataset: gelato_dataset\n    Target column: Sales (units) (integer)\n    Additional configuration settings:\n        Primary metric: NormalizedRootMeanSquaredError\n        Explain best model: Selected\n        Enable ensemble stacking: Unselected\n        Use all supported models: Unselected. You’ll restrict the job to try only a few specific algorithms.\n        Allowed models: Select only KNN, RandomForest and XGBoosterRegressor\n\n    Limits: Expand this section\n        Max trials: 0\n        Max concurrent trials: 0\n        Max nodes: 2\n        Metric score threshold: 0\n        Experiment timeout: 15\n        Iteration timeout: 15\n        Enable early termination: Selected\n\n    Validation and test:\n        Validation type: Automatic\n        Test data: None\n\n    Compute:\n        Select compute type: Compute cluster\n```\n\n- After configuring the settings, submit the training job to begin the model training process.\n\n#### 4.2. Trained Models\n\n- Once the AutoML job is complete, review the best model trained by the system.\n\n- In this training, the best model was the `Random Forest`, which had the best training performance. The *Normalized root mean squared error* was **0.014714** and duration of **31 seconds**.\n\n- The metrics of the model are shown below:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/metrics_automl.png\" title=\"Metrics of the model\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eMetrics of the model\u003c/div\u003e\n\u003cbr /\u003e\n\n- The hyperparameters of the model are shown below:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/hyperparameters.png\" title=\"Hyperparameters of the model\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eHyperparameters of the model\u003c/div\u003e\n\n### 4.3. Review the training\n\n- The following diagram illustrates the data preprocessing, feature engineering, scaling techniques and the machine learning algorithm that Automated ML applied to generate this particular model.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/data_flow.png\" title=\"Data flow\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eData flow\u003c/div\u003e\n\u003cbr /\u003e\n\n- The _Residuals_ graph shows the distribution of errors made by the model:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/residuals.png\" title=\"Residuals histogram\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eResiduals histogram\u003c/div\u003e\n\u003cbr /\u003e\n\n- The graph below compares the predicted values with the true values from the test set:\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./output/images/predicted_vs_true.png\" title=\"Comparation of predicted and true values graphs\" width=\"80%\" /\u003e \n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eComparation of predicted and true values graphs\u003c/div\u003e\n\n### 4.4. Deploy the Best Model\n\n- With the best model selected, you can deploy it. The `Real-time endpoint` option was used to deploy the model.\n\n- Once the deployment is complete, you can test the model by sending requests to the `Real-time endpoint`.\n\n### 4.5. Input Data for Testing\n\n- To test the model, replace the sample JSON input with your own data. Below are two examples of the input used:\n\n**Model:**\n\n```\n{\n    \"input_data\": {\n        \"columns\": [\n            \"Temperature (°C)\"\n        ],\n        \"index\": [],\n        \"data\": []\n    }\n}\n```\n\u003cbr /\u003e\n\n**Input Test 01:**\n\n```\n{\n    \"input_data\": {\n        \"columns\": [\n            \"Temperature (°C)\"\n        ],\n        \"data\": [\n            {\n                \"Temperature (°C)\": 32\n            }\n        ]\n    }\n}\n```\n\u003cbr /\u003e\n\n**Input Test 02:**\n\n```\n  {\n    \"input_data\": {\n        \"columns\": [\n            \"Temperature (°C)\"\n        ],\n        \"data\": [\n            {\n                \"Temperature (°C)\": 24\n            }\n        ]\n    }\n}\n```\n\n### 4.6. Output\n\n**Output Test 01:**\n\n```\n[\n    210\n]\n```\nWith a temperature of 32 Celsius degree, the predicted value for sales are 210 units of ice cream.\n\n\u003cbr /\u003e\n\n**Output Test 02:**\n\n```\n[\n    140\n]\n```\nWith a temperature of 24 Celsius degree, the predicted value for sales are 140 units of ice cream.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikpires%2Fds_predictive-sales","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikpires%2Fds_predictive-sales","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikpires%2Fds_predictive-sales/lists"}