query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
If there is a negative gradient, change it to zero
def relu_backward_hook_function(module, grad_in, grad_out): # Get last forward output corresponding_forward_output = self.forward_relu_outputs[-1] corresponding_forward_output[corresponding_forward_output > 0] = 1 modified_grad_out = corresponding_forward_output * torch.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_grad(self):\n self.grad.zero_()", "def grad_zero(self):\r\n pass", "def grad_zero(self):\r\n pass", "def negative_gradient(self, y, y_pred, **kargs):", "def zero_grad(self):\n self.grad = Tensor(data=np.zeros_like(self.data, dtype=np.float))", "def zero_grad(x):\n ...
[ "0.76615775", "0.76399404", "0.76399404", "0.76242167", "0.7470609", "0.74599236", "0.7242895", "0.7150094", "0.71176636", "0.7107646", "0.70826745", "0.7034797", "0.7034797", "0.7016988", "0.7001879", "0.69932896", "0.69932896", "0.6954989", "0.69188714", "0.68847275", "0.68...
0.0
-1
Store results of forward pass
def relu_forward_hook_function(module, ten_in, ten_out): self.forward_relu_outputs.append(ten_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_pass(self):", "def forward_pass(self):\n # Compute the support set's mean and var and use these as the moments for\n # batch norm on the query set.\n train_embeddings = self.embedding_fn(self.episode.train_images,\n self.is_training)\n self.train_em...
[ "0.65868884", "0.6509388", "0.6396395", "0.6384102", "0.6342878", "0.6342878", "0.6329432", "0.6291918", "0.6291918", "0.62083226", "0.6193587", "0.6159851", "0.61594737", "0.61594737", "0.61594737", "0.6113193", "0.60944366", "0.60923964", "0.6091803", "0.60865366", "0.60748...
0.0
-1
generate the next state
def _nextObservation(self): frame = np.array(self.df.loc[(self.currentStep - (self.time_lag - 1)):self.currentStep,['return_Low','return_Volume']].values) obs = (frame,np.array([self.balance/10000,self.buy_amount/10000,self.sell_amount/10000])) # standardize the value return obs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_next_state(self, action) :\n raise NotImplementedError", "def next_state(self):\n \n self.state = np.random.choice(['checkout', 'dairy', 'drinks', 'fruit', 'spices'], p=self.tr_array_dict[f'{self.state}'])", "def next(self):\n self.state += 1\n if self.state > 1:\n...
[ "0.8228073", "0.76831114", "0.7611324", "0.7524008", "0.744573", "0.7322066", "0.73127764", "0.73049396", "0.7203904", "0.7172242", "0.7148373", "0.7090857", "0.7040154", "0.7002292", "0.697542", "0.6929242", "0.6918649", "0.6869711", "0.6867532", "0.6853744", "0.67200696", ...
0.0
-1
upate the balance, sell acount, buy acount, based on returan rate
def _balance_update(self): return_rate = self.df.loc[self.currentStep, "return_Close"] self.buy_amount += return_rate * self.buy_amount self.sell_amount -= return_rate * self.sell_amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_earning(self, data=None):\n result = Result()\n if data is None:\n data = self.security\n self.calcDecision()\n first_purchase_method = self.check_first_purchase_method()\n for i in np.arange(len(data['Close'])):\n if data['FinalDecision'].iloc[i] i...
[ "0.6785312", "0.6220181", "0.6175861", "0.6114552", "0.6088199", "0.60283774", "0.6012482", "0.59921443", "0.5976123", "0.5962097", "0.59508103", "0.5949215", "0.5946042", "0.5930534", "0.5910977", "0.59003735", "0.5884636", "0.58771354", "0.5839308", "0.58320624", "0.5797567...
0.72528595
0
given action, return new state and reward
def step(self, action): self.currentStep += 1 # add current step by 1 self._takeAction(action) # update buy/sell account self._balance_update() # update balance account obs = self._nextObservation() newnetWorth = self.balance + self.buy_amount + self.sell_amount # calculate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n res = self.reward_table.get(self.curr_state, action)\n\n self.curr_state = res['result']\n\n return res", "def state_update(self, last_action, action):\n s_t = self._get_state(last_action)\n r= self._get_reward(last_action,action)\n self._move_user()\n s_t1 ...
[ "0.82155526", "0.76120025", "0.75517076", "0.75496775", "0.7516878", "0.7515607", "0.74979776", "0.74631685", "0.738725", "0.73777217", "0.7361667", "0.73603576", "0.73077524", "0.7297692", "0.72945803", "0.7272934", "0.72710866", "0.72631186", "0.72499824", "0.7240149", "0.7...
0.701414
51
Prepare the dict of values to create the new invoice for a sale order. This method may be overridden to implement custom invoice generation (making sure to call super() to establish a clean extension chain).
def _prepare_invoice(self, cr, uid, order, lines, context=None): invoice_vals = super(my_sale_order, self)._prepare_invoice(cr, uid, order, lines, context) invoice_vals.update({ 'partner_shipping_id': order.partner_shipping_id....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_invoice(self):\n # get current logged in user's timezone\n local = pytz.timezone(self.env['res.users'].browse(self._uid).tz) or pytz.utc\n\n self.ensure_one()\n journal_id = self.env['account.journal'].search([('type', '=', 'purchase')], limit=1).id\n if not journal_...
[ "0.74100953", "0.73465693", "0.73403376", "0.7328195", "0.7002523", "0.69652605", "0.68501127", "0.67724967", "0.6712132", "0.665417", "0.6562301", "0.6495313", "0.6490809", "0.6431741", "0.6104436", "0.6072918", "0.59833795", "0.59129834", "0.5863059", "0.5860928", "0.578695...
0.76020634
0
r"""Smooth (and optionally differentiate) data with a SavitzkyGolay filter. The SavitzkyGolay filter removes high frequency noise from data. It has the advantage of preserving the original shape and features of the signal better than other types of filtering approaches, such as moving averages techniques.
def savitzky_golay(y, window_size, order, deriv=0, rate=1): import numpy as np from math import factorial if type(y) != np.ndarray: y = np.array(y) try: window_size = np.abs(np.int(window_size)) order = np.abs(np.int(order)) except ValueError, msg: raise ValueError("w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savitzky_golay(data, kernel = 11, order = 4):\n try:\n kernel = abs(int(kernel))\n order = abs(int(order))\n except ValueError as msg:\n raise ValueError(\"kernel and order have to be of type int (floats will be converted).\")\n if kernel % 2 != 1 or kernel < 1:\n r...
[ "0.6111886", "0.59920794", "0.5924583", "0.59181935", "0.5907186", "0.5907186", "0.58241117", "0.5821847", "0.57398474", "0.568444", "0.56125593", "0.55897284", "0.55865884", "0.5586021", "0.5577094", "0.556779", "0.5545501", "0.554301", "0.554301", "0.5539812", "0.5532512", ...
0.55577457
16
Defines a new factor of the variables in 'variables'.
def __init__(self, variables=[], values=[], probabilities=[]): self.variables = variables self.values = values self.probabilities = probabilities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changeVars(self, vars):\n v = VarSet(vars)\n newOrder = map(lambda x:v.index(x), vars)\n return Factor(v, self.t.transpose(newOrder))\n #return NotImplemented", "def add_factor(self, variables, table):\n unknown_vars = set(variables) - set(self.vs.keys())\n if unknown_vars != set():...
[ "0.70088005", "0.6836307", "0.67915875", "0.65298533", "0.6334977", "0.63198227", "0.599025", "0.59119016", "0.58628434", "0.5843477", "0.57352024", "0.5614046", "0.55369943", "0.55199915", "0.54717815", "0.54656976", "0.5433968", "0.5418116", "0.5400235", "0.5386884", "0.533...
0.5186049
27
Multiplies 'self' with 'other'.
def multiply(self, other): #we create the set of variables in the new factor new_variables = list(set(self.variables).union(set(other.variables))) new_values = [] new_probabilities = [] if len(self.variables) == 0: for i,values in enumerate(other.values): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _multiply(self, other):\n raise NotImplementedError(\n \"{} does not support scalar multiplication\".format(type(self)))", "def __mul__(self, other):\n\n return self._mul_div(other, div=False)", "def _mul(self, other):\n return None", "def __mul__(self, other):\n tr...
[ "0.8064776", "0.7970657", "0.796114", "0.79249585", "0.7889723", "0.78663045", "0.7815562", "0.7790138", "0.77565044", "0.7755494", "0.76342523", "0.76095176", "0.7581025", "0.75805557", "0.7572927", "0.7551614", "0.75353855", "0.7507408", "0.7506214", "0.7499792", "0.7464834...
0.0
-1
Sums out 'variable' from the factor.
def sum_out(self, variable): variable_index = self.variables.index(variable) new_values = [] new_probabilities = [] #we take the value of the variable that we are summing out #in the first row of 'self.values' and then sum the probability of this row #with the probabilit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eliminate_variable(variable, factors):\r\n containing_var = []\r\n not_containing_var = []\r\n for fac in factors:\r\n if variable in fac.get_variables():\r\n containing_var.append(fac)\r\n else:\r\n not_containing_var.append(fac)\r\n\r\n...
[ "0.5763951", "0.5669693", "0.55726874", "0.55263823", "0.5515817", "0.5482787", "0.542001", "0.5418609", "0.53602505", "0.53336567", "0.531933", "0.5285622", "0.5236265", "0.5204135", "0.5204135", "0.51979774", "0.51931953", "0.5181711", "0.5155577", "0.5143785", "0.5126949",...
0.550545
5
Compute FFT either using pyfftw (default) or scipy
def fft_wrap(iq_buffer, mode = 'pyfftw'): if mode == 'pyfftw': return pyfftw.interfaces.numpy_fft.fft(iq_buffer, threads=4) elif mode == 'scipy': return fft(iq_buffer) #### TODO CLEAN
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Forvard(Fin, z, usepyFFTW = False):\n _using_pyfftw = False # determined if loading is successful\n if usepyFFTW or _USE_PYFFTW:\n try:\n import pyfftw as _pyfftw\n from pyfftw.interfaces.numpy_fft import fft2 as _fft2\n from pyfftw.interfaces.numpy_fft import ifft...
[ "0.7427441", "0.73273164", "0.71920234", "0.70279694", "0.6929818", "0.6861905", "0.6849192", "0.67657036", "0.672953", "0.6695925", "0.66232765", "0.65545744", "0.6535014", "0.6516699", "0.65082127", "0.6489493", "0.64837605", "0.6350328", "0.6346015", "0.62473303", "0.62402...
0.7184091
3
Function to parse user argument
def parse_args() -> str: ap = ArgumentParser(description='Create camera_pose files.') ap.add_argument('--workspace_path', required=True) args = vars(ap.parse_args()) return args['workspace_path']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parseInputArgs():\n parser = argparse.ArgumentParser(description=\"Unix cut analog\", usage='%(prog)s [arguments]')\n\n # pos arg\n parser.add_argument('filename', type=str, help='input file name')\n\n # req arg\n requiredNamed = parser.add_argument_group('require...
[ "0.70487463", "0.66665703", "0.6544067", "0.65317565", "0.6513973", "0.651204", "0.6479623", "0.6431322", "0.642296", "0.64047027", "0.63884735", "0.63625544", "0.63537353", "0.6340073", "0.6334934", "0.6334471", "0.6314911", "0.6312969", "0.6304386", "0.62819535", "0.6276047...
0.0
-1
The function removes all the extra images created in the images folder
def remove_extra_images(path_to_images: str, number_of_images: int) -> None: last_image = 'image' + str(number_of_images) + '.jpg' while last_image in listdir(path_to_images): last_image_path = path.join(path_to_images, last_image) remove(last_image_path) print(f"remove {last_image}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def space_cleaning():\n for file in os.listdir(\".\"):\n if file.endswith(\".png\"):\n os.remove(file)", "def delete_AllImgs(self):\n self.listImages.remove_all_imgs()", "def clearAllPictures(self):\n shutil.rmtree(PNG_OUTPUT_PATH)\n os.makedirs(PNG_OUTPUT_PATH)", "d...
[ "0.772399", "0.7678155", "0.762436", "0.7403201", "0.7364772", "0.7342737", "0.7281264", "0.72779584", "0.7222312", "0.719953", "0.7062136", "0.69628257", "0.6952707", "0.6949376", "0.6933136", "0.6925044", "0.692482", "0.692419", "0.6918678", "0.6897421", "0.6856652", "0.6...
0.7538987
3
The function prepares the images for our model based on a given video
def prepare_video(path_to_video: str, number_of_images=87) -> None: temp_video = path.join(path_to_video, 'temp_outpy.mp4') video = path.join(path_to_video, 'outpy.h264') # create mp4 video for metadata and compute video duration subprocess.run(['ffmpeg', '-i', video, '-c', 'copy', temp_video]) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_video(opt, frame_path, Total_frames):\n clip = []\n i = 0\n loop = 0\n\n # choosing a random frame\n if Total_frames <= opt.sample_duration: \n loop = 1\n start_frame = 0\n else:\n start_frame = np.random.randint(0, Total_frames - opt.sample_duration)\n \n ...
[ "0.6378548", "0.6341571", "0.6268886", "0.6267411", "0.62665486", "0.62576735", "0.61747694", "0.6135613", "0.61193234", "0.6107251", "0.607215", "0.6004102", "0.59735906", "0.5962933", "0.5939074", "0.59383684", "0.59096986", "0.5904158", "0.58933836", "0.5886941", "0.588352...
0.6345232
1
The function prepares the images for our model based on a given video
def create_temp_model(temp_dir_path: str) -> str: # create temp images folder path_to_temp_model = path.join(temp_dir_path, 'temp_model') path_to_temp_images = path.join(path_to_temp_model, 'temp_images') # remove old temporary folder if exists if path.exists(path_to_temp_model) and path.isdir(pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_video(opt, frame_path, Total_frames):\n clip = []\n i = 0\n loop = 0\n\n # choosing a random frame\n if Total_frames <= opt.sample_duration: \n loop = 1\n start_frame = 0\n else:\n start_frame = np.random.randint(0, Total_frames - opt.sample_duration)\n \n ...
[ "0.63750154", "0.63425624", "0.6340762", "0.62680477", "0.6264588", "0.62635916", "0.625837", "0.6173872", "0.613284", "0.61168224", "0.6105058", "0.6069448", "0.60025144", "0.59694576", "0.59601396", "0.59386766", "0.5936131", "0.59105086", "0.5900934", "0.5891576", "0.58850...
0.0
-1
The function converts the quaternion vector to a rotation matrix
def quaternion_to_rotation_matrix(q0, q1, q2, q3) -> np: # First row of the rotation matrix r00 = 2 * (q0 * q0 + q1 * q1) - 1 r01 = 2 * (q1 * q2 - q0 * q3) r02 = 2 * (q1 * q3 + q0 * q2) # Second row of the rotation matrix r10 = 2 * (q1 * q2 + q0 * q3) r11 = 2 * (q0 * q0 + q2 * q2) - 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion_to_rotation_matrix(quaternion):\n\n q_w, q_x, q_y, q_z = quaternion\n sqw, sqx, sqy, sqz = np.square(quaternion)\n norm = (sqx + sqy + sqz + sqw)\n rotation_matrix = np.zeros((3, 3))\n\n # division of square length if quaternion is not already normalized\n rotation_matrix[0, 0] = (...
[ "0.75867957", "0.74146473", "0.73953855", "0.72882676", "0.7253188", "0.72290003", "0.71538144", "0.71532506", "0.7126588", "0.7108177", "0.7099389", "0.70787674", "0.7061855", "0.7034862", "0.7003994", "0.70023286", "0.6997477", "0.697881", "0.69561833", "0.69520205", "0.693...
0.683938
25
The function converts rotation matrix to quaternion vector
def rotation_matrix_to_quaternion(rotation_matrix: np) -> object: cosine_for_pitch = math.sqrt(rotation_matrix[0][0] ** 2 + rotation_matrix[1][0] ** 2) is_singular = cosine_for_pitch < 10 ** -6 if not is_singular: yaw = math.atan2(rotation_matrix[1][0], rotation_matrix[0][0]) pitch = math.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrix_to_quaternion(rotation_matrix):\n trace = np.trace(rotation_matrix)\n\n if trace > 0:\n S = np.sqrt(trace + 1) * 2\n q_w = 0.25 * S\n q_x = (rotation_matrix[2, 1] - rotation_matrix[1, 2]) / S\n q_y = (rotation_matrix[0, 2] - rotation_matrix[2, 0]) / S\n ...
[ "0.76806", "0.75808585", "0.757304", "0.7515583", "0.7400028", "0.7371076", "0.72685283", "0.72596556", "0.722488", "0.71143645", "0.70881724", "0.7081711", "0.70517707", "0.7031683", "0.70243925", "0.7013156", "0.70124847", "0.7006788", "0.69838303", "0.69710416", "0.6961587...
0.7486031
4
The function convert Euler angle to quaternion object
def euler_to_quaternion(euler: tuple) -> object: (yaw, pitch, roll) = (euler[0], euler[1], euler[2]) qy = np.sin(roll / 2) * np.cos(pitch / 2) * np.cos(yaw / 2) - np.cos(roll / 2) * np.sin(pitch / 2) * np.sin(yaw / 2) qx = np.cos(roll / 2) * np.sin(pitch / 2) * np.cos(yaw / 2) + np.sin(roll / 2) * np.cos(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler_to_quaternion(psi, theta, phi):\n # Abbreviations for the various angular functions\n cy = np.cos(psi * 0.5)\n sy = np.sin(psi * 0.5)\n cp = np.cos(theta * 0.5)\n sp = np.sin(theta * 0.5)\n cr = np.cos(phi * 0.5)\n sr = np.sin(phi * 0.5)\n\n q = np.zeros(4)\n q[0] = cy * cp * c...
[ "0.7751907", "0.7692476", "0.7672758", "0.7591342", "0.7487414", "0.74774384", "0.7452368", "0.742516", "0.74124753", "0.7385367", "0.7384482", "0.73697144", "0.7299849", "0.72180927", "0.7195682", "0.71946454", "0.7185801", "0.71458083", "0.7089422", "0.70486486", "0.7017161...
0.805849
0
The function return the absolut R & T for the first image in temp model
def get_first_image_pose(image_src: str) -> list: # read images file with open(image_src, 'r') as file: lines = file.readlines()[4::2] # create absolut camera pose dictionary for line in lines: columns = line.split() image_name = columns[9].split('.')[0] image_id = int(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTEMP(self):\r\n\t\ttemp_H = self.read(0x41)\r\n\t\ttemp_L = self.read(0x42)\r\n\t\ttemp = self.twos_comp(val = (temp_H*256 + temp_L),bits=16)\r\n\t\ttempC = (temp/340.0)+36.53\r\n\t\ttempF = tempC*(9.0/5) + 32\r\n\t\treturn tempC,tempF ,temp", "def get_temp():\n\n\tall_temp = scipy.io.loadmat('../files/AL...
[ "0.5835618", "0.56531143", "0.55923015", "0.5438354", "0.5347717", "0.5341041", "0.5332741", "0.5300689", "0.52883106", "0.5286375", "0.5286375", "0.52680224", "0.5263778", "0.5262911", "0.5252384", "0.5249313", "0.52401304", "0.52320766", "0.5204717", "0.51733774", "0.516107...
0.0
-1
Debug function for plotting the relative camera poses
def draw_rel_camera_pose(image: int, origin: list, camera_pose: list, plot_dir_path: str) -> None: fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.view_init(elev=10.) ax.set_title('camera pose image: %d' % image) scale = 7 ax.set_xlim3d(-scale, scale) ax.set_ylim3d(-scale, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_camera_view(self):\n fig, axs = plt.subplots()\n fig.show()\n axs.cla()\n axs.axis([-0.003, 0.003, -0.003, 0.003])\n axs.grid()\n axs.plot([0], [0], 'r+')\n for t_step in range(0, int(self._t_sim / self._dt) + 1, 250):\n axs.plot(\n ...
[ "0.73460865", "0.66647047", "0.6283057", "0.6272126", "0.6184981", "0.6083503", "0.6081631", "0.60760427", "0.60532206", "0.5971392", "0.59111524", "0.5910716", "0.590532", "0.59003586", "0.58845973", "0.58664477", "0.5849812", "0.5844196", "0.58399713", "0.58338684", "0.5831...
0.62216526
4
The function return a dictionary with recovered R&T for each image
def compute_absolut_camera_pose(camera_pose_rel_dict: dict, first_image_pose: list, workspace_path: str, do_plot=False) -> dict: # create directory for reference plots ref_pose_images_path = path.join(workspace_path, 'ref_images') if do_plot: makedirs(ref_pose_images...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images_and_labels(tampered_path, authentic_path):\n tampered_dir = tampered_path\n authentic_dir = authentic_path\n images = {}\n for im in glob.glob(authentic_dir):\n images[im] = {}\n images[im]['mat'] = cv2.imread(im)\n images[im]['label'] = 0\n for im in glob.glob(ta...
[ "0.59811085", "0.5820795", "0.58199984", "0.57714254", "0.5704318", "0.5689812", "0.56580365", "0.5642151", "0.5625003", "0.56211644", "0.5559603", "0.55574334", "0.5546614", "0.5507273", "0.5501269", "0.5493681", "0.5486779", "0.5481917", "0.546224", "0.5449304", "0.54414034...
0.0
-1
The function write the recovered camera poses according to COLMAP documentation
def write_camera_pose_to_file(camera_pose_abs_dict: dict, pose_dir_path: str) -> None: image_dst = path.join(pose_dir_path, 'images.txt') with open(image_dst, 'w+') as file: file.write('# Image list with two lines of data per image:\n') file.write('# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMER...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_poses():\n get_marshmallow_pose(should_remember=True)\n get_mouth_pose(should_remember=True)\n rospy.sleep(1)\n print \"Finished saving poses\"", "def write(self, pathname='wind.png'):\r\n cv2.imwrite(pathname, self.matrix * 255)", "def writeCameraSettings(self):\n pass", "...
[ "0.6014014", "0.5977247", "0.5700586", "0.56356347", "0.56256527", "0.5615104", "0.560124", "0.55990064", "0.55756223", "0.5424815", "0.54085475", "0.5403678", "0.5390949", "0.5362901", "0.53255045", "0.53230655", "0.5303748", "0.5303022", "0.5295456", "0.52894944", "0.528787...
0.6023144
0
The function deletes all the files in the workspace folder except the input video
def clear_workspace(workspace_path: str) -> None: # make sure the workspace in empty for filename in listdir(workspace_path): if filename.endswith('.h264'): continue path_to_node = path.join(workspace_path, filename) if path.isdir(path_to_node): shutil.rmtree(path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_video(video_path):\n print()\n message : str = \"removing folder\"\n pretty_print_value(video_path,message,Fore.YELLOW)\n print()\n\n\n command = \"rm \\\"\" + video_path + \"\\\"\"\n print(command)\n os.system(command)\n ...", "def delete(self):\n os.remove(self.file_pa...
[ "0.71255624", "0.6622876", "0.654681", "0.64084095", "0.6397945", "0.6377839", "0.6360218", "0.6339522", "0.6309185", "0.62984246", "0.6296886", "0.62502575", "0.6248952", "0.62447387", "0.62233245", "0.6200896", "0.620054", "0.6183128", "0.6178877", "0.6172909", "0.6167118",...
0.6389304
5
Draw an n x n grid with edges / nodes from X in red
def draw_grid(n,X): G = nx.grid_2d_graph(n+1,n+1) set_node_colors(G,G.nodes(),'k') set_edge_colors(G,G.edges(),'k') set_edge_weights(G,G.edges(),0.5) set_node_colors(G,edge_subgraph_nodes(X),'r') set_edge_colors(G,X,'r') set_edge_weights(G,X,1) nc = [G.node[n]['color'] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_grid(self):\n plt.imshow(py.array(\n map(lambda x: map(lambda y: mplc.colorConverter.to_rgb(colord[y]), x), self.create_grid(self.graph))),\n interpolation='nearest')\n plt.show()", "def draw_grid(self):\n for i in range(N * N + 1):\n color = \"blue\...
[ "0.6630089", "0.647417", "0.6226133", "0.6224112", "0.6188585", "0.6169128", "0.61569834", "0.6127831", "0.61215925", "0.6074973", "0.6070254", "0.606452", "0.60638255", "0.6051185", "0.60291207", "0.6009064", "0.600086", "0.5957386", "0.59433025", "0.59421194", "0.59329593",...
0.7901583
0
Turns a numpy array into an integer array corresponding to its unique values.
def encode_column(col: np.ndarray) -> Tuple[np.ndarray, EmbedMapping]: assert len(col.shape) == 1, "only embedding 1D arrays" _, indices, encoded_col = np.unique( col, return_index=True, return_inverse=True, return_counts=False ) n_uniques = indices.shape[0] mapping = {col[indice]: idx for (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cat2int(x):\n s = set(x)\n v2int = {}\n for i, v in enumerate(unique):\n v2int[v] = i\n assert len(s) >= 2, 'Kind of values is smaller than 2'\n return np.array([v2int[e] for e in x], dtype=np.int32), v2int", "def unique_of_an_array(an_array):\n temp_array=an_array.copy()\n u=[]\n...
[ "0.7057783", "0.6852139", "0.6836868", "0.68208766", "0.6546067", "0.6433152", "0.62101084", "0.6201899", "0.6189905", "0.6157561", "0.6144629", "0.6132668", "0.60799134", "0.60772425", "0.6070786", "0.60621244", "0.6054846", "0.6054343", "0.6051386", "0.60384727", "0.6030941...
0.0
-1
Embeds a columns from an existing mapping from floats to codes.
def encode_from_mapping(col: np.ndarray, mapping: EmbedMapping) -> np.ndarray: assert "UNK_TOKEN" in mapping encoded = np.empty_like(col) for (ix, val) in enumerate(col): try: encoded[ix] = mapping[val] except KeyError: encoded[ix] = mapping["UNK_TOKEN"] return en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform_map_data(self):\n WARD_FMT = '%s-%s'\n self.map_data_trans = []\n lookup = {i.column: ''.join(filter(lambda x: x.isdigit(), i.value)) for i in self.sht[1]}\n\n #skip over header\n rs = iter(self.sht.rows)\n next(rs)\n next(rs)\n for r in rs:\n ...
[ "0.57176745", "0.5700983", "0.54500836", "0.5328572", "0.52717036", "0.526309", "0.5219423", "0.5202589", "0.51164263", "0.5103581", "0.5081847", "0.50752693", "0.50520027", "0.5045185", "0.5021839", "0.4988317", "0.49841195", "0.49638763", "0.49529734", "0.492426", "0.491906...
0.50825346
10
Scale entries in the input to the range [1, 1].
def scale_column( col: np.ndarray, ) -> Tuple[np.ndarray, Optional[Tuple[float, float]]]: assert len(col.shape) == 1 assert not np.any(np.isnan(col)), "NaN values in array to rescale" min_, max_ = col.min(), col.max() if (max_ - min_) < FLOAT_TOL: return np.zeros_like(col), None else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(input):\n return (input - np.min(input)) / ((np.max(input) - np.min(input)))", "def rescale(x):\n if x.min() != 0:\n raise ValueError('input should have min zero.')\n\n x /= x.max() # max 1\n x *= 2 # max 2\n x -= 1 # range -1, 1\n\n if x.min() != -1 and x.max() != 1:\n ...
[ "0.80568105", "0.7588538", "0.73361796", "0.73288435", "0.72421265", "0.7234204", "0.721903", "0.7195681", "0.718205", "0.7181776", "0.71636903", "0.7139774", "0.71332127", "0.7055854", "0.70536315", "0.70240897", "0.6988062", "0.6939791", "0.6935333", "0.6903189", "0.6825208...
0.0
-1
Scale entries in the input using existing min max values
def scale_from_minmax( col: np.ndarray, minmax: Optional[Tuple[float, float]] ) -> np.ndarray: if minmax is None: return np.zeros_like(col) else: min_, max_ = minmax assert max_ - min_ >= FLOAT_TOL return 2 * (col - min_) / (max_ - min_) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(input):\n return (input - np.min(input)) / ((np.max(input) - np.min(input)))", "def __scale(data, max_value_list, min_value_list, scale_value_list, process_cols_list):\n features = np.array(data.features, dtype=float)\n for i in process_cols_list:\n value = features[i]\n...
[ "0.7884871", "0.7450257", "0.74433905", "0.74255383", "0.72756886", "0.7246593", "0.7236667", "0.72221416", "0.71644276", "0.71283484", "0.71039796", "0.7097882", "0.7069458", "0.7058498", "0.70544004", "0.70540905", "0.70508415", "0.7047351", "0.69412607", "0.6932006", "0.69...
0.6487516
50
Normalize inputs using a log, then standardize them
def log_std(col: np.ndarray) -> Tuple[np.ndarray, Tuple[float, float]]: assert col.min() > 0.0 log_transformed = np.log(col) mean_, std_ = log_transformed.mean(), log_transformed.std() return (log_transformed - mean_) / (std_ + FLOAT_TOL), (mean_, std_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lognormalize(x, temp = 1):\n if type(x) is list: x = np.array(x)\n\n x = x - np.max(x)\n # anneal\n xp = np.power(np.exp(x), temp)\n return xp / xp.sum()", "def normalise(self,data,take_logs:bool=False):\n\n # Normalise vector to sum up to 1\n normalised_vector = data/np.sum(data...
[ "0.7340787", "0.69749516", "0.6919301", "0.68766457", "0.6748069", "0.67386186", "0.67236066", "0.66689205", "0.6596321", "0.65622526", "0.65040284", "0.64725643", "0.6462739", "0.6441923", "0.6431693", "0.6418261", "0.6301656", "0.62992144", "0.6297648", "0.6270137", "0.6267...
0.0
-1
Normalize inputs using a log, a mean offset and a std scale.
def log_std_from_stats( col: np.ndarray, mean_std: Tuple[float, float] ) -> np.ndarray: mean_, std_ = mean_std assert std_ >= 0.0 assert col.min() > 0.0 return (np.log(col) - mean_) / (std_ + FLOAT_TOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(dataset):\n return normalize_standard_deviation(normalize_mean(dataset))", "def normalize(X, mu, sigma):\n return (X - mu) / sigma", "def normalize(values):\n return (values - np.mean(values)) / np.std(values)", "def normalize(adata, log_transform=True, **kwargs):\n sc.pp.normalize_to...
[ "0.6575835", "0.65729403", "0.6567097", "0.6540712", "0.6431638", "0.6410498", "0.6410498", "0.63853174", "0.63853174", "0.63391674", "0.632828", "0.63230276", "0.6322845", "0.6322552", "0.6310987", "0.62713665", "0.62632674", "0.6249568", "0.6233811", "0.62288135", "0.622552...
0.0
-1
This function handles command line parameters. Run the server using python server.py Show the help text using python server.py help
def run(debug, threaded, host, port): HOST, PORT = host, port print "running on %s:%d" % (HOST, PORT) app.run(host=HOST, port=PORT, debug=debug, threaded=threaded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = create_arg_parser()\n\n # If script run without arguments, print syntax\n if len(sys.argv) == 1:\n parser.print_help()\n sys.exit(1)\n\n # Parse arguments\n args = parser.parse_args()\n host = args.h\n mode = args.m\n port = args.p\n debug_mode = args...
[ "0.81759226", "0.8050697", "0.80427533", "0.78978634", "0.7878987", "0.7878987", "0.7590224", "0.7564658", "0.7556798", "0.7555605", "0.7452737", "0.7312544", "0.73076516", "0.7255843", "0.71107197", "0.71107197", "0.7087304", "0.6971827", "0.6925472", "0.68589836", "0.684500...
0.0
-1
Only show the debug toolbar to users with the superuser flag.
def _custom_show_toolbar(request: 'HttpRequest') -> bool: return DEBUG and request.user.is_superuser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _custom_show_toolbar(request):\n return DEBUG and request.user.is_superuser", "def show_toolbar(request: HttpRequest) -> bool:\n conditions = (\n settings.DEBUG\n and request.META.get('REMOTE_ADDR', None) in settings.INTERNAL_IPS,\n request.user.is_superuser,\n )\n disqualifi...
[ "0.817702", "0.67734593", "0.61041766", "0.6046557", "0.5890961", "0.5890961", "0.5883483", "0.5869873", "0.58142656", "0.58089703", "0.5765674", "0.57116914", "0.57055", "0.56569725", "0.5652845", "0.5607011", "0.5505614", "0.5483127", "0.5456996", "0.5456996", "0.5435421", ...
0.8088223
1
Formats the location values separating keys, values and k/v pairs >>> l = Location(42.1, 23.5, "test")
def format_geocommit(self, keyval_separator, entry_separator): end = entry_separator sep = keyval_separator msg = "lat" + sep + str(self.lat) + end msg += "long" + sep + str(self.long) + end for attr in self.optional_keys: if hasattr(self, attr): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_pair(self, k, v):\n if isinstance(v, int):\n data_width = len(str(v)) + 1\n header_width = len(str(k))\n w = max(data_width, header_width)\n h = ('%% %us'%w)%k\n return ' '*len(h), h, '%%%ud'%w\n elif k=='dt':\n fmt = '%6.3...
[ "0.59635484", "0.5520702", "0.5457944", "0.54207", "0.5350413", "0.5347729", "0.5347187", "0.5327935", "0.53164715", "0.53077406", "0.5262094", "0.5207229", "0.5207229", "0.51810014", "0.5175114", "0.51656723", "0.5141616", "0.51369876", "0.51341087", "0.51255035", "0.5115307...
0.568076
1
Formats the location using the long geocommit format >>> l = Location(42.1, 23.5, "test") >>> l.format_long_geocommit()
def format_long_geocommit(self): geocommit = "geocommit (1.0)\n" geocommit += self.format_geocommit(": ", "\n") geocommit += "\n\n" return geocommit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_short_geocommit(self):\r\n geocommit = \"geocommit(1.0): \"\r\n geocommit += self.format_geocommit(\" \", \", \")\r\n geocommit += \";\"\r\n\r\n return geocommit", "def format_latlon(lat: float, lon: float) -> str:\n if lat < 0:\n latdir = \"S\"\n e...
[ "0.6449494", "0.5818637", "0.57956123", "0.57563007", "0.5687247", "0.55729204", "0.55175114", "0.5450161", "0.5328889", "0.53174734", "0.5223536", "0.52226293", "0.51880616", "0.5184553", "0.51536745", "0.51523906", "0.5143899", "0.513625", "0.5133939", "0.51274645", "0.5106...
0.7905342
0
Formats the location using the long geocommit format >>> l = Location(42.1, 23.5, "test") >>> l.format_short_geocommit()
def format_short_geocommit(self): geocommit = "geocommit(1.0): " geocommit += self.format_geocommit(" ", ", ") geocommit += ";" return geocommit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_long_geocommit(self):\r\n geocommit = \"geocommit (1.0)\\n\"\r\n geocommit += self.format_geocommit(\": \", \"\\n\")\r\n geocommit += \"\\n\\n\"\r\n\r\n return geocommit", "def short_def(self):\r\n return f\"{self.lat}, {self.lon}\"", "def from_short_format(data):\...
[ "0.78306407", "0.64534444", "0.62554103", "0.61308855", "0.60158163", "0.5945876", "0.5859429", "0.57603073", "0.5721214", "0.55733645", "0.55531913", "0.55373216", "0.55149174", "0.54258066", "0.54249513", "0.54163617", "0.53930986", "0.5350871", "0.5336369", "0.5322799", "0...
0.7280461
1
Parses a string in short format to create an instance of the class. >>> l = Location.from_short_format(
def from_short_format(data): m = re.search("geocommit\(1\.0\): ((?:[a-zA-Z0-9_-]+ [^,;]+, )*)([a-zA-Z0-9_-]+ [^,;]+);", data) if m is None: return None values = m.group(1) + m.group(2) data = dict() for keyval in re.split(",\s+", values): ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_location(location):\n city, state = location.strip().split(',')\n return f\"{city.strip().replace(' ', '-')}-{state.strip().replace(' ', '-')}\"", "def from_str(cls, string):", "def parse_location(location_str):\n def floatify(latlon):\n \"\"\" Turns a latlon string into a flo...
[ "0.5796067", "0.57846785", "0.5758145", "0.5640593", "0.5627394", "0.5549736", "0.53233117", "0.5281842", "0.526684", "0.52663153", "0.5237364", "0.51908535", "0.51495135", "0.5133941", "0.511369", "0.5065242", "0.5057992", "0.50402415", "0.5021159", "0.5001185", "0.49983492"...
0.6709516
0
Retrieves a location using this LocationProvider. Should be overwritten in specialisations of this class.
def get_location(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location(self) -> models.Location:\n return models.Location.get(region=self, name=self.name, deleted=False)", "def get_location(self):\n return self.location", "def get_location(self):\n\t\treturn self.location", "def get_location(self):\r\n return self.__location", "def _get_l...
[ "0.7753154", "0.76495415", "0.7630321", "0.7557997", "0.75226474", "0.74665785", "0.7435566", "0.74313676", "0.73154056", "0.7309289", "0.72279537", "0.7225498", "0.7192612", "0.7192612", "0.71177167", "0.7008181", "0.69932073", "0.69932073", "0.6984769", "0.69491065", "0.693...
0.68752146
23
Retrieves all nearby access points. Should be overwritten in specialisations of this class.
def get_access_points(self): return {"invalid mac": {"mac": "invalid mac", "ssid": "none"}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def near(self, meters):\n lng = self.position['coordinates'][0]\n lat = self.position['coordinates'][1]\n\n return Location.objects(position__near=[lng, lat], position__max_distance=meters)", "async def get_all_accesspoints(self) -> list[NetworkWirelessAP]:\n accesspoints_data = await...
[ "0.61669075", "0.6093544", "0.604198", "0.5997114", "0.59545606", "0.59494096", "0.5789342", "0.57684696", "0.57039857", "0.5678461", "0.5651898", "0.5641419", "0.5637641", "0.5613552", "0.5607629", "0.56046563", "0.56018794", "0.55903774", "0.55815107", "0.5577816", "0.55617...
0.0
-1
Creates a JSON request string for location information from google. The access points are a map from mac addresses to access point information dicts. >>> wlp = WifiLocationProvider() >>> wlp.request_dict()["wifi_towers"]
def request_dict(self): ap_map = self.get_access_points() if not ap_map: return None request = dict() request["version"] = "1.1.0" request["host"] = "localhost" request["request_address"] = True request["address_language"] = "en_GB" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google(self):\r\n prefix ='https://maps.googleapis.com/maps/api/staticmap?center='\r\n middle = '&zoom=14&size=400x400&markers='\r\n suffix = '&key=AIzaSyD5nqmDGFH1SUZxJAYVtFHP7RNjjFE9CHg'\r\n marker = '+'.join(self.placeToSearch) # marker in google format, no space but + separator\...
[ "0.54804015", "0.53161436", "0.5291573", "0.5062097", "0.50081235", "0.49757034", "0.49650696", "0.49560982", "0.49435157", "0.49330306", "0.49222854", "0.48264238", "0.4785291", "0.4694317", "0.46646068", "0.4656133", "0.46497852", "0.4645924", "0.46358958", "0.46351212", "0...
0.70129
0
Converts a Google JSON response into a location object >>> wlp = WifiLocationProvider()
def location_from_dict(self, data): if not data.has_key("location"): return None ldata = data["location"] location = Location(ldata["latitude"], ldata["longitude"], self.name) optional_keys = { "altitude": "alt", "accuracy": "hacc", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_location_details(self, location):\n resp = requests.get(\n self.base_url,\n params = {\n 'address': ''.join(location.split(' ')),\n 'key': GOOGLE_API_KEY,\n }\n )\n return resp.json()", "def getLocation(self):\n s...
[ "0.5974814", "0.59591895", "0.5927976", "0.58715785", "0.58531946", "0.5832747", "0.580127", "0.580127", "0.57854533", "0.5756534", "0.5724387", "0.57035905", "0.5642393", "0.5549555", "0.5529168", "0.5524611", "0.5499603", "0.5488703", "0.54848623", "0.548114", "0.5437042", ...
0.56601113
12
Sends a JSON request to google geolocation and parses the response >>> wlp = WifiLocationProvider()
def json_request(self, data): json_request = json.dumps(data, indent=4) try: result = urllib2.urlopen(self.webservice, json_request).read() except urllib2.URLError, e: return None try: response = json.loads(result) except ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLocation(self):\n send_url = 'https://ipinfo.io'\n r = requests.get(send_url)\n resp = json.loads(r.text)\n logging.info(\"GeoLoc: {}\".format(resp))\n return resp", "def getGeo(self):\n command = f'curl -s -m 5 http://ip-api.com/json/' + self.ip\n result =...
[ "0.6605563", "0.6393113", "0.6295248", "0.622101", "0.606464", "0.6008153", "0.57522696", "0.5721718", "0.57157815", "0.5683287", "0.56634706", "0.5638915", "0.56357163", "0.5595905", "0.55884135", "0.55500716", "0.5509407", "0.5507103", "0.55044156", "0.5499998", "0.54815227...
0.0
-1
Retrieves a location from Google Geolocation API based on Wifi APs.
def get_location(self): request = self.request_dict() if not request: return None location = self.json_request(request) if not location: return None if location.has_key("access_token"): self.access_token = location["access_token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rogueap_location(self, conn, macaddr: str, offset=0, limit=100, units=\"FEET\"):\n path = urlJoin(urls.ROGUE_LOCATION[\"GET_AP_LOC\"], macaddr)\n params = {\n \"offset\": offset,\n \"limit\": limit,\n \"units\": units\n }\n resp = conn.command(ap...
[ "0.63196516", "0.61935186", "0.61679256", "0.5916524", "0.5898339", "0.58925164", "0.57678634", "0.57564193", "0.57287663", "0.56398714", "0.56225747", "0.5619764", "0.55834264", "0.55488384", "0.5495334", "0.54464465", "0.5441897", "0.5391288", "0.53513193", "0.53510875", "0...
0.5033922
41
Extract features from points.
def extract_feat(self, points, img_metas=None): voxels, num_points, coors = self.voxelize(points) voxel_features = self.voxel_encoder(voxels, num_points, coors) batch_size = coors[-1, 0].item() + 1 x = self.middle_encoder(voxel_features, coors, batch_size) x = self.backbone(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_feat(self, points, img, img_metas):\n img_feats = self.extract_img_feat(img, img_metas)\n pts_feats = self.extract_pts_feat(points, img_feats, img_metas)\n return (img_feats, pts_feats)", "def extract_features(input_feature_map, points=conv43Points):\n arr = []\n for y,x in...
[ "0.76258445", "0.75479424", "0.7520793", "0.7304446", "0.72170246", "0.7079929", "0.68441653", "0.6794022", "0.6782572", "0.6651835", "0.6640643", "0.66359365", "0.65395874", "0.6499239", "0.6448742", "0.6447992", "0.642975", "0.6423805", "0.63974905", "0.6388154", "0.6350114...
0.7565338
1
Apply hard voxelization to points.
def voxelize(self, points): voxels, coors, num_points = [], [], [] for res in points: res_voxels, res_coors, res_num_points = self.voxel_layer(res) voxels.append(res_voxels) coors.append(res_coors) num_points.append(res_num_points) voxels = torch.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voxelize(self, points):\n voxels, coors, num_points = [], [], []\n for res in points:\n res_voxels, res_coors, res_num_points = self.pts_voxel_layer(res)\n voxels.append(res_voxels)\n coors.append(res_coors)\n num_points.append(res_num_points)\n ...
[ "0.6439414", "0.6234096", "0.61848783", "0.61010504", "0.6074771", "0.58545244", "0.5738699", "0.5695123", "0.56734055", "0.5653354", "0.5604796", "0.56036615", "0.55895144", "0.557377", "0.55472815", "0.5544818", "0.55416125", "0.54999644", "0.54610586", "0.54565", "0.543493...
0.6423426
1
Test function without augmentaiton.
def simple_test(self, points, img_metas, imgs=None, rescale=False): x = self.extract_feat(points, img_metas) outs = self.bbox_head(x) bbox_list = self.bbox_head.get_bboxes( *outs, img_metas, rescale=rescale) bbox_results = [ bbox3d2result(bboxes, scores, labels) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_func():\n pass", "def istest(func):\n func.__test__ = True\n return func", "def test_empty_functions():", "def test():\r\n pass", "def test():\n pass", "def test():\n pass", "def test():", "def test():", "def nottest(func):\n func.__test__ = False\n return func"...
[ "0.8132576", "0.8071819", "0.800281", "0.7998863", "0.79607767", "0.7866433", "0.77652454", "0.77652454", "0.775515", "0.76536846", "0.74718827", "0.74428475", "0.7407458", "0.7383898", "0.7348863", "0.72939146", "0.72939146", "0.72939146", "0.72939146", "0.72939146", "0.7263...
0.0
-1
Test function with augmentaiton.
def aug_test(self, points, img_metas, imgs=None, rescale=False): feats = self.extract_feats(points, img_metas) # only support aug_test for one sample aug_bboxes = [] for x, img_meta in zip(feats, img_metas): outs = self.bbox_head(x) bbox_list = self.bbox_head.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():", "def test():", "def test():\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def test():\r\n pass", "def test_func():\n pass", "def test_something():", "def istest(func):\n func.__test__ = True\n ret...
[ "0.74091053", "0.74091053", "0.7398965", "0.7205164", "0.7205164", "0.7205164", "0.7205164", "0.7205164", "0.71508545", "0.71262884", "0.71077543", "0.70619524", "0.70262593", "0.6987379", "0.6978902", "0.69609225", "0.6952422", "0.69435656", "0.69096893", "0.6908036", "0.689...
0.0
-1
Load the grid data from the sample earth_relief file.
def fixture_grid(): return load_earth_relief(registration="pixel")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_grid():\n return load_earth_relief(registration=\"gridline\")", "def load_train_grid40(return_imsize=True):\n file_base_path = os.path.join(rlvision.RLVISION_DATA,\n \"train\", \"gridworld_40\", \"gridworld_40\")\n\n if not os.path.isfile(file_base_path+\".h5...
[ "0.71628165", "0.65157515", "0.64941037", "0.6290516", "0.6283898", "0.6261977", "0.6137829", "0.59520215", "0.5852507", "0.58480215", "0.5800172", "0.5742071", "0.57125926", "0.57125765", "0.5712251", "0.5711601", "0.5700506", "0.5699708", "0.5662421", "0.5648323", "0.561772...
0.7127945
1
grdfilter an input DataArray, and output as DataArray.
def test_grdfilter_dataarray_in_dataarray_out(grid): result = grdfilter(grid=grid, filter="g600", distance="4") # check information of the output grid assert isinstance(result, xr.DataArray) assert result.coords["lat"].data.min() == -89.5 assert result.coords["lat"].data.max() == 89.5 assert res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grdfilter_dataarray_in_file_out(grid):\n with GMTTempFile(suffix=\".nc\") as tmpfile:\n result = grdfilter(grid, outgrid=tmpfile.name, filter=\"g600\", distance=\"4\")\n assert result is None # grdfilter returns None if output to a file\n result = grdinfo(tmpfile.name, per_column=...
[ "0.72438073", "0.71895283", "0.6108349", "0.6072146", "0.60382855", "0.6018336", "0.58795875", "0.58754164", "0.5870362", "0.5869875", "0.5862751", "0.5731808", "0.56614274", "0.5651315", "0.56284916", "0.5540049", "0.55231196", "0.5522951", "0.5522951", "0.54774076", "0.5467...
0.75263023
0
grdfilter an input DataArray, and output to a grid file.
def test_grdfilter_dataarray_in_file_out(grid): with GMTTempFile(suffix=".nc") as tmpfile: result = grdfilter(grid, outgrid=tmpfile.name, filter="g600", distance="4") assert result is None # grdfilter returns None if output to a file result = grdinfo(tmpfile.name, per_column=True) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grdfilter_file_in_dataarray_out():\n outgrid = grdfilter(\n \"@earth_relief_01d\", region=\"0/180/0/90\", filter=\"g600\", distance=\"4\"\n )\n assert isinstance(outgrid, xr.DataArray)\n assert outgrid.gmt.registration == 1 # Pixel registration\n assert outgrid.gmt.gtype == 1 # Geo...
[ "0.74676794", "0.6965203", "0.6943156", "0.57479334", "0.5405306", "0.5393092", "0.53729516", "0.5346795", "0.5268873", "0.5247941", "0.5225041", "0.52224445", "0.52160496", "0.5199661", "0.51719517", "0.5155658", "0.5155277", "0.5070777", "0.50582415", "0.50448567", "0.50338...
0.77258784
0
grdfilter an input grid file, and output as DataArray.
def test_grdfilter_file_in_dataarray_out(): outgrid = grdfilter( "@earth_relief_01d", region="0/180/0/90", filter="g600", distance="4" ) assert isinstance(outgrid, xr.DataArray) assert outgrid.gmt.registration == 1 # Pixel registration assert outgrid.gmt.gtype == 1 # Geographic type # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grdfilter_dataarray_in_file_out(grid):\n with GMTTempFile(suffix=\".nc\") as tmpfile:\n result = grdfilter(grid, outgrid=tmpfile.name, filter=\"g600\", distance=\"4\")\n assert result is None # grdfilter returns None if output to a file\n result = grdinfo(tmpfile.name, per_column=...
[ "0.82479215", "0.73520637", "0.7201283", "0.63456845", "0.63165814", "0.585526", "0.576018", "0.57303125", "0.56888694", "0.5629014", "0.5605087", "0.55669653", "0.5533368", "0.5529867", "0.55254185", "0.5519094", "0.54980975", "0.5455956", "0.5448404", "0.54415244", "0.54415...
0.76401544
1
grdfilter an input grid file, and output to a grid file.
def test_grdfilter_file_in_file_out(): with GMTTempFile(suffix=".nc") as tmpfile: result = grdfilter( "@earth_relief_01d", outgrid=tmpfile.name, region=[0, 180, 0, 90], filter="g600", distance="4", ) assert result is None # return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grdfilter_dataarray_in_file_out(grid):\n with GMTTempFile(suffix=\".nc\") as tmpfile:\n result = grdfilter(grid, outgrid=tmpfile.name, filter=\"g600\", distance=\"4\")\n assert result is None # grdfilter returns None if output to a file\n result = grdinfo(tmpfile.name, per_column=...
[ "0.704675", "0.68028927", "0.5841552", "0.58407056", "0.57574695", "0.5738572", "0.5637733", "0.5556143", "0.55201113", "0.54455745", "0.54209566", "0.5312087", "0.529742", "0.52541614", "0.5249761", "0.52250904", "0.5192693", "0.5181852", "0.5169016", "0.51613814", "0.516137...
0.7821418
0
Check that grdfilter fails correctly.
def test_grdfilter_fails(): with pytest.raises(GMTInvalidInput): grdfilter(np.arange(10).reshape((5, 2)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_errors(self):\n\n with self.assertRaises(ValueError):\n self.test_table.filter()\n\n with self.assertRaises(ValueError):\n self.test_table.filter(mode='wrongmode', Property='Property')", "def test_filter_function_settings_fail(self):\n with self.assertRa...
[ "0.67835367", "0.6310252", "0.62462205", "0.61204123", "0.6087536", "0.60227674", "0.59823984", "0.59056413", "0.58599424", "0.57920605", "0.573395", "0.5714643", "0.5699136", "0.5680347", "0.5672416", "0.56558776", "0.56553173", "0.56384057", "0.563598", "0.55971026", "0.558...
0.71679807
0
Ensure tests are running
def test_this_is_working(self): self.assertEqual(1, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_started(self):", "def runTests(self):\n \n pass", "def startTestRun(self):", "def do_test(self):\n\t\tshutit_global.shutit_global_object.yield_to_draw()\n\t\tif not self.build['dotest']:\n\t\t\tself.log('Tests configured off, not running',level=logging.DEBUG)\n\t\t\treturn\n\t\t# Test ...
[ "0.7622389", "0.7469543", "0.73592174", "0.7115611", "0.70846725", "0.70702255", "0.70586264", "0.6923004", "0.6884074", "0.6880718", "0.68450254", "0.68419343", "0.6823735", "0.6821682", "0.68007135", "0.6797732", "0.67934436", "0.67854553", "0.67481923", "0.669763", "0.6676...
0.0
-1
Generate Pydantic Model files given the Postman Collection input file.
def generate_models(input_file): if not os.path.exists(input_file): console.print( f":pile_of_poo: [bold red]No file found at the given path:[/bold red] [i yellow]{input_file}[/i yellow]" ) exit(1) # TODO: Add try/catch for other possible errors collection = postman.load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_models():\n return [\n PDBFile(\n Path(golden_data, \"protdna_complex_1.pdb\"),\n path=golden_data,\n score=42.0,\n restr_fname=Path(golden_data, \"example_ambig_1.tbl\")\n ),\n PDBFile(\n Path(golden_data, \"protdna_compl...
[ "0.56165767", "0.5588253", "0.5478929", "0.54493415", "0.5426958", "0.53957415", "0.53064173", "0.52855295", "0.52591866", "0.52293295", "0.5166549", "0.50401545", "0.5026971", "0.50226295", "0.5017243", "0.4993968", "0.4981129", "0.49646968", "0.4943805", "0.4927351", "0.491...
0.7841486
0
Tests that update_status creates a correctly formatted url. Compares the url created by update_status to correct_url
def test_update_status(self): content_url = 'https://api.github.com' status = 'success' token = '123' correct_url = 'https://123:x-oauth-basic@api.github.com/' post_req = update_status(content_url, status, token) self.assertEqual(correct_url, post_req.url) """ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkServiceURL(self, serviceName, options):\n url = self._getURL(serviceName, options)\n system = options['System']\n module = options['Module']\n self.log.info(\"Checking URLs for %s/%s\" % (system, module))\n urlsConfigPath = os.path.join('/Systems', system, self.setup, 'URLs', module)\n ...
[ "0.6494839", "0.63909346", "0.62975353", "0.61703724", "0.61658883", "0.61041194", "0.6101163", "0.6069293", "0.59918106", "0.5973078", "0.5959037", "0.59548736", "0.59496254", "0.5906024", "0.5898634", "0.58770066", "0.58564144", "0.58474356", "0.58468753", "0.5846074", "0.5...
0.7175717
0
Helper method for making a request to the Blockstore REST API
def api_request(method, url, **kwargs): if not settings.BLOCKSTORE_API_AUTH_TOKEN: raise ImproperlyConfigured("Cannot use Blockstore unless BLOCKSTORE_API_AUTH_TOKEN is set.") kwargs.setdefault('headers', {})['Authorization'] = f"Token {settings.BLOCKSTORE_API_AUTH_TOKEN}" response = requests.reques...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBlocks(request):\n if request.method == 'GET':\n blockName = request.GET.get('block', '')\n bid = request.GET.get('bid', '')\n districtName=request.GET.get('district', '')\n stateName=request.GET.get('state', '')\n limit=request.GET.get('limit', '')\n if limit ==...
[ "0.63156694", "0.63156694", "0.58579916", "0.5850182", "0.58061534", "0.5766906", "0.57296586", "0.57222426", "0.5660935", "0.56325656", "0.55943286", "0.5584792", "0.5576492", "0.5573743", "0.5564736", "0.55544657", "0.5547002", "0.5537741", "0.55332834", "0.55300415", "0.55...
0.7547545
0
Given data about a Collection returned by any blockstore REST API, convert it to a Collection instance.
def _collection_from_response(data): return Collection(uuid=UUID(data['uuid']), title=data['title'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_collection(self, collection, request, environ, start_response,\n response_headers):\n response_type = self.content_negotiation(\n request, environ, self.ValueTypes)\n if response_type is None:\n return self.odata_error(\n reques...
[ "0.6577779", "0.6343278", "0.6237831", "0.6221495", "0.6207642", "0.6203012", "0.6195551", "0.6181388", "0.6098431", "0.6020433", "0.60099417", "0.5990563", "0.5976519", "0.5969405", "0.5889118", "0.58554935", "0.58416325", "0.5817092", "0.5749313", "0.57408684", "0.57094455"...
0.71289414
0
Given data about a Bundle returned by any blockstore REST API, convert it to a Bundle instance.
def _bundle_from_response(data): return Bundle( uuid=UUID(data['uuid']), title=data['title'], description=data['description'], slug=data['slug'], # drafts: Convert from a dict of URLs to a dict of UUIDs: drafts={draft_name: UUID(url.split('/')[-1]) for (draft_name, ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundle_instance(obj):\n\n content, contents = osl_encode(obj, True)\n # should be a bunch of documents, not just one.\n bundle = [json.dumps(c) for c in contents]\n return bundle", "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions]...
[ "0.6342084", "0.6269155", "0.62631524", "0.6151707", "0.60612935", "0.5925814", "0.59022117", "0.5898795", "0.5896431", "0.58471715", "0.5792275", "0.5681991", "0.56783265", "0.56710964", "0.566184", "0.5634402", "0.56337357", "0.56250954", "0.5600761", "0.5547723", "0.554208...
0.76745385
0
Given data about a Draft returned by any blockstore REST API, convert it to a Draft instance.
def _draft_from_response(data): return Draft( uuid=UUID(data['uuid']), bundle_uuid=UUID(data['bundle_uuid']), name=data['name'], updated_at=dateutil.parser.parse(data['staged_draft']['updated_at']), files={ path: DraftFile(path=path, **file) for path, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_draft(self):\n return Draft(self)", "def convert_to_draft(self, source_location):\r\n if source_location.category in DIRECT_ONLY_CATEGORIES:\r\n raise InvalidVersionError(source_location)\r\n original = self.collection.find_one({'_id': source_location.to_deprecated_son(...
[ "0.6512679", "0.6157547", "0.58887076", "0.5854836", "0.57501346", "0.5479013", "0.54623795", "0.5257162", "0.5218776", "0.51486325", "0.51365983", "0.5121651", "0.50962335", "0.50772154", "0.5046453", "0.4987209", "0.49718696", "0.49420643", "0.48823994", "0.4866242", "0.482...
0.75933146
0
Retrieve metadata about the specified collection Raises CollectionNotFound if the collection does not exist
def get_collection(collection_uuid): assert isinstance(collection_uuid, UUID) try: data = api_request('get', api_url('collections', str(collection_uuid))) except NotFound: raise CollectionNotFound(f"Collection {collection_uuid} does not exist.") # lint-amnesty, pylint: disable=raise-missing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection(self, collection):\r\n\t\tself.fetch_collections()\r\n\t\tif collection is not None:\r\n\t\t\treturn self._collections[collection]\r\n\t\treturn None", "def get_collection(self, collection):\n return self.database[collection]", "def __find_collection_in_meta(self, db_name, collection_name...
[ "0.7305138", "0.69398516", "0.68930227", "0.6497091", "0.6449103", "0.6319241", "0.6290924", "0.62775695", "0.6266724", "0.6266204", "0.6262986", "0.6204985", "0.6163578", "0.6105707", "0.60913056", "0.60794675", "0.6076522", "0.6055384", "0.6033745", "0.6032824", "0.6010094"...
0.60184395
20
Create a new collection.
def create_collection(title): result = api_request('post', api_url('collections'), json={"title": title}) return _collection_from_response(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_collection(collection):\n return db[collection]", "def collection_create(self, name):\n try:\n return CastleCollection(name, self)\n except:\n raise", "def test_create_collection(self):\n pass", "def create_collections(self):\n\n ''''''", "def...
[ "0.7994884", "0.7690659", "0.75408405", "0.7422378", "0.7185147", "0.71705693", "0.7120078", "0.71186167", "0.7102771", "0.704654", "0.69963944", "0.69785434", "0.6919937", "0.6918079", "0.6877754", "0.68428624", "0.6807147", "0.68062043", "0.67231405", "0.67221653", "0.67078...
0.75662047
2
Update a collection's title
def update_collection(collection_uuid, title): assert isinstance(collection_uuid, UUID) data = {"title": title} result = api_request('patch', api_url('collections', str(collection_uuid)), json=data) return _collection_from_response(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_title(self, title):\n if type(title) != str:\n raise Exception(\"title is not a string\")\n\n self.__title_var.set(title)", "def _UpdateTitle(self, event, new_title='Updated event title'):\n\n previous_title = event.title.text\n event.title.text = new_title\n print 'U...
[ "0.7148695", "0.70232713", "0.70118755", "0.69351953", "0.6923893", "0.6876951", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", "0.67621106", ...
0.6916492
5
Get the details of all bundles
def get_bundles(uuids=None, text_search=None): query_params = {} if uuids: query_params['uuid'] = ','.join(map(str, uuids)) if text_search: query_params['text_search'] = text_search version_url = api_url('bundles') + '?' + urlencode(query_params) response = api_request('get', version...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_bundles():\n response = houston.get(\"/zipline/bundles\")\n\n houston.raise_for_status_with_json(response)\n return response.json()", "def js_bundle_names(self):\n yield 'djblets-utils'\n yield 'djblets-avatars-config'\n\n for service in self.avatar_service_registry.configu...
[ "0.7786203", "0.6552698", "0.65044695", "0.6455476", "0.6441764", "0.6422063", "0.6287278", "0.61940336", "0.6077372", "0.6044391", "0.6042801", "0.6016157", "0.59816015", "0.5979297", "0.59682506", "0.59142685", "0.59101593", "0.5890483", "0.5887062", "0.58353376", "0.579112...
0.609653
8
Retrieve metadata about the specified bundle Raises BundleNotFound if the bundle does not exist
def get_bundle(bundle_uuid): assert isinstance(bundle_uuid, UUID) try: data = api_request('get', api_url('bundles', str(bundle_uuid))) except NotFound: raise BundleNotFound(f"Bundle {bundle_uuid} does not exist.") # lint-amnesty, pylint: disable=raise-missing-from return _bundle_from_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bundle_file_metadata(bundle_uuid, path, use_draft=None):\n assert isinstance(bundle_uuid, UUID)\n files_dict = get_bundle_files_dict(bundle_uuid, use_draft=use_draft)\n try:\n return files_dict[path]\n except KeyError:\n raise BundleFileNotFound( # lint-amnesty, pylint: disable=r...
[ "0.6519393", "0.6253627", "0.57244164", "0.55816317", "0.5546743", "0.5535242", "0.5494695", "0.54787546", "0.54765534", "0.54500854", "0.54294044", "0.5417688", "0.53673923", "0.53673923", "0.5361767", "0.53374165", "0.5311152", "0.53036445", "0.5297356", "0.52674055", "0.52...
0.5795087
2
Create a new bundle. Note that description is currently required.
def create_bundle(collection_uuid, slug, title="New Bundle", description=""): result = api_request('post', api_url('bundles'), json={ "collection_uuid": str(collection_uuid), "slug": slug, "title": title, "description": description, }) return _bundle_from_response(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_bundle(self):\n self._highest_bundle_id += 1\n bundle = Bundle(document=self, bundle_id=str(self._highest_bundle_id))\n self.bundles.append(bundle)\n bundle.number = len(self.bundles)\n return bundle", "def firmware_pack_create(handle, org_name, name, rack_bundle_ver...
[ "0.668372", "0.62939143", "0.6256046", "0.61546004", "0.61484855", "0.6085676", "0.6012268", "0.5936996", "0.5896103", "0.5847529", "0.58094597", "0.5789102", "0.57620066", "0.57466364", "0.5724561", "0.5723571", "0.5719755", "0.5677166", "0.5674543", "0.5627814", "0.5617824"...
0.71486557
0
Update a bundle's title, description, slug, or collection.
def update_bundle(bundle_uuid, **fields): assert isinstance(bundle_uuid, UUID) data = {} # Most validation will be done by Blockstore, so we don't worry too much about data validation for str_field in ("title", "description", "slug"): if str_field in fields: data[str_field] = fields....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_in_place(self, request, original_bundle, new_data):\r\n\r\n # TODO: Is this the place to use MongoDB atomic operations to update the document?\r\n\r\n from tastypie.utils import dict_strip_unicode_keys\r\n original_bundle.data.update(**dict_strip_unicode_keys(new_data))\r\n\r\n ...
[ "0.64282304", "0.5881592", "0.58728546", "0.5861083", "0.5718554", "0.56827384", "0.5633981", "0.5599242", "0.55933994", "0.55191696", "0.54296964", "0.5405867", "0.54009414", "0.5397951", "0.5393401", "0.5391082", "0.5379236", "0.53778917", "0.5375577", "0.5358188", "0.53553...
0.7425863
0
Retrieve metadata about the specified draft. If you don't know the draft's UUID, look it up using get_bundle()
def get_draft(draft_uuid): assert isinstance(draft_uuid, UUID) try: data = api_request('get', api_url('drafts', str(draft_uuid))) except NotFound: raise DraftNotFound(f"Draft does not exist: {draft_uuid}") # lint-amnesty, pylint: disable=raise-missing-from return _draft_from_response(da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self,\n draft_id,\n ):\n return self._invoke('get',\n {\n 'draft_id': draft_id,\n })", "def get(self, oauth, resource_id, draft_id):\n d = Deposition.get(resource_id, user=current_user)\n ...
[ "0.67328864", "0.6331739", "0.6144933", "0.58064723", "0.5665685", "0.5603166", "0.55384314", "0.5455672", "0.53143066", "0.531383", "0.5187394", "0.5155247", "0.5139512", "0.51386", "0.5116797", "0.5080759", "0.5057689", "0.5048839", "0.50426704", "0.50284934", "0.50284934",...
0.57508475
4
Retrieve metadata about the specified draft.
def get_or_create_bundle_draft(bundle_uuid, draft_name): bundle = get_bundle(bundle_uuid) try: return get_draft(bundle.drafts[draft_name]) # pylint: disable=unsubscriptable-object except KeyError: # The draft doesn't exist yet, so create it: response = api_request('post', api_url('d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self,\n draft_id,\n ):\n return self._invoke('get',\n {\n 'draft_id': draft_id,\n })", "def get(self, oauth, resource_id, draft_id):\n d = Deposition.get(resource_id, user=current_user)\n ...
[ "0.6504005", "0.60097516", "0.57217854", "0.5682793", "0.5668223", "0.5561862", "0.5507919", "0.54667366", "0.5463275", "0.54286134", "0.5427839", "0.54156", "0.5385616", "0.5367478", "0.5338896", "0.5338896", "0.5327211", "0.53266174", "0.53234196", "0.5313462", "0.52506757"...
0.0
-1
Commit all of the pending changes in the draft, creating a new version of the associated bundle. Does not return any value.
def commit_draft(draft_uuid): api_request('post', api_url('drafts', str(draft_uuid), 'commit'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit(self):\n self.create()\n return self.refresh()", "async def commit(self):\n if await self.is_valid():\n await self.update(committed=True).apply()", "def commit(self):\n return", "def Commit(self, request, context):\n context.code(beta_interfaces.StatusCode...
[ "0.6353239", "0.599407", "0.59923935", "0.590607", "0.5880677", "0.5827969", "0.57992727", "0.579128", "0.5776125", "0.5776125", "0.5776125", "0.5776125", "0.5776125", "0.5657164", "0.56538993", "0.5624831", "0.5623977", "0.559058", "0.5577797", "0.5562359", "0.55580884", "...
0.5923847
3
Delete the specified draft, removing any staged changes/files/deletes. Does not return any value.
def delete_draft(draft_uuid): api_request('delete', api_url('drafts', str(draft_uuid)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self,\n draft_id,\n ):\n return self._invoke('delete',\n {\n 'draft_id': draft_id,\n })", "def _delete_draft_message(draft):\n if draft is not None:\n draft.key.delete()\n return Ht...
[ "0.8477247", "0.7536803", "0.70039415", "0.6800242", "0.6678656", "0.6091169", "0.59882015", "0.598721", "0.5658908", "0.5609526", "0.55231327", "0.55021924", "0.5446673", "0.54136", "0.5397559", "0.53314614", "0.53098047", "0.5283851", "0.52465004", "0.5162799", "0.5152421",...
0.78767365
1
Get the details of the specified bundle version
def get_bundle_version(bundle_uuid, version_number): if version_number == 0: return None version_url = api_url('bundle_versions', str(bundle_uuid) + ',' + str(version_number)) return api_request('get', version_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n return about.get_version()", "def get_version(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/version\").json()", "def _get_via_app_bundle(self, path: pathlib.Path | str) -> str:\n\n path = pathlib.Path(path) / \"Contents\" / \"Info.plist\"\n\n if not...
[ "0.71063685", "0.7055568", "0.69581395", "0.6899469", "0.68665576", "0.68434507", "0.6821725", "0.6754685", "0.6730333", "0.6705119", "0.67003167", "0.6696833", "0.6665585", "0.66480154", "0.6647472", "0.663893", "0.6636554", "0.66245484", "0.6607001", "0.658064", "0.6521611"...
0.7637766
0
Get a list of the files in the specified bundle version
def get_bundle_version_files(bundle_uuid, version_number): if version_number == 0: return [] version_info = get_bundle_version(bundle_uuid, version_number) return [BundleFile(path=path, **file_metadata) for path, file_metadata in version_info["snapshot"]["files"].items()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_files(self, package, version):\n with self._conn.begin():\n return {\n row.filename\n for row in self._conn.execute(\n \"SELECT filename \"\n \"FROM get_version_files(%s, %s)\", (package, version)\n ...
[ "0.7293217", "0.69692844", "0.6767985", "0.65724486", "0.65694773", "0.6546248", "0.6306112", "0.6290885", "0.6254722", "0.6251354", "0.6199755", "0.6197552", "0.61879873", "0.61280656", "0.61088586", "0.60504794", "0.60438734", "0.59778523", "0.5970127", "0.5940632", "0.5922...
0.7863409
0
Get a dictionary of the links in the specified bundle version
def get_bundle_version_links(bundle_uuid, version_number): if version_number == 0: return {} version_info = get_bundle_version(bundle_uuid, version_number) return { name: LinkDetails( name=name, direct=LinkReference(**link["direct"]), indirect=[LinkReferen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bundle_links(bundle_uuid, use_draft=None):\n bundle = get_bundle(bundle_uuid)\n if use_draft and use_draft in bundle.drafts: # pylint: disable=unsupported-membership-test\n draft_uuid = bundle.drafts[use_draft] # pylint: disable=unsubscriptable-object\n return get_draft(draft_uuid).li...
[ "0.65551144", "0.63308424", "0.6044713", "0.5982717", "0.5820173", "0.58162254", "0.5697063", "0.5680008", "0.5680008", "0.5654119", "0.5614463", "0.5573144", "0.55640477", "0.55347484", "0.5501417", "0.5493479", "0.5456731", "0.5444286", "0.54436064", "0.5442817", "0.5428819...
0.7957789
0
Get a dict of all the files in the specified bundle. Returns a dict where the keys are the paths (strings) and the values are BundleFile or DraftFile tuples.
def get_bundle_files_dict(bundle_uuid, use_draft=None): bundle = get_bundle(bundle_uuid) if use_draft and use_draft in bundle.drafts: # pylint: disable=unsupported-membership-test draft_uuid = bundle.drafts[use_draft] # pylint: disable=unsubscriptable-object return get_draft(draft_uuid).files ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bundle_files(bundle_uuid, use_draft=None):\n return get_bundle_files_dict(bundle_uuid, use_draft).values() # lint-amnesty, pylint: disable=dict-values-not-iterating", "def get_bundle_version_files(bundle_uuid, version_number):\n if version_number == 0:\n return []\n version_info = get_bu...
[ "0.7790072", "0.64431036", "0.63394016", "0.63182753", "0.630003", "0.62759304", "0.6194732", "0.6178175", "0.61479455", "0.6144583", "0.6076846", "0.60737944", "0.6040074", "0.5976576", "0.59606755", "0.5862239", "0.5857732", "0.58249676", "0.5790602", "0.5765096", "0.576296...
0.8014129
0
Get an iterator over all the files in the specified bundle or draft.
def get_bundle_files(bundle_uuid, use_draft=None): return get_bundle_files_dict(bundle_uuid, use_draft).values() # lint-amnesty, pylint: disable=dict-values-not-iterating
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(self, block):\n \n raise NotImplementedError('get_files')", "def __iter__(self):\n\n return iter(self.files)", "def getFiles(self, getContent=False):\n for index, file in enumerate(self.files):\n if getContent:\n logger.debug(\n ...
[ "0.61938465", "0.6149882", "0.61284655", "0.60207605", "0.5920121", "0.5907837", "0.5906147", "0.58372724", "0.5820502", "0.5797337", "0.575836", "0.5687807", "0.56840444", "0.56556374", "0.56395537", "0.5559454", "0.5515556", "0.54998755", "0.54887193", "0.54826784", "0.5477...
0.6996779
0
Get a dict of all the links in the specified bundle. Returns a dict where the keys are the link names (strings) and the values are LinkDetails or DraftLinkDetails tuples.
def get_bundle_links(bundle_uuid, use_draft=None): bundle = get_bundle(bundle_uuid) if use_draft and use_draft in bundle.drafts: # pylint: disable=unsupported-membership-test draft_uuid = bundle.drafts[use_draft] # pylint: disable=unsubscriptable-object return get_draft(draft_uuid).links e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bundle_version_links(bundle_uuid, version_number):\n if version_number == 0:\n return {}\n version_info = get_bundle_version(bundle_uuid, version_number)\n return {\n name: LinkDetails(\n name=name,\n direct=LinkReference(**link[\"direct\"]),\n indire...
[ "0.7305899", "0.68209445", "0.6084511", "0.5888304", "0.58443224", "0.58205533", "0.57978463", "0.57962805", "0.57638013", "0.56552774", "0.56552774", "0.56552774", "0.56552774", "0.56552774", "0.5595823", "0.55944407", "0.5573283", "0.5561761", "0.5560517", "0.55239433", "0....
0.73346376
0
Get the metadata of the specified file.
def get_bundle_file_metadata(bundle_uuid, path, use_draft=None): assert isinstance(bundle_uuid, UUID) files_dict = get_bundle_files_dict(bundle_uuid, use_draft=use_draft) try: return files_dict[path] except KeyError: raise BundleFileNotFound( # lint-amnesty, pylint: disable=raise-missin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metadata(self, filename):\n return self.execute_json(filename)[0]", "def get_metadata(self, file_id):\n pass", "def metadata_file(self):\n return self._metadata_file", "def _get_file_meta(cls, file=None, file_path=None):\n if not file and file_path:\n file = ope...
[ "0.83143204", "0.7956004", "0.76730394", "0.738435", "0.73713607", "0.72093016", "0.7183509", "0.7126052", "0.7085625", "0.7016068", "0.70038253", "0.6963683", "0.69587713", "0.68719065", "0.6854037", "0.683621", "0.6826863", "0.68247527", "0.6806132", "0.6795918", "0.679283"...
0.0
-1
Read all the data in the given bundle file and return it as a binary string. Do not use this for large files!
def get_bundle_file_data(bundle_uuid, path, use_draft=None): metadata = get_bundle_file_metadata(bundle_uuid, path, use_draft) with requests.get(metadata.url, stream=True) as r: return r.content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binary(fname):\n with open(fname, 'rb+') as f_name:\n data = f_name.read()\n return data", "def read_binary(self):\n with self.open(\"rb\") as f:\n return f.read()", "def get_binary(self, filepath):\n with open(filepath, \"rb\") as f:\n return b64encode(...
[ "0.71974015", "0.66317815", "0.66020185", "0.6489387", "0.64036137", "0.62352324", "0.6202045", "0.6177646", "0.6148498", "0.614845", "0.6109348", "0.61091924", "0.6097358", "0.6048688", "0.6039264", "0.59987104", "0.59759474", "0.5970356", "0.596682", "0.5955203", "0.5937059...
0.628166
5
Create or overwrite the file at 'path' in the specified draft with the given contents. To delete a file, pass contents=None. If you don't know the draft's UUID, look it up using get_or_create_bundle_draft() Does not return anything.
def write_draft_file(draft_uuid, path, contents): api_request('patch', api_url('drafts', str(draft_uuid)), json={ 'files': { path: encode_str_for_draft(contents) if contents is not None else None, }, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_file(path: Path, content: str) -> None:\n path.touch()\n with path.open(\"w\") as f:\n f.write(content)", "def put_contents( path, name, contents, dryrun = False, get_config=lambda: {}, verbose=False ):\n t_file_fh, t_file_name = tempfile.mkstemp()\n os.close(t_file_fh)\n print(c...
[ "0.59362435", "0.5571267", "0.5565971", "0.55636615", "0.55125356", "0.5481879", "0.5437837", "0.5421367", "0.5293984", "0.5231956", "0.5211434", "0.51726305", "0.5162061", "0.5162061", "0.5150922", "0.51438993", "0.51366174", "0.5113197", "0.5112223", "0.51041156", "0.509784...
0.80568475
0
Create or replace the link with the given name in the specified draft so that it points to the specified bundle version. To delete a link, pass bundle_uuid=None, version=None. If you don't know the draft's UUID, look it up using get_or_create_bundle_draft() Does not return anything.
def set_draft_link(draft_uuid, link_name, bundle_uuid, version): api_request('patch', api_url('drafts', str(draft_uuid)), json={ 'links': { link_name: {"bundle_uuid": str(bundle_uuid), "version": version} if bundle_uuid is not None else None, }, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_bundle_draft(bundle_uuid, draft_name):\n bundle = get_bundle(bundle_uuid)\n try:\n return get_draft(bundle.drafts[draft_name]) # pylint: disable=unsubscriptable-object\n except KeyError:\n # The draft doesn't exist yet, so create it:\n response = api_request('post',...
[ "0.58408153", "0.51587373", "0.49001387", "0.4804741", "0.47611052", "0.47401834", "0.46968883", "0.46876737", "0.45107222", "0.4470004", "0.44540083", "0.4445877", "0.44092384", "0.44081253", "0.44045332", "0.44012755", "0.43953812", "0.4391029", "0.43773264", "0.43721762", ...
0.8172148
0
Given a string, return UTF8 representation that is then base64 encoded.
def encode_str_for_draft(input_str): if isinstance(input_str, str): binary = input_str.encode('utf8') else: binary = input_str return base64.b64encode(binary)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_base64encode(s):\n return base64.b64encode(s).decode(\"utf-8\")", "def convert_to_base64(str):\n str_bytes = str.encode(\"utf-8\")\n str_bytes_base64 = base64.b64encode(str_bytes)\n str_base64 = str_bytes_base64.decode(\"utf-8\")\n return str_base64", "def base64_encode_string(string):\n ...
[ "0.8349008", "0.82634866", "0.8113166", "0.7998077", "0.7926648", "0.77931964", "0.7790754", "0.7628252", "0.7628252", "0.7508145", "0.7495968", "0.7376367", "0.7362331", "0.7323071", "0.7307147", "0.72765124", "0.7257662", "0.7248031", "0.72335285", "0.72253436", "0.7190259"...
0.72494906
17
Ensure that the given URL Blockstore is a URL accessible from the end user's browser.
def force_browser_url(blockstore_file_url): # Hack: on some devstacks, we must necessarily use different URLs for # accessing Blockstore file data from within and outside of docker # containers, but Blockstore has no way of knowing which case any particular # request is for. So it always returns a URL s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def check_url_invalidity(self) -> bool:\n validate = URLValidator()\n try:\n validate(self.args.url)\n return False\n except ValidationError:\n return True", "def check_url(url=None, parse_url=None):\n return ...
[ "0.6467403", "0.61517715", "0.61352235", "0.6027143", "0.6014926", "0.6010201", "0.6007184", "0.599208", "0.59750557", "0.5965351", "0.5957245", "0.5952767", "0.5918729", "0.5906625", "0.589159", "0.58743834", "0.58737737", "0.58627915", "0.5818365", "0.581255", "0.5793624", ...
0.66461307
0
Initialize the weights of the model. The weights are initialized to small random values and the biases to zero. Weights are stored in the variable dictionary named self.params.
def initialize_weights(self, input_dim, std_dev=1e-2): self.params = {} hidden_size = self.hidden_size num_classes = self.num_classes num_layers = self.num_layers ############################################################################# # TODO: Initialize th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)", "def init_weights(model):\n ...", "def init_weights(self):\n \n self.w ...
[ "0.84454", "0.83300084", "0.83285135", "0.8306398", "0.81789726", "0.8172356", "0.81278425", "0.80801696", "0.80633783", "0.8052339", "0.8016938", "0.8014385", "0.7996117", "0.7978683", "0.7978683", "0.7978683", "0.79736733", "0.791141", "0.791141", "0.7864369", "0.7859745", ...
0.7425541
56
Computes the forward pass of a fully connected layer. A fully connected / affine / linear / dense layer applies a linear transformation
def fully_connected_forward(self, X, W, b): ############################################################################# # TODO: Implement the forward pass of a fully connected layer and store # # the variables needed for the backward pass (gradient computation) # #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n\t\t## Conv layers\n\t\tx = self.avgpool(F.tanh(self.conv1(x)))\n\t\tx = self.avgpool(F.tanh(self.conv2(x)))\n\t\tx = F.tanh(self.conv3(x))\n\n\t\t## Flatten\n\t\tx = x.view(x.size(0), -1)\n\n\t\t## Fully connected layers\n\t\tx = F.tanh(self.fc1(x))\n\t\tx = self.fc2(x)\n\n\t\tx = F.softm...
[ "0.70442754", "0.70390433", "0.6991137", "0.69601756", "0.6937577", "0.68354714", "0.6818054", "0.68100935", "0.67688334", "0.6750614", "0.6743198", "0.67403555", "0.672098", "0.6709776", "0.6684743", "0.6683617", "0.6679447", "0.6648096", "0.6629698", "0.66107196", "0.659222...
0.643094
34
Computes the backward pass for a fully connected layer layer.
def fully_connected_backward(self, dUpper, cache): X, W, b = cache ############################################################################# # TODO: Implement the affine backward pass. # #################################################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward_pass(self):\r\n # the gradient of cross-entropy on top of softmax is (t-y)\r\n back_output = (self.targets - self.y) / self.y.shape[0]\r\n\r\n for layer in reversed(self.layers):\r\n back_output = layer.backward_pass(back_output)", "def backward_pass(self, loss):\n\n ...
[ "0.7731608", "0.7610461", "0.73420644", "0.72815114", "0.72757447", "0.72352403", "0.7125551", "0.7122199", "0.7122199", "0.71118426", "0.7089552", "0.70816886", "0.7054744", "0.7054744", "0.69949067", "0.6970302", "0.6941496", "0.6925301", "0.6913951", "0.69076765", "0.68970...
0.0
-1
Computes the forward pass for sigmoid activation function.
def sigmoid_forward(self, x): ############################################################################# # TODO: Implement the Sigmoid forward pass. # ############################################################################# out = 1 / (1 + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(inputs,weights,function=sigmoid,step=-1):\n if step == 0:\n return inputs\n elif step == -1:\n step = len(weights) #go to output layer \n output = np.append(1, inputs)\n for i in range(step):\n output = np.append(1, function(np.dot(weights[i], output))) #calculating ac...
[ "0.77107674", "0.7618095", "0.75897205", "0.75454354", "0.74707013", "0.7382036", "0.7337359", "0.72318465", "0.718649", "0.7181982", "0.7180619", "0.71706724", "0.71224266", "0.71222806", "0.71213764", "0.71071005", "0.7100093", "0.70848095", "0.70848095", "0.7031294", "0.70...
0.7314022
7
Computes the backward pass for a sigmoid activation function.
def sigmoid_backward(self, dUpper, cache): out = cache ############################################################################# # TODO: Implement the backward pass for the sigmoid function. # #############################################################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_backward(dout, cache):\n dx, x = None, cache\n\n f = lambda x: 1/(1 + np.exp(-x)) # activation function (sigmoid)\n\n fun = f(x)\n\n dx = np.multiply(fun, (1-fun))\n dx = np.multiply(dx,dout)\n\n return dx", "def sigmoid_backward(dA, Z):\r\n dsig = sigmoid(Z) * (1 - sigmoid(Z))\...
[ "0.7805891", "0.76624775", "0.75691813", "0.7389613", "0.72973096", "0.72793454", "0.72200996", "0.72104853", "0.72072583", "0.7176278", "0.7166796", "0.71486557", "0.712793", "0.7086538", "0.7080874", "0.70740503", "0.7072516", "0.70650476", "0.7015476", "0.70073223", "0.698...
0.7265221
6
Compute the softmax function for each row of the input x.
def softmax(self, x): ############################################################################# # TODO: Implement the softmax function. # ############################################################################# meanValue = np.mean(x, axis=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out", "def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res...
[ "0.8561103", "0.8524938", "0.8485795", "0.84788704", "0.84645116", "0.84644413", "0.84097195", "0.8395736", "0.8390502", "0.8372838", "0.8333905", "0.8323554", "0.8323105", "0.8323105", "0.8323105", "0.8323105", "0.8323105", "0.8323105", "0.8323105", "0.8323105", "0.8309577",...
0.8095466
48
Jointly computes the softmax and cross entropy loss. This function should return the loss and its gradient with respect to the scores.
def softmax_cross_entropy_loss(self, scores, labels): ############################################################################# # TODO: Compute for the softmax cross entropy loss # ############################################################################# ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_and_grad(self, X, y):\n\n # Initialize the loss and gradient to zero.\n loss = 0.0\n grad = np.zeros_like(self.W)\n grad_tmp = np.zeros_like(self.W)\n num_classes = self.W.shape[0] # C = num_classes\n num_train = X.shape[0]\n \n # ==================================================...
[ "0.7552237", "0.74971294", "0.7361533", "0.7297716", "0.7081309", "0.7060637", "0.70372635", "0.70132375", "0.7011851", "0.698142", "0.69772744", "0.6949587", "0.69317883", "0.6925177", "0.69105256", "0.6898687", "0.6895407", "0.68951285", "0.6879018", "0.682814", "0.68271774...
0.7278144
4
This functions performs the forward pass which computes for the class scores given the input.
def network_forward(self, X): ############################################################################# # TODO: Perform a forward pass on the network and store the caches of # # each layer inside the cache_list # ###############...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forward(self, x):\n # Computing: `x * w^T`\n score = CArray(x.dot(self.w.T)).todense().ravel() + self.b\n\n scores = CArray.ones(shape=(x.shape[0], self.n_classes))\n scores[:, 0] = -score.ravel().T\n scores[:, 1] = score.ravel().T\n\n return scores", "def _forward(...
[ "0.7152157", "0.67411566", "0.6440144", "0.6402874", "0.64024365", "0.637545", "0.62795955", "0.6259711", "0.62537515", "0.62476677", "0.6244945", "0.62178695", "0.62178695", "0.62093914", "0.61990786", "0.6183218", "0.6170751", "0.61354846", "0.61190605", "0.61190605", "0.61...
0.61028564
21
This functions performs the backward pass which computes for the gradients of the loss with respect to every parameter.
def network_backward(self, dloss, cache_list): ############################################################################# # TODO: Implement the backward pass. # ############################################################################# ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, inputs, grad_loss_input):\n raise NotImplementedError", "def backward_pass(architecture,gradient_layerwise,grad_weights,grad_bias):\n \n for layer in range(len(architecture)-1,-1,-1):\n X_input,X_output,weightsi,biasi,X_input_im2col,imi,output_shapei,kernel_shapei,strid...
[ "0.8062878", "0.80259913", "0.7828948", "0.7777686", "0.77527696", "0.7702246", "0.7693619", "0.76381147", "0.76381147", "0.7636189", "0.7616303", "0.7592515", "0.7568821", "0.75661427", "0.7554769", "0.7545626", "0.7532964", "0.75251085", "0.7524329", "0.7416668", "0.7412596...
0.6830542
84
Compute the loss and gradients for an iteration.
def loss(self, X, y=None, lambda_reg=0.0): # Unpack variables from the params dictionary N, D = X.shape # Compute the forward pass ############################################################################# # TODO: Perform the forward pass, computing the class scores ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self) -> None:\n for _ in range(self.epochs):\n for x, y in zip(self.x_train, self.y_train):\n\n weights_gradient = [\n None for weight in self.weights\n ] # Initializing weight gradients for each layer which are going to be used to upda...
[ "0.7177683", "0.70011306", "0.69751114", "0.68704146", "0.6854747", "0.6794312", "0.67768157", "0.67635286", "0.6713901", "0.6713034", "0.66898924", "0.66752005", "0.665963", "0.6622884", "0.6610839", "0.66093385", "0.66018146", "0.65964544", "0.6590787", "0.6583664", "0.6579...
0.0
-1
Computes the forward pass for the tanh activation function.
def tanh_forward(self, x): ############################################################################# # TODO: Implement the tanh forward pass. # ############################################################################# out = np.tanh(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_hidden_activation(self, X):\n return np.tanh(X)", "def test_tanh_activation(self):\n self.assertEqual([0.099668, 0.099668], list(\n af.TanH().output(np.array([0.1, 0.1]))))\n self.assertEqual([0.990066, 0.990066], list(\n af.TanH().derivative(np.array([0.1, ...
[ "0.7288412", "0.7224226", "0.71908355", "0.7186722", "0.7179838", "0.71629184", "0.71265453", "0.7122386", "0.7074787", "0.7027048", "0.69930476", "0.69930476", "0.6986668", "0.6968281", "0.6967701", "0.6929699", "0.6904969", "0.68929416", "0.68862855", "0.6878756", "0.687386...
0.8011069
0
Computes the backward pass for tanh activation function.
def tanh_backward(self, dUpper, cache): out = cache ############################################################################# # TODO: Implement the tanh backward pass. # ############################################################################# ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tanh_backward(dA, internal_params):\n Z = internal_params\n Zt=tanh(Z)\n dzp=np.power(Zt,2)\n print(dzp.shape)\n dZ=np.multiply(dzp,dA)\n return dZ\n # raise NotImplementedError", "def tanh_backward(dA, Z):\n\n s = 1 - tanh(Z)**2\n dZ = dA * s\n\n assert (dZ.shape == Z.shape)\n\...
[ "0.74967176", "0.73036784", "0.72315353", "0.7112281", "0.7106927", "0.70630103", "0.70371467", "0.70149505", "0.69678706", "0.6954078", "0.6912582", "0.6871865", "0.6849014", "0.6831122", "0.6824879", "0.6811179", "0.68090993", "0.6785766", "0.67692584", "0.6741517", "0.6728...
0.70860624
5
Computes the forward pass of a rectified linear unit (ReLU).
def relu_forward(self, x): #out = None ############################################################################# # TODO: Implement the ReLU forward pass. # ############################################################################# out = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relu_forward(x):\n ############################################################################\n # TODO: Implement the ReLU forward pass. #\n ############################################################################\n ######################################################...
[ "0.6923425", "0.6670239", "0.6663412", "0.6650045", "0.6630312", "0.65392053", "0.64895386", "0.648836", "0.64600945", "0.6429588", "0.6399773", "0.63981783", "0.63528794", "0.63357466", "0.63077855", "0.62966233", "0.6285175", "0.6278084", "0.62459034", "0.62427825", "0.6203...
0.67316556
1
Computes the backward pass for a layer of rectified linear units (ReLUs).
def relu_backward(self, dUpper, cache): x = cache ############################################################################# # TODO: Implement the ReLU backward pass. # ############################################################################# ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(ctx, grad_output):\n loss, reg, u, lbda = ctx.saved_tensors\n\n device = u.device\n\n # do clever computations\n eps = 1e-10\n grad, = torch.autograd.grad(loss, u, only_inputs=True,\n retain_graph=True)\n x = (u - eps * grad)...
[ "0.6948249", "0.6898323", "0.6847992", "0.6847992", "0.68477255", "0.68407637", "0.68200904", "0.6768128", "0.67572653", "0.67565167", "0.67562467", "0.6743265", "0.67394495", "0.6715497", "0.67090523", "0.67006433", "0.669643", "0.669643", "0.66886026", "0.6666757", "0.66667...
0.70406467
0
Train Linear Regression using stochastic gradient descent.
def train(self, X, y, learning_rate=1e-3, lambda_reg=0.0, num_iters=100, std_dev=1e-2, batch_size=200, verbose=False, one_step=False): num_train, dim = X.shape self.initialize_weights(dim, std_dev) loss_history = [] for it in range(num_iters): loss, grads = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, loss_function='logistic',\n lr=0.1, decay=0.5, max_iters=3000, batch_size=128, **kwargs):\n return super(LogisticRegression, self).train('sgd', loss_function,\n lr=lr,\n decay...
[ "0.7195158", "0.71620756", "0.71615815", "0.71331125", "0.70809966", "0.7030623", "0.70056266", "0.69661504", "0.6926212", "0.690336", "0.68971825", "0.6893532", "0.6856372", "0.6845524", "0.6811018", "0.6810703", "0.6780936", "0.67630255", "0.6749425", "0.67289364", "0.67193...
0.631829
94
Predict labels for test data using this classifier.
def predict(self, X, return_scores=False): scores, cache_list = self.network_forward(X) probs = self.softmax(scores) prediction = np.argmax(probs, axis=1) if return_scores: return prediction, scores else: return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self):\n self.get_test_data()\n predicted_labels = []\n for row in self.test_data:\n predicted_labels.append(DecisionTree.predict_row(self.classifier, row))\n return predicted_labels", "def predict(self, X_test):\n\n # Predict Label 0\n i = 0\n ...
[ "0.811686", "0.80712956", "0.78437126", "0.7705113", "0.7671728", "0.7612549", "0.7588116", "0.7575117", "0.7493927", "0.7471557", "0.74658227", "0.74150544", "0.7381984", "0.73806554", "0.73481315", "0.73377925", "0.72906667", "0.72607785", "0.7221459", "0.72066003", "0.7181...
0.0
-1
Given gradient, will update the layer weights
def update_params(self, update_weights, update_bias): if not self.trainable: return update_weights = np.squeeze(update_weights) update_bias = np.squeeze(update_bias) # some have non-trainable parameters, in addition to the # weights and biases if len(self.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_update(self, gradient):\n w = sys.modules[self.shared_mem_name].__dict__[\"w\"]\n w -= self.learning_rate * gradient", "def update_weights(self, X, Y, learning_rate):\n grads = self.calculate_gradients(X, Y)\n #update weights and biases\n self.weights[0] = self.weig...
[ "0.7662058", "0.756946", "0.7527331", "0.73841107", "0.7367387", "0.72501403", "0.7238229", "0.7204643", "0.71658003", "0.7152769", "0.71068096", "0.7099971", "0.70949143", "0.7080805", "0.70684385", "0.70570195", "0.70487124", "0.70160997", "0.6927363", "0.6914079", "0.68777...
0.6196009
100
Save input to the function, and output f(x)
def output(self, inputs): # if max pool we need to save the indices for backproping if self.max_pool: self.indices = self.f(inputs) out = np.take(inputs, self.indices) else: out = self.f(inputs) # save input self.current_input = inputs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveall(self, f):\n if not self.enabled:\n return f\n @wraps(f)\n def wrapper(*args, **kwargs):\n func_name = f.__name__\n\n # save parameters\n params = dict(zip(f.__code__.co_varnames, args))\n params.update(kwargs)\n\n fo...
[ "0.61477196", "0.60924035", "0.60078835", "0.5988158", "0.5940525", "0.58522373", "0.57708055", "0.57708055", "0.5726363", "0.5718889", "0.57045394", "0.56582165", "0.56162596", "0.55415493", "0.5506286", "0.5488552", "0.54811376", "0.5469306", "0.5469306", "0.5469306", "0.54...
0.0
-1