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 theano | |
import theano.tensor as tt | |
import numpy as np | |
import pymc3 as pm | |
print(theano.__version__) | |
x = np.asarray([0,1]) | |
print(x.dtype) |
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 pymc3 as pm | |
import numpy as np | |
def sigmoid(x): | |
return np.exp(x) / (1. + np.exp(x)) | |
# Create toy dataset | |
n = 100 | |
n_components = 2 | |
p = 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 numpy as np | |
import pymc3 as pm | |
n = 4 | |
X_2D_train = np.random.randn(n,2) | |
X_2D_star = np.random.randn(n-1, 2) | |
y = np.random.randn(n,1) | |
with pm.Model() as model: |
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 matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
from theano import shared | |
import scipy.stats as stats | |
from scipy.stats import gamma, norm | |
import pymc3 as pm | |
import theano.tensor as tt | |
import arviz as az |
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 matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
from theano import shared | |
import scipy.stats as stats | |
from scipy.stats import gamma, norm | |
import pymc3 as pm | |
import theano.tensor as tt | |
import arviz as az |
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 pymc3 as pm | |
from time import time | |
traces = [] | |
t1 = time() | |
with pm.Model() as model: | |
RVS = [] | |
for i in range(20): | |
RVS.append(pm.Normal('var_{0}'.format(i))) |
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
from pymc3.step_methods.arraystep import BlockedStep | |
from pymc3.distributions.transforms import stick_breaking | |
from pymc3.model import modelcontext | |
import pymc3 as pm | |
import numpy as np | |
def sample_dirichlet(c): | |
gamma = np.random.gamma(c) | |
p = gamma/gamma.sum(axis=-1, keepdims=True) |
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 numpy as np | |
import pymc3 as pm | |
from pymc3.distributions.transforms import StickBreaking | |
genus_counts = np.random.multinomial(10, np.ones(5)/5, 20) | |
with pm.Model() as model: | |
k = 3 | |
n, p = genus_counts.shape | |
profile_gamma = pm.Gamma('profile_gamma', alpha=np.ones((k, p)), beta=np.ones((k, p)), shape=(k,p)) |
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 geopandas as gpd | |
import numpy as np | |
import pandas as pd | |
import requests | |
save_directory = '../data/' | |
osm_api_url_base = 'http://overpass.openstreetmap.ru/cgi/xapi_meta?' | |
regions = { |
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 numpy as np | |
import pymc3 as pm | |
N, T = 20, 10 | |
min_lat, max_lat = 35, 40 | |
min_long, max_long = 30, 35 | |
lat_interval = max_lat - min_lat | |
long_interval = max_long - min_long |
OlderNewer