Skip to main content

scikit-learn Template

The scikit-learn template scaffolds a production-ready ML project with scikit-learn, pandas, and traditional ML algorithms. Two variants are available:
  • sklearn: basic model template
  • sklearn-pipeline: full preprocessing + model pipeline

Quick Start

The model type (classification, regression, etc.) is selected interactively during cirron init.

Project Structure

For shared files (Dockerfile, .gitignore, README.md, .env.example, tests), see Common files.

Cirron-specific bits

cirron.yaml

Profiling hooks

The generated train.py and inference.py integrate with the Cirron SDK. Call ci.profile() once at module top, then wrap the estimator with ci.wrap() to record fit, predict, and pipeline-step spans:

requirements.txt

Model Types

  • Classification: defaults to RandomForestClassifier(n_estimators=100, max_depth=10). Metrics: accuracy, precision, recall, F1.
  • Regression: defaults to RandomForestRegressor(n_estimators=100, max_depth=10). Metrics: MSE, R².
Swap the default model in src/model.py:

Model Persistence

The generated train.py saves both the model and the fitted preprocessor together via joblib:
inference.py reloads both so prediction-time preprocessing matches training.

Usage

Hyperparameter Tuning

Wrap create_model() with GridSearchCV for sweep-based tuning:

Next Steps

PyTorch Template

Deep learning framework

TensorFlow Template

Alternative deep learning framework

Common files

Dockerfile, tests, and shared scaffolding

Deployment

Deploy your trained model