---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:6000
- loss:CosineSimilarityLoss
base_model: keepitreal/vietnamese-sbert
widget:
- source_sentence: 64 /161 c số92 phường linh trung quận quận tân bình long an
sentences:
- 179 /108 a số53 đường nguyễn văn cừ phường quận thanh xuân hà nội
- 184 /22 c số116 ngõ196 điện biên phủ quận đống đa hải phòng
- 64 /161 c số92 phường linh trung quận quận tân bình long an
- source_sentence: 164 /222 c, số291 kim, mã, quận, long, biên, hải, phòng
sentences:
- 282 /223 b số41 ngõ39 đường kim mã quận hồàn kiếm hải phòng
- 164 /222 c, số291 kim, mã, quận, long, biên, hải, phòng
- 136 /25 c. số43 hem108 đuong. phường. bengõ nghe. quangõ 3 vũng. tàu
- source_sentence: 168 /127 a số53 nguyễn trãi phố quận đống đa nam định
sentences:
- 49 /137 b. số34 ngõ123 ngách296 kim. mã. quậngõ đống. đấp nam. định
- 14 /121 a so8 ngõ116 kim ma quận quan thanh xuân hai phòng
- 41 /281 a số181 ngõ244 kim mã phố quận hai bà trưng tphố thái bình
- source_sentence: 287 /179 a số104 phan văn trị quận long biên bắc ninh
sentences:
- 205 /161 a số117 kim mã quận quận hai bà trưng nam định
- 295 /231 a, số125 ngõ284 nguyễn, trãi, quận, thanh, xuân, hải, phòng
- 232 /206 c, so157 ngo223 ngach63 phồ, giai, phồng, quan, cau, giay, tphố, hung,
yen
- source_sentence: 2 71 /299 c. số212 phố. trầngõ hưng. đạo. quậngõ hồàngõ kiếm. hải.
phòng
sentences:
- 214 /194 a, số20 đường, nguyễn, trãi, quận, cầu, giấy, thái, bình
- 164 /123 c. số213 kim. mã. phố. quậngõ thanhuyện xuângõ bắc. ninh
- 130 /185 a so63 ngo115 ngach279 le loi quan hai ba trung tphố ha noi
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy
- cosine_accuracy_threshold
- cosine_f1
- cosine_f1_threshold
- cosine_precision
- cosine_recall
- cosine_ap
- cosine_mcc
model-index:
- name: SentenceTransformer based on keepitreal/vietnamese-sbert
results:
- task:
type: binary-classification
name: Binary Classification
dataset:
name: address eval
type: address-eval
metrics:
- type: cosine_accuracy
value: 0.998
name: Cosine Accuracy
- type: cosine_accuracy_threshold
value: 0.6475284695625305
name: Cosine Accuracy Threshold
- type: cosine_f1
value: 0.998
name: Cosine F1
- type: cosine_f1_threshold
value: 0.6475284695625305
name: Cosine F1 Threshold
- type: cosine_precision
value: 0.998
name: Cosine Precision
- type: cosine_recall
value: 0.998
name: Cosine Recall
- type: cosine_ap
value: 0.999976118968095
name: Cosine Ap
- type: cosine_mcc
value: 0.996
name: Cosine Mcc
---
# SentenceTransformer based on keepitreal/vietnamese-sbert
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [keepitreal/vietnamese-sbert](https://huggingface.co/keepitreal/vietnamese-sbert). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [keepitreal/vietnamese-sbert](https://huggingface.co/keepitreal/vietnamese-sbert)
- **Maximum Sequence Length:** 256 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("Kao1412/Classification_Address_New")
# Run inference
sentences = [
'2 71 /299 c. số212 phố. trầngõ hưng. đạo. quậngõ hồàngõ kiếm. hải. phòng',
'164 /123 c. số213 kim. mã. phố. quậngõ thanhuyện xuângõ bắc. ninh',
'214 /194 a, số20 đường, nguyễn, trãi, quận, cầu, giấy, thái, bình',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Binary Classification
* Dataset: `address-eval`
* Evaluated with [BinaryClassificationEvaluator](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.BinaryClassificationEvaluator)
| Metric | Value |
|:--------------------------|:--------|
| cosine_accuracy | 0.998 |
| cosine_accuracy_threshold | 0.6475 |
| cosine_f1 | 0.998 |
| cosine_f1_threshold | 0.6475 |
| cosine_precision | 0.998 |
| cosine_recall | 0.998 |
| **cosine_ap** | **1.0** |
| cosine_mcc | 0.996 |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 6,000 training samples
* Columns: sentence_0, sentence_1, and label
* Approximate statistics based on the first 1000 samples:
| | sentence_0 | sentence_1 | label |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
41 /183 b số204 ngõ1 ngách48 xô viết nghệ tĩnh quận quận cầu giấy hà nội | 41 /183 b số204 ngõ1 ngách48 xô viết nghệ tĩnh quận quận cầu giấy hà nội | 1.0 |
| 235 /121 c số119 ngõ74 nguyễn trãi quận hồàn kiếm tphố nam định | 235 /121 c so119 ngo74 nguyễn trai quan hồan kiem tphố nam đinh | 1.0 |
| 26 /74 c số16 ngõ194 ngách106 điện biên phủ quận đống đa hưng yên | 195 /93 b số240 ngõ241 ngách98 phố kim mã quận hai bà trưng thành phố hà nội | 0.0 |
* Loss: [CosineSimilarityLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
```json
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 32
- `num_train_epochs`: 5
- `multi_dataset_batch_sampler`: round_robin
#### All Hyperparameters