Skip to main content

Custom Template

The custom template creates a minimal ML project structure that you can use to implement your own models from scratch or integrate with custom ML frameworks. This template provides a clean foundation for building custom ML solutions.

Quick Start

Create a new custom project:
The model type (classification, regression, etc.) is selected interactively during cirron init.

Project Structure

The custom template generates the following project structure:

Generated Files

requirements.txt

src/model.py

A minimal model template that you can customize:

src/inference.py

Production-ready inference script:

Implementation Examples

Example 1: Simple Linear Regression

Example 2: Custom Neural Network

Example 3: Integration with External Libraries

Training Script Template

Create a src/train.py file for your training logic:

Data Loading Template

Create a src/data_loader.py file for your data loading logic:

Usage Examples

Basic Usage

Custom Inference

Integration Examples

Integration with PyTorch

Integration with TensorFlow

Best Practices

Model Interface

  • Implement consistent train(), predict(), save(), and load() methods
  • Handle different input formats (numpy arrays, pandas DataFrames, etc.)
  • Provide clear error messages for invalid inputs

Data Handling

  • Implement proper data validation
  • Handle missing values and outliers
  • Scale features appropriately
  • Split data into train/validation/test sets

Model Persistence

  • Use appropriate serialization format (pickle, joblib, JSON, etc.)
  • Include model metadata (version, parameters, etc.)
  • Ensure cross-platform compatibility

Performance

  • Optimize for your specific use case
  • Use appropriate data structures
  • Consider parallel processing for large datasets
  • Profile your code for bottlenecks

Customization Options

Adding Dependencies

Update requirements.txt to include your custom dependencies:

Custom Configuration

Add configuration options to your model:

Advanced Features

  • Add model validation and testing
  • Implement model versioning
  • Add logging and monitoring
  • Create model explainability features

Next Steps