# DBGD init probe_magnitude = 0.5 # just arbitrary number for now.. change_magnitude = 0.01 # L2R init (create Learning2Rank class instance) l2r = Learning2Rank('../../data/NP2004/Fold1/test.txt', D) # ###### REMBO + LEROT ####### # # Step 1 # Generate random matrix A = crm.random_matrix(D, d) # Step 2 # Choose bounded region set: y = N x d matrix (the exhaustive search subset) y = cbr.choose_bounded_region(d, -region_bound, region_bound, region_bound_stepsize) y = np.array(y) # start with random sample Y = acq.select_random_point(y) # t starts from 1 to avoid having t+1 all over the code (might confuse us.) # is our time the length of the queries we do? We could shorten it for testing at least. for t in range(1, l2r.get_query_length): # create y_probe based on y_current y_probe, altered_dimension = get_similar_point(y_current, probe_magnitude, region_bound) # prep for L2R: convert to D-dimensional Ay_current, Ay_probe = l2r.prepare_rankers(A, y_current, y_probe)
D=10 d=3 # Step 1 # Generate random matrix A = crm.random_matrix(D, d) # Step 2 # Choose bounded region set regionBound = math.sqrt(d) regionBoundStepSize = 0.5 #y = N x d matrix (the exhaustive search subset) y = cbr.choose_bounded_region(d, -regionBound, regionBound, regionBoundStepSize) #create artificial data [0...1] #data = cbr.choose_bounded_region(d,0,1,0.5) #y_projected = acq.projection(data,ybest) max_iter = 10 # t starts from 1 to avoid having t+1 all over the code (might confuse us.) for t in range(1, max_iter+1): #number of samples = t for each iteration step. (is that correct?) number_of_samples = t
# DBGD init probe_magnitude = 0.5 # just arbitrary number for now.. change_magnitude = 0.01 # L2R init (create Learning2Rank class instance) l2r = Learning2Rank('../../data/NP2004/Fold1/test.txt', D) # ###### REMBO + LEROT ####### # # Step 1 # Generate random matrix A = crm.random_matrix(D, d) # Step 2 # Choose bounded region set: y = N x d matrix (the exhaustive search subset) y = cbr.choose_bounded_region(d, -region_bound, region_bound, region_bound_stepsize) y = np.array(y) # start with random sample Y = acq.select_random_point(y) # t starts from 1 to avoid having t+1 all over the code (might confuse us.) # is our time the length of the queries we do? We could shorten it for testing at least. for t in range(1, l2r.get_query_length): # create y_probe based on y_current y_probe, altered_dimension = get_similar_point(y_current, probe_magnitude, region_bound) # prep for L2R: convert to D-dimensional Ay_current, Ay_probe = l2r.prepare_rankers(A, y_current, y_probe) # evaluate
import scipy.spatial.distance as sp D = 10 d = 3 # Step 1 # Generate random matrix A = crm.random_matrix(D, d) # Step 2 # Choose bounded region set regionBound = math.sqrt(d) regionBoundStepSize = 0.5 #y = N x d matrix (the exhaustive search subset) y = cbr.choose_bounded_region(d, -regionBound, regionBound, regionBoundStepSize) #create artificial data [0...1] #data = cbr.choose_bounded_region(d,0,1,0.5) #y_projected = acq.projection(data,ybest) max_iter = 10 # t starts from 1 to avoid having t+1 all over the code (might confuse us.) for t in range(1, max_iter + 1): #number of samples = t for each iteration step. (is that correct?) number_of_samples = t #Step 3 : sample out of y , and create Y Y = acq.select_sample_set(number_of_samples, y)
# L2R init (create Learning2Rank class instance) l2r = Learning2Rank('../../data/NP2004/Fold1/test.txt', D) # ###### REMBO + LEROT ALGORITHM START ####### # # Step 1 # Generate random matrix # this mu/sigma might be wrong, I don't know. mu = 0.5 sigma = 1 A = random_matrix2(D, d, mu, sigma) # Step 2 # Choose bounded region set: y = N x d matrix (the exhaustive search subset) y = choose_bounded_region(d, min_region_bound, max_region_bound, region_bound_stepsize) y = np.array(y) # start with 1 random sample Y = get_random_point(y) # time = amount of queries? for t in range(1, l2r.get_query_length()): # create y_current / y_probe based on y_current y_current = Y[len(Y)-1] y_probe, altered_dimension = get_random_close_point(y_current, exploration_stepsize, min_region_bound, max_region_bound, d) # prep for L2R: convert to D-dimensional + create ranker objects ranker_current, ranker_probe = l2r.prepare_rankers(A, y_current, y_probe) # evaluate