8ea593ba135faf00d9ba39f393682172366eee9b,conceptnet5/vectors/retrofit.py,,retrofit,#Any#Any#Any#Any#Any#,53
Before Change
// Subtract the mean so that vectors don"t just clump around common
// hypernyms
orig_vecs -= orig_vecs.mean(0)
// Delete the frame we built, we won"t need its indices again until the end
del retroframe
vecs = orig_vecs
for iteration in range(iterations):
if verbosity >= 1:
print("Retrofitting: Iteration %s of %s" % (iteration+1, iterations))
vecs = sparse_csr.dot(vecs)
vecs -= vecs.mean(0)
// use sklearn"s normalize, because it normalizes in place and
// leaves zero-rows at 0
normalize(vecs, norm="l2", copy=False)
After Change
// Divide up the labels by what language they"re in -- we"ll use this to
// subtract the mean of each language, reducing clumping by language and
// improving multilingual alignment.
rows_by_language = defaultdict(list)
for i, label in enumerate(row_labels):
lang = label.split("/")[2]
rows_by_language [lang].append(i)
all_languages = sorted(rows_by_language)
row_groups = [rows_by_language[lang] for lang in all_languages]
// Subtract the mean so that vectors don"t just clump around common
// hypernyms
for row_group in row_groups:
orig_vecs[row_group] -= orig_vecs[row_group].mean(0)
// Delete the frame we built, we won"t need its indices again until the end
del retroframe
vecs = orig_vecs
for iteration in range(iterations):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 7
Instances Project Name: commonsense/conceptnet5
Commit Name: 8ea593ba135faf00d9ba39f393682172366eee9b
Time: 2017-06-09
Author: rob@luminoso.com
File Name: conceptnet5/vectors/retrofit.py
Class Name:
Method Name: retrofit
Project Name: rlworkgroup/garage
Commit Name: 0c2457ead494e84985aec5fd8d5df4ba399e919c
Time: 2019-04-30
Author: naeioi@hotmail.com
File Name: garage/tf/samplers/off_policy_vectorized_sampler.py
Class Name: OffPolicyVectorizedSampler
Method Name: process_samples
Project Name: rlworkgroup/garage
Commit Name: 563acaf48cf475f4b125fd32374c6bb566049551
Time: 2019-11-06
Author: 43084978+yonghyuc@users.noreply.github.com
File Name: src/garage/torch/algos/vpg.py
Class Name: VPG
Method Name: process_samples
Project Name: dmlc/gluon-cv
Commit Name: b30cdf3a1a977927345f407a4c25be2884cfee7f
Time: 2018-09-06
Author: 8041160+zhanghang1989@users.noreply.github.com
File Name: scripts/segmentation/train.py
Class Name: Trainer
Method Name: validation