Skip to content

Instantly share code, notes, and snippets.

@hyunjimoon
hyunjimoon / meditech.py
Last active June 12, 2024 23:00
meditech.py
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
from collections import namedtuple
Decision = namedtuple('Decision', ['cable', 'assembly', 'pack'])
EquityRate = namedtuple('EquityRate', ['CEO', 'VC', 'Emp', 'Supp'])
INITIAL_MONEY = 760_000
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Constants
x1, x2, y1, y2 = 1, 3, 2, 4
# Grid of x, y points
x = np.linspace(0, 5, 400)
y = np.linspace(0, 5, 400)
@hyunjimoon
hyunjimoon / gist:ac42e298f3e4d64071c7f132e88062cd
Created September 18, 2023 13:42
gpt experiments for bayes workflow and startup operations
# Two-Page Summary: Analogy between Bayesian Modeling and Startup Growth
## Introduction
The conceptual strategic operation of startups can be likened to Bayesian computation, particularly in the context of Simulation-Based Calibration Checking. This paper aims to draw an analogy between the P, A, D components in Bayesian modeling and startup growth, extending it to P, PD, PA, PAD models in both domains. We also discuss the most likely growth bottleneck sequences for startups, drawing parallels with Bayesian workflows.
## P, A, D Components and Models in Bayesian Workflow and Startup Growth
### 1. P, A, D component in Bayesian modeling
- **P**: Joint probability distribution over variables (e.g., p(y,θ))
- **A**: Posterior approximator (e.g., MCMC, VI)
functions {
vector diagSPD_EQ(real alpha, real rho, real L, int M) {
return sqrt((alpha^2) * sqrt(2*pi()) * rho * exp(-0.5*(rho*pi()/2/L)^2 * linspaced_vector(M, 1, M)^2));
}
vector diagSPD_periodic(real alpha, real rho, int M) {
real a = 1/rho^2;
int one_to_M[M];
for (m in 1:M) one_to_M[m] = m;
@hyunjimoon
hyunjimoon / gist:bacd0048eda62c39e33c911575e24fa1
Created August 3, 2023 19:49
three actors from old free .list version of imdb
Cruise, Tom 'Minority Report': The Players (2002) (V) [Himself]
'Minority Report': The Story, the Debate (2002) (V) [Himself]
'Rain Man' Featurette (1988) (TV) [Himself] <3>
'War of the Worlds': Characters - The Family Unit (2005) (V) [Himself]
'War of the Worlds': Production Diaries, East Coast - Beginning (2005) (V) [Himself]
'War of the Worlds': Production Diaries, East Coast - Exile (2005) (V) [Himself]
'War of the Worlds': Production Diaries, West Coast - Destruction (2005) (V) [Himself]
'War of the Worlds': Production Diaries, West Coast - War (2005) (V) [Himself]
'War of the Worlds': Revisiting the Invasion (2005) (V) [Himself]
100 Years at the Movies (1994) (TV) (archive footage) [Himself]
@hyunjimoon
hyunjimoon / store.py
Last active July 8, 2023 15:30
one nc
import xarray as xr
def gen_param_names():
# spatial subscript
state_names = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware',
'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky',
'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri',
'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York',
'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington',
@hyunjimoon
hyunjimoon / compare.py
Last active November 15, 2022 15:48
compare filesize of csv, pkl, nc
import pandas
import scipy
# 49MB
df = pd.read_csv("oldtitle.csv")
# takes 1s to create pkl, 51MB
df.to_pickle("oldtitle.pkl")
# takes 1.5s to create nc, 610MB
for section in am.sections:
for element in section.elements:
print("*" * 10)
print(f"name: {element.name}")
print(f"length: {len(element.components)}")
for component in element.components:
print(f"type: {component.type}")
print(f"subtype: {component.subtype}")
print(f"subscript: {component.subscripts}")
print(component.ast)