Skip to content

A machine learning model to predict stroke disease

Notifications You must be signed in to change notification settings

SHasina/StrokePrediction-azureMLOPS

Repository files navigation

Problem Definition

A model to predict if a person have stroke or not. Machine Learning Algorithms and Deep Learning Techniques were used to build this model.

Cloud Architecture used

stroke-containerapp drawio

Algorithms used

  • GradientBoostingClassifier

  • LinearDiscriminantAnalysis

  • Random Forest Classifier.

  • Support Vector Machine.

  • ExtraTreesClassifier

  • Logistic Regression.

  • k-Nearest Neighbors.

  • AdaBoostClassifier

  • MLPClassifier

  • Decision Tree.

  • Naive Bayes.

  • Deep Learning Technique

    • Tensorflow

Evaluation Matrics Used

  • cross_val_score
  • classification_report
  • confusion_matrix
  • precision_score
  • accuracy_score
  • recall_score
  • f1_score

Azure Services Used

  • Containerapp Environment
  • Containerapp
  • Log Analytics
  • Storage Account
  • Resource Group
  • Managed Identity

Other services

  • Docker

Note:

This article assumes

  • You have a Dockerhub Account, Microsoft Azure Account and a Github Account.
  • You have git installed on your local machine.
  • Have authenticated into github using your cli.
  • Change the name of the storage account name in .github/workflow/main.yaml line: 17 and 14

Deployment Of Application

Step 1:

Create Service Principle

  1. Create a new service principle and grant owner permission to this service principle using the command bellow.
az ad sp create-for-rbac --name "temp-github-action-svp" --role owner --scopes /subscriptions/${SUBSCRIPTION_ID} --sdk-auth

Ignore the warning: Option '--sdk-auth' has been deprecated and will be removed in a future release.

  1. Copy and paste the output after creating service principle in the format bellow in your clip board.
{
  "clientId": "",
  "clientSecret": "",
  "subscriptionId": "",
  "tenantId": "",
  "activeDirectoryEndpointUrl": "",
  "resourceManagerEndpointUrl": "",
  "activeDirectoryGraphResourceId": "",
  "sqlManagementEndpointUrl": "",
  "galleryEndpointUrl": "",
  "managementEndpointUrl": ""
}

Step2:

Save service principle credentials in github secrets

  1. Open github and create a new repository with any name of your choice
  2. Open the repository and click on settings.
  3. Scroll down and click on secrets and select actions.
  4. Click on new repository secrets.
  5. Copy and past the output of creation of the service princlicple in the bellow form
{
  "clientId": "",
  "clientSecret": "",
  "subscriptionId": "",
  "tenantId": "",
  "activeDirectoryEndpointUrl": "",
  "resourceManagerEndpointUrl": "",
  "activeDirectoryGraphResourceId": "",
  "sqlManagementEndpointUrl": "",
  "galleryEndpointUrl": "",
  "managementEndpointUrl": ""
}
  1. Click on save

Step3:

Test Pipeline

  1. push the code to your repository.
  2. Navigate to Actions and see your pipeline being triggered by github actions.
  3. Wait for the deployment to complete and test your endpoint.

Note: The endpoint can be tested using the url generated by the container app with /docs append to it. Example: https://stroke0modelm.victoriousstone-80e7c8c7.centralus.azurecontainerapps.io/docs

About

A machine learning model to predict stroke disease

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published