Exemplo n.º 1
0
    def calculatePathDistance(self, pathA, pathB):
        courseNames = abstract.extractAllCourseNames([pathA, pathB])
        semesterA, semesterB = abstract.createExtendedLookUpList(
            pathA, pathB, courseNames)
        distanceA = self.generateDistanceMatrix(semesterA)
        distanceB = self.generateDistanceMatrix(semesterB)
        distanceDiff = np.absolute(np.sign(np.subtract(distanceA, distanceB)))

        n, m = distanceDiff.shape
        size = n - 1
        tri = np.fliplr(distanceDiff)[np.triu_indices(size)]
        distance = sum(tri) / len(tri)

        return distance
 def calculatePathDistance(self, pathA, pathB):
     coursesA = abstract.extractAllCourseNames([pathA])
     coursesB = abstract.extractAllCourseNames([pathB])
     coursesCombined = np.intersect1d(coursesA, coursesB)
     courseNames = abstract.extractAllCourseNames([pathA, pathB])
     semesterA, semesterB = abstract.createExtendedLookUpList(
         pathA, pathB, courseNames)
     distanceA = self.generateDistanceMatrix(semesterA)
     distanceB = self.generateDistanceMatrix(semesterB)
     #distanceA = self.setNonOverlap(distanceA, courseNames, coursesA, 0)
     #distanceB = self.setNonOverlap(distanceB, courseNames, coursesB, 1)
     distanceA = self.setNonOverlap(distanceA, courseNames, coursesA, 0)
     distanceB = self.setNonOverlap(distanceB, courseNames, coursesB, 1)
     distanceDiff = np.absolute(np.sign(np.subtract(distanceA, distanceB)))
     tri = distanceDiff[np.triu_indices_from(distanceDiff, 1)]
     distance = sum(tri) / len(tri)
     return distance
Exemplo n.º 3
0
 def calculatePathDistance(self, pathA, pathB):
     courseNames = abstract.extractAllCourseNames([pathA, pathB])
     semesterA, semesterB = abstract.createExtendedLookUpList(
         pathA, pathB, courseNames)
     distance = energy_distance(semesterA, semesterB)
     return distance