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.pylab as plt | |
f_sample = 22050. | |
signal = np.sin(2. * np.pi * 20. * np.arange(0, 2., 1/f_sample)) | |
plt.plot(signal); | |
def frame(x, n_window, n_hop): | |
n = x.shape[0] | |
n_frames = 1 + int(np.floor((n - n_window) / n_hop)) |
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.pylab as plt | |
f_sample = 22050. | |
signal = np.sin(2. * np.pi * 20. * np.arange(0, 2., 1/f_sample)) | |
plt.plot(signal); | |
def frame(x, n_window, n_hop): | |
n = x.shape[0] | |
n_frames = 1 + int(np.floor((n - n_window) / n_hop)) |
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
# x^y mod p | |
def power(x, y, p): | |
res = 1 | |
x = x % p | |
while (y > 0): | |
if (y & 1): | |
res = (res * x) % p | |
y = y >> 1 | |
x = (x * x) % p | |
return res |
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 | |
from mpl_toolkits.axes_grid1 import make_axes_locatable | |
ax = plt.subplot() | |
divider = make_axes_locatable(ax) | |
cax = divider.append_axes("right", size = "5%", pad = 0.05) | |
im = ax.imshow(x) | |
plt.colorbar(im, cax = cax) |
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 | |
from mpl_toolkits.axes_grid1 import make_axes_locatable | |
fig = plt.figure(1, figsize=(17, 17)) | |
ax = fig.add_subplot(1, 2, 1) | |
divider = make_axes_locatable(ax) | |
cax = divider.append_axes("right", size = "5%", pad = 0.05) | |
im = ax.imshow(x1) |
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 os | |
from pydub import AudioSegment | |
from pydub.utils import mediainfo | |
path_flacs = '/home/russell/Documents/audiobooks/Educated_ A Memoir by Tara Westover-20190704T203807Z-001/Educated_ A Memoir by Tara Westover/FLAC' | |
path_mp3s = 'MP3' | |
path_cover = '/home/russell/Documents/audiobooks/Educated_ A Memoir by Tara Westover-20190704T203807Z-001/Educated_ A Memoir by Tara Westover/Educated_ A Memoir by Tara Westover.jpg' | |
def make_dir(path): | |
if not os.path.exists(path): |
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 | |
# n is batch size; d_in is input dimension; | |
# h is hidden dimension; d_out is output dimension. | |
n, d_in, d_h, d_out = 64, 1000, 100, 10 | |
# Create random input and output data | |
x = np.random.randn(n, d_in) | |
y = np.random.randn(n, d_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
import tensorflow as tf | |
import numpy as np | |
from datasets import mnist as dataset | |
tf.reset_default_graph() | |
class Params: | |
def __init__(self): | |
self.experiment = 'calssification' | |
def model(self): |
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 tensorflow as tf | |
import numpy as np | |
from datasets import mnist as dataset | |
tf.reset_default_graph() | |
class Params: | |
def __init__(self): | |
self.dataset = 'dataset_fn1' | |
def model(self): |
NewerOlder