Giter Site home page Giter Site logo

eniola-ajala / regression-model-azure-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pamelafox/regression-model-azure-demo

0.0 0.0 0.0 20.05 MB

A demonstration of running a regression model on Azure functions.

Python 0.39% CSS 0.04% HTML 97.40% Jupyter Notebook 1.83% Dockerfile 0.04% Jinja 0.10% Bicep 0.20%

regression-model-azure-demo's Introduction

Building a regression model and deploying to Azure

This repository was built for a #30DaysOfDataScience talk that demonstrates how to build a regression model using sci-kit learn and then deploy it as an HTTP API to Azure Functions.

Technologies used: Jupyter notebook, pandas, scikit-learn, numpy, matplotlib, joblib, Azure functions, Azure Developer CLI, FastAPI

The slides

The slides are viewable online here: tinyurl.com/regression-slides

The slides are generated using a Github action that runs nbconvert on notebook/index.ipynb. Locally, you can use RISE to view the notebook as slides.

The function

The function folder contains the code necessary to turn the pickled regression model into an Azure function:

  • __init__.py: The main Python code that uses FastAPI to setup the model_predict API endpoint
  • categories.py: The values of the enums for model_predict (generated from the categorical features in the notebook)
  • model.pkl: The pickled regression model
  • function.json: Configuration JSON needed for Azure functions

Deployment

The function can be deployed using the Azure Developer CLI. The azd CLI uses these files:

  • infra:
    • main.bicep: Creates an Azure resource group and passes parameters to resources.bicep
    • resources.bicep: Creates a Function App, Storage account, App Service Plan, Log Analytics workspace, and Application Insights.
    • main.parameters.json: Describes parameters needed for main.bicep
  • azure.yaml: Describes which code to upload to the Function App

Deployment steps:

  1. Sign up for a free Azure account and create an Azure Subscription.

  2. Install the Azure Developer CLI. (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)

  3. Login to Azure:

    azd auth login
  4. Provision and deploy all the resources:

    azd up

    It will prompt you to provide an azd environment name (like "modelfunc"), select a subscription from your Azure account, and select a location (like "eastus"). Then it will provision the resources in your account and deploy the latest code.

  5. When azd has finished deploying, you'll see an endpoint URI in the command output.

  6. When you've made any changes to the app code, you can just run:

    azd deploy

Feedback!?

If you have any issues going through this repository, you can use the Discussions tab on this repo.

regression-model-azure-demo's People

Contributors

pamelafox avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.