CrunchDAO example packages for machine learning competitions
Project description
CrunchDAO Crunch Example
This package provides example utilities and base classes for CrunchDAO machine learning competitions.
Installation
pip install crunchdao-crunch-example
Usage
Iris Classification
The crunchdao.crunch_example.iris package provides base classes for iris classification models:
from crunchdao.crunch_example.iris import IrisModelBase
import pandas as pd
class MyIrisModel(IrisModelBase):
def train(self, train_data: pd.DataFrame) -> None:
# Implement your training logic here
# train_data contains features and target labels
pass
def infer(self, dataframe: pd.DataFrame) -> pd.DataFrame:
# Implement your inference logic here
# dataframe contains features to predict on
predictions = [0, 1, 2] # Your model predictions
return pd.DataFrame({
'prediction': predictions
})
# Use your model
model = MyIrisModel()
# Training data with features and target
train_data = pd.DataFrame({
'sepal_length': [5.1, 4.9, 4.7],
'sepal_width': [3.5, 3.0, 3.2],
'petal_length': [1.4, 1.4, 1.3],
'petal_width': [0.2, 0.2, 0.2],
'species': [0, 0, 0] # 0=setosa, 1=versicolor, 2=virginica
})
model.train(train_data)
# Test data with just features
test_data = pd.DataFrame({
'sepal_length': [6.1, 5.9],
'sepal_width': [2.9, 3.0],
'petal_length': [4.7, 4.2],
'petal_width': [1.4, 1.5]
})
predictions = model.infer(test_data)
print(predictions)
Package Structure
This package uses namespace packaging to allow for future expansion:
crunchdao.crunch_example.iris- Iris classification utilities- Future:
crunchdao.crunch_example.forex- Forex prediction utilities - Future:
crunchdao.crunch_example.crypto- Cryptocurrency utilities
Development
Requirements
- Python 3.11+
- uv (for dependency management)
Setup
# Clone the repository
git clone https://github.com/crunchdao/coordinator-setup
cd coordinator-setup/examples/crunch_examples
# Install dependencies
uv sync
# Install in development mode
uv pip install -e .
Testing
uv run pytest
Building
# Build the package
uv build
# Upload to PyPI (requires authentication)
uv publish
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crunchdao_crunch_example-0.0.1.tar.gz.
File metadata
- Download URL: crunchdao_crunch_example-0.0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22951477543a47b3c0ba653572466f82d027194389db2db6a1f4d86ad433a0fc
|
|
| MD5 |
d89ff7c6dc20785f9e2969d3e99b5ad3
|
|
| BLAKE2b-256 |
a82cf94d2f8752c533686de4a8c2c2705b2f37324b9f11d593159397eef14ba8
|
File details
Details for the file crunchdao_crunch_example-0.0.1-py3-none-any.whl.
File metadata
- Download URL: crunchdao_crunch_example-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbe965b3ccc2e7d843f93424f9d9be2741c16c6328ce91630d8c56c6a030fd8
|
|
| MD5 |
c1ee0166461ec40872b480d02c8d27d3
|
|
| BLAKE2b-256 |
484c8e230973f0cf08a2b63cf445ddff3ad02e8c0ca51baa53d6bb98c973e2f5
|