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 torch.utils.data as data | |
class SimpleDataset(data.Dataset): | |
def __init__(self): | |
super().__init__() | |
self.data = np.random.randn(1000, 5) | |
def __getitem__(self, idxs): |
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 sklearn.base import BaseEstimator | |
import torchtuples as tt | |
class DeepSURVSklearnAdapter(BaseEstimator): | |
def __init__( | |
self, | |
learning_rate=1e-4, | |
batch_norm=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 pandas as pd | |
import holoviews as hv | |
from holoviews import opts | |
from bokeh.models import HoverTool | |
from holoviews import streams | |
hv.extension("bokeh") | |
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 fs from "fs" | |
export enum ByteEncoding { | |
Base64, | |
Hex, | |
} | |
export function hexToBuff(data: string): Buffer { | |
return Buffer.from(data, "hex"); | |
} |
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
\documentclass{article} | |
\usepackage{amsmath} | |
\begin{document} | |
Transformation matrix from $|jm>$ to $|m_1 m_2>$ basis | |
This is not the actual matrix; elements are represented as in the | |
CG tables. Do element-wise sqrt but keep the sign for the matrix. |
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 sympy as sp | |
import sympy.physics.quantum as spq | |
from sympy.matrices.dense import matrix_multiply_elementwise as mme | |
import numpy as np | |
import itertools | |
from fractions import Fraction | |
from argparse import ArgumentParser |
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 numpy.random import uniform | |
class MISER: | |
def __init__(self, miser_params): | |
""" | |
Parameters | |
---------- | |
MNBS : int | |
If less than MNBS evaluations are left we do | |
vanilla MC. |
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
def MonteCarloIntegral(f, N, dim, fractional_error_tolerance=0.05): | |
relative_error = 1. | |
function_evaluations = list() | |
while relative_error > fractional_error_tolerance: | |
for _ in range(int(N)): | |
F = f(np.random.rand(dim)) | |
function_evaluations.append(F) | |
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
# Modified example from mlflow-example/train.py | |
import os | |
import warnings | |
import sys | |
from git_autocommit import autocommit | |
import pandas as pd | |
import numpy as np |
NewerOlder