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
oversampler = MulticlassOversampling(sv.TRIM_SMOTE(proportion = 0.1)) | |
warnings.filterwarnings("ignore") | |
Scores1 = [] | |
cmatrices1 = [] | |
cmatrices2 = [] | |
Scores2 = [] | |
for i in range(50): | |
print("Trial {}".format(i)) | |
print("-----------------------------") | |
scores1 = [] |
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 bayes_opt import BayesianOptimization | |
def RF_opt(n_estimators, max_depth): | |
global rskf | |
reg = RandomForestClassifier(verbose = 0, | |
n_estimators = int(n_estimators), | |
#min_samples_split = int(min_samples_split), | |
#min_samples_leaf = int(min_samples_leaf), | |
max_depth = int(max_depth), |
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 catboost import Pool, cv, CatBoostClassifier | |
from bayes_opt import BayesianOptimization | |
from sklearn.model_selection import * | |
from sklearn.metrics import * | |
def CB_opt(n_estimators, depth, learning_rate, max_bin, | |
subsample, num_leaves, l2_leaf_reg, model_size_reg): | |
scores = [] | |
skf = StratifiedKFold(n_splits = 5, shuffle = True, random_state = 1944) |
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
D = reconstruct(s, dim = 22 * 2 + 5, tau = 1) | |
Xs = [] | |
Ys = [] | |
for choice in np.repeat("random",3): | |
X = D[:,:22 * 2] ; Y = D[:,-5:] | |
if choice == 'random': | |
import random | |
y = [] | |
for i in range(len(Y)): |
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
trainstock = yf.Ticker("SPY") | |
start = "2009-01-01" | |
end = "2016-01-01" | |
st = trainstock.history(start = start,end = end) | |
st = st[["Close","Open","Volume","High","Low"]] | |
D = reconstruct(st["Close"].values, dim = 45, tau = 1) | |
win = D[:,:-1] ; s = D[:,-1] | |
std = np.std(win, axis = -1) |
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
import tweepy #https://github.com/tweepy/tweepy | |
import csv | |
#Twitter API credentials | |
consumer_key = "" | |
consumer_secret = "" | |
access_key = "" |
NewerOlder