TrustTune is a robust, plug-and-play solution for automating model score calibration in production ML systems. It supports both online (streaming) and offline (batch) calibration with comprehensive monitoring and drift detection.
- Multiple calibration methods:
- Platt Scaling
- Isotonic Regression
- Temperature Scaling
- Beta Calibration (coming soon)
- Online and offline calibration
- Comprehensive calibration metrics
- Drift detection and monitoring
- Model versioning and governance
- REST API and Python SDK
- Production-ready with Docker support
- Interactive web UI
The easiest way to get started with TrustTune is to use GitHub Codespaces:
- Click the "Code" button on the GitHub repository
- Select the "Codespaces" tab
- Click "Create codespace on main"
- Wait for the codespace to initialize
- Once ready, run the following command in the terminal:
./.devcontainer/codespace-setup.sh && uvicorn app:app --host 0.0.0.0 --port 8000 --reload
- Click on the "Ports" tab and click the globe icon next to port 8000 to open the application
# Clone the repository
git clone https://github.com/dave05/TrustTune.git
cd TrustTune
# Install dependencies
pip install -e .
pip install -r requirements.txt
# Run the application
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
# Build the Docker image
docker build -t trusttune .
# Run the container
docker run -p 8000:8000 trusttune
# Install the AWS CLI and EB CLI
pip install awscli awsebcli
# Configure AWS credentials
aws configure
# Initialize Elastic Beanstalk application
eb init -p python-3.10 trusttune
# Create an environment and deploy
eb create trusttune-env
# For subsequent deployments
eb deploy
# Open the application in a browser
eb open
- Sign in to the AWS Management Console
- Navigate to AWS App Runner
- Click "Create service"
- Connect your GitHub repository
- Configure the build:
- Runtime: Python 3
- Build command:
pip install -r requirements.txt
- Start command:
python application.py
- Configure service settings and click "Create & deploy"
- Package your application using AWS Serverless Application Model (SAM):
# Install AWS SAM CLI
pip install aws-sam-cli
# Initialize SAM project
sam init
# Build the application
sam build
# Deploy the application
sam deploy --guided
# Login to Heroku
heroku login
# Create a new Heroku app
heroku create trusttune-app
# Push to Heroku
git push heroku main
# Open the app
heroku open
- Sign up for a Render account
- Create a new Web Service
- Connect your GitHub repository
- Use the following settings:
- Build Command:
pip install -r requirements.txt
- Start Command:
uvicorn app:app --host 0.0.0.0 --port $PORT
- Build Command:
- Sign up for a Railway account
- Create a new project from GitHub
- Connect your GitHub repository
- Railway will automatically detect the Procfile and deploy your application
from trusttune.core.platt import PlattCalibrator
# Initialize calibrator
calibrator = PlattCalibrator()
# Fit calibrator with your data
calibrator.fit(scores, labels)
# Get calibrated probabilities
calibrated_scores = calibrator.predict_proba(scores)
import requests
# Prepare data
data = {
"scores": [0.2, 0.7, 0.9],
"labels": [0, 1, 1],
"calibrator_type": "platt"
}
# Call API
response = requests.post(
"http://localhost:8000/calibrate",
json=data
)
# Get results
result = response.json()
print(result["calibrated_scores"])
TrustTune includes comprehensive end-to-end tests using Playwright:
# Install Playwright
npm init -y
npm install @playwright/test
npx playwright install --with-deps
# Run tests
npx playwright test
from trusttune.core.platt import PlattCalibrator