Model Card for Model ID
This model classifies pet health symptoms from text descriptions into predefined health conditions, fine-tuned on VetBERTDx.
Model Details
Model Description
Fine-tuned VetBERTDx for sequence classification.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Developed by: Fatemeh Dastak
Model type: Fine-tuned VetBERTDx for sequence classification
Language(s) (NLP): English
License: MIT
Finetuned from model [optional]: havocy28/VetBERTDx
Model Sources [optional]
Uses
Direct Use
1 from transformers import AutoModelForSequenceClassification , AutoTokenizer
2
3 model = AutoModelForSequenceClassification . from_pretrained ( "fdastak/model_classification" )
4 tokenizer = AutoTokenizer . from_pretrained ( "fdastak/model_classification" )
Out-of-Scope Use
Not for actual medical diagnosis
Not a replacement for veterinary consultation
Not suitable for emergency medical decisions
Downstream Use [optional]
This model can be integrated into:
Veterinary triage systems
Pet health monitoring applications
Symptom screening tools
Educational veterinary platforms
Out-of-Scope Use
This model should NOT be used for:
Direct medical diagnosis
Emergency medical decisions
Replacement of veterinary consultation
Legal or insurance decisions
Automated treatment recommendation
Bias, Risks, and Limitations
Technical Limitations
Limited to 512 token input length
CPU-only training constraints
Early stopping at 301 steps
Batch size limitations (8 training, 20 evaluation)
Specific to owner-reported symptoms
Data Biases
Training data from owner observations only
English language only
Limited to common pet conditions
Potential reporting biases in symptoms
Class imbalance considerations
Risk
-Misinterpretation of medical conditions
-Over-reliance on automated classification
-Delayed professional consultation
-False confidence in predictions
-Language and cultural biases
Recommendations
Best Practices
Always verify predictions with professionals
Use as screening tool only
Monitor prediction confidence scores
Implement user warnings
Regular model evaluation
How to Get Started with the Model
Load required libraries
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch.nn.functional as F
Load model and tokenizer
repo_id = "fdastak/model_classification"
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
tokenizer = AutoTokenizer.from_pretrained(repo_id)
Example usage
def classify_symptoms(text: str):
# Preprocess and tokenize
inputs = tokenizer(
text,
truncation=True,
padding=True,
max_length=512,
return_tensors="pt"
)
Training Details
Training Data
Source: Pet Health Symptoms Dataset (Kaggle)
Split: 80% training, 20% validation
Preprocessing: Text lowercasing, label encoding
Training Procedure
Training Hyperparameters
Epochs: 5
Train batch size: 8
Eval batch size: 20
Learning rate: 2e-5
Scheduler: Linear with warmup
Warmup ratio: 0.1
Early stopping: At step 301
Maximum sequence length: 512
Evaluation
Metrics
Accuracy
Precision (weighted)
Recall (weighted)
F1-score (weighted)
Speeds, Sizes, Times
Training Duration : ~1 hour
Steps : 301 (with early stopping)
Checkpoint Frequency : Every 50 steps
Batch Processing :
Training: 8 samples/batch
Evaluation: 20 samples/batch
Model Storage : Local checkpoints in './model_classification'
Evaluation
Testing Data, Factors & Metrics
Testing Data
Source : Pet Health Symptoms Dataset
Split : 20% of data (validation set)
Format : Text descriptions with condition labels
Preprocessing : Text lowercasing, label encoding
Factors
Record Types : Owner observations
Text Length : Maximum 512 tokens
Language : English
Conditions : Multiple pet health conditions
Data Balance : Stratified split for class distribution
Metrics
Accuracy : Overall classification accuracy
Precision (weighted) : Measure of exactness
Recall (weighted) : Measure of completeness
F1-score (weighted) : Harmonic mean of precision and recall
Confusion Matrix : Class-wise performance visualization
Results
Performance Summary
Overall Accuracy: 89%
Average F1-Score: 0.89
Class-wise Performance:
Class 0: Highest precision (0.97) and F1-score (0.95)
Class 1: Perfect recall (1.00)
Class 2: Balanced performance (0.93 across metrics)
Classes 3 & 4: Similar performance (~0.82-0.83 F1-score)
Key Metrics
Precision (weighted) : 0.89
Recall (weighted) : 0.89
F1-score (weighted) : 0.89
Support : 200 validation samples (40 per class)
Summary
Model shows balanced performance across classes
Early stopping at step 301 prevents overfitting
Validation performed every 50 steps
Best model selected based on eval_loss
Confusion matrix shows class-wise performance
Model Examination
Validation Results
The model's performance was examined using several evaluation methods:
Classification Metrics
Computed using sklearn's classification_report
Includes precision, recall, and F1-score
Evaluated on validation dataset
Weighted averages to handle class imbalance
Confusion Matrix Analysis
1 # Visualization code
2 from sklearn . metrics import confusion_matrix , ConfusionMatrixDisplay
3 import matplotlib . pyplot as plt
4
5 model . eval ( )
6 with torch . no_grad ( ) :
7 # Prediction collection
8 true_labels = [ ]
9 pred_labels = [ ]
10 pred_scores = [ ]
11 # ...evaluation logic
Prediction Confidence
Softmax probabilities for class predictions
Confidence scores tracked for each prediction
Score distribution analysis for reliability
Early Stopping Analysis
Training stopped at step 301
Monitored eval_loss for best model selection
Used custom StopAtStepCallback for controlled training
Model Interpretability
Base model: VetBERTDx (domain-specific veterinary BERT)
Fine-tuned for pet symptom classification
Uses attention mechanisms for text understanding
Maximum sequence length: 512 tokens
Limitations
CPU-only training might affect model capacity
Limited to predefined condition categories
Performance varies by symptom complexity
Early stopping may affect final performance
Environmental Impact
Carbon emissions can be estimated using the
Machine Learning Impact calculator presented in
Lacoste et al. (2019) .
Hardware Type: CPU (Personal Computer)
Hours used: ~2 hours (301 steps with early stopping)
Cloud Provider: None (Local training)
Compute Region: USA (Colorado)
Power Mix: Rocky Mountain Power Grid
Training Configuration:
301 steps with early stopping
CPU-based training
Batch size: 8 samples
Epochs: 5
Local machine execution
Environmental considerations:
Used CPU instead of GPU for lower power consumption
Implemented early stopping at step 301
Leveraged pre-trained model (VetBERTDx)
Local training to minimize data center impact
Efficient batch size selection
Technical Specifications [optional]
Model Architecture and Objective
Base model: VetBERTDx
Task: Sequence classification
Input: Text descriptions of pet symptoms
Output: Classification among health conditions
Compute Infrastructure
Framework: PyTorch
Training device: GPU
Python dependencies:
transformers
torch
numpy
scikit-learn
Hardware
The model was trained using:
Training Device: CPU
Batch Configuration:
Training batch size: 8
Evaluation batch size: 20
Training Steps: Limited to 301 (early stopping)
Local Storage: Required for model checkpoints in './model_classification'
Software
Training environment specifications:
Python 3.11
Core Libraries:
1 torch >= 2.0 .0
2 transformers >= 4.30 .0
3 numpy >= 1.24 .0
4 pandas >= 1.5 .0
5 scikit - learn >= 1.0 .0
6 sentence - transformers >= 2.2 .0
Training Components:
Framework: 🤗 Transformers
Base Model: havocy28/VetBERTDx
Tokenizer: AutoTokenizer
Model Class: AutoModelForSequenceClassification
Training API: Transformers Trainer with custom callbacks
Logging: Python's built-in logging module
Citation [optional]
If you use this model in your research, please cite it using the following:
BibTeX:
1 @misc{dastak2024pethealthclassifier,
2 title={Pet Health Symptoms Classification Model},
3 author={Dastak, Fatemeh},
4 year={2024},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/fdastak/model_classification}},
7 note={Based on VetBERTDx by Havocy28},
8 keywords={veterinary-nlp, text-classification, pet-health}
9 }
APA:
Dastak, F. (2025). Pet Health Symptoms Classification Model [Machine learning model]. Hugging Face Model Hub. https://huggingface.co/fdastak/model_classification
Please also cite the base model:
@misc{havocy282023vetbertdx,
title={VetBERTDx: A Domain-Specific Language Model for Veterinary Medicine},
author={Havocy28},
year={2023},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/havocy28/VetBERTDx}}
}
Model Card Contact