diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..b7906e1 --- /dev/null +++ b/catalog-info.yaml @@ -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 diff --git a/docs/api-reference.md b/docs/api-reference.md new file mode 100644 index 0000000..c86ce12 --- /dev/null +++ b/docs/api-reference.md @@ -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 diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000..10dc227 --- /dev/null +++ b/docs/getting-started.md @@ -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. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..8868ece --- /dev/null +++ b/docs/index.md @@ -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) diff --git a/docs/model-info.md b/docs/model-info.md new file mode 100644 index 0000000..a7ecfcc --- /dev/null +++ b/docs/model-info.md @@ -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 diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..d4fa5bc --- /dev/null +++ b/mkdocs.yml @@ -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