Skip to content

Instantly share code, notes, and snippets.

Euclidean Distance vs Cosine Similarity (Time)

import time
import numpy as np

for i in range(10):
	start = time.time() 
	for i in range(10000):
		a, b = np.random.rand(100), np.random.rand(100) 
@alvations
alvations / bulba-parser.rb
Created July 3, 2016 16:04 — forked from meew0/bulba-parser.rb
Ruby script to parse a dump of Bulbapedia's Pokémon pages into obtainability data
# This script parses a dump of Bulbapedia's Pokémon pages into a JSON file
# with details about what Pokémon are obtainable in respective regions
# (specifically, the latest series of games set in a specific region).
require 'nokogiri'
require 'json'
# An XML dump of all of Bulbapedia's Pokémon pages is required to exist at
# this path. It can be generated using this special page:
# http://bulbapedia.bulbagarden.net/wiki/Special:Export
#!/usr/bin/env python -*- coding: utf-8 -*-
"""
An implementation of the *FastNet* from
Armand Joulin, Edouard Grave, Piotr Bojanowski and Tomas Mikolov. 2016.
Bag of Tricks for Efficient Text Classification.
https://arxiv.org/pdf/1607.01759v2.pdf
Largely based on RaRe Technologies' `gensim`
https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/word2vec.py
êê... i do n't ...
êê look at that . look at that .
êê okay , that 's good . that 's good .
êê that woman ! that woman !
êê琌瑍 ︾ ┍ that 's a laundromat .
êê⊿ 闽玒 . th-that 's okay .
- êび - good .
ê  . good .
êび good
êタ good

Our dearest script that everyone uses in the modern #neuralempty revolution in machine translation is multi-bleu.perl

But consider this:

alvas@ubi:~/git/mosesdecoder/scripts/generic$ perl multi-bleu.perl 
Use of uninitialized value $ARGV[0] in string eq at multi-bleu.perl line 11.
usage: multi-bleu.pl [-lc] reference < hypothesis
Reads the references from reference or reference0, reference1, ...
alvas@ubi:~/git/mosesdecoder/scripts/generic$ python3 -c "open('hyp.txt', 'w').write('foo bar\n')"
唐嫣 , 中国 女 演员 。 1983年 12月 6日 出生 于 上海 。 2006年 毕业于 中央 戏剧 学院 表演系 本科班 。
2001年 获得 第三 届 舒蕾 世纪 星 比赛 全 国 总 冠军 。 2004年 被 张艺谋 钦定 为 " 奥运 宝贝 " , 参与 中国 8 分钟 的 闭幕式 表演 。 因 主演 电视剧 《 仙剑奇侠传三 》 和 《 夏 家 三千 金 》 受到 关注 。 2012年 成立 唐嫣 工作室 , 担任 其 主演 微 电影 《 逐 爱 之 旅 》 的 制作人 。
2015年 主演 多部 热播剧 , 担任 第六 届 中国 大学生 电视节 推广 大使 和 2015 国 剧 盛典 代言人 。 2016年 主演 中 韩 合 拍片 《 赏金 猎人 》 票房 突破 两 亿 , 主演 奇幻 喜剧 电影 《 大话西游 3 》 票房 超过 3.6亿 , 同年 成为 第 11 届 中国 金鹰 电视 艺术节 金 鹰 女神 , 主演 古装 女人 权谋 剧 《 锦绣 未央 》
@alvations
alvations / google_twunter_lol
Created February 21, 2017 06:51 — forked from jamiew/google_twunter_lol
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,

So, it comes to point where you can deploy the cool #nlproc / #neuralempty tech you've built and there's this Docker thing that everyone is telling you to do so that installing the libraries/tools you need for you tech is less painful...

Contents

  1. What is Docker?

  2. "Dockerize..."

user@servername:~$ sudo apt-get remove docker docker-engine
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'docker' is not installed, so not removed
Package 'docker-engine' is not installed, so not removed
The following packages were automatically installed and are no longer required:
aufs-tools cgroup-lite linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
Use 'apt-get autoremove' to remove them.
FROM ubuntu:latest
MAINTAINER Momo <mo@mo.com>
LABEL description="TL;DR instructions to install Moses with Docker."
# Update Ubuntu.
RUN apt-get update
RUN apt-get install -y apt-utils debconf-utils
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get -y upgrade