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 | |
if 'CUDA_VISIBLE_DEVICES' in os.environ: | |
print('CUDA_VISIBLE_DEVICES:', os.environ['CUDA_VISIBLE_DEVICES']) | |
if torch.cuda.is_available() is False: | |
print('no gpu available') | |
total_devices = torch.cuda.device_count() | |
print(f'{total_devices} gpus available') |
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
# Install tmux 2.8 on Centos | |
# install deps | |
yum install -y gcc kernel-devel make ncurses-devel | |
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL | |
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz | |
tar -xf libevent-2.1.8-stable.tar.gz | |
cd libevent-2.1.8-stable | |
./configure --prefix=/usr/local |
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 random as rand | |
iters = 1000 | |
actual_threshold = 70 | |
for i in range(iters): | |
score_sampled = rand.randint(0,100) | |
get_prob_command = " echo \" | f1:{} \" | netcat localhost 26542".format(score_sampled) |
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
SELECT x1, | |
x2, | |
y, | |
w_00 — (2.0)*(dw_00+(1e-3)*w_00) AS w_00, | |
w_01 — (2.0)*(dw_01+(1e-3)*w_01) AS w_01, | |
w_10 — (2.0)*(dw_10+(1e-3)*w_10) AS w_10, | |
w_11 — (2.0)*(dw_11+(1e-3)*w_11) AS w_11, | |
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
SELECT *, | |
SUM(x1*dhidden_0) OVER () AS dw_00, | |
SUM(x1*dhidden_1) OVER () AS dw_01, | |
SUM(x2*dhidden_0) OVER () AS dw_10, | |
SUM(x2*dhidden_1) OVER () AS dw_11, | |
SUM(dhidden_0) OVER () AS db_0, | |
SUM(dhidden_1) OVER () AS db_1 | |
FROM {inner subquery} |
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
SELECT *, | |
SUM(d0*dscores_0) OVER () AS dw2_00, | |
SUM(d0*dscores_1) OVER () AS dw2_01, | |
SUM(d1*dscores_0) OVER () AS dw2_10, | |
SUM(d1*dscores_1) OVER () AS dw2_11, | |
SUM(dscores_0) OVER () AS db2_0, | |
SUM(dscores_1) OVER () AS db2_1, | |
CASE |
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
SELECT *, | |
(CASE | |
WHEN y = 0 THEN (probs_0–1)/num_examples | |
ELSE probs_0/num_examples | |
END) AS dscores_0, | |
(CASE | |
WHEN y = 1 THEN (probs_1–1)/num_examples | |
ELSE probs_1/num_examples | |
END) AS dscores_1 | |
FROM {inner subquery} |
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
SELECT *, | |
(sum_correct_logprobs/num_examples) + 1e-3*(0.5*(w_00*w_00 + w_01*w_01 + w_10*w_10 + w_11*w_11) + 0.5*(w2_00*w2_00 + w2_01*w2_01 + w2_10*w2_10 + w2_11*w2_11)) AS loss | |
FROM | |
(SELECT *, | |
SUM(correct_logprobs) OVER () sum_correct_logprobs, | |
COUNT(1) OVER () num_examples | |
FROM | |
(SELECT *, | |
(CASE | |
WHEN y = 0 THEN -1*LOG(probs_0) |
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
SELECT *, | |
EXP(scores_0)/(EXP(scores_0) + EXP(scores_1)) AS probs_0, | |
EXP(scores_1)/(EXP(scores_0) + EXP(scores_1)) AS probs_1 | |
FROM | |
( SELECT *, | |
((d0*w2_00 + d1*w2_10) + b2_0) AS scores_0, | |
((d0*w2_01 + d1*w2_11) + b2_1) AS scores_1 | |
FROM {INNER sub-query}) |
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
SELECT *, | |
(CASE | |
WHEN ((x1*w_00 + x2*w_10) + b_0) > 0.0 THEN ((x1*w_00 + x2*w_10) + b_0) | |
ELSE 0.0 | |
END) AS d0, | |
(CASE | |
WHEN ((x1*w_01 + x2*w_11) + b_0) > 0.0 THEN ((x1*w_01 + x2*w_11) + b_1) | |
ELSE 0.0 | |
END) AS d1 | |
FROM {inner subquery} |
NewerOlder