Esempio n. 1
0
    def inner(delete_mongo_observer, config_value):
        ex = SacredExperiment("name")
        ex.observers.append(delete_mongo_observer)
        ex.add_config({"value": config_value})

        def run_fn(value, _run):
            _run.log_scalar("test_metric", 1)
            _run.add_artifact(__file__)
            return value

        ex.main(run_fn)
        run = ex.run()
        return run._id
Esempio n. 2
0
def test_find_latest__for_multiple_with_newly_added_experiments(recent_db_loader, recent_mongo_observer):
    ex = SacredExperiment("most recent")
    ex.observers.append(recent_mongo_observer)
    ex.add_config({"value": 1})

    def run(value, _run):
        return value

    ex.main(run)
    ex.run()

    ex = SacredExperiment("new most recent")
    ex.observers.append(recent_mongo_observer)
    ex.add_config({"value": 2})

    ex.main(run)
    ex.run()

    exps = recent_db_loader.find_latest(2)

    assert exps[0].config.value == 2
    assert exps[1].config.value == 1
Esempio n. 3
0
from sacred import Experiment as SacredExperiment
from sacred.observers import MongoObserver

from dataset.dataset import DataSize
import main

import numbers

from utils.argument_parser import resolve_data_path

ex = SacredExperiment()
ex.observers.append(MongoObserver())


@ex.config
def config():
    emb_model = "boot_ea"  # either "boot_ea", "multi_ke" or "rdgcn"
    size = DataSize.K15.value
    data_name = "D_W"
    fold = 1  # 1...5
    version = 1  # 1 or 2
    classifier = "random forest 500"  # either "random forest 500" or "MLP"
    ptv_name = "SimAndEmb"
    data_path = resolve_data_path(data_name, size, version)


@ex.capture
def run_single(
    emb_model: str,
    data_path: str,
    fold: int,