コード例 #1
0
ファイル: run.py プロジェクト: daiwei89/AutoMl_Challenge
            time_budget = max_time
        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))
        if time_spent >= time_budget:
            vprint( verbose,  "[-] Sorry, time budget exceeded, skipping this task")
            execution_success = False
            continue
        
        # ========= 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 ==========")
        M = MyAutoML(D.info, verbose=False, debug_mode=debug_mode) # I turned off verbose to avoid tons of junk...
        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_budget = time_budget - time_spent # Remove time spent so far
        start = time.time()                    # Reset the counter
        time_spent = 0                         # Initialize time spent learning
        cycle = 0

        while time_spent <= time_budget/2 and cycle <= max_cycle and M.model.n_estimators<max_estimators:
コード例 #2
0
        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))
        if time_spent >= time_budget:
            vprint(verbose, "[-] Sorry, time budget exceeded, skipping this task")
            execution_success = False
            continue
        
        # ========= 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 ==========")
        M = MyAutoML(D.info, verbose=False, debug_mode=debug_mode, num_train=num_train, num_valid=num_valid, num_test=num_test, dim_data=dim_data)
        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_budget = time_budget - time_spent # Remove time spent so far
        start = time.time() # Reset the counter
        time_spent = 0 # Initialize time spent learning
        cycle = 0
        
コード例 #3
0
        ]
        D.info['hyps'] = _convert_to_hyp(space_hyps, base_hyps=[is_bo])

        arr_range = np.array([[elem_hyps[3], elem_hyps[4]]
                              for elem_hyps in space_hyps])
        model_bo = bayesobo.BO(arr_range, str_acq='ucb')
        cur_hyps = [elem_hyps[2] for elem_hyps in space_hyps]
        list_hyps_all = []
        list_measures_all = []

        while time_spent <= time_budget - (
                2 * time_one_loop) - TIME_RESIDUAL and is_bo and True:
            vprint(
                verbose, "=========== " + basename.capitalize() +
                " Training cycle " + str(cycle) + " ================")
            M = MyAutoML(D.info, verbose=False, debug_mode=debug_mode)

            M.fit(X_train_train, Y_train_train)

            vprint(
                verbose, "[+] Fitting success, time spent so far %5.2f sec" %
                (time.time() - start))
            # Make predictions
            # -----------------
            pred_train_valid = M.predict(X_train_valid)
            if 'classification' in D.info['task']:
                performance = sklearn.metrics.roc_auc_score(
                    Y_train_valid, pred_train_valid)
                performance = 2 * performance - 1
                vprint(verbose,
                       "[+] AUC for X_train_valid, %5.4f" % (performance))
コード例 #4
0
        if time_spent >= time_budget:
            vprint( verbose,  "[-] Sorry, time budget exceeded, skipping this task")
            execution_success = False
            continue
        
        # ========= 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 ==========")

	
	if D.info['task'] !='regression':
		import engine_automl as mpd
		mpd.predict(D, output_dir, start,  time_budget, basename, running_on_codalab )
	else:
		
		M = MyAutoML(D.info, verbose, debug_mode)
		
		# ========= Iterating over learning cycles and keeping track of time
		# Preferably use a method that iteratively improves the model and
		# regularly saves predictions results gradually getting better
		# until the time budget is exceeded.
		# The example model we provide we use just votes on an increasingly 
		# large number of "base estimators".
		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_budget = time_budget - time_spent # Remove time spent so far
コード例 #5
0
ファイル: run_new.py プロジェクト: ludovicth/chalearn
        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 from 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))
        if time_spent >= time_budget:
            vprint( verbose,  "[-] Sorry, time budget exceeded, skipping this task")
            execution_success = False
            continue

        # ========= 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. 
        # Only instantiates class object 
        vprint( verbose,  "======== Creating model ==========")
        M = MyAutoML(D.info, verbose=False, debug_mode=debug_mode) # I turned off verbose to avoid tons of junk...
        print M

        # Does cross validation for all models and picks the best classifier
        # Probably need to pass in the time remaining since timekeeping needs to be done in here
        # -------------------
        M.run_cycles(D.data['X_train'], D.data['Y_train']) 
        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
        # -----------------
        Y_test = M.predict(D.data['X_test'])                         
        vprint( verbose,  "[+] Prediction success, time spent so far %5.2f sec" % (time.time() - start))

        # Write results