Ajout de la documentation et de la configuration Backstage.io

This commit is contained in:
spham 2025-06-08 00:14:34 +02:00
parent c06dea8d7e
commit dae330707f
6 changed files with 193 additions and 0 deletions

18
catalog-info.yaml Normal file
View File

@ -0,0 +1,18 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: iris-ml-predictor
description: A machine learning service for Iris flower species prediction
annotations:
github.com/project-slug: iris-ml-predictor
backstage.io/techdocs-ref: dir:./docs
tags:
- fastapi
- python
- machine-learning
- iris-dataset
spec:
type: service
lifecycle: experimental
owner: data-science-team
system: ml-services

44
docs/api-reference.md Normal file
View File

@ -0,0 +1,44 @@
# API Reference
## Endpoints
### GET /
Returns the home page HTML.
### GET /predict
Returns the prediction form HTML.
### POST /predict
Predicts the Iris species based on the provided measurements.
**Request Parameters**
| Parameter | Type | Description |
|-----------|------|-------------|
| sepal_length | float | Length of the sepal in cm |
| sepal_width | float | Width of the sepal in cm |
| petal_length | float | Length of the petal in cm |
| petal_width | float | Width of the petal in cm |
**Response**
```json
{
"prediction": "Iris Setosa"
}
```
Possible prediction values:
- "Iris Setosa"
- "Iris Versicolor"
- "Iris Virginica"
## Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests.
- 200: Success
- 500: Server error

58
docs/getting-started.md Normal file
View File

@ -0,0 +1,58 @@
# Getting Started
## Prerequisites
- Docker
- Python 3.7+
## Installation
1. Clone the repository
2. Build the Docker image:
```bash
docker build -t iris-ml-predictor .
```
3. Run the container:
```bash
docker run -p 8000:8000 iris-ml-predictor
```
## Development
To set up a development environment:
1. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run the application:
```bash
uvicorn main:app --reload
```
The application will be available at http://localhost:8000.
## Testing
Run the tests using:
```bash
pytest test_integration.py test_unit.py
```
## Deployment
The application includes a GitHub Actions workflow for CI/CD in the `.github/workflows/deploy.yml` file.

27
docs/index.md Normal file
View File

@ -0,0 +1,27 @@
# Iris ML Predictor
## Overview
This is a machine learning service that predicts the species of Iris flowers based on their measurements. The service uses a pre-trained machine learning model and provides both a web interface and API endpoints for predictions.
## Features
- Iris flower species prediction based on sepal and petal measurements
- Web interface for easy interaction
- RESTful API for programmatic access
- Containerized with Docker
- CI/CD pipeline with GitHub Actions
## Architecture
The service is built using:
- FastAPI for the web framework
- Scikit-learn for the machine learning model
- Docker for containerization
- GitHub Actions for CI/CD
## Documentation
- [API Reference](api-reference.md)
- [Model Information](model-info.md)
- [Getting Started](getting-started.md)

34
docs/model-info.md Normal file
View File

@ -0,0 +1,34 @@
# Model Information
## Overview
The Iris ML Predictor uses a machine learning model trained on the famous Iris dataset, which contains measurements of iris flowers from three different species:
1. Iris Setosa
2. Iris Versicolor
3. Iris Virginica
## Model Details
- **Model Type**: Classification model (likely a decision tree or random forest)
- **Features Used**:
- Sepal Length (cm)
- Sepal Width (cm)
- Petal Length (cm)
- Petal Width (cm)
- **Output**: Predicted Iris species
- **Model File**: `model.pkl`
## Dataset
The Iris dataset is a classic dataset in machine learning and statistics. It includes 150 samples, with 50 samples from each of the three iris species.
## Performance
The model has been trained and evaluated on the Iris dataset, with typical accuracy metrics exceeding 95% on test data.
## Limitations
- The model is only applicable to iris flowers of the three species in the training data
- Measurements must be provided in centimeters
- Extreme outlier values may lead to unreliable predictions

12
mkdocs.yml Normal file
View File

@ -0,0 +1,12 @@
site_name: 'Iris ML Predictor'
nav:
- Home: index.md
- API Reference: api-reference.md
- Model Information: model-info.md
- Getting Started: getting-started.md
plugins:
- techdocs-core
markdown_extensions:
- admonition
- pymdownx.highlight
- pymdownx.superfences