def build_model(self):

        self._user_ids = np.asanyarray(self.dataset.keys())
        self._user_ids.sort()

        self._item_ids = np.array([])
        for items in self.dataset.itervalues():
            self._item_ids = np.append(self._item_ids, items)

        self._item_ids = np.unique(self._item_ids)
        self._item_ids.sort()

        logger.info("creating matrix for %d users and %d items" % \
                    (self._user_ids.size, self._item_ids.size))

        self.index = np.empty(shape=(self._user_ids.size, self._item_ids.size), dtype=bool)
        for userno, user_id in enumerate(self._user_ids):
            if userno % 2 == 0:
                logger.debug("PROGRESS: at user_id #%i/%i" %  \
                    (userno, self._user_ids.size))
            for itemno, item_id in enumerate(self._item_ids):
                r = True if item_id in self.dataset[user_id] else False
                self.index[userno, itemno] = r
Returns
dataset/ETHPy150Open muricoca/crab/scikits/crab/models/classes.py/MatrixBooleanPrefDataModel.build_model