Esempio n. 1
0
 # STARS no sphere
 for trial in range(ntrials):
 #sim setup
     test = Stars_sim(f, init_pt, L1 = None, var = None, verbose = False, maxit = maxit)
     test.STARS_only = True
     test.get_mu_star()
     test.get_h()
     test.update_L1 = True
     test2 = Stars_sim(f, init_pt, L1 = None, var = None, verbose = True, maxit = maxit)
     test2.update_L1 = True
     #test.STARS_only = True
     test2.get_mu_star()
     test2.get_h()
     test2.train_method = 'GQ'
     test2.adapt = 2*f.dim
     test2.regul = test2.var
     test2.pad_train = 2.0
     test2.explore_weight = 2.0
     #test2.regul = None
 
     dist = None
     L1_hist = None
     while test.iter < test.maxit:
         test.step()
         test2.step()
         if test2.active is not None:
             temp = np.array(subspace_dist(test2.active,f.active))
             if dist is None:
                 dist = np.copy(temp)
                 L1_hist = np.copy(np.array(test2.L1))
             else:
Esempio n. 2
0
a_dims = [2]
n_a_dims = np.size(a_dims)
f2_avr = np.zeros((maxit+1,n_a_dims))
j=0

for i in a_dims:
    for trial in range(ntrials):
        test = Stars_sim(f, this_init_pt, L1 = f.L1, var = f.var, verbose = False, maxit = maxit)
        test.get_mu_star()
        test.get_h()        
        test.set_dim = True
        test.subcycle = True
        test.adim = i # hard-code adim
        test.train_method = 'GQ'
        test.adapt = 3.0*f.dim
        test.regul = test.sigma**2

	# do steps
        while test.iter < test.maxit:
            test.step()

        f2_avr[:,j] += test.fhist
        print('ASTARS trial',trial,' minval',test.fhist[-1])
    j += 1
	    

# Stop the clock!
stop = timeit.default_timer()

# Difference stop-start tells us run time
time = stop - start
Esempio n. 3
0
                         L1=f.L1,
                         var=f.var,
                         verbose=False,
                         maxit=maxit,
                         true_as=f.active)
        test.get_mu_star()
        test.get_h()
        # adapt every f.adapt timesteps using quadratic(after inital burn)
        test.train_method = 'GQ'

        test.adapt = f.adapt  # Sets retraining steps
        #test.subcycle = True # turn on subcycling
        test.threshadapt = True

        #test.debug = True
        test.regul = f.regul
        test.threshold = f.threshold

        # do 100 steps
        while test.iter < test.maxit:
            test.step()
            if test.active is not None and test.iter // test.adapt:
                print('distance', subspace_dist(test.active, f.active))

        f2_avr += test.fhist

        if maxit > test.tr_stop:
            FAASTARS_adim_sto = np.zeros((maxit - test.tr_stop - 1, 1))
            FAASTARS_sub_dist_sto = np.zeros((maxit - test.tr_stop - 1, 1))

        # data dump
Esempio n. 4
0
# Start the clock!
start = timeit.default_timer()

for trial in range(ntrials):
    #sim setup
    test = Stars_sim(nesterov_2_f,
                     init_pt,
                     L1=4,
                     var=1E-12,
                     verbose=True,
                     maxit=maxit)
    #test.STARS_only = True
    test.get_mu_star()
    test.get_h()
    test.regul = None
    test.train_method = 'GQ'
    test.adapt = 100  # Sets number of sub-cylcing steps
    test.threshold = 0.99999

    # do 100 steps
    while test.iter < test.maxit:
        test.step()
        #if test.iter % 100 == 0:
        #   print('iter',test.iter,test.fhist[test.iter])
    f2_avr += test.fhist
    #print('trial',trial,' minval',test.fhist[-1])

# Stop the clock!
stop = timeit.default_timer()
Esempio n. 5
0
    test.STARS_only = True
    test.get_mu_star()
    test.get_h()
    test2 = Stars_sim(dci,
                      init_pt,
                      f_obj=dci,
                      L1=dci.L1,
                      var=dci.var,
                      verbose=True,
                      maxit=maxit)
    #test.STARS_only = True
    test2.get_mu_star()
    test2.get_h()
    test2.train_method = 'GL'
    test2.adapt = 2 * dci.dim
    test2.regul = dci.sig
    test2.threshold = .9
    test2.lasso = True
    test2.pad_train = 2.0
    test2.explore_weight = 2.0
    #test3 = Stars_sim(f, init_pt, L1 = f.L1, var = f.var, verbose = False, maxit = maxit)
    #test.STARS_only = True
    #test3.active = f.active
    #test3.get_mu_star()
    #test3.get_h()
    # test3.adapt = 0
    #test3.debug = False

    while test.iter < test.maxit:
        test.step()
        test2.step()