コード例 #1
0
def test_predict_proba():
    from EvoDAG.model import EvoDAGE
    m = EvoDAGE(n_estimators=3, n_jobs=2, time_limit=4).fit(X, cl)
    pr = m.predict_proba(X)
    default_nargs()
    print(pr.min(), pr.max())
    assert pr.min() >= 0 and pr.max() <= 1
コード例 #2
0
def test_init_e():
    from EvoDAG.model import EvoDAGE
    m = EvoDAGE(n_estimators=4, n_jobs=4, seed=10,
                early_stopping_rounds=100).fit(X, cl)
    hy = m.predict(X)
    assert (cl == hy).mean() > 0.9
    default_nargs()
コード例 #3
0
def test_raw_decision_function():
    from EvoDAG.model import EvoDAGE
    m = EvoDAGE(n_estimators=3, n_jobs=2, time_limit=4)
    m.fit(X, cl)
    pr = m.raw_decision_function(X)
    default_nargs()
    print(pr.shape)
    assert pr.shape[1] == np.unique(cl).shape[0] * len(m._m.models)
コード例 #4
0
def test_init_time_limit():
    from EvoDAG.model import EvoDAGE
    import time
    local = time.time()
    EvoDAGE(n_estimators=30, n_jobs=2, time_limit=4).fit(X, cl)
    default_nargs()
    t = time.time() - local
    print(t)
    assert t <= 6
コード例 #5
0
def test_regression_multiple_outputs():
    from EvoDAG.model import EvoDAGE
    from SparseArray import SparseArray
    y = [
        SparseArray.fromlist(cl),
        SparseArray.fromlist(cl * -1),
        SparseArray.fromlist(cl * -1 + 0.5)
    ]
    m = EvoDAGE(time_limit=4, multiple_outputs=True,
                classifier=False).fit(X, y)
    assert m
コード例 #6
0
ファイル: test_model.py プロジェクト: yadevi/EvoDAG
def test_max_training_size():
    from EvoDAG.model import EvoDAGE
    import time
    local = time.time()
    try:
        EvoDAGE(n_estimators=30, n_jobs=2, time_limit=4,
                max_training_size="hola").fit(X, cl)
    except TypeError:
        default_nargs()
        t = time.time() - local
        print(t)
        assert t <= 6
        return
    assert False        
コード例 #7
0
ファイル: run.py プロジェクト: INGEOTEC/AutoML2-2018
            time_budget = D.info['time_budget']        # <== HERE IS THE TIME BUDGET!
        else:
            time_budget = max_time
        time_budget = float(time_budget)
        overall_time_budget = overall_time_budget + time_budget
        vprint(verbose,  "[+] Cumulated time budget (all tasks so far)  %5.2f sec" % (overall_time_budget))
        # We do not add the time left over form previous dataset: time_budget += time_left_over
        vprint(verbose,  "[+] Time budget for this task %5.2f sec" % time_budget)
        time_spent = time.time() - start
        vprint(verbose,  "[+] Remaining time after reading data %5.2f sec" % (time_budget-time_spent))

        # ========= Creating a model, knowing its assigned task from D.info['task'].
        # The model can also select its hyper-parameters based on other elements of info.
        vprint(verbose,  "======== Creating model ==========")
        time_budget = 3600
        M = EvoDAGE(n_jobs=16, classifier=True, time_limit=time_budget, fitness_function='macro-F1', Tanh=False)
        print(M)

        # ========= Iterating over learning cycles and keeping track of time
        time_spent = time.time() - start
        vprint(verbose,  "[+] Remaining time after building model %5.2f sec" % (time_budget-time_spent))
        if time_spent >= time_budget:
            vprint(verbose,  "[-] Sorry, time budget exceeded, skipping this task")
            execution_success = False
            continue
        time_predict_value = time_to_predict(D)
        time_budget = time_budget - time_spent  # Remove time spent so far
        start = time.time()                     # Reset the counter
        time_spent = 0                          # Initialize time spent learning
        M.time_limit = time_budget * time_predict_value * 0.9
        vprint(verbose,  "[+] Time budget to train the model %5.2f sec" % M._time_limit)