Exemplo n.º 1
0
    def findData(self):
        text_file = open("NewPredictedData.mat", "r")
        totalCoeff = []
        ranking = []
        count = 0 
        m = [line.rstrip('\n').split(",") for line in text_file]

        for coeff in m:
            total = float(coeff[1]) + float(coeff[2]) + \
                    float(coeff[3]) + 3 * float(coeff[4])
            totalCoeff.append(total)

        amount = map(lambda x: x[0], m)
        twoYearCoeff = map(lambda x: x[1], m)
        threeYearCoeff = map(lambda x: x[2], m)
        fourYearCoeff = map(lambda x: x[3], m)
        firstGenCoeff = map(lambda x: x[4], m)

        text_file.close()

        for i, score in enumerate(firstGenCoeff):
            ranking.append((fd.findRow(str(i)), float(score), amount[i]))

        ranking = sorted(ranking, key=lambda school: school[1])

        for i in reversed(ranking):
            if count <= 100:
                print i
                count = count + 1
Exemplo n.º 2
0
    def rankWinners(self, judgement, decFunc = (lambda x: x)):
        text_file = open("NewDataPredict3.mat", "r")
        computed_mat = [line.rstrip('\n').split(",") for line in text_file]
        text_file.close()

        translated_mat = []
        for index, r in enumerate(computed_mat):
            if index < 76:
                if index % 2 != 0:
                    translated_mat.append((fd.findRow(str(index)),
                        map(decFunc, r)))
            else:
                translated_mat.append((fd.findRow(str(index)),r))

        ranking = sorted(translated_mat, key=lambda s: judgement(s[1]))
        ranking = map(lambda x: (x[0], judgement(x[1])), ranking)
        return ranking[::-1]