Esempio n. 1
0
 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:
                 dist = np.append(dist,temp)
        test4.adapt = f.adapt # Sets retraining steps
        test2.adapt = f.adapt
        test3.adapt = f. adapt
        
        #test.update_L1 = True
        #test2.update_L1 = True
        #test3.update_L1 = True
        
        # Make test2 our adaptive thresholding trial, and test3 our subcycling trial
        test2.threshadapt = True
        test3.subcycle = True
        test3.sub_method = 2
        test2.slope_weight = .1
        test3.slope_weight = .1
        
        test2.pad_train = 2.0
        test2.explore_weight = 2.0
        test3.pad_train = 2.0
        test3.explore_weight = 2.0

        #test4.regul = f.regul
        #test2.regul = f.regul
        #test3.regul = f.regul
        
        
        
        test4.threshold = f.threshold
        test2.threshold = f.threshold
        test3.threshold = f.threshold
        
        # do 100 steps