Skip to main content

Overview

The /cruncher directory contains example model implementations from the perspective of Crunchers - the ML engineers who submit competing models to Crunch Protocol prediction challenges. This directory demonstrates how models are structured, packaged, and submitted within the Crunch Protocol Ecosystem.

Core Components

1. Model Package (model_package/)

Provides the standard interface that all models in this Crunch must implement. Model implementation example:
from crunchdao.crunch_example.iris import IrisModelBase

class MyIrisModel(IrisModelBase):
    def train(self, train_data: pd.DataFrame) -> None:
        """Train the model on provided training data"""
        pass
    
    def infer(self, dataframe: pd.DataFrame) -> pd.DataFrame:
        """Generate predictions for test data"""
        predictions = self.predict(dataframe)
        return pd.DataFrame({'prediction': predictions})

2. Model Implementations (models/)

This directory includes three complete model implementations, each showcasing a different ML approach. As a Coordinator, you can use them to test your node or share them with Crunchers as references — either to guide their own implementations or serve as benchmark models for pre-Crunch evaluation.

Integration with Coordinator

The models integrate with the Coordinator through:
  1. Model Orchestration: Coordinator sends training data via gRPC
  2. Containerized Execution: Models run in isolated Docker containers
  3. Prediction Collection: Coordinator collects predictions from all models
  4. Performance Scoring: Coordinator evaluates model performance

Coordinator Node Setup

In the next section we will walkthrough the core components to set up your Coordinator node.