コード例 #1
0
ファイル: models.py プロジェクト: paveldedik/thesis
    def update(self, answer):
        """Updates skills of users and difficulties of places according
        to given answer.

        :param answer: Answer to a question.
        :type answer: :class:`pandas.Series` or :class:`Answer`
        """
        user = self.users[answer.user_id]
        place = self.places[answer.place_id]

        prediction = self.predict(answer)
        level = tools.automaticity_level(answer.response_time)

        prob = (prediction * self.zeta + level) / (self.zeta + 1)
        shift = answer.is_correct - prob

        user.inc_skill(self.uncertainty(user.answers_count) * shift)
        place.inc_difficulty(-(self.uncertainty(place.answers_count) * shift))

        self.predictions[answer.id] = prediction
コード例 #2
0
ファイル: models.py プロジェクト: paveldedik/thesis
    def update(self, answer):
        """Performes update of current knowledge of a user based on the
        given answer.

        :param answer: Answer to a question.
        :type answer: :class:`pandas.Series` or :class:`Answer`
        """
        item = self.items[answer.user_id, answer.place_id]

        if not item.practices:
            self.prior.update(answer)

        prediction = self.predict(answer)
        self.predictions[answer.id] = prediction

        item.add_practice(answer)
        level = tools.automaticity_level(answer.response_time) / self.zeta

        if answer.is_correct:
            item.inc_knowledge(self.gamma * (1 - prediction) + level)
        else:
            item.inc_knowledge(self.delta * prediction + level)