Metadata-Version: 2.4
Name: motion2health
Version: 1.0.0
Summary: Behaviour-mediated and direct prediction workflows for livestock health monitoring using accelerometry
Author-email: Aniket Sinha <aniket.sinha@sydney.edu.au>
License: MIT
Project-URL: Homepage, https://github.com/SydneyBioX/motion2health
Project-URL: Repository, https://github.com/SydneyBioX/motion2health.git
Project-URL: Bug Tracker, https://github.com/SydneyBioX/motion2health/issues
Keywords: livestock,accelerometry,animal-health,machine-learning,pytorch,ggt-prediction
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22.0
Requires-Dist: pandas>=1.4.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: scipy>=1.8.0
Requires-Dist: statsmodels>=0.14.0
Requires-Dist: torch>=2.0.0
Dynamic: license-file

# Motion2Health: Livestock Accelerometry & Health Outcome Prediction

[![PyPI version](https://img.shields.io/pypi/v/motion2health.svg)](https://pypi.org/project/motion2health/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)

**Motion2Health** is a SOTA Python package and research framework for livestock health outcome prediction (Gamma-Glutamyl Transferase - GGT) using high-frequency continuous accelerometry data and behavior classification.

---

## 🚀 Key Features

- **Unified Predictor Engine (`GGTPredictor`)**: Easily load pre-trained classical and PyTorch deep learning models to predict livestock health outcomes.
- **12 Benchmarking Workflows**:
  - Classical Tabular Models: `ElasticNet`, `LME`, `RandomForest`, `SVM`
  - Deep Learning Models: `MultiScale-CNN + LSTM`, `MultiScale-CNN + Causal Transformer`
  - Direct Sensor & Behavior-Disentangled Architectures
- **End-to-End Pipeline**: From 1 Hz raw tri-axial accelerometer CSV data to behavior estimation (Grazing, Ruminating, Standing, Lying) and GGT trajectory forecasting.

---

## 📦 Installation

Install directly via `pip`:

```bash
pip install motion2health
```

Or install from source:

```bash
git clone https://github.com/SydneyBioX/motion2health.git
cd motion2health
pip install -e .
```

---

## 💡 Quick Start

```python
from motion2health import GGTPredictor

# Initialize the predictor using the behavior-disentangled Random Forest model
predictor = GGTPredictor(workflow="behaviour_rf")

# Predict GGT outcome on Study Day 14
predicted_ggt = predictor.predict_ggt(
    csv_path="data/sample_animal.csv",
    baseline_ggt=32.0,    # Pre-trial baseline GGT (U/L)
    study_day=14          # Target day (-7 to 24)
)

print(f"Predicted GGT Value: {predicted_ggt:.2f} U/L")
```

---

## 🧪 Deep Learning (PyTorch Transformer) Workflow

```python
# Initialize deep learning Transformer workflow
predictor_dl = GGTPredictor(workflow="behaviour_transformer")

# Predict GGT with Monte Carlo Test-Time Augmentation (TTA)
predicted_ggt_dl = predictor_dl.predict_ggt(
    csv_path="data/sample_animal.csv",
    baseline_ggt=28.5,
    study_day=7
)

print(f"Transformer Predicted GGT: {predicted_ggt_dl:.2f} U/L")
```

---

## 📖 Citation & Repository

Public research code, analysis scripts, and evaluation benchmarks are available in the official repository:
- Repository: [SydneyBioX/motion2health](https://github.com/SydneyBioX/motion2health)

License: [MIT License](LICENSE)
