tests/functional/demo/dir_per_trial.py
def execute():
    """Execute a simple pipeline as an example."""
    parser = argparse.ArgumentParser()
    parser.add_argument("-x", type=float, required=True)
    parser.add_argument("--dir", type=str, required=True)
    parser.add_argument("--name", type=str, required=True)
    parser.add_argument("--other-name", type=str, required=True)
    inputs = parser.parse_args()

    # That's what is expected to happen
    os.makedirs(
        os.path.join(inputs.dir, inputs.other_name, "my-exp-{}".format(inputs.name)),
        exist_ok=False,
    )  # Raise OSError if it exists

    y, dy = function(inputs.x)

    results = list()
    results.append(dict(name="example_objective", type="objective", value=y))
    results.append(dict(name="example_gradient", type="gradient", value=[dy]))

    report_results(results)
Execute a simple pipeline as an example.
Execute a simple pipeline as an example.
Execute a simple pipeline as an example .
def execute():
    parser = argparse.ArgumentParser()
    parser.add_argument("-x", type=float, required=True)
    parser.add_argument("--dir", type=str, required=True)
    parser.add_argument("--name", type=str, required=True)
    parser.add_argument("--other-name", type=str, required=True)
    inputs = parser.parse_args()
    os.makedirs(
        os.path.join(inputs.dir, inputs.other_name, "my-exp-{}".format(inputs.name)),
        exist_ok=False,
    )  
    y, dy = function(inputs.x)
    results = list()
    results.append(dict(name="example_objective", type="objective", value=y))
    results.append(dict(name="example_gradient", type="gradient", value=[dy]))
    report_results(results)
def execute ( ) : parser = argparse . ArgumentParser ( ) parser . add_argument ( "-x" , type = float , required = True ) parser . add_argument ( "--dir" , type = str , required = True ) parser . add_argument ( "--name" , type = str , required = True ) parser . add_argument ( "--other-name" , type = str , required = True ) inputs = parser . parse_args ( ) os . makedirs ( os . path . join ( inputs . dir , inputs . other_name , "my-exp-{}" . format ( inputs . name ) ) , exist_ok = False , ) y , dy = function ( inputs . x ) results = list ( ) results . append ( dict ( name = "example_objective" , type = "objective" , value = y ) ) results . append ( dict ( name = "example_gradient" , type = "gradient" , value = [ dy ] ) ) report_results ( results )
Execute a simple pipeline as an example.
Execute a simple pipeline as an example .
"""Execute a simple pipeline as an example.""" # That's what is expected to happen # Raise OSError if it exists