I modified Mike Bostock's Bilevel Partition so that only one level is viewable at a time and added labels.
This visualization also accepts negative values in the data, and displays them in Red color. The positive values are displayed in Green color
Click on any arc to zoom in. Click in the center to zoom out.
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
document.getElementById("editor").addEventListener("keydown", function (event) { | |
// Check if Enter is pressed without the Ctrl key | |
if (event.key === "Enter" && !event.ctrlKey) { | |
event.preventDefault(); | |
} | |
// Check if both Ctrl and Enter are pressed | |
if (event.ctrlKey && event.key === "Enter") { | |
event.preventDefault(); |
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
class ProgressBar: | |
def __init__(self, total, desc='', width=10): | |
self.total = total | |
self.width = width | |
self.header = f"{desc}: " if len(desc) > 0 else '' | |
self.i = 0 | |
self.__print_progress() | |
def __print_progress(self): | |
p = round((self.i*self.width) / self.total) |
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
## | |
# usage: | |
# 1. Add '#export' as the first line of the cells you want to export. | |
# This script will ignore all other cells. | |
# 2. $python convert_nb_script.py -n sample.ipynb > sample_script.py | |
# | |
# You can use other tags to selectively export other cells | |
# eg. Add tag #test to the cells containing unit tests | |
# python convert_nb_script.py -n sample.ipynb -t test > unit_tests.py | |
## |
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 prefix_beam_search(ctc, | |
alphabet, | |
blank_token, | |
end_token, | |
space_token, | |
lm, | |
k=25, | |
alpha=0.30, | |
beta=5, | |
prune=0.001): |
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 create_spectrogram(signals): | |
stfts = tf.signal.stft(signals, fft_length=256) | |
spectrograms = tf.math.pow(tf.abs(stfts), 0.5) | |
return spectrograms |
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
class ASR(tf.keras.Model): | |
def __init__(self, filters, kernel_size, conv_stride, conv_border, n_lstm_units, n_dense_units): | |
super(ASR, self).__init__() | |
self.conv_layer = tf.keras.layers.Conv1D(filters, | |
kernel_size, | |
strides=conv_stride, | |
padding=conv_border, | |
activation='relu') | |
self.lstm_layer = tf.keras.layers.LSTM(n_lstm_units, | |
return_sequences=True, |
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
class Cache: | |
''' | |
class to cache the probability values while performing prefix beam search | |
''' | |
def __init__(self): | |
self.data = {} | |
def add(self, key1, key2, value): | |
if key1 not in self.data: | |
self.data[key1] = {} |