Exemplo n.º 1
0
    def computeMaxStdDev(self):
        """computes the maximalStdDevs (the theoretical maximums)

        - maxWeightedUserStdDev
        - maxEqualUserStdDev
        - maxWeightedTeamStdDev
        - maxEqualTeamStdDev
        """
        # User
        for graded in self.GradedUser.values():
            # Weighted
            if graded.weightedResult < (self.lowerBound + self.upperBound) / 2:
                self.maxWeightedUserStdDev += (
                    self.upperBound -
                    graded.weightedResult)**2 * jr.getUserWeight(
                        self._jsonData, graded.id)
            else:
                self.maxWeightedUserStdDev += (
                    self.lowerBound -
                    graded.weightedResult)**2 * jr.getUserWeight(
                        self._jsonData, graded.id)
            # Equal
            if graded.equalResult < (self.lowerBound + self.upperBound) / 2:
                self.maxEqualUserStdDev += (self.upperBound -
                                            graded.equalResult)**2
            else:
                self.maxEqualUserStdDev += (self.lowerBound -
                                            graded.equalResult)**2
        self.maxWeightedUserStdDev /= self.totalGradedWeight
        self.maxWeightedUserStdDev = m.sqrt(self.maxWeightedUserStdDev)
        self.maxEqualUserStdDev /= self.nbGraded
        self.maxEqualUserStdDev = m.sqrt(self.maxEqualUserStdDev)
        # Team
        self.maxWeightedTeamStdDev = self.maxWeightedUserStdDev
        self.maxEqualTeamStdDev = self.maxEqualUserStdDev
    def setGrades(self):
        """ Sets grades attribute with the grades in the json

        should be called only by the constructor
        gets the user grades
        gets the user's team grades
        """
        self.grades = []
        for grader, team_grades in jr.getTeamGrades(self._jsonData,
                                                    self.criteria_id).items():
            if self.id in team_grades.keys():
                self.grades.append((team_grades[self.id],
                                    jr.getUserWeight(self._jsonData, grader)))
                self.totalWeight += jr.getUserWeight(self._jsonData, grader)
                self.numberGrader += 1
Exemplo n.º 3
0
    def setGrades(self):
        """gets the grades self gives in the json

        - build userGrades and teamGrades {graded_id, Gradable}
        - calculate totalGradedWeight, nbGraded
        """
        # user grades
        if self.id in jr.getUserGrades(self._jsonData, self.criteriaID).keys():
            for graded, user_grade in jr.getUserGrades(
                    self._jsonData, self.criteriaID)[self.id].items():
                self.userGrades[graded] = user_grade
                self.totalGradedWeight += jr.getUserWeight(
                    self._jsonData, graded)
                self.nbGraded += 1
        if self.totalGradedWeight == 0:
            self.totalGradedWeight += 1
        # team grades
        if self.team_id is not None and jr.getTeamGrades(
                self._jsonData,
                self.criteriaID) and self.id in jr.getTeamGrades(
                    self._jsonData, self.criteriaID).keys():
            for graded, team_grade in jr.getTeamGrades(
                    self._jsonData, self.criteriaID)[self.id].items():
                self.teamGrades[graded] = team_grade
                self.totalGradedWeight += jr.getTeamWeights(
                    self._jsonData)[graded] / len(
                        jr.getTeams(self._jsonData)[graded])
                self.nbGraded += 1
    def setTeamMembers(self):
        """gets the team member in the json

        teamMember : {grader_id, UserGrader}
        """
        for grader in self.criteria.userGraders.values():
            if grader.team_id == self.id:
                self.teamMember[grader.id] = grader
                self.totalGraderWeight += jr.getUserWeight(
                    self._jsonData, grader.id)
                self.nbTeamMember += 1
    def calculStdDev(self):
        """calculates the both stdDev

        - weightedStdDev
        - equalStdDev
        """
        for grader in self.teamMember.values():
            self.weightedStdDev += grader.weightedStdDev * jr.getUserWeight(
                self._jsonData, grader.id)
            self.equalStdDev += grader.equalStdDev
        self.weightedStdDev /= self.totalGraderWeight
        self.equalStdDev /= self.nbTeamMember
    def setGrades(self):
        """ Sets grades attribute with the grades in the json

        get the user grades
        get the user's team grades
        should be called only by the constructor
        """
        self.grades = []
        # Loop on the user grades
        for grader, user_grades in jr.getUserGrades(self._jsonData, self.criteria_id).items():
            # if the grader has graded this graded (jockerisation)
            if self.id in user_grades.keys():
                self.grades.append((user_grades[self.id], jr.getUserWeight(self._jsonData, grader)))
                self.totalWeight += jr.getUserWeight(self._jsonData, grader)
                self.numberGrader += 1
        # Loop on the team results (if necessary)
        if self.team_id is not None:
            for grader, team_grades in jr.getTeamGrades(self._jsonData, self.criteria_id).items():
                if self.team_id in team_grades.keys() and jr.getTeamId(self._jsonData, grader) != self.team_id:
                    self.grades.append((team_grades[self.team_id], jr.getUserWeight(self._jsonData, grader)))
                    self.totalWeight += jr.getUserWeight(self._jsonData, grader)
                    self.numberGrader += 1
        if self.totalWeight == 0:
            self.totalWeight += 1
Exemplo n.º 7
0
    def computeStdDev(self):
        """computes the standard deviations values

        - averageWeightedUserStdDev
        - averageEqualUserStdDev
        - averageWeightedTeamStdDev
        - averageEqualTeamStdDev
        """
        for grader in self.userGraders.values():
            self.averageWeightedUserStdDev += grader.weightedStdDev * jr.getUserWeight(
                self._jsonData, grader.id)
            self.averageEqualUserStdDev += grader.equalStdDev
        self.averageWeightedUserStdDev /= self.totalUserGradersWeight
        self.averageEqualUserStdDev /= self.nbGraders
        if self.nbGradersTeam:
            for grader in self.teamGraders.values():
                self.averageWeightedTeamStdDev += grader.weightedStdDev * jr.getTeamWeights(
                    self._jsonData)[grader.id]
                self.averageEqualTeamStdDev += grader.equalStdDev
            self.averageWeightedTeamStdDev /= self.totalTeamsGradersWeight
            self.averageEqualTeamStdDev /= self.nbGradersTeam
Exemplo n.º 8
0
 def setGraders(self):
     """Instantiates all the graders (user and team)
     build userGraders and teamGraders {graderID: grader}
     """
     # users
     for graderID in jr.getUserGrades(self._jsonData, self.criteria_id).keys() | \
                     jr.getTeamGrades(self._jsonData, self.criteria_id).keys():
         self.userGraders[graderID] = ug.UserGrader(graderID, self)
         self.totalUserGradersWeight += jr.getUserWeight(
             self._jsonData, graderID)
         self.nbGraders += 1
     # teams (contains a least one grader)
     for grader in self.userGraders.values():
         if (grader.team_id is not None) and (not grader.team_id
                                              in self.teamGraders.keys()):
             self.teamGraders[grader.team_id] = tg.TeamGrader(
                 grader.team_id, self)
             self.totalTeamsGradersWeight += jr.getTeamWeights(
                 self._jsonData)[grader.team_id]
             self.nbGradersTeam += 1
     if self.totalUserGradersWeight == 0:
         self.totalUserGradersWeight = 1
Exemplo n.º 9
0
    def computeInertia(self):
        """Computes the inertia values

        - weightedUserInertia
        - equalUserInertia
        - weightedTeamInertia
        - equalTeamInertia
        """
        # Users
        for grader in self.userGraders.values():
            self.weightedUserInertia += grader.weightedStdDev**2 * jr.getUserWeight(
                self._jsonData, grader.id)
            self.equalUserInertia += grader.equalStdDev**2
        self.weightedUserInertia /= self.totalUserGradersWeight
        self.equalUserInertia /= self.nbGraders
        # Teams
        if self.nbGradersTeam:
            for grader in self.teamGraders.values():
                self.weightedTeamInertia += grader.weightedStdDev**2 * jr.getTeamWeights(
                    self._jsonData)[grader.id]
                self.equalTeamInertia += grader.equalStdDev**2
            self.weightedTeamInertia /= self.totalTeamsGradersWeight
            self.equalTeamInertia /= self.nbGradersTeam