일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Test
- plugin
- 900gle
- Java
- license delete
- 파이썬
- matplotlib
- License
- MySQL
- high level client
- licence delete curl
- aggregation
- 차트
- query
- Elasticsearch
- sort
- zip 암호화
- Kafka
- springboot
- ELASTIC
- docker
- TensorFlow
- Mac
- token filter test
- flask
- aggs
- analyzer test
- Python
- zip 파일 암호화
- API
Archives
- Today
- Total
개발잡부
[tf] 유사성 측정 본문
반응형
import tensorflow as tf
import tensorflow_text as text
hypotheses = tf.ragged.constant([['captain', 'of', 'the', 'delta', 'flight'],
['the', '1990', 'transcript']])
references = tf.ragged.constant([['delta', 'air', 'lines', 'flight'],
['this', 'concludes', 'the', 'transcript']])
result = text.metrics.rouge_l(hypotheses, references)
print('F-Measure: %s' % result.f_measure)
print('P-Measure: %s' % result.p_measure)
print('R-Measure: %s' % result.r_measure)
# Compute ROUGE-L with alpha=0
result = text.metrics.rouge_l(hypotheses, references, alpha=0)
print('F-Measure (alpha=0): %s' % result.f_measure)
print('P-Measure (alpha=0): %s' % result.p_measure)
print('R-Measure (alpha=0): %s' % result.r_measure)
# Compute ROUGE-L with alpha=1
result = text.metrics.rouge_l(hypotheses, references, alpha=1)
print('F-Measure (alpha=1): %s' % result.f_measure)
print('P-Measure (alpha=1): %s' % result.p_measure)
print('R-Measure (alpha=1): %s' % result.r_measure)
반응형
'Python > RNN' 카테고리의 다른 글
[tf] RNN을 사용한 텍스트 분류 (0) | 2022.08.17 |
---|---|
[tf] rnn project (1) | 2022.07.10 |
RNN (0) | 2022.01.09 |
Comments