# new env:
conda create --name myenv python=3.7 ipykernel numpy pandas
# remove:
conda remove --name myenv --all
# export:
This file contains hidden or 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 | |
| def pcor(X, rowvar=False): | |
| """ | |
| Partial correlation | |
| Implemented as in pcor::pcor function in R. | |
| Kim, S. (2015) ppcor: An R Package for a Fast Calculation to Semi-partial Correlation Coefficients. | |
| Communications for Statistical Applications and Methods, 22(6), 665-674. |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| def identity_line(ax=None, ls='--', *args, **kwargs): | |
| # see: https://stackoverflow.com/q/22104256/3986320 | |
| ax = ax or plt.gca() | |
| identity, = ax.plot([], [], ls=ls, *args, **kwargs) | |
| def callback(axes): | |
| low_x, high_x = ax.get_xlim() | |
| low_y, high_y = ax.get_ylim() | |
| low = min(low_x, low_y) |
This file contains hidden or 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 | |
| class ECDF: | |
| def __init__(self, arr: np.ndarray, max_points: Optional[int] = None) -> None: | |
| self.arr = np.sort(arr) | |
| n = len(self.arr) | |
| if max_points and n > max_points: | |
| self.arr = self.arr[:: (n // max_points)] |
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 hidden or 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 is a pure python implementation of t-digest algorithm 1. Parts of the code are borrowed | |
| from https://github.com/CamDavidsonPilon/tdigest | |
| Code is released under The MIT License (MIT). | |
| """ | |
| import math | |
| from typing import List, Tuple, Union, Optional |
This file contains hidden or 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 scipy.stats as sp | |
| C = np.array([ | |
| [3, 2, 3], | |
| [2, 4, 2], | |
| [3, 2, 3] | |
| ]) | |
| n = 100_000 |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| git fetch | |
| BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| NEWBRANCH="$BRANCH-pr" | |
| if [[ -n $(git rev-parse --verify $NEWBRANCH) ]]; then | |
| read -p "'$NEWBRANCH' exists, do you want to overwrite it? (y/[n])? " CONTINUE |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.