This model is a fine-tuned version of
answerdotai/ModernBERT-base for binary classification of behavioral coding utterances. It identifies whether utterances should be coded or marked as "not_coded" in behavioral analysis workflows.
This model is designed to automatically filter utterances in behavioral coding tasks, distinguishing between:
The model was evaluated on a held-out test set of 3,713 examples with the following class distribution:
The model shows strong performance on both classes, with particularly high accuracy on the majority class (coded utterances) while maintaining good F1 score (85.84%) on the minority class (not coded utterances).
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5model_name = "lekhansh/bc-not-coded-classifier"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Prepare input
10text = "Your utterance text here"
11inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=3000)
12
13# Get prediction
14with torch.no_grad():
15 outputs = model(**inputs)
16 prediction = torch.argmax(outputs.logits, dim=-1)
17
18# Interpret result
19label = "Not Coded" if prediction.item() == 1 else "Coded"
20print(f"Prediction: {label}")
1def classify_utterances(texts, model, tokenizer):
2 """
3 Classify multiple utterances with confidence scores.
4
5 Returns:
6 List of dicts with predictions and probabilities
7 """
8 inputs = tokenizer(
9 texts,
10 return_tensors="pt",
11 truncation=True,
12 max_length=3000,
13 padding=True
14 )
15
16 with torch.no_grad():
17 outputs = model(**inputs)
18 probs = torch.softmax(outputs.logits, dim=-1)
19 predictions = torch.argmax(outputs.logits, dim=-1)
20
21 results = []
22 for i in range(len(texts)):
23 results.append({
24 'text': texts[i],
25 'label': 'not_coded' if predictions[i].item() == 1 else 'coded',
26 'confidence': probs[i][predictions[i]].item(),
27 'probabilities': {
28 'coded': probs[i][0].item(),
29 'not_coded': probs[i][1].item()
30 }
31 })
32
33 return results
34
35# Example
36utterances = [
37 "I don't know what to say.",
38 "Let me explain the process step by step.",
39 "Mmm-hmm."
40]
41
42results = classify_utterances(utterances, model, tokenizer)
43for r in results:
44 print(f"Text: {r['text']}")
45 print(f" Label: {r['label']} (confidence: {r['confidence']:.2%})")
1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="lekhansh/bc-not-coded-classifier",
6 tokenizer="lekhansh/bc-not-coded-classifier"
7)
8
9result = classifier("Your utterance here", truncation=True, max_length=3000)
10print(result)
11# Output: [{'label': 'coded', 'score': 0.98}]
Training was conducted using mixed precision to optimize resource usage. Exact carbon footprint was not measured.
1@misc{lekhansh2025bcnotcoded,
2 author = {Lekhansh},
3 title = {Behavior Coding Not-Coded Classifier},
4 year = {2025},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/lekhansh/bc-not-coded-classifier}}
7}