Creating Models
Build and publish your own classification models
Model Development Workflow
1. Train
2. Test
3. Package
4. Publish
Model Configuration
Create a veriafy.yaml file in your model directory:
# veriafy.yaml
name: my-org/fraud-detector
version: 1.0.0
description: Detects fraudulent documents and invoices
# Supported file types
extractors:
- document # PDF, DOCX
- image # JPG, PNG, WebP
# Classification categories
categories:
- name: legitimate
description: Authentic document
- name: fraudulent
description: Potentially fake or manipulated
- name: uncertain
description: Requires manual review
# Default thresholds
thresholds:
block: 0.9 # High confidence fraud
flag: 0.7 # Needs review
allow: 0.3 # Low confidence fraud
# Model architecture
architecture:
type: classifier
base:.veriafy-vector-v2
hidden_layers: [512, 256, 128]
activation: relu
dropout: 0.3
# Training configuration
training:
epochs: 100
batch_size: 64
learning_rate: 0.001
optimizer: adam
early_stopping:
patience: 10
min_delta: 0.001
# Metadata
license: MIT
author: Your Organization
tags:
- fraud
- document
- complianceTraining Your Model
# Prepare training data veriafy dataset init ./training-data veriafy dataset add ./legitimate --label legitimate veriafy dataset add ./fraudulent --label fraudulent # Extract vectors from training files veriafy dataset vectorize ./training-data # Train the model veriafy train ./veriafy.yaml --data ./training-data # Evaluate on test set veriafy eval ./my-model --data ./test-data # Output: # Accuracy: 97.3% # Precision: 96.8% # Recall: 97.9% # F1 Score: 97.3%
Testing Locally
# Test single file veriafy classify document.pdf --model ./my-model # Test batch veriafy classify ./test-files --model ./my-model --output results.json # Run inference server locally veriafy serve ./my-model --port 8080 # Test via API curl -X POST http://localhost:8080/classify \ -F "file=@document.pdf"
Packaging
# Package model for distribution veriafy package ./my-model # Output: # Created: my-org-fraud-detector-1.0.0.veriafy # Size: 45.2 MB # SHA256: abc123... # Test the package veriafy run my-org-fraud-detector-1.0.0.veriafy --test
The package includes the model weights, configuration, and metadata in a single portable file.
Publishing to Marketplace
# Login to Veriafy veriafy login # Publish model veriafy push my-org/fraud-detector:1.0.0 # Set visibility veriafy model set-visibility my-org/fraud-detector public # Set pricing (optional) veriafy model set-price my-org/fraud-detector \ --type subscription \ --monthly 99
Publishing Checklist
- Model achieves >90% accuracy on validation set
- All categories have clear descriptions
- License is specified and compatible
- Documentation explains use cases and limitations
- Test data does not contain PII or sensitive content
- Model passes automated quality checks