--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: >- Niels Rasmussen, kaldet Niels Slagter, alm. Højde, svær bygget, mørkt Haar, iført mørk Stortrøie, Benklæder og Kaskjet, sigtes forTyveri. Anholdes hertil. (St. 3, 688.) - text: Nicolai Gerhard Ahrenzen (Kbhvn.), 49 Aar. - text: Peter Mortensen (Kbhvn.), 31 Aar. Død. P. [2733]. - text: Claus Tollefsen, 40 Aar. - text: >- 2) Et Fruentimmer, ca. 40 Aar gl., middelaf Højde og Bygning med mørkt Haar, iført mørk Kjole graaligt Shavl og over Hovedet et hvidt uldent Tørklæde med en rød Kant, og medførte en brun Hankekurv, sigtes for Bedrageri. (St. 4, 177.) metrics: - accuracy - f1 - precision - recall pipeline_tag: text-classification library_name: setfit inference: true base_model: JohanHeinsen/Old_News_Segmentation_SBERT_V0.1 model-index: - name: SetFit with JohanHeinsen/Old_News_Segmentation_SBERT_V0.1 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.9816666666666667 name: Accuracy - type: f1 value: 0.9385474860335196 name: F1 - type: precision value: 0.9230769230769231 name: Precision - type: recall value: 0.9545454545454546 name: Recall language: - da --- # SetFit with JohanHeinsen/Old_News_Segmentation_SBERT_V0.1 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [JohanHeinsen/Old_News_Segmentation_SBERT_V0.1](https://huggingface.co/JohanHeinsen/Old_News_Segmentation_SBERT_V0.1) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. It is designed to identify texts describing missing people from police gazettes in nineteenth century Denmark. The model has been trained using an efficient few-shot learning technique that involves: 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. 2. Training a classification head with features from the fine-tuned Sentence Transformer. ## Model Details ### Model Description - **Model Type:** SetFit - **Sentence Transformer body:** [JohanHeinsen/Old_News_Segmentation_SBERT_V0.1](https://huggingface.co/JohanHeinsen/Old_News_Segmentation_SBERT_V0.1) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 512 tokens - **Number of Classes:** 2 classes ### Model Sources - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) ### Model Labels | Label | Examples | |:------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | | | 0 | | ## Evaluation ### Metrics | Label | Accuracy | F1 | Precision | Recall | |:--------|:---------|:-------|:----------|:-------| | **all** | 0.9817 | 0.9385 | 0.9231 | 0.9545 | ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 3 | 20.8907 | 245 | | Label | Training Sample Count | |:------|:----------------------| | 0 | 1195 | | 1 | 205 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (3, 3) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 12 - body_learning_rate: (2e-05, 2e-05) - head_learning_rate: 2e-05 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: False - use_amp: False - warmup_proportion: 0.1 - l2_weight: 0.01 - seed: 87 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0005 | 1 | 0.1797 | - | | 0.0238 | 50 | 0.2091 | - | | 0.0476 | 100 | 0.1061 | - | | 0.0714 | 150 | 0.0529 | - | | 0.0952 | 200 | 0.0491 | - | | 0.1190 | 250 | 0.0238 | - | | 0.1429 | 300 | 0.0195 | - | | 0.1667 | 350 | 0.013 | - | | 0.1905 | 400 | 0.0066 | - | | 0.2143 | 450 | 0.005 | - | | 0.2381 | 500 | 0.0038 | - | | 0.2619 | 550 | 0.0038 | - | | 0.2857 | 600 | 0.005 | - | | 0.3095 | 650 | 0.0062 | - | | 0.3333 | 700 | 0.0024 | - | | 0.3571 | 750 | 0.0002 | - | | 0.3810 | 800 | 0.0003 | - | | 0.4048 | 850 | 0.0008 | - | | 0.4286 | 900 | 0.0001 | - | | 0.4524 | 950 | 0.0006 | - | | 0.4762 | 1000 | 0.0022 | - | | 0.5 | 1050 | 0.0003 | - | | 0.5238 | 1100 | 0.0016 | - | | 0.5476 | 1150 | 0.0001 | - | | 0.5714 | 1200 | 0.0 | - | | 0.5952 | 1250 | 0.0 | - | | 0.6190 | 1300 | 0.0 | - | | 0.6429 | 1350 | 0.0 | - | | 0.6667 | 1400 | 0.0 | - | | 0.6905 | 1450 | 0.0 | - | | 0.7143 | 1500 | 0.0 | - | | 0.7381 | 1550 | 0.0024 | - | | 0.7619 | 1600 | 0.0002 | - | | 0.7857 | 1650 | 0.0001 | - | | 0.8095 | 1700 | 0.0 | - | | 0.8333 | 1750 | 0.0 | - | | 0.8571 | 1800 | 0.0 | - | | 0.8810 | 1850 | 0.0 | - | | 0.9048 | 1900 | 0.0 | - | | 0.9286 | 1950 | 0.0 | - | | 0.9524 | 2000 | 0.0 | - | | 0.9762 | 2050 | 0.0 | - | | 1.0 | 2100 | 0.0 | - | | 1.0238 | 2150 | 0.0 | - | | 1.0476 | 2200 | 0.0 | - | | 1.0714 | 2250 | 0.0 | - | | 1.0952 | 2300 | 0.0 | - | | 1.1190 | 2350 | 0.0 | - | | 1.1429 | 2400 | 0.0 | - | | 1.1667 | 2450 | 0.0 | - | | 1.1905 | 2500 | 0.0 | - | | 1.2143 | 2550 | 0.0 | - | | 1.2381 | 2600 | 0.0 | - | | 1.2619 | 2650 | 0.0 | - | | 1.2857 | 2700 | 0.0 | - | | 1.3095 | 2750 | 0.0 | - | | 1.3333 | 2800 | 0.0 | - | | 1.3571 | 2850 | 0.0 | - | | 1.3810 | 2900 | 0.0 | - | | 1.4048 | 2950 | 0.0 | - | | 1.4286 | 3000 | 0.0 | - | | 1.4524 | 3050 | 0.0 | - | | 1.4762 | 3100 | 0.0 | - | | 1.5 | 3150 | 0.0 | - | | 1.5238 | 3200 | 0.0 | - | | 1.5476 | 3250 | 0.0 | - | | 1.5714 | 3300 | 0.0 | - | | 1.5952 | 3350 | 0.0 | - | | 1.6190 | 3400 | 0.0 | - | | 1.6429 | 3450 | 0.0 | - | | 1.6667 | 3500 | 0.0 | - | | 1.6905 | 3550 | 0.0 | - | | 1.7143 | 3600 | 0.0 | - | | 1.7381 | 3650 | 0.0 | - | | 1.7619 | 3700 | 0.0 | - | | 1.7857 | 3750 | 0.0 | - | | 1.8095 | 3800 | 0.0 | - | | 1.8333 | 3850 | 0.0 | - | | 1.8571 | 3900 | 0.0 | - | | 1.8810 | 3950 | 0.0 | - | | 1.9048 | 4000 | 0.0 | - | | 1.9286 | 4050 | 0.0 | - | | 1.9524 | 4100 | 0.0 | - | | 1.9762 | 4150 | 0.0 | - | | 2.0 | 4200 | 0.0 | - | | 2.0238 | 4250 | 0.0 | - | | 2.0476 | 4300 | 0.0 | - | | 2.0714 | 4350 | 0.0 | - | | 2.0952 | 4400 | 0.0 | - | | 2.1190 | 4450 | 0.0 | - | | 2.1429 | 4500 | 0.0 | - | | 2.1667 | 4550 | 0.0 | - | | 2.1905 | 4600 | 0.0 | - | | 2.2143 | 4650 | 0.0 | - | | 2.2381 | 4700 | 0.0 | - | | 2.2619 | 4750 | 0.0 | - | | 2.2857 | 4800 | 0.0 | - | | 2.3095 | 4850 | 0.0 | - | | 2.3333 | 4900 | 0.0 | - | | 2.3571 | 4950 | 0.0 | - | | 2.3810 | 5000 | 0.0 | - | | 2.4048 | 5050 | 0.0 | - | | 2.4286 | 5100 | 0.0 | - | | 2.4524 | 5150 | 0.0 | - | | 2.4762 | 5200 | 0.0 | - | | 2.5 | 5250 | 0.0 | - | | 2.5238 | 5300 | 0.0 | - | | 2.5476 | 5350 | 0.0 | - | | 2.5714 | 5400 | 0.0 | - | | 2.5952 | 5450 | 0.0 | - | | 2.6190 | 5500 | 0.0 | - | | 2.6429 | 5550 | 0.0 | - | | 2.6667 | 5600 | 0.0 | - | | 2.6905 | 5650 | 0.0 | - | | 2.7143 | 5700 | 0.0 | - | | 2.7381 | 5750 | 0.0 | - | | 2.7619 | 5800 | 0.0 | - | | 2.7857 | 5850 | 0.0 | - | | 2.8095 | 5900 | 0.0 | - | | 2.8333 | 5950 | 0.0 | - | | 2.8571 | 6000 | 0.0 | - | | 2.8810 | 6050 | 0.0 | - | | 2.9048 | 6100 | 0.0 | - | | 2.9286 | 6150 | 0.0 | - | | 2.9524 | 6200 | 0.0 | - | | 2.9762 | 6250 | 0.0 | - | | 3.0 | 6300 | 0.0 | - | ### Framework Versions - Python: 3.11.12 - SetFit: 1.1.3 - Sentence Transformers: 4.1.0 - Transformers: 4.51.3 - PyTorch: 2.7.0 - Datasets: 2.19.2 - Tokenizers: 0.21.1