Skip to content

Instantly share code, notes, and snippets.

View matpalm's full-sized avatar
🎯
Focusing

mat kelcey matpalm

🎯
Focusing
View GitHub Profile

sorted by sum log(P)

$ cat test | ./mm_loglikelihood.py --model oms.mm.json | sort -k1 -nr -t"     "
sum_log(P)      mean_log(P)     B? sequence
-20.0139103713	-1.42956502652	F  A/DT white/JJ blaze/NN and/CC noseband/NN is/VBZ preferred/VBN over/IN a/DT solid-colored/JJ head/NN ./.
-21.8407084327	-3.12010120468	T  Sign/VB In/IN |/CD Sign/NN Up/IN
-30.9669696364	-1.93543560227	F  The/DT average/JJ household/NN size/NN was/VBD 2.69/CD and/CC the/DT average/JJ family/NN size/NN was/VBD 3.09/CD ./.
-36.3208027746	-2.59434305533	T  com/NN is/VBZ a/DT division/NN of/IN ThreadPit/NNP Copyright/NNP ©/CD 2005-2014/CD 6/CD Dollar/NN Shirts/NNS
-38.8882082333	-1.94441041167	F  The/DT airline/NN was/VBD established/VBN in/IN 1991/CD and/CC began/VBD operations/NNS in/IN 1992/CD as/IN Iran/NNP 's/POS first/JJ private/JJ airline/NN ./.
import numpy as np
import time
np.random.seed(123)
# square matrices will do for a demo
m = np.random.randn(1000, 1000).astype('float32')
x = np.random.randn(1000, 1000).astype('float32')
b = np.random.randn(1000, 1000).astype('float32')
start = time.time()
for i in range(500):
y = np.add(np.dot(m, x), b)
mat@mat-desktop:~/dev/GTX970test$ make run
./test_bandwidth1.out
The bandwidth should stay be about the same each time:
Data size: 0.125000 GB; Bandwidth: 101725.257812 GB/s
Data size: 0.375000 GB; Bandwidth: 930059.500000 GB/s
Data size: 0.625000 GB; Bandwidth: 1514050.500000 GB/s
Data size: 0.875000 GB; Bandwidth: 2119670.750000 GB/s
Data size: 1.125000 GB; Bandwidth: 3662109.250000 GB/s
Data size: 1.375000 GB; Bandwidth: 4475911.500000 GB/s
Data size: 1.625000 GB; Bandwidth: 3998523.500000 GB/s
@matpalm
matpalm / gist:a81ee7f848c3f7db2ad8
Created March 31, 2015 02:43
numpy.__config__.show()
>>> numpy.__config__.show()
atlas_threads_info:
libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
language = f77
include_dirs = ['/usr/include/atlas']
blas_opt_info:
libraries = ['ptf77blas', 'ptcblas', 'atlas']
library_dirs = ['/usr/lib/atlas-base']
#!/usr/bin/env python
import theano
import theano.tensor as T
import numpy as np
NUM_TOKENS = 5 # number of tokens in sequence being attended to
D = 3 # generate embedding dim
np.random.seed(123)
# params of dummy RNN to gen data
-module(median).
-export([from_file/1,from_list/1]).
from_file(File) ->
io:format("~w\n",[from_list(parse_file:to_list(File))]),
init:stop().
from_list(List) ->
nth_order_stat(round(length(List)/2), List).
# process files one at time, NUM_CPUS in parallel
@postcodes = `ls resem_per_postcode`.collect{|l| l.chomp}
def fork_for_next_postcode
postcode = @postcodes.shift
fork { run "cat resem_per_postcode/#{postcode} | ./connected_components.rb > result_per_postcode/#{postcode}" }
end
NUM_CPUS.times { fork_for_next_postcode }
while not @postcodes.empty?
Process.wait
fork_for_next_postcode
#!/usr/bin/env ruby
def emit tuple
puts "LongValueSum:#{tuple.join(' ')}\t1"
end
NGRAM_SIZE = 3
STDIN.each do |line|
terms = line.downcase.gsub(/\'/,'').gsub(/[^a-z0-9]/,' ').chomp.strip.split
next if terms.size < NGRAM_SIZE
#!/usr/bin/env ruby
STDIN.each do |line|
terms = line.downcase.gsub(/\'/,'').gsub(/[^a-z0-9]/,' ').chomp.strip.split
terms.each { |term| puts "LongValueSum:#{term}\t1" }
end
rvm install 1.9.1
rvm 1.9.1 --default
gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rack-mount --version=0.4.0
gem install rails --pre
gem install webrat
gem install sqlite3-ruby
gem install rspec-rails --pre
script/rails g rspec:install