File size: 1,861 Bytes
1c922fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
tags:
- model_hub_mixin
- pytorch_model_hub_mixin
- address-parsing
- deepparse
license: mit
datasets:
- deepparse/worldwide-addresses
library_name: deepparse
---

# deepparse model2vec-8m-attention

A [deepparse](https://deepparse.org) address parser (Seq2Seq, with attention mechanism) using the
[minishlab/potion-base-8M](https://huggingface.co/minishlab/potion-base-8M) Model2Vec static embeddings (256
dimensions).

```python
from deepparse.parser import AddressParser

address_parser = AddressParser(model_type="model2vec-8m", attention_mechanism=True)
address_parser("350 rue des Lilas Ouest Québec Québec G1L 1B6")
```

Install it with `pip install deepparse[model2vec]`.

## Training

- Data: the [deepparse/worldwide-addresses](https://huggingface.co/datasets/deepparse/worldwide-addresses) dataset
  (20 countries, 100,000 clean and 50,000 incomplete addresses per country), 90% for training and 10% for validation.
  `Suburb` and `District` are mapped to `Municipality`, and the `County` and `Country` words are removed.
- Architecture: encoder and decoder hidden size 256, one layer each, with an attention mechanism.
- Selection: the hidden size (128, 256, 512 or 1024) with the lowest mean validation loss over 5 seeds, then the
  seed with the lowest validation loss (seed 42, best epoch 26).

## Results

| | Accuracy (%) |
|---|---|
| Test, this model | 98.17 |
| Test, mean ± std over the 5 seeds of this configuration | 97.99 ± 0.29 |
| Validation, this model | 98.41 |

The accuracy is the per-word tag accuracy on the test split of the rebuilt worldwide-addresses data.

## Limitations

The source data has no `Orientation` nor `GeneralDelivery` tags: the model has these outputs but never predicts them
(the street orientation, e.g. `Ouest` or `NW`, is part of the `StreetName`). South Korea has almost only incomplete
addresses.