Ejemplo n.º 1
0
from six.moves.urllib import request

from numpy import genfromtxt
from sklearn.cross_validation import train_test_split
from sklearn import preprocessing
import numpy as np
import dateutil.parser
import pdb
import glob
import cPickle as pickle
import shelve
import six
import episodic_data
from six.moves.urllib import request

data = episodic_data.load_data("data.pkl", episode=10)
data_dict = episodic_data.load_file_data("data_dict.pkl")
supervised_y_data = episodic_data.make_supervised_data(data, data_dict)
x_train, x_test, y_train, y_test = train_test_split(data,
                                                    supervised_y_data,
                                                    test_size=0.10,
                                                    random_state=123)
action_map = {0: "Hold", 1: "Buy", 2: "Sell"}
#calling data_dict is data_dict[episodic_data.list_md5_string_value(list)]


def get_intial_data():
    data_dictionary = {}
    data_dictionary["input"] = len(
        x_train[0][0]) + 1  #here one is portfolio value
    data_dictionary["action"] = 3  #short, buy and hold
Ejemplo n.º 2
0
from six.moves.urllib import request

from numpy import genfromtxt
from sklearn.cross_validation import train_test_split
from sklearn import preprocessing
import numpy as np
import dateutil.parser
import pdb
import glob
import cPickle as pickle
import shelve
import six
import episodic_data
from six.moves.urllib import request

data = episodic_data.load_data("data.pkl",episode=10)
data_dict = episodic_data.load_file_data("data_dict.pkl")
supervised_y_data  = episodic_data.make_supervised_data(data, data_dict)
x_train, x_test, y_train, y_test = train_test_split(data, supervised_y_data, test_size=0.10, random_state=123)
action_map = {0: "Hold", 1: "Buy", 2: "Sell"}
#calling data_dict is data_dict[episodic_data.list_md5_string_value(list)]

def get_intial_data():
    data_dictionary = {}
    data_dictionary["input"] = len(x_train[0][0]) + 1 #here one is portfolio value
    data_dictionary["action"] = 3 #short, buy and hold
    data_dictionary["hidden_layer_1_size"] = 40
    data_dictionary["hidden_layer_2_size"] = 20 #will be using later
    data_dictionary["x_train"] = x_train
    data_dictionary["x_test"] = x_test
    data_dictionary["y_test"] = y_test