Skip to content

Charfi21/azure-ml-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure ML Pipeline — Titanic Survival Prediction

Architecture

graph LR
    A[CSV Upload] --> B[Blob Storage input/]
    B --> C[Event Grid]
    C --> D[Dispatcher Function]
    D --> E[Worker Function - Blob Trigger]
    E --> F[ML API - Container Apps]
    F --> G[Cosmos DB]
    G --> H[Dashboard]
Loading

Dataset & ML Model

  • Dataset : Titanic (Kaggle) — 891 passagers, 7 features
  • Tâche : Classification binaire (survie ou non)
  • Modèle : RandomForest (100 estimateurs, seed=42)
  • Accuracy : 0.8212
  • F1 Score : 0.8199
  • Version : model_v1.0.0.pkl

URLs

Service URL
API ML https://titanic-api.wonderfulpond-f7e17ee3.switzerlandnorth.azurecontainerapps.io
Dashboard https://func-projet-ml-2026.azurewebsites.net/api/dashboard
API Recent https://func-projet-ml-2026.azurewebsites.net/api/recent

Déploiement

Prérequis

  • Azure CLI
  • Docker Desktop
  • Azure Functions Core Tools v4
  • Python 3.11

Commandes de déploiement

# 1. Créer le Resource Group
az group create --name rg-projet-ml --location switzerlandnorth

# 2. Storage Account
az storage account create --name stprojetml2026 --resource-group rg-projet-ml --location switzerlandnorth --sku Standard_LRS

# 3. Containers
az storage container create --name input --account-name stprojetml2026
az storage container create --name output --account-name stprojetml2026
az storage container create --name models --account-name stprojetml2026

# 4. ACR
az acr create --name acrprojetml2026 --resource-group rg-projet-ml --location switzerlandnorth --sku Basic --admin-enabled true

# 5. Cosmos DB
az cosmosdb create --name cosmos-projet-ml-2026 --resource-group rg-projet-ml --locations regionName=switzerlandnorth --capabilities EnableServerless
az cosmosdb sql database create --account-name cosmos-projet-ml-2026 --resource-group rg-projet-ml --name titanic-db
az cosmosdb sql container create --account-name cosmos-projet-ml-2026 --resource-group rg-projet-ml --database-name titanic-db --name inferences --partition-key-path "/id"

# 6. Build et push Docker
docker build -t acrprojetml2026.azurecr.io/titanic-api:v1.0.0 ./api
az acr login --name acrprojetml2026
docker push acrprojetml2026.azurecr.io/titanic-api:v1.0.0

# 7. Container Apps
az containerapp env create --name cae-projet-ml --resource-group rg-projet-ml --location switzerlandnorth
az containerapp create --name titanic-api --resource-group rg-projet-ml --environment cae-projet-ml --image acrprojetml2026.azurecr.io/titanic-api:v1.0.0 --target-port 8000 --ingress external --min-replicas 0 --max-replicas 3

# 8. Function App
az functionapp create --name func-projet-ml-2026 --resource-group rg-projet-ml --storage-account stprojetml2026 --consumption-plan-location switzerlandnorth --runtime python --runtime-version 3.11 --functions-version 4 --os-type linux
cd functions && func azure functionapp publish func-projet-ml-2026 --force

Exemple API

curl -X POST https://titanic-api.wonderfulpond-f7e17ee3.switzerlandnorth.azurecontainerapps.io/predict \
  -H "Content-Type: application/json" \
  -d '{"Pclass":3,"Sex":1,"Age":22,"SibSp":1,"Parch":0,"Fare":7.25,"Embarked":2}'

Réponse :

{"prediction": 0, "label": "Not Survived", "confidence": 0.88, "model_version": "1.0.0"}

KQL Queries (Application Insights)

1. Nombre d'inférences par heure

traces
| where timestamp > ago(24h)
| where message contains "WORKER TERMINÉ"
| summarize count() by bin(timestamp, 1h)
| render timechart

2. Top 5 fichiers les plus lents

traces
| where message contains "WORKER TERMINÉ"
| extend duration = todouble(extract("duration: ([0-9.]+)", 1, message))
| top 5 by duration desc

3. Distribution des codes HTTP

requests
| where timestamp > ago(24h)
| summarize count() by resultCode
| render piechart

Estimation coût mensuel

Service SKU Coût estimé
Container Apps Consumption ~$0 (scale to 0)
Functions Consumption ~$0 (1M free)
Cosmos DB Free Tier ~$0
Storage Standard LRS ~$0.02
ACR Basic ~$5
Event Grid - ~$0 (100K free)
Total ~$5/mois

Structure du projet

azure-ml-pipeline/
├── api/              # FastAPI + Dockerfile
├── functions/        # Azure Functions
├── model/            # Training + modèle exporté
├── web/              # Dashboard HTML
├── tests/            # Tests E2E
├── docs/             # Diagrammes
└── .github/workflows/ # CI/CD

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors