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 torch | |
import outlines.models as models | |
from outlines.text.generate.regex import choice | |
from outlines.text.generate.continuation import continuation | |
from outlines.text.generate.sample import greedy | |
def make_greedy_tracker(generator): |
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 typing import Tuple, Union | |
import numpy as np | |
def is_basic_idx(x): | |
return isinstance(x, (slice, type(None))) | |
def expand_indices( |
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 numba as nb | |
import numpy as np | |
from numba.core.datamodel.models import StructModel | |
from numba.core.datamodel.registry import register_default | |
from numba.core.extending import intrinsic, overload, overload_method | |
@nb.njit | |
def add(x, y): | |
return x + y |
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 aesara | |
import aesara.tensor as at | |
import numpy as np | |
from aeppl.joint_logprob import factorized_joint_logprob | |
# aesara.config.compute_test_value = "warn" | |
srng = at.random.RandomStream(seed=2320) | |
N = 100 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 collections import defaultdict | |
import aesara.tensor as aet | |
from aesara import config | |
from aesara.compile import optdb | |
from aesara.graph.basic import ancestors, applys_between, graph_inputs | |
from aesara.graph.fg import FunctionGraph | |
from aesara.graph.opt import ( | |
EquilibriumOptimizer, |
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 time | |
from datetime import date, timedelta | |
import arviz as az | |
import formulaic | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
import scipy |
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 | |
sigma2_true = 2.0 | |
def simulate_regression(N=100, M=1000): | |
X = np.random.normal(size=(N, M)) | |
beta_true = np.random.normal(size=(M,)) | |
y = X.dot(beta_true) + np.random.normal(0, np.sqrt(sigma2_true), size=(N,)) |
NewerOlder