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
# -*- coding: utf-8 -*- | |
"""Stack tracer for multi-threaded applications. | |
This code is a copy of https://pypi.python.org/pypi/stacktracer/0.1.2 | |
with minor modifications. | |
Usage: |
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import sklearn.utils | |
from scipy.stats import anderson, kstest, normaltest, shapiro | |
from sklearn.cluster import KMeans | |
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 tensorflow as tf | |
import math | |
class WarmupCosineDecayLRScheduler( | |
tf.keras.optimizers.schedules.LearningRateSchedule): | |
def __init__(self, | |
max_lr: float, | |
warmup_steps: int, | |
decay_steps: int, |
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
// Open browser JS console and Copy&Paste the following code | |
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() | |
} | |
setInterval(ConnectButton, 300000); |
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 aitken_interpolation(x, y): | |
if len(x) != len(y): | |
raise ValueError() | |
# Constants | |
x_poly = np.polynomial.Polynomial([0, 1]) | |
# Initialize algorithm | |
n = len(x) | |
p = [np.polynomial.Polynomial([y[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
import numpy as np | |
# `data` is expected to be a numpy array | |
def filter_outliers_iqr(data, iqr_factor=1.5): | |
quartile_1, quartile_3 = np.percentile(data, (25, 75)) | |
iqr = quartile_3 - quartile_1 | |
lw_bound = quartile_1 - (iqr * iqr_factor) | |
up_bound = quartile_3 + (iqr * iqr_factor) | |
return data[data >= lw_bound & data <= up_bound] |