def config(self, elems):
        config = self.parameter_defaults(
            top_k=100,
            min_time=0,
            seed=0,
            out_file=None,
            filters=[],
            loggers=[],
        )

        model = rs.NearestNeighborModel(
            **self.parameter_defaults(gamma=0.8,
                                      norm="num",
                                      direction="forward",
                                      gamma_threshold=0,
                                      num_of_neighbors=10))
        updater = rs.NearestNeighborModelUpdater(**self.parameter_defaults(
            compute_similarity_period=86400, period_mode="time-based"))
        updater.set_model(model)
        learner = rs.SimpleLearner()
        learner.add_simple_updater(updater)
        learner.set_model(model)

        model = model
        learner = learner
        filters = [model]

        return {'config': config, 'model': model, 'learner': learner}
Пример #2
0
    def _config(self, top_k, seed):
        model = rs.NearestNeighborModel(**self.parameter_defaults(
          gamma=0.8,
          norm="num",
          direction="forward",
          gamma_threshold=0,
          num_of_neighbors=10
        ))
        updater = rs.NearestNeighborModelUpdater(**self.parameter_defaults(
          compute_similarity_period=86400,
          period_mode="time-based"
        ))
        updater.set_model(model)

        return (model, updater, [])
Пример #3
0
    def _fit(self, recommender_data, users, items, matrix):
        model = rs.NearestNeighborModel(
            gamma=1,
            norm="off",
            direction="both",
            gamma_threshold=0,
            num_of_neighbors=self.parameter_default("num_of_neighbors", 10),
        )

        updater = rs.NearestNeighborModelUpdater(
            period_mode="off",
        )
        updater.set_model(model)

        learner = rs.OfflineIteratingOnlineLearnerWrapper(
            seed=254938879,
            number_of_iterations=0,
            shuffle=False,
        )
        learner.add_updater(updater)

        return (model, learner)