Example #1
0
 def __init__(self,
              n_items=30,
              reward_func="likelihood",
              threshold=0.5,
              seed=None,
              n_steps=None,
              *args,
              **kwargs):
     super(GPLEnv, self).__init__(n_items=n_items,
                                  reward_func=reward_func,
                                  threshold=threshold,
                                  seed=seed,
                                  *args,
                                  **kwargs)
     self.learners = GPLLearnerGroup(self.n_items,
                                     n_steps=n_steps,
                                     seed=seed)
     self.test_item_base = self._item_base = MBSItemBase(
         self.n_items,
         attributes={"difficulty", "difficulty_coefficient"},
         seed=seed)
     self.learning_item_base = deepcopy(self._item_base)
     self.learning_item_base.drop_attribute()
     self.test_item_base = self._item_base
     self.action_space = ListSpace(self.learning_item_base.item_id_list,
                                   seed=seed)
Example #2
0
    def __init__(self, seed=None, initial_step=20):
        self.random_state = np.random.RandomState(seed)

        parameters = load_environment_parameters()
        self.knowledge_structure = parameters["knowledge_structure"]
        self._item_base = KSSItemBase(parameters["knowledge_structure"],
                                      parameters["learning_order"],
                                      items=parameters["items"])
        self.learning_item_base = deepcopy(self._item_base)
        self.learning_item_base.drop_attribute()
        self.test_item_base = self._item_base
        self.scorer = KSSScorer(parameters["configuration"].get(
            "binary_scorer", True))

        self.action_space = ListSpace(self.learning_item_base.item_id_list,
                                      seed=seed)

        self.learners = LearnerGroup(self.knowledge_structure, seed=seed)

        self._order_ratio = parameters["configuration"]["order_ratio"]
        self._review_times = parameters["configuration"]["review_times"]
        self._learning_order = parameters["learning_order"]

        self._topo_order = list(nx.topological_sort(self.knowledge_structure))
        self._initial_step = parameters["configuration"][
            "initial_step"] if initial_step is None else initial_step

        self._learner = None
        self._initial_score = None
        self._exam_reduce = "sum" if parameters["configuration"].get(
            "exam_sum", True) else "ave"
Example #3
0
    def __init__(self,
                 name,
                 mode="with_measurement_error",
                 seed=None,
                 parameters: dict = None):
        """

        Parameters
        ----------
        name:
            binary or tree
        parameters: dict
            * test_item_for_each_skill
        mode
        """
        super(TMSEnv, self).__init__()

        directory = ENV_META.get(name, name)
        environment_parameters = load_environment_parameters(directory)
        if parameters is not None:
            environment_parameters.update(parameters)

        self.knowledge_structure = environment_parameters[
            "knowledge_structure"]
        self.learners = LearnerGroup(
            transition_matrix=environment_parameters["transition_matrix"],
            state2vector=environment_parameters["state2vector"],
            initial_states=environment_parameters["initial_states"],
            seed=seed)
        self._skill_num = environment_parameters["configuration"]["skill_num"]
        self._test_item_for_each_skill = environment_parameters[
            "configuration"]["test_item_for_each_skill"]
        self.mode_str = mode
        self.mode = MODE[mode]
        self.learning_item_base = TMSLearningItemBase(
            {"d%s" % i: {
                "knowledge": i
            }
             for i in range(self._skill_num)})
        self.test_item_base = TMSTestItemBase(self._skill_num,
                                              self._test_item_for_each_skill,
                                              seed=seed)
        self.scorer = TMSScorer()
        self._learner = None
        self._begin_state = None

        self.action_space = ListSpace(self.learning_item_base.item_id_list,
                                      seed=seed)
Example #4
0
 def __init__(self,
              n_items=30,
              reward_func="likelihood",
              threshold=0.5,
              seed=None,
              *args,
              **kwargs):
     super(HLREnv, self).__init__(n_items=n_items,
                                  reward_func=reward_func,
                                  threshold=threshold,
                                  seed=seed,
                                  *args,
                                  **kwargs)
     self.learners = HLRLearnerGroup(self.n_items, seed=seed)
     self.test_item_base = self._item_base = MBSItemBase(self.n_items,
                                                         seed=seed)
     self.learning_item_base = deepcopy(self._item_base)
     self.learning_item_base.drop_attribute()
     self.action_space = ListSpace(self.learning_item_base.item_id_list,
                                   seed=seed)