f1fc699be9ce8b249cf5bd670d2200f990a5294d,conceptnet5/vectors/evaluation/analogy.py,,eval_analogies,#Any#,85
Before Change
standardized_uri("en", word)
for word in wordfreq.top_n_list("en", 100000)
]
tframe = frame.loc[vocab]
total = 0
correct = 0
for quad in quads:
if all(term in tframe.index for term in quad):
prompt = quad[:3]
answer = quad[3]
vector = analogy_func(frame, *prompt)
similar = similar_to_vec(tframe, vector)
result = None
for match in similar.index:
if match not in prompt:
result = match
break
if result == answer:
correct += 1
else:
print(
"%s : %s :: %s : %s (should be %s)"
% (quad[0], quad[1], quad[2], result.upper(), answer)
)
total += 1
return correct, total, correct / total
After Change
standardized_uri("en", word)
for word in wordfreq.top_n_list("en", 200000)
]
wrap = VectorSpaceWrapper(frame=frame)
vecs = np.vstack([wrap.get_vector(word) for word in vocab])
tframe = pd.DataFrame(vecs, index=vocab)
total = 0
correct = 0
seen_mistakes = set()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: commonsense/conceptnet5
Commit Name: f1fc699be9ce8b249cf5bd670d2200f990a5294d
Time: 2016-09-09
Author: rob@luminoso.com
File Name: conceptnet5/vectors/evaluation/analogy.py
Class Name:
Method Name: eval_analogies
Project Name: pandas-dev/pandas
Commit Name: 7e0bf1c8ca62c402f937d7b31472d22d2854aac3
Time: 2020-09-12
Author: jbrockmendel@gmail.com
File Name: pandas/core/dtypes/concat.py
Class Name:
Method Name: union_categoricals
Project Name: pantsbuild/pants
Commit Name: 937907d721b8e4e9628b6d13bb59423e4406a5f1
Time: 2015-04-20
Author: itay@twitter.com
File Name: src/python/pants/backend/python/tasks/pytest_run.py
Class Name: PytestRun
Method Name: run_tests