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
| from rich.progress import ( | |
| ProgressColumn, | |
| BarColumn, | |
| DownloadColumn, | |
| TextColumn, | |
| TransferSpeedColumn, | |
| TimeRemainingColumn, | |
| Progress, | |
| TaskID, | |
| TimeElapsedColumn, |
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 | |
| from functools import partial | |
| from pykdtree.kdtree import KDTree | |
| class LeftKDTree(KDTree): | |
| """ | |
| KNN that only looks left. |
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 math | |
| import torch | |
| from torch.distributions import Normal | |
| from torch.distributions.utils import broadcast_all, _standard_normal | |
| from torch.distributions.kl import register_kl | |
| class StableNormal(Normal): | |
| """Modified version that uses log_scale for stability of grad.""" | |
| def __init__(self, loc, log_scale): |
For your IAM user you get a csv of credentials like this
User name,Password,Access key ID,Secret access key,Console login link
USERNAME,PASSWORD,ACCESS_KEY,SECRET_KEY,https://0123456.signin.aws.amazon.com/console
If your region is sydney (ap-southeast-2) in keepass you enter:
Title: USERNAME/COMPANY
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
| name: azureml_py36_pytorch | |
| channels: | |
| - pytorch | |
| - conda-forge | |
| - anaconda | |
| - defaults | |
| dependencies: | |
| - _libgcc_mutex=0.1=main | |
| - _py-xgboost-mutex=2.0=cpu_0 | |
| - _pytorch_select=0.2=gpu_0 |
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
| def row2date(row, tz="Australia/Perth"): | |
| """Parse time columns.""" | |
| return pd.Timestamp( | |
| year=int(row.Year), | |
| month=int(row.Month), | |
| day=int(row.Day), | |
| hour=int(row.Hour), | |
| minute=int(row.Minute), | |
| second=int(row.Seconds), |
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
| def smooth_noise(shp, dim=1, smoothing=30): | |
| """ | |
| Generate smoothed random noise that looks like a random walk. | |
| - shp: shape of noise | |
| - dim: dimension to smooth along | |
| - smooth_steps: smoothing steps | |
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
| from torch import nn | |
| import torch | |
| import torch.nn.functional as F | |
| import numpy as np | |
| def radneg2radpos(f): | |
| """convert radians in range [-pi,pi] to [0,2*pi]""" | |
| return np.where(f < 0, f + np.pi * 2, f) |
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 pandas as pd | |
| import numpy as np | |
| import hashlib | |
| import json | |
| def default(o): | |
| """Sets are unordered so are no good for hasing""" | |
| if isinstance(o, set): | |
| try: | |
| o = sorted(o) |