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)
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) Xtest = None if D.info['test_num'] < 1000: Xtest = np.array([x.hy.full_array() for x in read_data(test_fname)]).T M.fit(X, y, test_set=Xtest) # log_reg = LogisticRegression(random_state=0, class_weight='balanced') # log_reg.fit(M.raw_decision_function(X), y) vprint(verbose, "=========== " + basename.capitalize() + " Training cycle " + " ================") vprint(verbose, "[+] Fitting success, time spent so far %5.2f sec" % (time.time() - start)) vprint(verbose, "[+] Size of trained model %5.2f bytes" % data_io.total_size(M)) # Make predictions # ----------------- if os.path.isfile(valid_fname): Y_valid = M.predict_proba(read_data(valid_fname))[:, 1] # Y_valid = log_reg.predict_proba(M.raw_decision_function(read_data(valid_fname)))[:, 1] else: Y_valid = None if Xtest is None: Xtest = read_data(test_fname) Y_test = M.predict_proba(Xtest)[:, 1]