Esempio n. 1
0
def test_gather_commands(ing):
    ing2 = Ingredient("other", ingredients=[ing])

    @ing.command
    def foo():
        pass

    @ing2.command
    def bar():
        pass

    commands = list(ing2.gather_commands())
    assert ("other.bar", bar) in commands
    assert ("tickle.foo", foo) in commands
Esempio n. 2
0
def test_gather_commands(ing):
    ing2 = Ingredient('other', ingredients=[ing])

    @ing.command
    def foo():
        pass

    @ing2.command
    def bar():
        pass

    commands = list(ing2._gather_commands())
    assert ('other.bar', bar) in commands
    assert ('tickle.foo', foo) in commands
Esempio n. 3
0
def test_gather_commands(ing):
    ing2 = Ingredient('other', ingredients=[ing])

    @ing.command
    def foo():
        pass

    @ing2.command
    def bar():
        pass

    commands = list(ing2.gather_commands())
    assert ('other.bar', bar) in commands
    assert ('tickle.foo', foo) in commands
Esempio n. 4
0
def test_gather_named_configs(ing):
    ing2 = Ingredient('ing2', ingredients=[ing])

    @ing.named_config
    def named_config1():
        pass

    @ing2.named_config
    def named_config2():
        """named config with doc"""
        pass

    named_configs = list(ing2.gather_named_configs())
    assert ('ing2.named_config2', named_config2) in named_configs
    assert ('tickle.named_config1', named_config1) in named_configs
Esempio n. 5
0
def test_gather_named_configs(ing):
    ing2 = Ingredient('ing2', ingredients=[ing])

    @ing.named_config
    def named_config1():
        pass

    @ing2.named_config
    def named_config2():
        """named config with doc"""
        pass

    named_configs = list(ing2.gather_named_configs())
    assert ('ing2.named_config2', named_config2) in named_configs
    assert ('tickle.named_config1', named_config1) in named_configs
Esempio n. 6
0
def test_get_experiment_info_circular_dependency_raises(ing):
    ing2 = Ingredient('other', ingredients=[ing])
    ing.ingredients = [ing2]
    with pytest.raises(CircularDependencyError):
        ing.get_experiment_info()
Esempio n. 7
0
def ing():
    return Ingredient('tickle')
Esempio n. 8
0
# Author: Arthur Mensch
# License: BSD
import time

import matplotlib.pyplot as plt
from modl.feature_extraction.image import LazyCleanPatchExtractor
from modl.image import ImageDictFact
from sacred import Experiment
from sacred.ingredient import Ingredient

from modl.datasets.image import load_image
from modl.plotting.image import plot_patches

data_ing = Ingredient('data')
decompose_ex = Experiment('decompose_images', ingredients=[data_ing])


@decompose_ex.config
def config():
    batch_size = 400
    learning_rate = 0.92
    reduction = 10
    alpha = 0.08
    n_epochs = 10
    n_components = 50
    test_size = 4000
    max_patches = 10000
    patch_size = (16, 16)
    n_threads = 2
    verbose = 20
    method = 'average'
Esempio n. 9
0
def ing():
    return Ingredient("tickle")