Coverage for mlos_bench/mlos_bench/storage/__init__.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-22 01:18 +0000

1# 

2# Copyright (c) Microsoft Corporation. 

3# Licensed under the MIT License. 

4# 

5""" 

6Interfaces to the storage backends for mlos_bench. 

7 

8Storage backends (for instance :py:mod:`~mlos_bench.storage.sql`) are used to store 

9and retrieve the results of experiments and implement a persistent queue for 

10:py:mod:`~mlos_bench.schedulers`. 

11 

12The :py:class:`~mlos_bench.storage.base_storage.Storage` class is the main interface 

13and provides the ability to 

14 

15- Create or reload a new :py:class:`~.Storage.Experiment` with one or more 

16 associated :py:class:`~.Storage.Trial` instances which are used by the 

17 :py:mod:`~mlos_bench.schedulers` during ``mlos_bench`` run time to execute 

18 `Trials`. 

19 

20 In MLOS terms, an *Experiment* is a group of *Trials* that share the same scripts 

21 and target system. 

22 

23 A *Trial* is a single run of the target system with a specific *Configuration* 

24 (e.g., set of tunable parameter values). 

25 (Note: other systems may call this a *sample*) 

26 

27- Retrieve the :py:class:`~mlos_bench.storage.base_trial_data.TrialData` results 

28 with the :py:attr:`~mlos_bench.storage.base_experiment_data.ExperimentData.trials` 

29 property on a :py:class:`~mlos_bench.storage.base_experiment_data.ExperimentData` 

30 instance via the :py:class:`~.Storage` instance's 

31 :py:attr:`~mlos_bench.storage.base_storage.Storage.experiments` property. 

32 

33 These can be especially useful with :py:mod:`mlos_viz` for interactive exploration 

34 in a Jupyter Notebook interface, for instance. 

35 

36The :py:func:`.from_config` :py:mod:`.storage_factory` function can be used to get a 

37:py:class:`.Storage` instance from a 

38:py:attr:`~mlos_bench.config.schemas.config_schemas.ConfigSchema.STORAGE` type json 

39config. 

40 

41Example 

42------- 

43TODO: Add example usage. 

44 

45See Also 

46-------- 

47mlos_bench.storage.base_storage : Base interface for backends. 

48mlos_bench.storage.base_experiment_data : Base interface for ExperimentData. 

49mlos_bench.storage.base_trial_data : Base interface for TrialData. 

50 

51Notes 

52----- 

53- See `sqlite-autotuning notebooks 

54 <https://github.com/Microsoft-CISL/sqlite-autotuning/blob/main/mlos_demo_sqlite_teachers.ipynb>`_ 

55 for additional examples. 

56""" 

57 

58from mlos_bench.storage.base_storage import Storage 

59from mlos_bench.storage.storage_factory import from_config 

60 

61__all__ = [ 

62 "Storage", 

63 "from_config", 

64]