【发布时间】:2021-10-02 17:45:02
【问题描述】:
我想计算 tensorflow-hub 模型中存在的数据集单词的百分位数(例如 ELMo 或 Universal Sentence Encoder)。对于像GloVe这样的局部模型,我使用一种幼稚的方法:读取局部模型,将其转移到set,然后计算百分位数:
f = open('../glove.6B.100d.txt', encoding="utf8")
#Read all the word into a list
...
intersect_words = set(dataset_words).intersect(glove_words)
percentile = len(intersect_words)/len(dataset_words)*100
对于 Tenorflow-hub 模型,有什么方法可以做到这一点吗?
【问题讨论】:
标签: python tensorflow tensorflow-hub