Ajout de la documentation et de la configuration Backstage.io
This commit is contained in:
parent
752140ab39
commit
6bc0eadc84
18
catalog-info.yaml
Normal file
18
catalog-info.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: loan-approval-predictor
|
||||
description: A machine learning service for loan approval prediction
|
||||
annotations:
|
||||
github.com/project-slug: loan-approval-predictor
|
||||
backstage.io/techdocs-ref: dir:./docs
|
||||
tags:
|
||||
- fastapi
|
||||
- python
|
||||
- machine-learning
|
||||
- finance
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: experimental
|
||||
owner: finance-team
|
||||
system: ml-services
|
||||
44
docs/api-reference.md
Normal file
44
docs/api-reference.md
Normal file
@ -0,0 +1,44 @@
|
||||
# API Reference
|
||||
|
||||
## Endpoints
|
||||
|
||||
### GET /
|
||||
|
||||
Returns the home page HTML.
|
||||
|
||||
### GET /predict
|
||||
|
||||
Returns the prediction form HTML.
|
||||
|
||||
### POST /predict
|
||||
|
||||
Predicts loan approval status based on the provided applicant information.
|
||||
|
||||
**Request Parameters**
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| Gender | int | Gender of the applicant (0 for Female, 1 for Male) |
|
||||
| Married | int | Marital status (0 for No, 1 for Yes) |
|
||||
| Dependents | int | Number of dependents (0, 1, 2, or 3+) |
|
||||
| Education | int | Education level (0 for Not Graduate, 1 for Graduate) |
|
||||
| Self_Employed | int | Self-employment status (0 for No, 1 for Yes) |
|
||||
| ApplicantIncome | float | Applicant's income |
|
||||
| CoapplicantIncome | float | Co-applicant's income |
|
||||
| LoanAmount | float | Loan amount in thousands |
|
||||
| Loan_Amount_Term | int | Term of loan in months |
|
||||
| Credit_History | int | Credit history (0 for No, 1 for Yes) |
|
||||
| Property_Area | int | Area of property (0 for Rural, 1 for Semiurban, 2 for Urban) |
|
||||
|
||||
**Response**
|
||||
|
||||
The response is an HTML page with the prediction result:
|
||||
- "Approved" if the loan is predicted to be approved
|
||||
- "Not Approved" if the loan is predicted to be rejected
|
||||
|
||||
## 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
58
docs/getting-started.md
Normal 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 loan-approval-predictor .
|
||||
```
|
||||
|
||||
3. Run the container:
|
||||
|
||||
```bash
|
||||
docker run -p 8000:8000 loan-approval-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_app.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
27
docs/index.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Loan Approval Predictor
|
||||
|
||||
## Overview
|
||||
|
||||
This is a machine learning service that predicts loan approval based on applicant information. The service uses a pre-trained random forest model and provides both a web interface and API endpoints for predictions.
|
||||
|
||||
## Features
|
||||
|
||||
- Loan approval prediction based on applicant data
|
||||
- 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 (Random Forest)
|
||||
- Docker for containerization
|
||||
- GitHub Actions for CI/CD
|
||||
|
||||
## Documentation
|
||||
|
||||
- [API Reference](api-reference.md)
|
||||
- [Model Information](model-info.md)
|
||||
- [Getting Started](getting-started.md)
|
||||
43
docs/model-info.md
Normal file
43
docs/model-info.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Model Information
|
||||
|
||||
## Overview
|
||||
|
||||
The Loan Approval Predictor uses a Random Forest machine learning model trained on loan application data to predict whether a loan application will be approved or rejected.
|
||||
|
||||
## Model Details
|
||||
|
||||
- **Model Type**: Random Forest Classifier
|
||||
- **Features Used**:
|
||||
- Gender
|
||||
- Married
|
||||
- Dependents
|
||||
- Education
|
||||
- Self_Employed
|
||||
- ApplicantIncome
|
||||
- CoapplicantIncome
|
||||
- LoanAmount
|
||||
- Loan_Amount_Term
|
||||
- Credit_History
|
||||
- Property_Area
|
||||
- **Output**: Binary prediction (Approved/Not Approved)
|
||||
- **Model File**: `random_forest_model.pkl`
|
||||
- **Scaler File**: `scaler.pkl`
|
||||
|
||||
## Dataset
|
||||
|
||||
The model was trained on the Loan Approval Prediction dataset, which contains historical loan application data with features about applicants and whether their loans were approved.
|
||||
|
||||
## Feature Importance
|
||||
|
||||
The most important features for loan approval prediction typically include:
|
||||
1. Credit History
|
||||
2. Loan Amount
|
||||
3. Applicant Income
|
||||
4. Property Area
|
||||
5. Loan Amount Term
|
||||
|
||||
## Limitations
|
||||
|
||||
- The model is trained on historical data and may not capture recent changes in lending policies
|
||||
- The model assumes that the input data follows the same distribution as the training data
|
||||
- Extreme outlier values may lead to unreliable predictions
|
||||
12
mkdocs.yml
Normal file
12
mkdocs.yml
Normal file
@ -0,0 +1,12 @@
|
||||
site_name: 'Loan Approval 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
|
||||
Loading…
x
Reference in New Issue
Block a user