示例#1
0
 def test_default_configuration(self):
     c = SkLearnBallTreeHashIndex.get_default_config()
     self.assertEqual(len(c), 3)
     self.assertIsInstance(c['cache_element'], dict)
     self.assertIsNone(c['cache_element']['type'])
     self.assertEqual(c['leaf_size'], 40)
     self.assertIsNone(c['random_seed'])
示例#2
0
 def test_default_configuration(self):
     c = SkLearnBallTreeHashIndex.get_default_config()
     nose.tools.assert_equal(len(c), 3)
     nose.tools.assert_is_instance(c['cache_element'], dict)
     nose.tools.assert_is_none(c['cache_element']['type'])
     nose.tools.assert_equal(c['leaf_size'], 40)
     nose.tools.assert_is_none(c['random_seed'])
示例#3
0
def default_config():
    return {
        "hash2uuid_kv_store": smqtk.utils.plugin.make_config(
            smqtk.representation.get_key_value_store_impls()
        ),
        "sklearn_balltree": SkLearnBallTreeHashIndex.get_default_config(),
        "itq_bit_length": 256,
    }
示例#4
0
def default_config():
    return {
        "hash2uuid_kv_store":
        make_default_config(smqtk.representation.KeyValueStore.get_impls()),
        "sklearn_balltree":
        SkLearnBallTreeHashIndex.get_default_config(),
        "itq_bit_length":
        256,
    }
示例#5
0
def default_config():
    return {
        "hash2uuid_kv_store":
        smqtk.utils.plugin.make_config(
            smqtk.representation.get_key_value_store_impls()),
        "sklearn_balltree":
        SkLearnBallTreeHashIndex.get_default_config(),
        "itq_bit_length":
        256,
    }
示例#6
0
    def test_init_consistency(self):
        # Test that constructing an instance with a configuration yields the
        # same config via ``get_config``.

        # - Default config should be a valid configuration for this impl.
        c = SkLearnBallTreeHashIndex.get_default_config()
        self.assertEqual(
            SkLearnBallTreeHashIndex.from_config(c).get_config(), c)
        # With non-null cache element
        c['cache_element']['type'] = 'DataMemoryElement'
        self.assertEqual(
            SkLearnBallTreeHashIndex.from_config(c).get_config(), c)