Ejemplo n.º 1
0
            with tf.name_scope('Evaluation'):
                # MAPE : if it not y+1, will be inf
                self.MAPE = tf.reduce_mean(
                    tf.divide(tf.abs(tf.subtract(self.pred, self.y)),
                              tf.add(self.y, 1.0)))
                # RMSE : if it not y+1, will be inf
                self.RMSE = tf.sqrt(
                    tf.reduce_mean(tf.square(tf.subtract(self.pred, self.y))))

            self.merged = tf.summary.merge_all()


if __name__ == '__main__':
    pdata = pdata()
    training_X, training_Y, testing_X, testing_Y = pdata.get_taxi_data_24()
    training_X_batch = np.shape(np.reshape(
        training_X, (-1, 24, 3600)))[0]  # (B, T, N)  255*24*3600

    g = Graph()
    config = tf.ConfigProto()
    # config.gpu_options.allow_growth = True
    with tf.Session(graph=g.graph, config=config) as sess:
        # tensorboard writer
        writer = tf.summary.FileWriter('logs/', sess.graph)

        tStart = time.time()
        sess.run(tf.global_variables_initializer())
        step = 0

        while step < training_iters: