This file contains 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 shelve | |
def save_scope(session_id='default'): | |
filename = f'/tmp/{session_id}.out' | |
shelf = shelve.open(filename, 'n') | |
for name in dir(): | |
try: | |
shelf[name] = globals()[name] | |
except Exception as e: |
This file contains 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
name: eval_env | |
channels: | |
- defaults | |
dependencies: | |
- _libgcc_mutex=0.1=main | |
- asn1crypto=0.24.0=py36_0 | |
- attrs=19.1.0=py36_1 | |
- backcall=0.1.0=py36_0 | |
- blas=1.0=mkl | |
- bleach=3.1.0=py36_0 |
This file contains 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
-- a bit of subsampling, to make the size more manageable | |
-- I'm using the first N events, ordered by timestamp | |
-- this way, the learning traces should not be interrupted. | |
drop table if exists smaller; | |
create table smaller | |
as | |
select * | |
from log | |
order by timestamp | |
limit 20000000; |
This file contains 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 numpy as np | |
from scipy.stats import multivariate_normal | |
def metropolis_hastings(f, num_samples, burn_in, result_queue=None): | |
# sample normal values as stepsize for the updates | |
# important: g is symmetric, so we don't have to use it in the calculation of alpha below | |
steps = np.random.normal(0, 1, (num_samples, 2)) |
This file contains 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 json | |
import requests | |
data = {"song_id": "sjrt56usng", | |
"author_id": "spdfhu", | |
"song_name": "best song ever", | |
"artist_name": "onehitwonder", | |
"voters": { |
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", |
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ |
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder