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
// This file was initially generated by Windows Terminal Preview 1.5.3242.0 | |
// It should still be usable in newer versions, but newer versions might have additional | |
// settings, help text, or changes that you will not see unless you clear this file | |
// and let us generate a new one for you. | |
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", |
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 Iterable | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from numpy import ndarray | |
def generate_random_walk(size: int) -> ndarray: | |
draw = np.random.random(size) |
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 itertools import islice | |
def itersplit(iterable, n): | |
i = len(iterable) % n | |
start = 0; stop = i | |
for _ in range(n): | |
yield list(islice(iterable, start, stop)) | |
start += i; stop += i |
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
image: python:3.7.8-slim | |
default: | |
tags: | |
- common_runner | |
- docker_spot_runner | |
- group_runners | |
variables: | |
USER: "{username}" |
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 sys | |
import requests | |
from bs4 import BeautifulSoup | |
def download_html(url: str, filename: str): | |
r = requests.get(url) | |
r.raise_for_status() | |
html = r.text |
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
""" | |
A pure auto-regressive model from scratch. (WIP) | |
-------------------------------------------------- | |
The current implementation is incorrect. A proper | |
auto-regressive model uses $p$ "lags" of the variable | |
from $x_t$ to $x_{t-p}$ each with its own coefficient. | |
An auto-regressive model of order $p$ is written as: | |
$x_t = \sum_{i=1}^{p} \alpha_i x_{t-i} + \epsilon_t |
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
""" | |
Download a selection or all of the 500+ freely available Springer textbooks. | |
For significantly better IO performance, prefer this asynchronous | |
implementation to the synchronous alternative also provided. | |
Orginally inspired by: | |
https://towardsdatascience.com/download-all-free-textbooks-from-springer-using-python-bd0b10e0ccc | |
""" |
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 plotly.graph_objects as go | |
from scipy.fft import fft, ifft, fftfreq | |
from scipy.signal import find_peaks | |
from plotly.subplots import make_subplots | |
class FourierTransform: | |
def __init__(self, x, time_step: int=1): | |
""" |
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 matplotlib.pyplot as plt | |
import seaborn as sns # optional, just for aesthetics | |
from scipy.stats import gamma | |
# recreate the example shown in Wikipedia for reference | |
# param = (alpha, beta) == (k, 1/theta) | |
params = [ | |
(1, 1/2), | |
(2, 1/2), |
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
# for more info see: | |
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually | |
name: core-env | |
channels: | |
- conda-forge | |
dependencies: | |
- python=3.7 | |
- matplotlib | |
- jupyterlab | |
- xlrd |
NewerOlder