Skip to content

Instantly share code, notes, and snippets.

View ckrapu's full-sized avatar

Christopher Krapu ckrapu

View GitHub Profile
@ckrapu
ckrapu / nv-crawl.json
Last active June 1, 2024 16:01
Documents from nvidia.com
This file has been truncated, but you can view the full file.
{
"https://www.nvidia.com/": "June 2, 7 p.m. Taiwan Time.\nAI\nJoin NVIDIA Founder and CEO Jensen Huang and SAP CEO Christian Klein on June 4 as they discuss the many ways AI can help transform your business.\nLearn how to manage AI inference at scale through real-world case studies and best practices for ensuring data security, compliance, and innovation.\nDon\u2019t miss the opening keynote when NVIDIA Founder and CEO Jensen Huang joins Snowflake CEO Sridhar Ramaswamy to discuss what the future holds in the era of AI.\nImage Courtesy of Foxconn\nImage courtesy of Accuray\nNVIDIA AI models and microservices advance edge computing, route mapping, and app performance.\n*In-person registration is required.\nLatest AI performance gains and features for RTX AI PCs unveiled at Microsoft Build.\nImage courtesy of: JIYUE\nThe Dawn of a New Industrial Revolution\nBring Out the Best in Your Business With Jensen Huang at SAP Sapphire\nWebinar: Deploying Generative AI in Production\nJensen Huang Talks the Future of
@ckrapu
ckrapu / crawl-nv.py
Created June 1, 2024 15:54
Crawl NVIDA website
'''
Script for scraping text documents from NVIDIA's website.
Before running, make sure you've installed the required packages using
`pip install trafilatura bs4 requests`
'''
import requests
from bs4 import BeautifulSoup
import trafilatura
import json
@ckrapu
ckrapu / dz_snowflake.sql
Created May 17, 2023 17:41
Example Snowflake query for DomZip
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
@ckrapu
ckrapu / pymc-concatenate-constant.py
Created February 10, 2023 17:49
pymc-concatenate-constant
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))
@ckrapu
ckrapu / cdl_keys.json
Created January 2, 2023 16:31
2021 Cropland Data Layer legend / key dictionary
{"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
@ckrapu
ckrapu / dims-example.py
Created December 4, 2022 18:19
2nd attempt at fixing hierarchical model example
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
@ckrapu
ckrapu / reconnect-vscode-log.txt
Created October 18, 2022 16:47
Log from Jupyter / VSCode connection issues
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
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], ))
@ckrapu
ckrapu / var1-frobenius.py
Created February 12, 2022 11:18
VAR(1) with Frobenius penalty on weight matrix
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
@ckrapu
ckrapu / vae-skips.py
Created December 21, 2021 19:31
vae-skip-connection
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