def __init__ (self):
     self.data = []
     self.training = (0, 0.6)
     self.validation = (0.6, 0.8)
     self.testing = (0.8, 1)
     self.data_size = 7
     
     self.num_queries = 200
     #with open ('timeseriesOnlineRetailCleaned2.csv', 'r') as f:
     with open ('../data/randomizedOnlineRetail.csv', 'r' ) as f:
         reader = csv.reader(f, delimiter=',')
         title_row = True
         for row in reader:
             if title_row:
                 self.products = row
                 title_row = False
             else:
                 integer_data = [int(row[i]) for i in range (self.num_queries)]
                 self.data.append (integer_data)
     #print (self.data)
     self.predictor1 = QLearn(threshold=0.5, svd=True, regularization=True)
     #self.predictor2 = GRUModel ()
     self.baseline1 = NaiveModel()
     self.baseline2 = EarliestModel()
     self.baseline3 = AverageModel(threshold=0.75, regularization=True)
    def __init__(self):
        self.data = []
        self.training = (0, 0.6)
        self.validation = (0.6, 0.8)
        self.testing = (0.8, 1)
        #self.data_size = 24
        self.data_size = 7

        self.num_queries = 2000
        # q = 1, epochs = 100
        # q = 5, epochs = 20
        # q = 100, epochs = 10
        # q = 2000, epochs = 3

        with open(DATA_DIR, 'r') as f:
            #with open ('hourlyTimeSeriesOnlineRetailCleaned.csv', 'r') as f:
            reader = csv.reader(f, delimiter=',')
            title_row = True
            for row in reader:
                if title_row:
                    self.products = row
                    title_row = False
                else:
                    integer_data = [
                        int(row[i]) for i in range(self.num_queries)
                    ]
                    self.data.append(integer_data)
        #print (self.data)
        self.predictor1 = QLearn(threshold=0.5, regularization=True)
        #self.predictor2 = RNNModel ()
        self.baseline1 = NaiveModel()
        self.baseline2 = EarliestModel()
        self.predictor3 = simple_model((None, self.num_queries + 1), 2)
Ejemplo n.º 3
0
    def __init__(self):
        self.data = []
        self.training = (0, 0.6)
        self.validation = (0.6, 0.8)
        self.testing = (0.8, 0.95)
        #self.data_size = 24
        self.data_size = 7

        self.num_queries = 200
        # q = 1, epochs = 100
        # q = 5, epochs = 20
        # q = 100, epochs = 10
        # q = 2000, epochs = 3
        #print (self.data)
        #self.predictor1 = QLearn(threshold=0.5, regularization=True)
        self.baseline1 = NaiveModel()
        self.baseline2 = EarliestModel()

        saved_models = [(
            10, "LSTM", "sgd", 0.001, 2, 32,
            "../results/10Qs/LSTM/2L/32HS/sgd-0.001lr/20180731-134128-683987/900epochs.h5"
        )]
        model_num = 0

        self.num_queries = saved_models[model_num][0]
        # q = 1, epochs = 100
        # q = 5, epochs = 20
        # q = 100, epochs = 10
        # q = 2000, epochs = 3

        with open(DATA_DIR, 'r') as f:
            #with open ('hourlyTimeSeriesOnlineRetailCleaned.csv', 'r') as f:
            reader = csv.reader(f, delimiter=',')
            title_row = True
            for row in reader:
                if title_row:
                    self.products = row
                    title_row = False
                else:
                    integer_data = [
                        int(row[i]) for i in range(self.num_queries)
                    ]
                    self.data.append(integer_data)

        self.predictor3 = RNNModel(saved_models[model_num][0],
                                   rnn_type=saved_models[model_num][1],
                                   optimizer_type=saved_models[model_num][2],
                                   learning_rate=saved_models[model_num][3],
                                   layers=saved_models[model_num][4],
                                   hidden_size=saved_models[model_num][5])
        self.predictor3.load_model(saved_models[model_num][6])
Ejemplo n.º 4
0
    def __init__(self):
        self.data = []
        self.training = (0, 0.5)
        self.validation = (0.5, 0.8)
        self.testing = (0.8, 0.95)
        #self.data_size = 24
        self.data_size = 96

        self.num_queries = 10
        # q = 1, epochs = 100
        # q = 5, epochs = 20
        # q = 100, epochs = 10
        # q = 2000, epochs = 3

        self.ds = Electricity()
        data = self.ds.get_data()
        transpose = np.transpose(data)
        transpose = transpose[:self.num_queries]
        data = np.transpose(transpose)
        self.training_data = data[int(self.training[0] *
                                      len(data)):int(self.training[1] *
                                                     len(data))]
        self.validation_data = data[int(self.validation[0] *
                                        len(data)):int(self.validation[1] *
                                                       len(data))]
        self.testing_data = data[int(self.training[0] *
                                     len(data)):int(self.training[1] *
                                                    len(data))]
        #for i in range (int(len (transpose) / self.num_queries)):

        #print (self.data)
        self.predictor1 = QLearn(threshold=0.5, regularization=False)
        self.baseline1 = NaiveModel()
        self.baseline2 = EarliestModel()
        self.predictor3 = RNNModel(self.num_queries,
                                   rnn_type="LSTM",
                                   optimizer_type="adam",
                                   learning_rate=0.001,
                                   layers=2,
                                   hidden_size=64,
                                   recurrent_dropout=0.2)
    def __init__(self):
        self.data = []
        self.training = (0, 0.6)
        self.validation = (0.6, 0.8)
        self.testing = (0.8, 0.95)
        #self.data_size = 24
        self.data_size = 7

        self.num_queries = 10
        # q = 1, epochs = 100
        # q = 5, epochs = 20
        # q = 100, epochs = 10
        # q = 2000, epochs = 3

        with open(DATA_DIR, 'r') as f:
            #with open ('hourlyTimeSeriesOnlineRetailCleaned.csv', 'r') as f:
            reader = csv.reader(f, delimiter=',')
            title_row = True
            for row in reader:
                if title_row:
                    self.products = row
                    title_row = False
                else:
                    integer_data = [
                        int(row[i]) for i in range(self.num_queries)
                    ]
                    self.data.append(integer_data)
        #print (self.data)
        self.predictor1 = QLearn(threshold=0.5, regularization=True)
        self.baseline1 = NaiveModel()
        self.baseline2 = EarliestModel()
        self.predictor3 = RNNModel(self.num_queries,
                                   rnn_type="LSTM",
                                   optimizer_type="sgd",
                                   learning_rate=0.001,
                                   layers=1,
                                   hidden_size=128,
                                   recurrent_dropout=0.2)