Ejemplo n.º 1
0
    def test_with_initial_learning_parameters(self):
        expected = self.get_expected_settings_with_initial_learning_parameters()
        ilp = self.get_initial_learning_parameters_to_test()

        actual = SettingsBuilder().with_initial_learning_parameters(ilp).build()

        self.assertDictEqual(expected, actual)
Ejemplo n.º 2
0
 def start_merchant(self):
     settings = SettingsBuilder() \
         .with_data_file('rand_for_models.pkl') \
         .build()
     ml_merchant = MLMerchant(settings, RandomForestEngine())
     ml_merchant.initialize()
     return ml_merchant
Ejemplo n.º 3
0
 def start_merchant(self):
     settings = SettingsBuilder() \
         .with_data_file('log_reg_models.pkl') \
         .build()
     ml_merchant = MLMerchant(settings, LogisticRegressionEngine())
     ml_merchant.initialize()
     return ml_merchant
Ejemplo n.º 4
0
 def start_merchant(self):
     settings = SettingsBuilder() \
         .with_data_file('mlp_models.pkl') \
         .build()
     ml_merchant = MLMerchant(settings, MlpEngine())
     ml_merchant.initialize()
     return ml_merchant
Ejemplo n.º 5
0
 def __init__(self, api: ApiAbstraction = None):
     settings = SettingsBuilder() \
         .with_merchant_token('7xCvFloHDuwm9iHDVYpjjoVzlXue01I7yU3EGsVTnSGwAXAg6yQqnvpZTkEUlWbk') \
         .build()
     settings["shipping"] = 5
     settings["max_req_per_sec"] = 40.0
     super().__init__(settings, api)
     self.run_logic_loop()
Ejemplo n.º 6
0
    def test_initialize(self):
        expected = self.get_expected_default_settings()

        actual = SettingsBuilder().build()

        self.assertDictEqual(expected, actual)
Ejemplo n.º 7
0
    def test_with_merchant_token(self):
        expected = self.get_expected_settings_with_merchant_token()

        actual = SettingsBuilder().with_merchant_token("any_token").build()

        self.assertDictEqual(expected, actual)
Ejemplo n.º 8
0
    def test_with_data_file(self):
        expected = self.get_expected_settings_with_data_file()

        actual = SettingsBuilder().with_data_file("some_file.txt").build()

        self.assertDictEqual(expected, actual)
Ejemplo n.º 9
0
 def start_cross_validation(self, args):
     initial_learning_parameters = {'train': args.train, 'buy': args.buy, 'merchant_id': args.merchant, 'testing_set': args.test, 'output_file': args.output}
     logging.info('Using given settings for cross validation...')
     settings = SettingsBuilder().with_initial_learning_parameters(initial_learning_parameters).build()
     cross_validator = self.get_cross_validator(settings)
     cross_validator.cross_validation()
Ejemplo n.º 10
0
 def setUp(self):
     self.test_api = TestApi()
     self.ml_testengine = MlTestEngine()
     self.tested = MLMerchant(SettingsBuilder().build(), self.ml_testengine,
                              self.test_api)