Ejemplo n.º 1
0
def test_driver_2():
    """Assert that the tpot_driver() in TPOT driver outputs normal result with verbosity = 1."""
    args_list = [
                'tests/tests.csv',
                '-is', ',',
                '-target', 'class',
                '-g', '1',
                '-p', '2',
                '-cv', '2',
                '-s',' 45',
                '-config', 'TPOT light',
                '-v', '1'
                ]
    args = _get_arg_parser().parse_args(args_list)
    with captured_output() as (out, err):
        tpot_driver(args)
    ret_stdout = out.getvalue()

    assert "TPOT settings" not in ret_stdout
    assert "Final Pareto front testing scores" not in ret_stdout
    try:
        ret_val = float(ret_stdout.split('\n')[-2].split(': ')[-1])
    except Exception:
        ret_val = -float('inf')
    assert ret_val > 0.0
Ejemplo n.º 2
0
def test_driver_5():
    """Assert that the tpot_driver() in TPOT driver outputs normal result with exported python file and verbosity = 0."""

    # Catch FutureWarning https://github.com/scikit-learn/scikit-learn/issues/11785
    if (np.__version__ >= LooseVersion("1.15.0") and
            sklearn.__version__ <= LooseVersion("0.20.0")):
        raise nose.SkipTest("Warning raised by scikit-learn")

    args_list = [
                'tests/tests.csv',
                '-is', ',',
                '-target', 'class',
                '-o', 'test_export.py',
                '-g', '1',
                '-p', '2',
                '-cv', '3',
                '-s', '42',
                '-config', 'TPOT light',
                '-v', '0'
                ]
    args = _get_arg_parser().parse_args(args_list)
    with captured_output() as (out, err):
        tpot_driver(args)
    ret_stdout = out.getvalue()

    assert ret_stdout == ""
    assert path.isfile("test_export.py")
    remove("test_export.py") # clean up exported file
Ejemplo n.º 3
0
def test_driver_5():
    """Assert that the tpot_driver() in TPOT driver outputs normal result with exported python file and verbosity = 0."""
    args_list = [
        'tests/tests.csv', '-is', ',', '-target', 'class', '-o',
        'test_export.py', '-g', '1', '-p', '2', '-cv', '3', '-s', '42',
        '-config', 'TPOT light', '-v', '0'
    ]
    args = _get_arg_parser().parse_args(args_list)
    with captured_output() as (out, err):
        tpot_driver(args)
    ret_stdout = out.getvalue()

    assert ret_stdout == ""
    assert path.isfile("test_export.py")
    remove("test_export.py")  # clean up exported file
Ejemplo n.º 4
0
def test_driver_5():
    """Assert that the tpot_driver() in TPOT driver outputs normal result with exported python file and verbosity = 0."""
    args_list = [
                'tests/tests.csv',
                '-is', ',',
                '-target', 'class',
                '-o', 'test_export.py',
                '-g', '1',
                '-p', '2',
                '-cv', '3',
                '-s', '42',
                '-config', 'TPOT light',
                '-v', '0'
                ]
    args = _get_arg_parser().parse_args(args_list)
    with captured_output() as (out, err):
        tpot_driver(args)
    ret_stdout = out.getvalue()

    assert ret_stdout == ""
    assert path.isfile("test_export.py")
    remove("test_export.py") # clean up exported file