# Path: utility/datafilepath.py
# class DataFilePath:
#     def __init__(self):
#     def getOrderDir_Train(self):  
#     def getOrderDir_Test1(self):  
#     def getTest1Dir(self):
#     def getTest2Dir(self):
#     def getTrainDir(self):
#     def getGapCsv_Train(self):
#     def getGapCsv_Test1(self):
#     def getTestset1Readme(self):
#     def getTestset2Readme(self):
#     def getGapFilename(self):
#     def getGapPredictionFileName(self):
#     def getPrevGapFileName(self):
#     def get_dir_name(self, data_dir):


import pandas as pd
import numpy as np
import math
from datetime import datetime
from datetime import timedelta
from utility.datafilepath import g_singletonDataFilePath
        self.saveResultCsv(df, 'actual_0.csv')
        return
    
    
class Evaluate(GenerateResultCsv):
    def __init__(self):
        GenerateResultCsv.__init__(self)
        return
    def loadResultFiles(self, testSetNum):

        actualFile = 'actual_' + str(testSetNum) + '.csv'
        predictionFile = 'prediction_' + str(testSetNum) + '.csv'
        self.actualDict = self.loadDict(actualFile)
        self.predictonDict = self.loadDict(predictionFile)
        return
    
    def loadDict(self, filename):
        df = pd.read_csv(filename, header=None)
        res = {}
        for _, row in df.iterrows():
            res[(row[0], row[1])] = row[2]
        return res
    def calFinalResult(self, testSetNum):
        self.loadResultFiles(testSetNum)
        res = []
        for key, value in self.actualDict.iteritems():
            actual = value
            if actual == 0:
                print "record {} is 0, not included in final calculation".format(key)
                continue

# Path: utility/datafilepath.py
# class DataFilePath:
#     def __init__(self):
#     def getOrderDir_Train(self):  
#     def getOrderDir_Test1(self):  
#     def getTest1Dir(self):
#     def getTest2Dir(self):
#     def getTrainDir(self):
#     def getGapCsv_Train(self):
#     def getGapCsv_Test1(self):
#     def getTestset1Readme(self):
#     def getTestset2Readme(self):
#     def getGapFilename(self):
#     def getGapPredictionFileName(self):
#     def getPrevGapFileName(self):
#     def get_dir_name(self, data_dir):


# Path: evaluation/evaluate.py
import pandas as pd
import numpy as np
import math
from datetime import datetime
from datetime import timedelta
from utility.datafilepath import g_singletonDataFilePath

        self.saveResultCsv(df, 'actual_0.csv')
        return
    
    
class Evaluate(GenerateResultCsv):
    def __init__(self):
        GenerateResultCsv.__init__(self)
        return
    def loadResultFiles(self, testSetNum):

        actualFile = 'actual_' + str(testSetNum) + '.csv'
        predictionFile = 'prediction_' + str(testSetNum) + '.csv'
        self.actualDict = self.loadDict(actualFile)
        self.predictonDict = self.loadDict(predictionFile)
        return
    
    def loadDict(self, filename):
        df = pd.read_csv(filename, header=None)
        res = {}
        for _, row in df.iterrows():
            res[(row[0], row[1])] = row[2]
        return res
    def calFinalResult(self, testSetNum):
        self.loadResultFiles(testSetNum)
        res = []
        for key, value in self.actualDict.iteritems():
            actual = value
            if actual == 0:
                print "record {} is 0, not included in final calculation".format(key)
                continue

            prediction = self.predictonDict[key]