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
# Python Dictionary to translate Countries to Two-Letter codes and vice versa. | |
# | |
# https://gist.github.com/rogerallen/1583606 | |
# | |
# Dedicated to the public domain. To the extent possible under law, | |
# Roger Allen has waived all copyright and related or neighboring | |
# rights to this code. Data originally from Wikipedia at the url: | |
# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 | |
# | |
# Automatically Generated 2024-10-08 07:45:05 via Jupyter Notebook from |
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
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
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
#!/usr/bin/env python | |
""" | |
Example of using Keras to implement a 1D convolutional neural network (CNN) for timeseries prediction. | |
""" | |
from __future__ import print_function, division | |
import numpy as np | |
from keras.layers import Convolution1D, Dense, MaxPooling1D, Flatten | |
from keras.models import Sequential |
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 | |
def find_runs(x): | |
"""Find runs of consecutive items in an array.""" | |
# ensure array | |
x = np.asanyarray(x) | |
if x.ndim != 1: | |
raise ValueError('only 1D array supported') |
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
""" A simple U-Net w/ timm backbone encoder | |
Based off an old version of Unet in https://github.com/qubvel/segmentation_models.pytorch | |
Hacked together by Ross Wightman | |
""" | |
from typing import Optional, List | |
import torch |