Пример #1
0
    def __init__(self):
        args = commandlineArguments(enumerationTimeout=200,
                                    activation='tanh',
                                    iterations=1,
                                    recognitionTimeout=3600,
                                    a=3,
                                    maximumFrontier=5,
                                    topK=2,
                                    pseudoCounts=30.0,
                                    helmholtzRatio=0.5,
                                    structurePenalty=1.,
                                    CPUs=min(numberOfCPUs(), 8),
                                    extras=list_options)

        args['noConsolidation'] = True
        args.pop("random_seed")
        args['contextual'] = True
        args['biasOptimal'] = True
        args['auxiliaryLoss'] = True
        args['activation'] = "relu"
        args['useDSL'] = False

        extractor = {
            "learned": LearnedFeatureExtractor,
        }[args.pop("extractor")]
        extractor.H = args.pop("hidden")

        timestamp = datetime.datetime.now().isoformat()
        outputDirectory = "tmp/%s" % timestamp
        os.system("mkdir -p %s" % outputDirectory)

        args.update({
            "featureExtractor": extractor,
            "outputPrefix": "%s/hint" % outputDirectory,
            "evaluationTimeout": 0.0005,
        })
        args.pop("maxTasks")
        args.pop("split")

        self.primitives = McCarthyPrimitives()
        baseGrammar = Grammar.uniform(self.primitives)
        self.grammar = baseGrammar
        self.train_args = args
        self.semantics = [Semantics(i) for i in range(len(SYMBOLS))]
        self.allFrontiers = None
        self.helmholtzFrontiers = None
Пример #2
0
try:
    import binutil  # required to import from dreamcoder modules
except ModuleNotFoundError:
    import bin.binutil  # alt import if called as module

from dreamcoder.domains.succ.main import main, list_options
from dreamcoder.dreamcoder import commandlineArguments
from dreamcoder.utilities import numberOfCPUs


if __name__ == '__main__':
    args = commandlineArguments(
        enumerationTimeout=10, activation='tanh', iterations=1000, recognitionTimeout=3600,
        a=3, maximumFrontier=10, topK=2, pseudoCounts=30.0,
        helmholtzRatio=0.5, structurePenalty=1.,
        CPUs=numberOfCPUs(),
        extras=list_options)
    main(args)
Пример #3
0
try:
    import binutil  # required to import from dreamcoder modules
except ModuleNotFoundError:
    import bin.binutil  # alt import if called as module

from dreamcoder.domains.hint.main import main, list_options
from dreamcoder.dreamcoder import commandlineArguments
from dreamcoder.utilities import numberOfCPUs

if __name__ == '__main__':
    args = commandlineArguments(enumerationTimeout=200,
                                activation='tanh',
                                iterations=1,
                                recognitionTimeout=3600,
                                a=3,
                                maximumFrontier=5,
                                topK=2,
                                pseudoCounts=30.0,
                                helmholtzRatio=0.5,
                                structurePenalty=1.,
                                CPUs=min(8, numberOfCPUs()),
                                extras=list_options)
    args['noConsolidation'] = True
    args['contextual'] = True
    args['biasOptimal'] = True
    args['auxiliaryLoss'] = True
    args['activation'] = "relu"
    args['useDSL'] = False
    main(args)