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
open = pd.Series(df['open']) | |
high = pd.Series(df['high']) | |
low = pd.Series(df['low']) | |
close = pd.Series(df['close']) | |
volume = pd.Series(df['volume']) | |
# pct_change for new column | |
X['diff'] = y | |
# Exponential Moving Average |
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
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0 | |
_libgcc_mutex 0.1 main | |
alabaster 0.7.12 py37_0 | |
anaconda 2019.07 py37_0 | |
anaconda-client 1.7.2 py37_0 | |
anaconda-navigator 1.9.7 py37_0 | |
anaconda-project 0.8.3 py_0 | |
asn1crypto 0.24.0 py37_0 | |
astroid 2.2.5 py37_0 | |
astropy 3.2.1 py37h7b6447c_0 |
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
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0 | |
_libgcc_mutex 0.1 main | |
alabaster 0.7.12 py37_0 | |
anaconda 2019.07 py37_0 | |
anaconda-client 1.7.2 py37_0 | |
anaconda-navigator 1.9.7 py37_0 | |
anaconda-project 0.8.3 py_0 | |
asn1crypto 0.24.0 py37_0 | |
astroid 2.2.5 py37_0 | |
astropy 3.2.1 py37h7b6447c_0 |
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
# Univariate Statistics | |
from sklearn.feature_selection import SelectPercentile | |
select = SelectPercentile(percentile=25) | |
select.fit(X_train_full, y_train_full.values.ravel()) | |
X_train_selected = select.transform(X_train_full) | |
X_test_selected = select.transform(X_test_full) | |
mask = select.get_support() | |
print(mask) | |
plt.matshow(mask.reshape(1, -1), cmap='gray_r') | |
plt.xlabel("Technical Indexes") |
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
# Model-based Selection | |
from sklearn.feature_selection import SelectFromModel | |
select = SelectFromModel(RandomForestClassifier(n_estimators=100, random_state=42), | |
threshold="1.25*mean") | |
select.fit(X_train_full, y_train_full.values.ravel()) | |
X_train_model = select.transform(X_train_full) | |
print(X_train_model.shape) | |
X_test_model = select.transform(X_test_full) | |
mask = select.get_support() | |
print(mask) |
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
# Recursive Feature Elimination | |
from sklearn.feature_selection import RFE | |
select = RFE(RandomForestClassifier(n_estimators=100, random_state=42), | |
n_features_to_select=15) | |
select.fit(X_train_full, y_train_full.values.ravel()) | |
X_train_rfe = select.transform(X_train_full) | |
X_test_rfe = select.transform(X_test_full) | |
mask = select.get_support() | |
print(mask) | |
plt.matshow(mask.reshape(1, -1), cmap='gray_r') |
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.datasets import load_iris | |
from sklearn.model_selection import ParameterGrid, StratifiedKFold | |
iris = load_iris() | |
param_grid = [{'kernel': ['rbf'], | |
'C': [0.01, 1], | |
'gamma': [0.1, 1]}, | |
{'kernel': ['linear'], | |
'C': [0.01, 1]}] | |
print("List of parameter grids:\n{}".format(param_grid)) |
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
version: '3' | |
services: | |
elasticsearch: | |
build: elasticsearch | |
container_name: elasticsearch | |
environment: | |
- discovery.type=single-node | |
- bootstrap.memory_lock=true | |
- "ES_JAVA_OPTS=-Xms256m -Xmx256m" | |
ulimits: |
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
{ | |
"btcjpy" : { | |
"aliases" : { }, | |
"mappings" : { | |
"properties" : { | |
"close" : { | |
"type" : "long" | |
}, | |
"timestamp" : { | |
"type" : "date", |
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/python | |
import json | |
import time | |
import python_bitbankcc | |
from datetime import datetime | |
from elasticsearch import Elasticsearch | |
def get_ticker(pub): | |
ret = pub.get_ticker('btc_jpy') | |
return ret |