How kadufallone/credit-risk-prediction works
Credit Risk Predictor trains a default-probability model from a CSV and serves predictions through a FastAPI REST API. The training workflow loads and cleans records, makes a stratified train/test split, fits a preprocessing-and-classification pipeline, evaluates it, and saves a model artifact. For inference, the API validates client data, the predictor returns a probability and risk category, and the API formats the response. Training internals and API wiring are excerpted; the dataset and generated artifact are documented in the README, so their precise runtime details are not independently inspected.
Main entry points: api.py FastAPI routes · train.py Preprocess and train · predictor.py Default probability · models Trained model
Components 11
Model training
- Credit risk CSV
data/credit_risk_dataset.csv - Clean and split data
src/train.py - Preprocess and train
src/train.py - Evaluate model
src/train.py - Trained model
models
Prediction service
- FastAPI routes
src/api.py - Default probability
src/predictor.py - Risk classification
src/predictor.py
API contracts
- Client input schema
src/schemas.py - Prediction response
src/schemas.py
Other components
- API client
Connections 10
- Credit risk CSV → Clean and split data: loads and cleans
src/train.py - Clean and split data → Preprocess and train: splits data
src/train.py - Preprocess and train → Evaluate model: fits and evaluates
src/train.py - Preprocess and train → Trained model: saves model
src/train.py - API client → FastAPI routes: submits request
README.md - FastAPI routes → Client input schema: validates input
src/api.py - FastAPI routes → Default probability: requests prediction
src/api.py - Default probability → Trained model: loads model
src/predictor.py - Default probability → Risk classification: classifies probability
src/predictor.py - FastAPI routes → Prediction response: formats response
src/api.py