This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from theano import function, config, shared, tensor | |
| import numpy | |
| import time | |
| vlen = 10 * 30 * 768 # 10 x #cores x # threads per core | |
| iters = 1000 | |
| rng = numpy.random.RandomState(22) | |
| x = shared(numpy.asarray(rng.rand(vlen), config.floatX)) | |
| f = function([], tensor.exp(x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "loss":{ | |
| "y":"summed_cross_entropy", | |
| "anaphoricities":"summed_cross_entropy" | |
| }, | |
| "theano_mode":null, | |
| "name":"Graph", | |
| "output_config":[ | |
| { | |
| "inputs":[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import pywikibot | |
| import sys | |
| from collections import Counter | |
| from random import randint | |
| wiki = 'wikipedia' | |
| lang = 'vi' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import sys | |
| def zero_safe_normalization(a): | |
| norms = np.sum(a*a, axis=1) | |
| zero_indices = np.nonzero(norms == 0)[0].tolist() | |
| if zero_indices: | |
| sys.stderr.write('Detect %d zero norms: %s\n' %(len(zero_indices), str(zero_indices))) | |
| norms[zero_indices] = 1.0 # don't worry, 0/1 = 0 | |
| a /= norms[:,np.newaxis] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| # from deep-coref project: https://github.com/clarkkev/deep-coref | |
| # download w2v_50d.txt from here: https://drive.google.com/file/d/0B5Y5rz_RUKRmdEFPcGIwZ2xLRW8/view | |
| with open('w2v_50d.txt') as f: | |
| word2id = {} | |
| vectors = [] | |
| words = [] | |
| for line in f: | |
| parts = line.strip().split() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Counter | |
| import numpy as np | |
| from scipy.stats import pearsonr | |
| train = 'output/dep/penntree.jk.sd/train.mrg.dep' | |
| ref = 'output/dep/penntree.jk.sd/valid.mrg.dep' | |
| sys = 'output/dep/sd_parse-published-model_valid.conll' | |
| out_path = 'output/occurrence-performance.npy' | |
| count_path = 'output/occurrence-counts.npy' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy.stats import spearmanr, pearsonr | |
| from matplotlib import pyplot as pl | |
| import sys | |
| if __name__ == '__main__': | |
| repeats = int(sys.argv[1]) if len(sys.argv) >= 2 else 5 # change this and see what happens | |
| dim = 50 | |
| #sizes = {'simlex': 999, 'men': 3000, 'mc': 30, 'rg': 65, 'ws353': 353} | |
| sizes = {'men': (3000, '#0066ff', '#4d94ff'), 'mc': (30, '#ff3300', '#ffd6cc80'), 'rg': (65, '#00ff00', '#ccffcc80')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| from collections import defaultdict | |
| import sys | |
| import ptb | |
| ontonotes_root = '/Users/cumeo/corpora/ontonotes-release-5.0' | |
| ontonotes_en = os.path.join(ontonotes_root, 'data/files/data/english/annotations') | |
| assert os.path.exists(ontonotes_root), 'please link/put ontonotes into data directory' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| import re | |
| s=open('/Users/cumeo/Downloads/dup-docs.txt').read() | |
| pairs = [re.sub(' +', ' ', line).strip().split(' ') for line in s.strip().split('\n')] | |
| clusters = defaultdict(set) | |
| for doc1, doc2 in pairs: | |
| c = clusters[doc1] | |
| c.update(clusters[doc2]) | |
| c.update({doc1, doc2}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tuanminh01 (thảo luận · đóng góp): 439 điểm, Điểm thi tháng 9 năm 2017 | |
| Phương Huy (thảo luận · đóng góp): 324 điểm, Điểm thi tháng 9 năm 2017 | |
| Bluetpp (thảo luận · đóng góp): 287 điểm, Điểm thi tháng 9/2017 | |
| Buileducanh (thảo luận · đóng góp): 265 điểm, Điểm thi tháng 9/2017 | |
| Anhkhang234 (thảo luận · đóng góp): 223 điểm, Điểm thi tháng 9 năm 2017 | |
| Nguyenphanuyennhi (thảo luận · đóng góp): 194 điểm, Điểm thi tháng 9 2017 | |
| Mintu Martin (thảo luận · đóng góp): 128 điểm | |
| Atnastr (thảo luận · đóng góp): 127 điểm, Điểm thi viết bài khoa học tháng 9/2017 | |
| Hoanglongmit (thảo luận · đóng góp): 104 điểm, Điểm thi tháng 9 năm 2017 | |
| A.Einstein05 (thảo luận · đóng góp): 78 điểm, Điểm thi tháng 9 năm 2017 |