Upload TTM Stage of Change classifier for nutrition behavior change
Browse files- README.md +97 -0
- config.json +39 -0
- model.safetensors +3 -0
- special_tokens_map.json +7 -0
- tokenizer_config.json +58 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- nutrition
|
| 6 |
+
- behavior-change
|
| 7 |
+
- tpb
|
| 8 |
+
- ttm
|
| 9 |
+
- distilbert
|
| 10 |
+
- text-classification
|
| 11 |
+
datasets:
|
| 12 |
+
- custom
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
model-index:
|
| 16 |
+
- name: franzzzzzzzzz/ttm-stage-nutrition
|
| 17 |
+
results:
|
| 18 |
+
- task:
|
| 19 |
+
type: text-classification
|
| 20 |
+
metrics:
|
| 21 |
+
- type: accuracy
|
| 22 |
+
value: 84.0
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# franzzzzzzzzz/ttm-stage-nutrition
|
| 26 |
+
|
| 27 |
+
## Model Description
|
| 28 |
+
|
| 29 |
+
Fine-tuned DistilBERT model for classifying stage of change (pre-contemplation, contemplation, preparation, action, maintenance) based on the Transtheoretical Model (TTM) for nutrition behavior change.
|
| 30 |
+
|
| 31 |
+
This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased)
|
| 32 |
+
for behavior change inference in nutrition coaching contexts.
|
| 33 |
+
|
| 34 |
+
## Training Data
|
| 35 |
+
|
| 36 |
+
- **Training samples**: 175
|
| 37 |
+
- **Validation samples**: 25
|
| 38 |
+
- **Test samples**: 50
|
| 39 |
+
- **Total**: 250 samples
|
| 40 |
+
|
| 41 |
+
## Performance
|
| 42 |
+
|
| 43 |
+
- **Test Accuracy**: 84.0%
|
| 44 |
+
|
| 45 |
+
## Intended Use
|
| 46 |
+
|
| 47 |
+
This model is designed for:
|
| 48 |
+
- Nutrition coaching chatbots
|
| 49 |
+
- Behavior change interventions
|
| 50 |
+
- Health psychology research
|
| 51 |
+
- Personalized dietary guidance
|
| 52 |
+
|
| 53 |
+
## How to Use
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 57 |
+
import torch
|
| 58 |
+
|
| 59 |
+
# Load model
|
| 60 |
+
tokenizer = DistilBertTokenizer.from_pretrained("franzzzzzzzzz/ttm-stage-nutrition")
|
| 61 |
+
model = DistilBertForSequenceClassification.from_pretrained("franzzzzzzzzz/ttm-stage-nutrition")
|
| 62 |
+
|
| 63 |
+
# Predict
|
| 64 |
+
text = "I love healthy food, it's amazing!"
|
| 65 |
+
inputs = tokenizer(text, return_tensors='pt', padding=True, truncation=True)
|
| 66 |
+
outputs = model(**inputs)
|
| 67 |
+
prediction = torch.argmax(outputs.logits, dim=1).item()
|
| 68 |
+
|
| 69 |
+
# Convert 0-4 to 1-5 scale
|
| 70 |
+
score = prediction + 1
|
| 71 |
+
print(f"Score: {score}/5")
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
|
| 76 |
+
- Trained on English text only
|
| 77 |
+
- Limited to nutrition/dietary contexts
|
| 78 |
+
- May not generalize to other health behaviors
|
| 79 |
+
- Requires context-appropriate input
|
| 80 |
+
|
| 81 |
+
## Citation
|
| 82 |
+
|
| 83 |
+
If you use this model, please cite:
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
@misc{tpb-ttm-nutrition-models,
|
| 87 |
+
author = {Your Name},
|
| 88 |
+
title = {franzzzzzzzzz/ttm-stage-nutrition},
|
| 89 |
+
year = {2026},
|
| 90 |
+
publisher = {Hugging Face},
|
| 91 |
+
howpublished = {\url{https://huggingface.co/franzzzzzzzzz/ttm-stage-nutrition}}
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## License
|
| 96 |
+
|
| 97 |
+
MIT License
|
config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "distilbert-base-uncased",
|
| 3 |
+
"activation": "gelu",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"DistilBertForSequenceClassification"
|
| 6 |
+
],
|
| 7 |
+
"attention_dropout": 0.1,
|
| 8 |
+
"dim": 768,
|
| 9 |
+
"dropout": 0.1,
|
| 10 |
+
"hidden_dim": 3072,
|
| 11 |
+
"id2label": {
|
| 12 |
+
"0": "LABEL_0",
|
| 13 |
+
"1": "LABEL_1",
|
| 14 |
+
"2": "LABEL_2",
|
| 15 |
+
"3": "LABEL_3",
|
| 16 |
+
"4": "LABEL_4"
|
| 17 |
+
},
|
| 18 |
+
"initializer_range": 0.02,
|
| 19 |
+
"label2id": {
|
| 20 |
+
"LABEL_0": 0,
|
| 21 |
+
"LABEL_1": 1,
|
| 22 |
+
"LABEL_2": 2,
|
| 23 |
+
"LABEL_3": 3,
|
| 24 |
+
"LABEL_4": 4
|
| 25 |
+
},
|
| 26 |
+
"max_position_embeddings": 512,
|
| 27 |
+
"model_type": "distilbert",
|
| 28 |
+
"n_heads": 12,
|
| 29 |
+
"n_layers": 6,
|
| 30 |
+
"pad_token_id": 0,
|
| 31 |
+
"problem_type": "single_label_classification",
|
| 32 |
+
"qa_dropout": 0.1,
|
| 33 |
+
"seq_classif_dropout": 0.2,
|
| 34 |
+
"sinusoidal_pos_embds": false,
|
| 35 |
+
"tie_weights_": true,
|
| 36 |
+
"torch_dtype": "float32",
|
| 37 |
+
"transformers_version": "4.49.0",
|
| 38 |
+
"vocab_size": 30522
|
| 39 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fe2721dcda8fd0b5b3c20b9289bdc6766927469a9fb5f1c193b781d9f778d677
|
| 3 |
+
size 267841796
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cls_token": "[CLS]",
|
| 3 |
+
"mask_token": "[MASK]",
|
| 4 |
+
"pad_token": "[PAD]",
|
| 5 |
+
"sep_token": "[SEP]",
|
| 6 |
+
"unk_token": "[UNK]"
|
| 7 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "[PAD]",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"100": {
|
| 12 |
+
"content": "[UNK]",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"101": {
|
| 20 |
+
"content": "[CLS]",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"102": {
|
| 28 |
+
"content": "[SEP]",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"103": {
|
| 36 |
+
"content": "[MASK]",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"clean_up_tokenization_spaces": true,
|
| 45 |
+
"cls_token": "[CLS]",
|
| 46 |
+
"do_basic_tokenize": true,
|
| 47 |
+
"do_lower_case": true,
|
| 48 |
+
"extra_special_tokens": {},
|
| 49 |
+
"mask_token": "[MASK]",
|
| 50 |
+
"model_max_length": 512,
|
| 51 |
+
"never_split": null,
|
| 52 |
+
"pad_token": "[PAD]",
|
| 53 |
+
"sep_token": "[SEP]",
|
| 54 |
+
"strip_accents": null,
|
| 55 |
+
"tokenize_chinese_chars": true,
|
| 56 |
+
"tokenizer_class": "DistilBertTokenizer",
|
| 57 |
+
"unk_token": "[UNK]"
|
| 58 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c6c813961c87a0d7925711ecd6de5e3a13d32f57822c5f1330da3ccde977ab9
|
| 3 |
+
size 5240
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|