Views
No views yet
1from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
2
3model_name = "matthewleechen/multilabel_patent_classifier"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForTokenClassification.from_pretrained(model_name)
7
8pipe = pipeline(
9 task="text-classification",
10 model=model,
11 device = 0,
12 tokenizer=tokenizer,
13 return_all_scores=True
14)
15BCEWithLogitsLoss with a focal loss function (α=1, γ=2) to address class imbalance. Both during evaluation and at inference, we apply a sigmoid to each logit and use a 0.5 threshold to determine positive labels for each class.| Metric Type | Precision (Micro) | Recall (Micro) | F1 (Micro) | Exact Match | Any Match |
|---|---|---|---|---|---|
| Micro Average | 83.4% | 60.3% | 70.0% | 52.9% | 90.8% |
1@misc{hanlon2016,
2 title = {{British Patent Technology Classification Database: 1855–1882}},
3 author = {Hanlon, Walker},
4 year = {2016},
5 url = {http://www.econ.ucla.edu/whanlon/},
6 note = {Available at: \url{http://www.econ.ucla.edu/whanlon/}}
7}
8
9@misc{lin2018focallossdenseobject,
10 title={Focal Loss for Dense Object Detection},
11 author={Tsung-Yi Lin and Priya Goyal and Ross Girshick and Kaiming He and Piotr Dollár},
12 year={2018},
13 eprint={1708.02002},
14 archivePrefix={arXiv},
15 primaryClass={cs.CV},
16 url={https://arxiv.org/abs/1708.02002},
17}