Logo Lanfrica

wesetech-digital/Credit-Score

Domaine:

socioeconomic

Type de record:

model
Créateur:
wes
Hôte:
This repository contains a machine learning-based credit scoring system tailored for Zimbabwe’s unique economic and financial landscape. The model leverages pre-trained base models, fine-tuned with local financial data, to provide accurate credit risk assessments. Designed for both B2B and C2B use cases # FastAPI Loan Default Prediction & Credit Scoring Service This FastAPI service allows users to submit loan data and get a prediction on whether a loan will default or not. The service leverages a pre-trained machine learning model to perform loan default prediction and provides users with detailed insights on the loan's risk. The service includes authentication via JWT tokens, user management, and storage for past predictions. --- ## Table of Contents 1. Setup Instructions 2. Starting the Server 3. Authentication & Authorization 4. API Endpoints 5. Input Payload Schema 6. Prediction Model 7. Features Explained 8. Error Handling 9. Example Requests --- ## Setup Instructions ### Prerequisites Before setting up the project, make sure you have the following installed: 1. **Python 3.12+** (It's recommended to use a virtual environment) 2. **Required Python packages** as listed in the `requirements.txt` To install the necessary dependencies, run: ```bash pip install -r requirements.txt ``` --- ### Load the Model Pipeline If you're using a pre-trained model, ensure that the model is saved as `final_model_pipeline.pkl` and placed in the `pipelines/` directory. This model is responsible for the loan default predictions. If the model is not available, you will need to train and save the model using the following example code: ```python import joblib from sklearn.ensemble import IsolationForest from sklearn.pipeline import Pipeline # Define and train your model (example code, adjust as needed) pipeline = Pipeline([ # Add preprocessing steps and your trained model here ]) # Save the trained pipeline joblib.dump(pipeline, 'pipelines/final_model_pipeline.pkl') ``` --- ### File Structure ``` . ├── pipelines/ │ └── final_model_pipeline.pkl # Pre-trained model pipeline ├── scripts/ │ └── transformers.py # Additional processing scripts if needed └── main.py # FastAPI application ``` --- ## Starting the Server To start the FastAPI server: 1. Navigate …