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 update_dynamic_datasets(outputfolder=None, recompute_out_of_sample_static_y_hat=True): | |
###### COMBINED PREPREOCESSING ########### | |
logger.info('Preprocessing - making out of sample predictions') | |
target_col = 'intraday_pct_change_next' | |
#df = load_newest_dataset_from_fileserver(STATIC_EARNINGS_DATA_NAME) | |
# ds = load_newest_dataset_from_fileserver(MARKET_BAR_DATASET_NAME) | |
#df = get_static_earnings_input_data(df, ds, overwrite_overnight_pct_change=True) | |
#if settings.STATIC_DATASET_SETTINGS['use_shifted_static_data'] and recompute_out_of_sample_static_y_hat: | |
# df_shift = load_newest_dataset_from_fileserver(STATIC_EARNINGS_DATA_SHIFTED_NAME) |
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
# Packages we're using | |
import numpy as np | |
import copy | |
import soundfile as sf | |
def overlap(X, window_size, window_step): | |
""" | |
Create an overlapped version of X | |
Parameters |
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
# Packages we're using | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import copy | |
from scipy.io import wavfile | |
import soundfile as sf | |
from utils.snr import residual_snrdb |
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 torch | |
from torch.autograd import Variable | |
def dynamic_avg_pooling_test(): | |
from functions.dynamic_avg_pooling import dynamic_avg_pooling | |
batch_size = 7 #crashes if below 8 | |
nc = 32 |
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
H=heads, T=Tail | |
HHH = 1 | |
HHT = 2 | |
HTH = 3 | |
HTT = 4 | |
THH = 5 | |
THT = flip again | |
TTH = flip again | |
TTT = flip again |
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 mirror_padding(images, filter_size): | |
""" | |
Mirror padding is used to apply a 2D convolution avoiding the border | |
effects that one normally gets with zero padding. | |
We assume that the filter has an odd size. | |
To obtain a filtered tensor with the same output size, substitute | |
a ``conv2d(images, filters, mode="half")`` with | |
``conv2d(mirror_padding(images, filters.shape), filters, mode="valid")``. |
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 LinearLayer(): | |
def __init__(self, num_inputs, num_units, scale=0.01): | |
self.num_units = num_units | |
self.num_inputs = num_inputs | |
self.W = np.random.random((num_inputs, num_units)) * scale | |
self.b = np.zeros(num_units) | |
def __str__(self): | |
return "LinearLayer(%i, %i)" % (self.num_inputs, self.num_units) |