def __init__(self, d,ranker_arg_str, ties, feature_count, init=None, sample=None): self.A = random_matrix(feature_count, d) self.feature_count = feature_count ranking_model_str = "ranker.model.LinearREMBO" for arg in ranker_arg_str: if arg.startswith("ranker.model"): ranking_model_str = arg else: self.ranker_type = float(arg) self.ranking_model = get_class(ranking_model_str)(d) self.sample = getattr(__import__("utils"), sample) self.ties = ties self.w = self.ranking_model.initialize_weights(init,self.A,d)
def __init__(self, d, ranker_arg_str, ties, feature_count, init=None, sample=None): self.A = random_matrix(feature_count, d) self.feature_count = feature_count ranking_model_str = "ranker.model.LinearREMBO" for arg in ranker_arg_str: if arg.startswith("ranker.model"): ranking_model_str = arg else: self.ranker_type = float(arg) self.ranking_model = get_class(ranking_model_str)(d) self.sample = getattr(__import__("utils"), sample) self.ties = ties self.w = self.ranking_model.initialize_weights(init, self.A, d)
d = 3 region_bound = math.sqrt(d) region_bound_stepsize = 0.5 # 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,
import numpy as np import math import parisFunctions as pf import acquisition_function as acq import create_random_matrix as crm import choose_bounded_region as cbr 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)