ityndall commited on
Commit
a8002b1
·
verified ·
1 Parent(s): 08bf3a5

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,149 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: en
3
+ license: mit
4
+ tags:
5
+ - text-classification
6
+ - survey-classification
7
+ - james-river
8
+ - bert
9
+ datasets:
10
+ - custom
11
+ metrics:
12
+ - accuracy
13
+ - f1
14
+ model-index:
15
+ - name: james-river-classifier
16
+ results:
17
+ - task:
18
+ type: text-classification
19
+ name: Text Classification
20
+ dataset:
21
+ type: custom
22
+ name: James River Survey Classification
23
+ metrics:
24
+ - type: accuracy
25
+ value: 0.996 # Based on test prediction confidence
26
  ---
27
+
28
+ # James River Survey Classifier
29
+
30
+ This model classifies survey-related text messages into different job types for James River surveying services.
31
+
32
+ ## Model Description
33
+
34
+ - **Model Type**: BERT-based text classification
35
+ - **Base Model**: bert-base-uncased
36
+ - **Language**: English
37
+ - **Task**: Multi-class text classification
38
+ - **Classes**: 6 survey job types
39
+
40
+ ## Classes
41
+
42
+ The model can classify text into the following survey job types:
43
+
44
+ - **Boundary Survey** (ID: 0)
45
+ - **Construction Survey** (ID: 1)
46
+ - **Fence Staking** (ID: 2)
47
+ - **Other/General** (ID: 3)
48
+ - **Real Estate Survey** (ID: 4)
49
+ - **Subdivision Survey** (ID: 5)
50
+
51
+ ## Usage
52
+
53
+ ```python
54
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
55
+ import torch
56
+ import json
57
+
58
+ # Load model and tokenizer
59
+ model_name = "ityndall/james-river-classifier"
60
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
61
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
62
+
63
+ # Load label mapping
64
+ import requests
65
+ label_mapping_url = f"https://huggingface.co/{model_name}/resolve/main/label_mapping.json"
66
+ label_mapping = requests.get(label_mapping_url).json()
67
+
68
+ def classify_text(text):
69
+ # Tokenize input
70
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
71
+
72
+ # Get prediction
73
+ with torch.no_grad():
74
+ outputs = model(**inputs)
75
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
76
+ predicted_class_id = predictions.argmax().item()
77
+ confidence = predictions[0][predicted_class_id].item()
78
+
79
+ # Get label
80
+ predicted_label = label_mapping["id2label"][str(predicted_class_id)]
81
+
82
+ return {
83
+ "label": predicted_label,
84
+ "confidence": confidence,
85
+ "class_id": predicted_class_id
86
+ }
87
+
88
+ # Example usage
89
+ text = "I need a boundary survey for my property"
90
+ result = classify_text(text)
91
+ print(f"Predicted: {result['label']} (confidence: {result['confidence']:.3f})")
92
+ ```
93
+
94
+ ## Training Data
95
+
96
+ The model was trained on 1,000 survey-related text messages with the following distribution:
97
+
98
+ - **Other/General**: 919 samples (91.9%)
99
+ - **Real Estate Survey**: 49 samples (4.9%)
100
+ - **Fence Staking**: 21 samples (2.1%)
101
+ - **Subdivision Survey**: 4 samples (0.4%)
102
+ - **Boundary Survey**: 4 samples (0.4%)
103
+ - **Construction Survey**: 3 samples (0.3%)
104
+
105
+ ## Training Details
106
+
107
+ - **Training Framework**: Hugging Face Transformers
108
+ - **Base Model**: bert-base-uncased
109
+ - **Training Epochs**: 3
110
+ - **Batch Size**: 8
111
+ - **Learning Rate**: 5e-05
112
+ - **Optimizer**: AdamW
113
+ - **Training Loss**: 0.279
114
+ - **Training Time**: ~19.5 minutes
115
+
116
+ ## Model Performance
117
+
118
+ The model achieved a training loss of 0.279 after 3 epochs. However, note that this is a highly imbalanced dataset, and performance on minority classes may vary.
119
+
120
+ ## Limitations
121
+
122
+ - The model was trained on a small, imbalanced dataset
123
+ - Performance on minority classes (Construction Survey, Boundary Survey, Subdivision Survey) may be limited due to few training examples
124
+ - The model may have a bias toward predicting "Other/General" due to class imbalance
125
+
126
+ ## Intended Use
127
+
128
+ This model is specifically designed for classifying survey-related inquiries for James River surveying services. It should not be used for other domains without additional training.
129
+
130
+ ## Files
131
+
132
+ - `config.json`: Model configuration
133
+ - `model.safetensors`: Model weights
134
+ - `tokenizer.json`, `tokenizer_config.json`, `vocab.txt`: Tokenizer files
135
+ - `label_encoder.pkl`: Original scikit-learn label encoder
136
+ - `label_mapping.json`: Human-readable label mappings
137
+
138
+ ## Citation
139
+
140
+ If you use this model, please cite:
141
+
142
+ ```
143
+ @misc{james-river-classifier,
144
+ title={James River Survey Classifier},
145
+ author={James River Surveying},
146
+ year={2025},
147
+ url={https://huggingface.co/ityndall/james-river-classifier}
148
+ }
149
+ ```
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bert-base-uncased",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "id2label": {
13
+ "0": "LABEL_0",
14
+ "1": "LABEL_1",
15
+ "2": "LABEL_2",
16
+ "3": "LABEL_3",
17
+ "4": "LABEL_4",
18
+ "5": "LABEL_5"
19
+ },
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 3072,
22
+ "label2id": {
23
+ "LABEL_0": 0,
24
+ "LABEL_1": 1,
25
+ "LABEL_2": 2,
26
+ "LABEL_3": 3,
27
+ "LABEL_4": 4,
28
+ "LABEL_5": 5
29
+ },
30
+ "layer_norm_eps": 1e-12,
31
+ "max_position_embeddings": 512,
32
+ "model_type": "bert",
33
+ "num_attention_heads": 12,
34
+ "num_hidden_layers": 12,
35
+ "pad_token_id": 0,
36
+ "position_embedding_type": "absolute",
37
+ "problem_type": "single_label_classification",
38
+ "torch_dtype": "float32",
39
+ "transformers_version": "4.48.0",
40
+ "type_vocab_size": 2,
41
+ "use_cache": true,
42
+ "vocab_size": 30522
43
+ }
label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b28108bfccfaecd403981f3936cb9c999f7382f811f91ca7bda0c2db1915f2b
3
+ size 695
label_mapping.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id2label": {
3
+ "0": "Boundary Survey",
4
+ "1": "Construction Survey",
5
+ "2": "Fence Staking",
6
+ "3": "Other/General",
7
+ "4": "Real Estate Survey",
8
+ "5": "Subdivision Survey"
9
+ },
10
+ "label2id": {
11
+ "Boundary Survey": 0,
12
+ "Construction Survey": 1,
13
+ "Fence Staking": 2,
14
+ "Other/General": 3,
15
+ "Real Estate Survey": 4,
16
+ "Subdivision Survey": 5
17
+ }
18
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2430e6f41fdded6546e253c0744b8684c55d5b14294c22f3843db68a157aff13
3
+ size 437970952
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.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "BertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff