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
INSERT INTO USER_SANDBOX.CHRIS_KRAPU.DOMGEO_DAILY_TEST_FOR_SALE ( | |
RDC_VISITOR_ID | |
, MEMBER_ID | |
, DOMINANT_GEO | |
, MEAN_DIST_KM | |
, DG_VIEWS | |
, SUM_VIEWS_ACROSS_TOP | |
, DG_VIEWS_PCT | |
, TOP_VIEWED_GEOS | |
, SPATIAL_DISPERSION_INDEX |
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 pymc as pm | |
import numpy as np | |
with pm.Model() as model: | |
x = pm.Normal('x', shape=2) | |
x_2d = pm.Normal('x_2d', shape=(3,4)) | |
# Takes variable of shape (2,) and extends it to shape (3,) | |
y = pm.Deterministic('y',pm.math.concatenate([x, [0]], axis=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
{"1": "Corn", "2": "Cotton", "3": "Rice", "4": "Sorghum", "5": "Soybeans", "6": "Sunflower", "10": "Peanuts", "11": "Tobacco", "12": "Sweet Corn", "13": "Pop or Orn Corn", "14": "Mint", "21": "Barley", "22": "Durum Wheat", "23": "Spring Wheat", "24": "Winter Wheat", "25": "Other Small Grains", "26": "Dbl Crop WinWht/Soybeans", "27": "Rye", "28": "Oats", "29": "Millet", "30": "Speltz", "31": "Canola", "32": "Flaxseed", "33": "Safflower", "34": "Rape Seed", "35": "Mustard", "36": "Alfalfa", "37": "Other Hay/Non Alfalfa", "38": "Camelina", "39": "Buckwheat", "41": "Sugarbeets", "42": "Dry Beans", "43": "Potatoes", "44": "Other Crops", "45": "Sugarcane", "46": "Sweet Potatoes", "47": "Misc Vegs & Fruits", "48": "Watermelons", "49": "Onions", "50": "Cucumbers", "51": "Chick Peas", "52": "Lentils", "53": "Peas", "54": "Tomatoes", "55": "Caneberries", "56": "Hops", "57": "Herbs", "58": "Clover/Wildflowers", "59": "Sod/Grass Seed", "60": "Switchgrass", "61": "Fallow/Idle Cropland", "62": "Pasture/Grass", "63": "Fores |
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 pymc as pm | |
import numpy as np | |
import pandas as pd | |
import arviz as az | |
import matplotlib.pyplot as plt | |
import xarray as xr | |
import aesara | |
trainSize,testSize = 1000,400 | |
group_num_all = 7 |
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
log.ts:301 INFO [remote-connection][ExtensionHost][c4c80…][reconnect] received socket timeout event (unacknowledgedMsgCount: 9776, timeSinceOldestUnacknowledgedMsg: 20002, timeSinceLastReceivedSomeData: 20003). | |
11:43:34.029 log.ts:301 INFO [remote-connection][ExtensionHost][c4c80…][reconnect] starting reconnecting loop. You can get more information with the trace log level. | |
11:43:34.029 log.ts:301 INFO [remote-connection][ExtensionHost][c4c80…][reconnect] resolving connection... | |
11:43:34.030 log.ts:301 INFO [remote-connection][ExtensionHost][c4c80…][reconnect] connecting to 127.0.0.1:44341... | |
11:43:34.030 log.ts:289 TRACE [remote-connection][ExtensionHost][c4c80…][reconnect][127.0.0.1:44341] 1/6. invoking socketFactory.connect(). | |
11:43:40.202 log.ts:289 TRACE [remote-connection][ExtensionHost][c4c80…][reconnect][127.0.0.1:44341] 2/6. socketFactory.connect() was successful. | |
11:43:40.203 log.ts:289 TRACE [remote-connection][ExtensionHost][c4c80…][reconnect][127.0.0.1:44341] 3/6. sending AuthRequest control |
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
with pm.Model() as bnn: | |
x_data = pm.Data("x_data", x_input) | |
y_data = pm.Data("y_data", y_input) | |
#weights and bias prior | |
w_1 = pm.Normal("w_1", 0, sigma=1, shape=(layer_in, layer_nodes[0])) | |
b_1 = pm.Normal("b_1", 0, sigma=3, shape=1) | |
#w_2 = pm.Normal("w_2", 0, sigma=1, shape=(layer_nodes[0], layer_nodes[1])) | |
#b_2 = pm.Normal("b_2", 0, sigma=3, shape=1) | |
w_out = pm.Normal("w_out", 0, sigma=1, shape=(layer_nodes[1], )) |
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 | |
import theano.tensor as tt | |
def frobenius_norm(X): | |
return tt.sum(tt.nlinalg.trace(A@A.T))**0.5 | |
# Create simulated data via forward evolution of system | |
K = 3 | |
T = 10 |
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
class Sampling(layers.Layer): | |
"""Uses (z_mean, z_log_var) to sample z, the vector encoding a digit.""" | |
def call(self, inputs): | |
z_mean, z_log_var = inputs | |
batch = tf.shape(z_mean)[0] | |
dim = tf.shape(z_mean)[1] | |
epsilon = tf.keras.backend.random_normal(shape=(batch, dim)) | |
return z_mean + tf.exp(0.5 * z_log_var) * epsilon |
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 os | |
os.environ['THEANO_FLAGS'] = 'device=cuda,floatX=float64' | |
import pymc3 as pm | |
with pm.Model(): | |
x = pm.Normal('x', shape=1000) | |
trace = pm.sample(chains=1, cores=1) |
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 | |
from theano import function, config, shared, tensor as tt | |
import numpy | |
import time | |
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core | |
iters = 1000 | |
rng = numpy.random.RandomState(22) | |
x = shared(numpy.asarray(rng.rand(vlen), config.floatX)) |
NewerOlder