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
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr |
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 | |
import hashlib | |
def generate_cache_recursive(path, cache): | |
'''Recursivly generate the cache of files in path. SHA256 is used. | |
path - string that is the path os a folder | |
cache - set that is the cache | |
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 Attention(Layer): | |
def __init__(self, step_dim, | |
W_regularizer=None, b_regularizer=None, | |
W_constraint=None, b_constraint=None, | |
bias=True, **kwargs): | |
""" | |
Keras Layer that implements an Attention mechanism for temporal data. | |
Supports Masking. | |
Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756] | |
# Input shape |
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
from sklearn.base import BaseEstimator, ClassifierMixin | |
from sklearn.utils.validation import check_X_y, check_is_fitted | |
from sklearn.linear_model import LogisticRegression | |
from scipy import sparse | |
class NbSvmClassifier(BaseEstimator, ClassifierMixin): | |
def __init__(self, C=1.0, dual=False, n_jobs=1): | |
self.C = C | |
self.dual = dual | |
self.n_jobs = n_jobs |
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 Find_Optimal_Cutoff(target, predicted): | |
""" Find the optimal probability cutoff point for a classification model related to event rate | |
Parameters | |
---------- | |
target : Matrix with dependent or target data, where rows are observations | |
predicted : Matrix with predicted data, where rows are observations | |
Returns | |
------- |
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
%load_ext autoreload | |
%autoreload 2 | |
%matplotlib inline |
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 append_variable_to_url(URL, var_dict): | |
''' | |
Properly format string to append variable to URL | |
:param var_dict: | |
:return: URL variables string | |
''' | |
var_string = "" | |
for key in var_dict: | |
if var_string == "": |
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 | |
""" | |
Retrieve intraday stock data from Google Finance. | |
""" | |
import csv | |
import datetime | |
import re | |
import pandas as pd |