<jupyter_start><jupyter_text>Managing configurations There are three different ways of adding configuration to an experiment. Through Config Scopes, Dictionaries, and Config Files  config scopesConfig scopes is a regular function decorated with @ex.config. All variables from its local scope are then collected, and become configuration entries of the experiment.Note : Functions used as a config scopes cannot contain any return or yield statements!<jupyter_code>@ex.config
def my_config():
    x = 5 #some integer
    conf = {'foo': '10', 'bar':'ten'}
@ex.main
def my_main(x, conf):
    print(f"x = {x}")
    print(f"foo = {conf['foo']}")

ex.run()<jupyter_output>WARNING - my_experiment - No observers have been added to this run
INFO - my_experiment - Running command 'my_main'
INFO - my_experiment - Started
INFO - my_experiment - Completed after 0:00:00<jupyter_text>Dictionariesconfigurations can added as a dictionary using the ex.add_config method<jupyter_code>ex.add_config({
  'foo': 12,
  'bar': 'twelve'
})
@ex.main
def my_main(foo, bar):
    print(f"foo = {foo}")
    print(f"bar = {bar}")
ex.run()<jupyter_output>WARNING - my_experiment - No observers have been added to this run
INFO - my_experiment - Running command 'my_main'
INFO - my_experiment - Started
INFO - my_experiment - Completed after 0:00:00<jupyter_text>Config files<jupyter_code>ex.add_config('conf.json')
#{
#  "foo": 12,
#  "bar": "twelve"
#}
@ex.main
def my_main(foo, bar):
    print(f"foo = {foo}")
    print(f"bar = {bar}")
ex.run()<jupyter_output>WARNING - my_experiment - No observers have been added to this run
INFO - my_experiment - Running command 'my_main'
INFO - my_experiment - Started
INFO - my_experiment - Completed after 0:00:00<jupyter_text>Observe an experiment  Observer connectors* Mongo Observer* The File Storage Observer * TinyDB Observer * SQL Observer * Custom observer  File observer<jupyter_code>ex = Experiment("my_observer_experiment",interactive=True)
ex.add_config('conf.json')
@ex.main
def my_main(foo, bar):
    print(f"foo = {foo}")
    print(f"bar = {bar}")
from sacred.observers import FileStorageObserver
ex.observers.append(FileStorageObserver.create('test_runs'))
ex.run()
!tree test_runs/1
!cat test_runs/1/run.json<jupyter_output>{
  "artifacts": [],
  "command": "my_main",
  "experiment": {
    "base_dir": "/Users/alokumar0/Documents/Projects/personal/PacktCourse/Section-1/video 1.5/code",
    "dependencies": [
      "ipython==7.6.1",
      "numpy==1.16.4",
      "sacred==0.7.5"
    ],
    "mainfile": null,
    "name": "my_observer_experiment",
    "repositories": [],
    "sources": []
  },
  "heartbeat": "2019-12-03T18:02:29.325318",
  "host": {
    "ENV": {},
    "cpu": "Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz",
    "hostname": "WKMIN6388196",
    "os": [
      "Darwin",
      "Darwin-18.7.0-x86_64-i386-64bit"
    ],
    "python_version": "3.7.3"
  },
  "meta": {
    "command": "my_main",
    "options": {
      "--beat_interval": null,
      "--capture": null,
      "--comment": null,
      "--debug": false,
      "--enforce_clean": false,
      "--file_storage": null,
      "--force": false,
      "--help": false,
      "--loglevel": null,
      "--mongo_db": null,
  [...]
{'fraction_non_alphanumeric': 0.14938650306748466, 'fraction_numerical': 0.027300613496932514, 'mean_word_length': 3.678622668579627, 'pattern_counts': {'":': 31, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '389509', 'license': 'MIT', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1134, 'n_words': 277, 'path': 'Chapter 01/Sacred_Omniboard/hello_sacred.ipynb', 'repo_name': 'bpbpublications/Practical-Full-stack-Machine-Learning', 'size': '3260'}