query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Total amount to charge for this order. Includes optional donation, shipping and tax.
def amount(self): return self.subtotal + self.tax_subtotal + self.shipping
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_to_pay(self):\n self.__total_to_pay = Order.get_price_subtotals(self) + \\\n Order.get_qst_subtotals(self) + \\\n Order.get_gst_subtotals(self)\n return self.__total_to_pay", "def get_total_amount(self):\n total_price = ...
[ "0.7053868", "0.7048748", "0.7043842", "0.7012118", "0.69827783", "0.69398177", "0.6901252", "0.68979746", "0.6883089", "0.68816125", "0.68730205", "0.68235", "0.67788815", "0.67535025", "0.6727546", "0.6720996", "0.6712369", "0.670148", "0.6686171", "0.6680964", "0.6665583",...
0.78426963
0
Method to Create new User having the details provided(arguments). Bypasses an error after creating user to verify.
def createUser(self, firstName, lastName, email, role): self.waitForElement(locator=self._createUserBtn, locatorType="xpath") self.elementClick(locator=self._createUserBtn, locatorType="xpath") self.waitForElement(locator=self._createUser_firstName) self.sendKeys(firstName, locator=self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data:tuple):\n user = user_details.objects.create(user_name=validated_data[0], email=validated_data[1], password=validated_data[2])\n return user", "def _create_user(self, FirstName,LastName, EmailId, MobileNo, password=None, **extra_fields):\n if not (FirstName an...
[ "0.81658626", "0.812273", "0.79001874", "0.7873561", "0.786089", "0.7845663", "0.7822935", "0.7803112", "0.780146", "0.7782876", "0.77760905", "0.7772073", "0.7768335", "0.776815", "0.77621067", "0.77603656", "0.7755696", "0.77265525", "0.77216506", "0.7718733", "0.7713615", ...
0.0
-1
Generate the primes less than or equal to n using the sieve of Eratosthenes.
def eratosthenes(x): multiples = [] for i in range(2, x+1): if i not in multiples: print (i) for j in range(i*i, x+1, i): multiples.append(j)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eratosthenes_sieve(n):\r\n\tnumbers = [True for i in range(n + 1)]\r\n\t\r\n\tp = 2\r\n\twhile (p**2 <= n):\r\n\t\tif numbers[p]:\r\n\t\t\tfor i in range(p**2, n + 1, p):\r\n\t\t\t\tnumbers[i] = False\r\n\t\tp += 1\r\n\t\t\r\n\tprimes = compress(range(2, n + 1),numbers[2:])\r\n\treturn list(primes)", "def pr...
[ "0.84532684", "0.84293544", "0.839482", "0.82773215", "0.82773215", "0.827718", "0.824376", "0.82298744", "0.82075906", "0.8160965", "0.8142738", "0.81048757", "0.8100949", "0.80772", "0.80077285", "0.7987257", "0.7985756", "0.7976648", "0.79743433", "0.7949417", "0.79442585"...
0.7163392
80
Set a configuration of all the possible variables that were set in the experiments. This includes the datasets, hyperparameters for training, networks, outputs, datasets paths, results paths
def configuration(dataset_idx, network_idx, output_idx, usage_modus_idx=0, dataset_fine_tuning_idx=0, reshape_input=False, learning_rates_idx=0, name_counter=0, freeze=0, percentage_idx=0, fully_convolutional=False): # Flags plotting = False # Options dataset = {0: '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config():\n experiment_dir = './experiments'\n simulation_steps = 1000\n device = 'cpu'\n path_to_molecules = os.path.join(experiment_dir, 'data/ethanol.xyz')\n simulation_dir = os.path.join(experiment_dir, 'simulation')\n training_dir = os.path.join(experiment_dir, 'training')\n model_pat...
[ "0.672564", "0.62647396", "0.6243723", "0.6128425", "0.61060774", "0.60060334", "0.59438", "0.5941659", "0.5925815", "0.59166384", "0.5910552", "0.58799183", "0.58657604", "0.58369905", "0.5828707", "0.58076674", "0.58044046", "0.5795966", "0.5772712", "0.5751345", "0.5745822...
0.534881
86
Initialization of the BoundReduce class. Threshold defines the minimum percentage reduction for another iteration of the reduction process to occur.
def __init__(self, constants, threshold = 0.05, tries=50, flags = {}): self.constants = constants self.coefficients = constants.calculate_constants() self.threshold = threshold self.tries = tries self.flags = flags self.initialize_flags()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, threshold: float = 0.3, initial_val: float = 0.0) -> None:\n self.threshold = threshold\n self.initial_val = initial_val", "def __init__(self, window: int = 5, threshold: float = 0.3, initial_val: float = 0.0) -> None:\n self.window = window\n self.threshold = thres...
[ "0.6810921", "0.64456433", "0.63972753", "0.61463356", "0.5975817", "0.5975474", "0.5908852", "0.58632016", "0.5782928", "0.5772152", "0.57609445", "0.57543427", "0.57528543", "0.5717439", "0.5700633", "0.5643688", "0.5613517", "0.5608308", "0.55533224", "0.5535364", "0.55320...
0.5283508
55
Updates the constants given new bounds on n_1 n_k.
def update_real_constants(self, diff_bound): self.constants.eq_update_constants(diff_bound) self.coefficients = self.constants.get_coefficients() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_bounds(b, x, n):\n for j in range(1, n - 1):\n for i in range(1, n - 1):\n x[index_of(i, j, 0, n)] = -x[index_of(i, j, 1, n)] if b == 3 else x[index_of(i, j, 1, n)]\n x[index_of(i, j, 0, n - 1)] = -x[index_of(i, j, 1, n - 2)] if b == 3 else x[index_of(i, j, 1, n - 2)]\n ...
[ "0.5758972", "0.5612657", "0.55401975", "0.54818946", "0.5425561", "0.5327902", "0.5288398", "0.5261668", "0.5260755", "0.5236507", "0.5203776", "0.5196004", "0.518947", "0.51719576", "0.51719576", "0.512912", "0.5089175", "0.5071909", "0.50679207", "0.5052258", "0.5044588", ...
0.5166177
15
Calculates an appropriate large constant given a bound.
def calculate_large_constant(self, bound, real_reduction_iterations):#factor): minimum_exponent = round(90/(real_reduction_iterations-1))#math.ceil(math.log(bound, 10) * factor) return ZZ(10 ** minimum_exponent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_reduce(self, bound, large_constant):\n approximation_matrix = self.generate_approximation_matrix(large_constant)\n LLL_matrix = self.generate_LLL_matrix(approximation_matrix)\n GS_matrix = self.generate_GS_matrix(LLL_matrix) \n minimal_vector_bound = self.calculate_minimal_vect...
[ "0.70371264", "0.68274575", "0.6330151", "0.63199085", "0.6241818", "0.61968136", "0.59357655", "0.5923358", "0.58914244", "0.58479667", "0.5781844", "0.5777799", "0.5703968", "0.5685938", "0.5674198", "0.5645476", "0.56358624", "0.5593585", "0.5581525", "0.55808944", "0.5540...
0.7848133
0
Finds a better upperbound on our values as defined in the procedure within our paper.
def real_reduce(self, bound, large_constant): approximation_matrix = self.generate_approximation_matrix(large_constant) LLL_matrix = self.generate_LLL_matrix(approximation_matrix) GS_matrix = self.generate_GS_matrix(LLL_matrix) minimal_vector_bound = self.calculate_minimal_vector_bound(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upper_bound(self) -> float:\n ...", "def get_upper_bound(self):\n return self._upper_bound", "def best_upper_bound(self):\n if self._all_nodes:\n return min(node.upper_bound for node in self._all_nodes)\n else:\n return np.inf", "def upper_bound(height):\n ...
[ "0.8117035", "0.76629865", "0.7376866", "0.72653604", "0.7040345", "0.6879957", "0.6829678", "0.681125", "0.6780286", "0.67495567", "0.6693107", "0.6671602", "0.664028", "0.6582505", "0.6542788", "0.64727503", "0.64616185", "0.64602685", "0.64478844", "0.64478844", "0.6401193...
0.0
-1
Load pretrained checkpoint from file.
def load_pretrained_model(self, load_from): print("loading model from %s\n" % (load_from)) try: if self.use_cuda: pretrained_dict = torch.load(load_from) else: pretrained_dict = torch.load(load_from, map_location='cpu') model_dict = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, file):\n \"\"\"Load \"\"\"\n chkpnt = torch.load(file)\n self.load_state_dict(chkpnt['model_state_dict'])", "def load_checkpoint(checkpoint_file: pl.Path) -> Optional[Dict[str, Any]]:\n if checkpoint_file.exists():\n logger.info(f\"Loading checkpoint {chec...
[ "0.8382953", "0.79492986", "0.7863191", "0.78538054", "0.77684975", "0.77320653", "0.772008", "0.7675161", "0.7656564", "0.75781804", "0.74947304", "0.7473096", "0.7473096", "0.74447674", "0.74183965", "0.7414635", "0.7361754", "0.73499084", "0.73413765", "0.7331794", "0.7313...
0.7398939
16
Helper that sets up the users_allowed field on a Form or ModelForm that has a users_allowed ModelMultipleChoiceField (e.g. anything that inherits from AccessControl).
def setup_form_users_allowed(form, users_allowed): form.fields["users_allowed"].queryset = users_allowed if users_allowed else get_user_model().objects.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_users_groups_allowed(self, users_allowed, groups_allowed):\n self.widget.user_choices = user_choices(users_allowed)\n self.fields[0].queryset = users_allowed\n self.widget.widgets[0].choices = self.widget.user_choices\n\n self.widget.group_choices = group_choices(groups_allowed)...
[ "0.7133922", "0.59891295", "0.5419426", "0.53075457", "0.5258928", "0.52459574", "0.5212209", "0.5207903", "0.5204906", "0.51343834", "0.5131318", "0.5113206", "0.51043993", "0.5103326", "0.5090685", "0.50806564", "0.5064924", "0.5064924", "0.5062102", "0.50522286", "0.505021...
0.8015561
0
Returns a random string of length string_length.
def my_random_string(string_length=10): random = str(uuid.uuid4()) # Convert UUID format to a Python string. random = random.upper() # Make all characters uppercase. random = random.replace("-","") # Remove the UUID '-'. return random[0:string_length] # Return the random string.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(length):\n return ''.join(SystemRandom().choice(ascii_letters + digits)\n for i in range(length))", "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def get_random_stri...
[ "0.8691263", "0.8690539", "0.8676425", "0.86712104", "0.86504567", "0.86304426", "0.8626901", "0.85903996", "0.8588565", "0.8576007", "0.8560824", "0.85416645", "0.8539037", "0.85361385", "0.84932715", "0.8490938", "0.844971", "0.8442166", "0.84295636", "0.8426424", "0.838733...
0.8030489
84
_expand_dims for a scalar structured tensor.
def _expand_dims_scalar(st: structured_tensor.StructuredTensor): new_shape = tf.constant([1], dtype=tf.int64) new_fields = {k: _expand_dims(st.field_value(k), 0) for k in st.field_names()} return structured_tensor.StructuredTensor.from_fields( new_fields, shape=new_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _maybe_expand_dims(x):\n x = tf.convert_to_tensor(x)\n if x.shape == ():\n return tf.expand_dims(x, axis=0)\n return x", "def _expand_dims(st, axis):\n if not isinstance(st, structured_tensor.StructuredTensor):\n return tf.expand_dims(st, axis)\n nn_axis = _expand_dims_nonnegative_axis(a...
[ "0.7003609", "0.6901896", "0.6636332", "0.65023893", "0.6334577", "0.6224399", "0.6102494", "0.59605575", "0.59365094", "0.5773648", "0.5752287", "0.57223636", "0.56908256", "0.5673388", "0.56402624", "0.56392986", "0.5556645", "0.5543574", "0.5509353", "0.5501211", "0.549557...
0.8211019
0
tf.expand_dims, but works on StructuredTensor too.
def _expand_dims(st, axis): if not isinstance(st, structured_tensor.StructuredTensor): return tf.expand_dims(st, axis) nn_axis = _expand_dims_nonnegative_axis(axis, st.rank) if st.rank == 0: return _expand_dims_scalar(st) if nn_axis == 0: # Here, we can add a dimension 1 at the front. nrows = st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _maybe_expand_dims(x):\n x = tf.convert_to_tensor(x)\n if x.shape == ():\n return tf.expand_dims(x, axis=0)\n return x", "def _expand_dims_scalar(st: structured_tensor.StructuredTensor):\n new_shape = tf.constant([1], dtype=tf.int64)\n new_fields = {k: _expand_dims(st.field_value(k), 0) for...
[ "0.7842055", "0.7647919", "0.7427348", "0.71710736", "0.7027676", "0.6803491", "0.6722156", "0.67122793", "0.66567737", "0.66567737", "0.6634648", "0.65741295", "0.6564677", "0.6547203", "0.6547203", "0.65142137", "0.65100014", "0.64877397", "0.64306694", "0.6397916", "0.6380...
0.77122444
1
Creates a fully partitioned ragged tensor from a multidimensional tensor. If the tensor is 1D, then it is unchanged.
def _partition_if_not_vector(values: tf.Tensor, dtype: tf.dtypes.DType): values_shape = values.shape assert values_shape is not None values_rank = values_shape.rank # values cannot have an unknown rank in a RaggedTensor field # in a StructuredTensor. assert values_rank is not None if values_rank == 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fully_partitioned_ragged_tensor(rt: Union[tf.RaggedTensor, tf.Tensor],\n dtype=tf.dtypes.int64):\n if isinstance(rt, tf.RaggedTensor):\n rt = rt.with_row_splits_dtype(dtype)\n flattened_values = _partition_if_not_vector(rt.flat_values, dtype=dtype)\n return rt.wit...
[ "0.7368402", "0.64630765", "0.6426143", "0.6329257", "0.62925947", "0.6286065", "0.62552154", "0.6254118", "0.6218781", "0.6139193", "0.59959036", "0.5988833", "0.5983663", "0.59732264", "0.59441143", "0.59402", "0.5913747", "0.588858", "0.58860505", "0.58745676", "0.5845783"...
0.5308736
87
Creates a fully partitioned ragged tensor from a tensor or a ragged tensor. If given a tensor, it must be at least twodimensional.
def _fully_partitioned_ragged_tensor(rt: Union[tf.RaggedTensor, tf.Tensor], dtype=tf.dtypes.int64): if isinstance(rt, tf.RaggedTensor): rt = rt.with_row_splits_dtype(dtype) flattened_values = _partition_if_not_vector(rt.flat_values, dtype=dtype) return rt.with_flat_val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flat_shuffle(tensor):\n shape_ = tensor.size()\n flat_tensor = tensor.view(-1)\n shuffled_flat_tensor = shuffle(flat_tensor)\n return shuffled_flat_tensor.view(shape_)", "def reshape(tensor):\n row = tf.shape(tensor)[0]\n shape_list = [row, -1]\n out = tf.reshape(tensor, shape_list)\n ...
[ "0.60885423", "0.59994423", "0.59394586", "0.58616525", "0.5802742", "0.5799802", "0.5794589", "0.5777821", "0.57208747", "0.5720422", "0.5707192", "0.56794417", "0.567807", "0.5667455", "0.5644864", "0.5638416", "0.56102264", "0.56070644", "0.5604347", "0.557955", "0.5555979...
0.770993
0
Returns the minimax action using self.depth and self.evaluationFunction
def getAction(self, gameState): # compared to Minimax, the code did not change substantially # except for the addition of the alpha and beta parameters val, move = self.max_value(state=gameState, alpha=-math.inf, beta=math.inf) return move
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o...
[ "0.7482665", "0.7383559", "0.71806973", "0.7110041", "0.70884514", "0.70694935", "0.70683014", "0.7048308", "0.70055133", "0.69651455", "0.69642085", "0.69604385", "0.6945924", "0.68998593", "0.6895832", "0.688605", "0.6826282", "0.6767276", "0.6758028", "0.6751636", "0.67054...
0.0
-1
Return all values for var that aren't currently ruled out.
def choices(self, var): return (self.curr_domains or self.domains)[var]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unusedVars(self):\n fullcode = self.code_cfg\n variables = set([x[1:] for x in codeconfig_getvars(fullcode)])\n exceptions = set(['complexity', 'code_cfg'])\n clsvars = set(vars(self).keys())\n nones = set(filter(lambda x: self.__dict__[x] is None, clsvars))\n nones = ...
[ "0.6513947", "0.6378371", "0.6350286", "0.6258128", "0.61469907", "0.61321694", "0.59471303", "0.5930412", "0.5909507", "0.58292854", "0.5821927", "0.58140504", "0.5809701", "0.5802926", "0.58000296", "0.57720435", "0.5748814", "0.5747037", "0.5720926", "0.5712526", "0.56853"...
0.0
-1
Determines whether a number is prime or not.
def is_prime(num): square_root = int(math.ceil(math.sqrt(num))) for n in range(2, square_root+1): if num % n == 0: if num != n: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\telif number % 2 == 0: return False\n\telse:\n\t\tfor x in range(2, number):\n\t\t\tif number % x == 0:\n\t\t\t\treturn False\n\t\telse:\n\t\t\treturn True", "def is_prime_number(number_):\n flag = 0\n for values in...
[ "0.81489384", "0.81168395", "0.80673546", "0.80496997", "0.80037653", "0.7981594", "0.7973921", "0.79685766", "0.7966969", "0.79294753", "0.79008937", "0.7873249", "0.7852324", "0.7850377", "0.78497577", "0.7845095", "0.78436106", "0.78404874", "0.78381497", "0.7824701", "0.7...
0.77126676
29
Add Sample object to list of samples.
def add(self, sample, **kwargs): if not self.samples: self.init(sample) self.samples.append(sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_samples(self, samples):\n samples = [samples] if isinstance(samples, Sample) else samples\n for sample in samples:\n if isinstance(sample, Sample):\n self._samples.append(sample)\n self[SAMPLE_EDIT_FLAG_KEY] = True\n else:\n _...
[ "0.82711065", "0.82400715", "0.7879517", "0.73882633", "0.7204324", "0.6718199", "0.6655872", "0.65226907", "0.6508938", "0.64730805", "0.63968986", "0.63796824", "0.63000923", "0.62492037", "0.61510104", "0.6145541", "0.61278725", "0.6104108", "0.60343003", "0.6000136", "0.5...
0.8065982
2
Return whether self and other represent the same expressions. Unfortunately, the Node class in Python 2.3 doesn't define ==, so we need to write our own.
def _node_equal(self, other): # We're not equal if other isn't a Node, or if other is a different class. if not isinstance(other, Node) or not isinstance(other, self.__class__): return False # Loop through all children, checking whether they are equal for self_child, other_child in zip(self.getC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Expression):\n return False\n\n return self.evaluate() == other.evaluate()", "def __eq__(self, other):\n return (other is self) or (isinstance(other, Expr)\n and self.op == other.op and self.args == other.args)", "de...
[ "0.82572985", "0.8129553", "0.791884", "0.7829463", "0.7791102", "0.77551913", "0.77551913", "0.77551913", "0.77551913", "0.77551913", "0.76689976", "0.765581", "0.7652951", "0.76402044", "0.7531183", "0.7429546", "0.74063975", "0.738333", "0.7351718", "0.7348117", "0.7326018...
0.7354098
18
Converts a list of JsonSerializable objects to JSON.
def list_to_json(items): return json.dumps(to_dict_list(items))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __transform_list_to_jsons__(self, listofjsons):\n jsons = []\n for row in listofjsons:\n jsons += [json.dumps(row)]\n return jsons", "def to_json_string(list_dictionaries):\n if list_dictionaries is None:\n list_dictionaries = []\n return json.dumps(li...
[ "0.7775905", "0.6788045", "0.6788045", "0.67015606", "0.6662819", "0.6603623", "0.6520674", "0.6520674", "0.65070826", "0.6486467", "0.6478263", "0.6477549", "0.6447063", "0.64422417", "0.6440202", "0.6437975", "0.6426778", "0.64177066", "0.64158386", "0.640341", "0.6390288",...
0.7478646
1
Converts a list of JsonSerializable objects to a list of dictionaries.
def to_dict_list(items): dictionaries = [] for item in items: if not isinstance(item, JsonSerializable): raise ValueError('Items must of type JsonSerializable') dictionaries.append(item.__dict__) return dictionaries
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __transform_list_to_jsons__(self, listofjsons):\n jsons = []\n for row in listofjsons:\n jsons += [json.dumps(row)]\n return jsons", "def to_list_of_dicts(self) -> List[Dict[str, Any]]:\n return [this.to_dict() for this in self._elements]", "def list_to_dict(list_of_d...
[ "0.64979964", "0.64311266", "0.63277876", "0.61498904", "0.6096823", "0.6073397", "0.59635407", "0.5921128", "0.58732253", "0.58344257", "0.57878256", "0.57704824", "0.5759773", "0.5712127", "0.56738687", "0.56259304", "0.5557589", "0.5553443", "0.5530284", "0.5523198", "0.55...
0.8136458
0
Plot predictions of recurrent nets.
def plot_recurrent(ax, reana, prediction, each_N=7): reana.plot(label='reanalysis', linewidth=2, ax=ax) times = prediction.init_time for i, init in enumerate(times): if not i % each_N == 0: continue da = prediction.sel(init_time=init) time = [pd.Timestamp(da.coords['init...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()", "def plot_predictions(net, x_train, y_train, idx_train, x_...
[ "0.7712358", "0.727708", "0.7138299", "0.6980853", "0.6751405", "0.6733568", "0.66608036", "0.66227955", "0.6620298", "0.6603898", "0.6541682", "0.64953333", "0.64945626", "0.6484872", "0.64760584", "0.647545", "0.6456396", "0.6385887", "0.63581365", "0.63485366", "0.6331288"...
0.64298934
17
Sometimes the object has no `cursor_field` value assigned, and the ` "" ` emmited as state value, this causes conflicts with datetime lib to parse the `time component`, to avoid the errors we falling back to default start_date from input config.
def get_state_value(self, stream_state: Mapping[str, Any] = None) -> str: state = stream_state.get(self.cursor_field) if stream_state else self.start_datetime if not state: self.logger.info(f"Stream state for `{self.name}` was not emmited, falling back to default value: {self.start_datetime}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_start_date(self):\n today = datetimedate.today()\n if self.start == 'week':\n start_date = today - timedelta(days=today.weekday())\n elif self.start == 'month':\n start_date = today.replace(day=1)\n elif self.start == 'quarter':\n quarter = math...
[ "0.59654886", "0.5916772", "0.5880905", "0.5879721", "0.5780306", "0.5771559", "0.57325613", "0.5731133", "0.57017326", "0.5684123", "0.568002", "0.56400204", "0.56086844", "0.55757403", "0.5541543", "0.5535366", "0.5518431", "0.5514232", "0.5500834", "0.5486695", "0.54633373...
0.5595259
13
Returns the ResourceStatus of one particular Kubernetes resource.
def get_resource_status(type, full_name="", label="", must_exist=True): cmd = "kubectl get {} --no-headers --all-namespaces " \ "-o wide --selector \"{}\" " \ "| grep \"{}\" | awk '{{print $1 \" \" $2}}'" cmd = cmd.format(type, label, full_name) try: encoded_output = subprocess.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_status(self) -> 'outputs.InstantSnapshotResourceStatusResponse':\n return pulumi.get(self, \"resource_status\")", "def get_resource_status(self, namespace: \"str\" = None):\n pass", "def status(self, resource):\n resource_id = get_resource_id(resource)\n if resource_id:...
[ "0.76229763", "0.73207796", "0.66773975", "0.6439037", "0.62865084", "0.603517", "0.59161764", "0.5822509", "0.5811077", "0.57906324", "0.5747971", "0.5739691", "0.5718194", "0.5718194", "0.5718194", "0.5718194", "0.5718194", "0.5718194", "0.5718194", "0.5709668", "0.56913644...
0.72029287
2
Returns an iterator to the status of pods selected with the label selector.
def get_pods_status_iterator_by_labels(label_selector, host_ip_filter, must_exist=True): # TODO: Handle the case of a pod w/ multiple containers. # Right now, we pick the status of the first container in the pod. cmd = ("kubectl get pods --all-namespaces -o wide" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pods(self, label_selector, namespace):\n return self.core_client.list_namespaced_pod(namespace, label_selector=label_selector, watch=False)", "def GetPodIpsByLabel(self, pod_label_key, pod_label_value) -> List[str]:\n get_cmd = [\n 'get', 'pods', '-l', f'{pod_label_key}={pod_label_value}...
[ "0.68512", "0.65445507", "0.62595487", "0.61863065", "0.61733085", "0.6057545", "0.58621997", "0.58302987", "0.5808809", "0.5740844", "0.567828", "0.56306326", "0.5615431", "0.5466532", "0.5434335", "0.5413703", "0.5413656", "0.5400823", "0.53992146", "0.53965664", "0.5350517...
0.7944297
0
Returns energy gap correlation function data of an exciton state
def _excitonic_coft_old(self,SS,AG,n): # FIXME: works only for 2 level molecules c0 = AG.monomers[0].get_egcf((0,1)) Nt = len(c0) # SystemBathInteraction sbi = AG.get_SystemBathInteraction() # CorrelationFunctionMatrix cfm = sbi.CC ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_concentration(self, state):\n return self.fc(state.float_features).exp() + self.EPSILON", "def get_state_vars(state):\n x_n = state[0, :] # x_n\n x_m = np.roll(x_n, -1) # x_{n+1}\n x_m[-1] += Length # the first one goes ahead by Length\n dx_n = state[1, :] # dx_n\n dx_m = np.ro...
[ "0.57918143", "0.5706206", "0.5679367", "0.56127805", "0.560693", "0.55548656", "0.55495775", "0.55098313", "0.545567", "0.5435076", "0.5431533", "0.5406826", "0.5401776", "0.5399951", "0.5399907", "0.53825414", "0.5378272", "0.5374307", "0.5342117", "0.5313359", "0.5303445",...
0.0
-1
Remove all empty values and versions from the dumped dict.
def _remove_empty(self, data, many): if not many: for key in list(data): if key == 'versions': data.pop(key) return { key: value for key, value in data.items() if value is not None } for item in data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_all(dic):\n for k, v in dic.items():\n\n if len(v) == 0:\n dic[k] = 'NULL'\n if isinstance(v, str):\n v = v.strip().replace('\\t', '').replace('\\n', '').encode('utf-8', 'ignore')\n dic[k] = v\n\n return dic", "def remove_empty_values(_dict):\n r...
[ "0.71420825", "0.69245446", "0.6911726", "0.6817932", "0.6758381", "0.66833586", "0.64930177", "0.64137995", "0.6412033", "0.6384501", "0.6328246", "0.63277", "0.63069534", "0.62830883", "0.62739176", "0.62687373", "0.62326473", "0.62241316", "0.62227315", "0.61956143", "0.61...
0.7656601
0
Checks if the current request belongs to admin namespace
def is_admin(context): request = context["request"] url = resolve(request.path) context['is_admin'] = False return url.app_name == 'admin'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin_site(self, request) -> bool:\n if (\n settings.AXES_ONLY_ADMIN_SITE\n and hasattr(request, \"path\")\n and not re.match(\"^%s\" % reverse(\"admin:index\"), request.path)\n ):\n return True\n\n return False", "def is_admin(self):\r\n ...
[ "0.7516266", "0.71202093", "0.7084599", "0.70300645", "0.7011564", "0.7011564", "0.7011564", "0.70091057", "0.6944642", "0.6927288", "0.69075626", "0.6904302", "0.6904302", "0.6898047", "0.68556285", "0.6837943", "0.6820567", "0.68151474", "0.6811115", "0.6809473", "0.6790797...
0.8030837
0
Get the descendants of the given node.
def get_descendants(self, node_id, connection=None): connection = connection or self.engine.connect() return connection.execute( select( [self.paths, self.nodes.c.title] ).select_from( self.paths.join(self.nodes, self.nodes.c.id == self.paths.c.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s_all_descendants(node):\r\n if len(node.children)==0:\r\n return []\r\n else:\r\n children = node.children[:]\r\n for child in node.children:\r\n children.extend(Node.s_all_descendants(child))\r\n return children", "def get_descendants...
[ "0.7513998", "0.7354369", "0.72853243", "0.7061065", "0.70581686", "0.70034635", "0.69848096", "0.68753374", "0.6865626", "0.67648876", "0.676021", "0.6722101", "0.66403586", "0.660167", "0.6538753", "0.64592934", "0.6412767", "0.64020485", "0.6324568", "0.6242581", "0.622560...
0.7504214
1
Distance2 between sequence of N, Mdimensional points and line l1l2
def point_line_dist2(p, l1, l2): p, l1, l2 = np.asarray(p), np.asarray(l1), np.asarray(l2) ap = l1 - p n = l2 - l1 n /= np.sqrt(sum(n**2)) dist = ap - np.outer(n, np.dot(ap, n)).T return np.sum(dist**2, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distanceOfTwoLines(p1, v1, p2, v2):\n # if we transform multiple points in one go\n if len(v1.shape) == 2:\n a1 = np.einsum('ij,ij->i', v1, v1)\n a2 = np.einsum('ij,ij->i', v1, v2)\n b1 = -np.einsum('ij,ij->i', v2, v1)\n b2 = -np.einsum('ij,ij->i', v2, v2)\n c1 = -np.ei...
[ "0.7310883", "0.72843426", "0.7146299", "0.7141547", "0.7073252", "0.7022996", "0.70170534", "0.68681467", "0.6831304", "0.6820344", "0.67997026", "0.67725146", "0.67673594", "0.67307544", "0.6720408", "0.6647806", "0.66438526", "0.66293716", "0.6624619", "0.6614878", "0.6609...
0.7826586
0
Convert an image to a sequence of indexes
def img2line(img): img = img_as_bool(img) Ns = sum(img, axis=1) N = sum(Ns) ni, nj = img.shape jrange = np.arange(nj) iseq = np.zeros(N, dtype=int) jseq = np.zeros(N, dtype=int) ii = iseq jj = jseq for i, n in enumerate(Ns): ii, ii[:n] = ii[:n], i jj, jj[:n] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_img_indices():\n if K.image_dim_ordering() == 'th':\n return 0, 1, 2, 3\n else:\n return 0, 3, 1, 2", "def image_to_index(filename):\n return _image2image(filename)", "def _create_img_id_to_idx(self):\n with h5py.File(self.image_features_path, 'r') as features_file:\n ...
[ "0.7209459", "0.6851916", "0.6841864", "0.65924764", "0.65444666", "0.642088", "0.6372391", "0.6357856", "0.6269647", "0.6040294", "0.6040294", "0.6033849", "0.60004187", "0.59836465", "0.5981329", "0.59606445", "0.5949437", "0.5942697", "0.59202313", "0.5879955", "0.58695084...
0.6048361
9
Sets the text of this SummaryAnalysisRequest. Text to be analyzed
def text(self, text): if text is None: raise ValueError("Invalid value for `text`, must not be `None`") self._text = text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text(self, text):\n\n self._text = text", "def text(self, text):\n\n self._text = text", "def text(self, text):\n\n self._text = text", "def text(self, text):\n\n self._text = text", "def text(self, text):\n\n self._text = text", "def text(self, text):\n\n se...
[ "0.73053324", "0.73053324", "0.73053324", "0.73053324", "0.73053324", "0.73053324", "0.7250907", "0.7164473", "0.71619475", "0.70921135", "0.6974636", "0.696551", "0.6944709", "0.6916013", "0.6845413", "0.6792056", "0.6709426", "0.65639323", "0.6551423", "0.654735", "0.644821...
0.73276865
0
Gets the language of this SummaryAnalysisRequest. Document's language. Set correct UK/US language to get regionspecific suggestions
def language(self): return self._language
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language(self):\r\n return self.language", "def language(self):\r\n return self._get('language', {})", "def get_language(self):\n return self.lang", "def language(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"language\")", "def getLanguage(self):\n ...
[ "0.7281727", "0.72808343", "0.72280914", "0.7119039", "0.7116587", "0.70811087", "0.70652795", "0.7046453", "0.6973049", "0.69423443", "0.6893855", "0.68785393", "0.68559635", "0.68559635", "0.68206537", "0.6735319", "0.67247015", "0.67247015", "0.6691365", "0.66912156", "0.6...
0.69469714
12
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SummaryAnalysisRequest): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Opens a new database connection if there is none yet for the current application context.
def get_db(): if not hasattr(g, 'sqlite_db'): g.sqlite_db = connect_db() return g.sqlite_db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db", "def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)", "def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec...
[ "0.7737639", "0.7582971", "0.73180443", "0.71693045", "0.70220166", "0.6966687", "0.6954785", "0.69486743", "0.6897534", "0.6842663", "0.68292314", "0.68191963", "0.680592", "0.67950195", "0.67697805", "0.6762173", "0.6751266", "0.6746273", "0.67316663", "0.670031", "0.668866...
0.640242
75
Analyse a return statement.
def _analyse_stmt_Return(self, statement: ast.Return, *, next: CFNode) -> CFNode: if statement.value is None: nodes = dict(next=self._context[_LEAVE]) else: nodes = dict(next=self._context[_RETURN]) value_is_constant, _ = self._expression_as_constant(statement.value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_return(self: Parser, node: doc.Return) -> None:\n self.report_error(node, \"Return is not allowed.\")", "def ReturnStmt(self):\n self.currtok = next(self.tg)\n express = self.Expression()\n if self.currtok[1].name == \"SEMI\":\n self.currtok = next(self.tg)\n ...
[ "0.74100626", "0.7092027", "0.6895308", "0.676903", "0.6694369", "0.64414495", "0.64238936", "0.6385314", "0.636924", "0.63604385", "0.631531", "0.6298807", "0.62973344", "0.6276877", "0.62388825", "0.6163157", "0.61428994", "0.60274535", "0.59721214", "0.59432447", "0.590610...
0.75820386
0
Apply a function to all items in the specified tree. The function should take a single argument (the current item in the tree). The return value of the function is ignored. A deepfirstsearch algorithm is used.
def apply_tree(tree: dict, func: Callable, args: Optional[Tuple] = None, kwargs: Optional[Mapping] = None) -> None: if args is None: args = () if kwargs is None: kwargs = {} frontier = [] explored = set() for uid, item in tree.items(): frontier.append((uid, item)) while f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, func):\n ret = [func(self)]\n for _, node in self.children.items():\n ret.extend(node.apply(func))\n return ret", "def traverse(self, fn: Callable[[RTreeNode[T]], None]) -> None:\n self._traverse(self.root, fn)", "def for_each(self, fn):\n if self.v...
[ "0.65904546", "0.65580195", "0.6500019", "0.63694006", "0.63578683", "0.6255641", "0.62404877", "0.610505", "0.5889033", "0.5867297", "0.5859251", "0.5816661", "0.5803459", "0.57961905", "0.5620061", "0.5592607", "0.55921054", "0.5577645", "0.557688", "0.5506884", "0.54616064...
0.72394025
0
Find one item in the specified tree. The function applied to the item searched must return True when the item is passed to the function. By default the first match is returned.
def _find_one_tree(tree: dict, func: Callable, args: Tuple, kwargs: Mapping, ) -> Union[dict, None]: frontier = [] explored = set() for uid, item in tree.items(): frontier.append((uid, item)) while frontier: uid,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_item(self, func):\n return next((_(x) for x in self._ if func(x)), None)", "def __find(self, item):\n search_node = self.root\n if self.root is not None:\n search_node = self.__findHelper(search_node, item)\n return search_node", "def search(self, item):\n ...
[ "0.7241768", "0.72306645", "0.72128564", "0.6999607", "0.6960374", "0.682458", "0.68233484", "0.680479", "0.6804497", "0.6798166", "0.6790682", "0.6742852", "0.6676143", "0.66509813", "0.6638938", "0.6601269", "0.65210813", "0.6516802", "0.65001035", "0.64941734", "0.6477933"...
0.68086535
7
Write tree in a json file at specified location.
def write_tree(tree: dict, path: str) -> None: with open(path, mode="w", encoding="utf-8") as file_object: file_object.write(json.dumps(tree, indent=4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(node, filepath):\n data = read(node)\n\n if not data:\n return\n\n with open(filepath, 'w') as f:\n json.dump(data, f, indent=4, sort_keys=True)\n\n return data", "def json_write(data, path, **kwargs):\n with open(_fsdecode(path), 'wt') as file:\n _json_dump(data, fi...
[ "0.7074254", "0.6997906", "0.6891475", "0.6799715", "0.6799715", "0.6765691", "0.6716399", "0.66876066", "0.6681753", "0.6675008", "0.6670283", "0.6653552", "0.66356", "0.6622884", "0.65868676", "0.6586202", "0.6554381", "0.655351", "0.6544089", "0.6515199", "0.65092945", "...
0.7905787
0
conv2d returns a 2d convolution layer with full stride.
def conv2d(x, W, name=None): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME', name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')", ...
[ "0.7629538", "0.7627165", "0.7579147", "0.7463493", "0.74578935", "0.74578935", "0.7426121", "0.7426121", "0.7426121", "0.7426121", "0.7386576", "0.7337714", "0.7330282", "0.73295087", "0.7313963", "0.73015827", "0.7296284", "0.72696656", "0.72463566", "0.72321266", "0.720884...
0.7196564
21
weight_variable generates a weight variable of a given shape.
def weight_variable(shape, name=None): initial = tf.truncated_normal(shape, stddev=0.2) return tf.Variable(initial, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)", "def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)", "def create_weight_variable(shape):...
[ "0.8268416", "0.82356274", "0.815898", "0.81571364", "0.814004", "0.814004", "0.814004", "0.8137777", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8134971", "0.8121185", "0.8064902", "0.7982461", "0....
0.79582846
22
See what template used for main page
def test_correct_main_page_template(self): response = self.client.get('/') self.assertTemplateUsed(response, 'main.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"main_page.html\")", "def main_page():\n return render_template(\"index.html\")", "def home():\n return render_template('Main_Page.html')", "def home():\n return render_template('main.html')", "def main_page():\n pages=get_accounts()\n return ren...
[ "0.7223213", "0.6972704", "0.6837707", "0.68041813", "0.66889495", "0.66498816", "0.66498816", "0.65733975", "0.65592015", "0.64922833", "0.6471615", "0.6451084", "0.6428908", "0.64121896", "0.64073396", "0.6400402", "0.63593125", "0.635728", "0.63478667", "0.6346091", "0.632...
0.7040163
1
Check case is main page response if DB empty.
def test_main_page_is_response_if_database_empty(self): Person.objects.all().delete() client = Client() response = client.get("/") self.assertEquals(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_db(self):\n rv = self.app.get('/')\n assert b'Your closet is empty.' in rv.data", "def test_home_route_has_no_article_when_db_empty(testapp):\n response = testapp.get('/', status=200)\n html = response.html\n assert len(html.find_all('article')) == 0", "def test_context_da...
[ "0.6630922", "0.64764184", "0.62744784", "0.62744784", "0.6227041", "0.6220018", "0.6214386", "0.61474466", "0.61474466", "0.61474466", "0.61314154", "0.6129026", "0.6040497", "0.603603", "0.59957504", "0.5978025", "0.5955443", "0.59418917", "0.59172785", "0.5901049", "0.5899...
0.6473134
2
Transform a list of note in string into index.
def transform(self,list_array): transformed_list = [] for instance in list_array: transformed_list.append([self.notes_to_index[note] for note in instance]) return np.array(transformed_list, dtype=np.int32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_index(s):\n s = Unquote(s)\n if s == \".\":\n return ()\n return tuple(s.split(\"/\"))", "def get_index_from_list(self, l):\n\n return \" \".join(l)", "def get_index(s):\n return int(s[s.find(\"[\")+1:s.find(\"]\")])", "def sequence_enco...
[ "0.6205227", "0.6048822", "0.5978325", "0.5811571", "0.5778731", "0.57226247", "0.5722", "0.5709454", "0.5643686", "0.5579303", "0.55769545", "0.5557279", "0.5555395", "0.55224115", "0.55134404", "0.5511016", "0.550031", "0.54862696", "0.54687506", "0.54210365", "0.54057056",...
0.5760384
5
check if 2 grids are equal return boolean value
def grid_equal (grid1, grid2): for i in range (4): for j in range (4): if grid1[i][j] != grid2[i][j]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n else:\r\n return False", "def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n return False", "def grid_equal (grid1, grid2):\r\n s=0 \r\n for h in range(4):\r\n for m...
[ "0.8933384", "0.8914656", "0.8585009", "0.8558586", "0.8200414", "0.80762106", "0.79177386", "0.7875002", "0.784008", "0.75213224", "0.7462791", "0.7448489", "0.7448489", "0.74154866", "0.7414818", "0.73950034", "0.7244226", "0.7191573", "0.7164593", "0.7132306", "0.71306413"...
0.87099695
2
Returns dictionary of all chart objects supported by this test.
def getCharts(self): # code from Jerry to strip off irrelevant headings results = [] flag = False for line in self.ResultsForCSVfile: if flag: results.append(line) if len(line) == 0: flag = True # create charts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charts(self):\n return self.container['charts']", "def charts(self):\n return self._charts", "def charts(self):\n return self.properties.get('charts',\n EntityCollection(self.context, WorkbookChart,\n ...
[ "0.69593924", "0.6798381", "0.66532433", "0.6136536", "0.6111613", "0.6086991", "0.5799147", "0.5626746", "0.56218415", "0.5500341", "0.54916686", "0.5474156", "0.54647464", "0.54535556", "0.54518366", "0.5447293", "0.5435039", "0.53563887", "0.5341619", "0.53244686", "0.5297...
0.5805826
6
Returns integer representing condition severity.
def calc_color(temp, dewtemp, humid): if temp == hw.MISSING_VAL or dewtemp == hw.MISSING_VAL or humid == hw.MISSING_VAL: status = 'grey' istatus = 0 else: if (temp - dewtemp) < RED_DEWPOINT or humid >= RED_HUMIDITY: status = 'red' istat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def severity(self) -> str:\n return pulumi.get(self, \"severity\")", "def severity(self) -> str:\n return pulumi.get(self, \"severity\")", "def severity(self) -> str:\n return pulumi.get(self, \"severity\")", "def severity(self):\n return self._severity", "def severity(self):\n ...
[ "0.7769303", "0.7769303", "0.7769303", "0.7663294", "0.7663294", "0.7498207", "0.7457291", "0.744162", "0.73335856", "0.7295736", "0.7295736", "0.7295736", "0.7009136", "0.69886327", "0.6892374", "0.6577652", "0.65687114", "0.65422255", "0.64995885", "0.6195847", "0.6009437",...
0.0
-1
Generates the model. Model from the paper `Deep Convolutional Neural Networks for Hyperspectral Image Classification`. See Section 3 `CNNBased HSI Classification` in the paper for an explanation about the structure and parameters.
def get_model_1(parameters): # Parameters n1 = parameters['n1'] k1 = parameters['k1'] n2 = parameters['n2'] n3 = parameters['n3'] k2 = parameters['k2'] n4 = parameters['n4'] n5 = parameters['n5'] NUM_FILTERS_C1 = 20 # Sequential model model = keras.models.Sequential() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_model():\n # model = Sequential()\n # model.add(Dense(units=64, activation='relu', input_dim=100))\n # model.add(Dense(units=10, activation='softmax'))\n # model.compile(loss='categorical_crossentropy',\n # optimizer='sgd',\n # metrics=['accuracy'])\n # return model\n\n model ...
[ "0.7273317", "0.71614426", "0.7148825", "0.7114565", "0.70972764", "0.7067017", "0.7065465", "0.70437163", "0.69676495", "0.6936707", "0.69254875", "0.6898314", "0.6854568", "0.6853388", "0.6839613", "0.6795579", "0.6783441", "0.67684126", "0.67531115", "0.6739921", "0.673970...
0.0
-1
Generates the model. Model from the paper `Hyperspectral Image Classification with Convolutional Neural Networks`.
def get_model_2(parameters): # Parameters BANDS = parameters['num_features'] CLASSES = parameters['num_classes'] # Sequential model model = keras.models.Sequential() # Add convolution (1) # ------------------- # Input_shape (batch, rows, cols, channels) = (-, 9, BANDS, 1) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_model():\n \n model = models.Sequential()\n model.add(layers.Conv2D(32, (3, 3), activation='relu',\n input_shape=(150, 150, 3)))\n model.add(layers.MaxPooling2D((2, 2)))\n model.add(layers.Conv2D(64, (3, 3), activation='relu'))\n model.add(layers.MaxPooling2D((...
[ "0.74906576", "0.737708", "0.7374737", "0.73634493", "0.72738254", "0.722179", "0.719926", "0.7169744", "0.7165971", "0.71573997", "0.7155907", "0.70832247", "0.70800775", "0.700203", "0.6984699", "0.6975053", "0.6929465", "0.69279003", "0.69197756", "0.6908886", "0.6897424",...
0.67032945
34
Plots the training evaluation data of the model. Model from the paper `Deep Convolutional Neural Networks for Hyperspectral Image Classification`.
def plot_eval_1(trained_model, image_name): # Get training evaluation data train_accuracy = trained_model.history['acc'] train_val_accuracy = trained_model.history['val_acc'] train_loss = trained_model.history['loss'] train_val_loss = trained_model.history['val_loss'] # Generate accuracy pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_eval_2(trained_model, image_name):\n # Get training evaluation data\n train_accuracy = trained_model.history['acc']\n train_val_accuracy = trained_model.history['val_acc']\n train_loss = trained_model.history['loss']\n train_val_loss = trained_model.history['val_loss']\n \n # Generate...
[ "0.7542084", "0.74669844", "0.72453004", "0.7223387", "0.7192263", "0.71492183", "0.7140505", "0.7054963", "0.6979223", "0.6964172", "0.69600993", "0.6952179", "0.68771577", "0.6875886", "0.68262106", "0.6817834", "0.6802001", "0.67861915", "0.67545164", "0.6744266", "0.67390...
0.7668084
0
Plots the training evaluation data of the model. Model from the paper `Hyperspectral Image Classification with Convolutional Neural Networks`.
def plot_eval_2(trained_model, image_name): # Get training evaluation data train_accuracy = trained_model.history['acc'] train_val_accuracy = trained_model.history['val_acc'] train_loss = trained_model.history['loss'] train_val_loss = trained_model.history['val_loss'] # Generate accuracy pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_eval_1(trained_model, image_name):\n # Get training evaluation data\n train_accuracy = trained_model.history['acc']\n train_val_accuracy = trained_model.history['val_acc']\n train_loss = trained_model.history['loss']\n train_val_loss = trained_model.history['val_loss']\n \n # Generate...
[ "0.76353586", "0.7385049", "0.731253", "0.72681344", "0.7253085", "0.7234777", "0.7126624", "0.69923985", "0.6957708", "0.69074744", "0.6898441", "0.6861298", "0.68581146", "0.6856867", "0.6853311", "0.6842307", "0.68256897", "0.6770244", "0.67635125", "0.67462647", "0.672040...
0.74850214
1
Plots the training evaluation data of the model. Model from the paper `Hyperspectral Image Classification with Convolutional Neural Networks`.
def plot_eval_4(trained_model, X_val, y_val, image_name): # Predict with validation data start_time = timeit.default_timer() trained_model.predict(X_val) end_time = timeit.default_timer() time = end_time - start_time speed = int(X_val.shape[0] / time) # Get loss and accuracy val_acc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_eval_1(trained_model, image_name):\n # Get training evaluation data\n train_accuracy = trained_model.history['acc']\n train_val_accuracy = trained_model.history['val_acc']\n train_loss = trained_model.history['loss']\n train_val_loss = trained_model.history['val_loss']\n \n # Generate...
[ "0.76363397", "0.74857736", "0.73833954", "0.7310451", "0.7267302", "0.7252611", "0.7234279", "0.71253246", "0.6992255", "0.6955936", "0.69071275", "0.68974733", "0.68606985", "0.6858053", "0.6855054", "0.68527275", "0.6840225", "0.6824793", "0.6770499", "0.67630816", "0.6745...
0.6651616
28
Test API cannot make an order by unauthorised user (POST request).
def test_make_order_by_unauthorised_user(self): response = self.client().post( '/api/v2/orders', data = json.dumps( self.order_data) , content_type = 'application/json') result = json.loads(response.data) self.assertEqual(result["message"], "Token is mising!. You need to sign in first") self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_orders_by_unauthorised_user(self):\n\n\t\tres = self.login_user()\n\t\taccess_token = json.loads(res.data.decode())['access_token']\n\n\t\tresponse = self.client().post(\n\t\t\t'/api/v2/orders',\n\t\t\theaders={\"x-access-token\": access_token},\n\t\t\tdata = json.dumps(\n\t\t\t\tself.order_data) , co...
[ "0.81316954", "0.80734015", "0.7594781", "0.7561987", "0.74970907", "0.7308627", "0.7302554", "0.7179246", "0.71111685", "0.7108617", "0.70498455", "0.70459586", "0.69648284", "0.69372946", "0.6934432", "0.6933783", "0.68794", "0.68776923", "0.6870652", "0.68523437", "0.68474...
0.8783594
0
Test API cannot get orders by regular user (GET request).
def test_get_orders_by_unauthorised_user(self): res = self.login_user() access_token = json.loads(res.data.decode())['access_token'] response = self.client().post( '/api/v2/orders', headers={"x-access-token": access_token}, data = json.dumps( self.order_data) , content_type = 'application/json') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_order(self):\n self.client.force_authenticate(self.user)\n url = get_detail_url(self.order.id)\n resp = self.client.get(url)\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n\n with self.subTest('Unauthenticated users may not use the API.'):\n sel...
[ "0.82348883", "0.8143619", "0.8028673", "0.7914913", "0.7882654", "0.7690229", "0.75544363", "0.74755096", "0.745036", "0.741735", "0.72958523", "0.7180769", "0.7164221", "0.7164221", "0.71428716", "0.7105029", "0.7039351", "0.7024808", "0.7008482", "0.6971587", "0.6965985", ...
0.85777783
0
Test API cannot delete an order if user not owner (DELETE request).
def test_order_cannot_be_deleted_if_not_owner(self): res = self.login_user() ress = self.login_admin_user() access_token = json.loads(res.data.decode())['access_token'] a_access_token = json.loads(ress.data.decode())['access_token'] response = self.client().post( '/api/v2/orders', headers={"x-access-t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_order_can_be_deleted_by_owner(self):\n\n\t\tres = self.login_user()\n\t\taccess_token = json.loads(res.data.decode())['access_token']\n\n\t\tresponse = self.client().post(\n\t\t\t'/api/v2/orders',\n\t\t\theaders={\"x-access-token\": access_token},\n\t\t\tdata = json.dumps(\n\t\t\t\tself.order_data) , cont...
[ "0.85853326", "0.797096", "0.7581545", "0.743529", "0.7404028", "0.7306585", "0.71920556", "0.7126621", "0.71054995", "0.7040966", "0.69914645", "0.69272304", "0.691377", "0.69126827", "0.68701845", "0.6857445", "0.68496644", "0.67300075", "0.67289585", "0.67275727", "0.67230...
0.88546735
0
Test API cannot delete an order if doesn't exist (DELETE request).
def test_order_cannot_be_deleted_if_dont_exist(self): res = self.login_user() access_token = json.loads(res.data.decode())['access_token'] response = self.client().post( '/api/v2/orders', headers={"x-access-token": access_token}, data = json.dumps( self.order_data) , content_type = 'application/jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_order(self):\n order = PizzaOrder.objects.get(id=self.response.data['id'])\n response = self.client.delete(\n reverse('order_details',\n kwargs={'order_id': order.id}),\n format='json',\n follow=True\n )\n\n self.assert...
[ "0.80378914", "0.7969679", "0.78958875", "0.7693193", "0.75279903", "0.74650407", "0.7254609", "0.7209717", "0.7153256", "0.7075835", "0.70690346", "0.7053524", "0.7002133", "0.70007026", "0.69981444", "0.6991164", "0.6953879", "0.6946775", "0.69466794", "0.6928087", "0.68891...
0.87875044
0
Separate values with a comma in array2string.
def arraystr(a, max_line_width=None, precision=None, suppress_small=None): return np.array2string(a, max_line_width, precision, suppress_small, separator=', ', prefix="", style=str)\ .replace('..., ', '..., ' if PY3 else 'Ellipsis, ')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_concatenated_string(array):\r\n return \",\".join(str(x) for x in array)", "def array_to_concatenated_string(array):\n return \",\".join(str(x) for x in array)", "def transfer_2d_array_to_str(array):\n str_list = []\n for r in array:\n str_list.append(\",\".join([str(e) for e in r]))\n ...
[ "0.69929737", "0.6902601", "0.67887294", "0.6738385", "0.6713219", "0.6601589", "0.6556977", "0.6480791", "0.6461941", "0.6446728", "0.63959646", "0.6392251", "0.63810694", "0.63782966", "0.63289976", "0.62891847", "0.62744576", "0.6273592", "0.6265061", "0.6250876", "0.62184...
0.0
-1
Extracts logmel energies from the given frames.
def log_energy(frames, sample_rate, *, kwargs={}): l = [] for frame in frames: energy = librosa.feature.melspectrogram( y=frame, sr=sample_rate, power=1, **kwargs) l.append( np.mean( librosa.core.amplitude_to_db( energy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_fermi_energy_from_log(log_file):\n with open(log_file, \"r\") as f:\n content = f.readlines()\n ferimiValues = EFermi_Pattern.findall(\"\".join(content))\n return list([float(item.split()[1]) for item in ferimiValues])", "def stEnergy(frame):\n return numpy.sum(frame ** 2) / numpy.flo...
[ "0.614679", "0.5971718", "0.59690106", "0.57360893", "0.54906696", "0.5436379", "0.54297936", "0.5335597", "0.530135", "0.52653104", "0.5224114", "0.52122605", "0.51696557", "0.5117125", "0.5111649", "0.5109586", "0.510869", "0.51055866", "0.51013744", "0.50663465", "0.506622...
0.6964603
0
Return the total duration of all events
def totalEventDuration(self): if self.events == None: raise Exception('event detector has not been called for a timeseries') return sum([event.duration() for event in self.events])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n duration = 0\n\n for entry in self.entries:\n duration += entry.get_duration()\n return duration", "def total_duration(self):\r\n # XXX: bug in duration after slicing - attr_onread should be reset\r\n # after slicing\r\n #...
[ "0.7356099", "0.7167941", "0.6815445", "0.6712624", "0.6648239", "0.6564534", "0.64879084", "0.6410677", "0.6394221", "0.63889503", "0.6378186", "0.63695914", "0.63648343", "0.6339672", "0.63242865", "0.63170195", "0.63170195", "0.6316054", "0.62947315", "0.6291546", "0.62915...
0.8528004
0
Create an EventDetector object based on the label; example of labels are 'L50E03G10OP' or 'T65E05G00CL'
def createEventDetector(label): if len(label) != 11: raise Exception('invalid event detector label: "%s"' % label) if label[0] == 'L': Lbeta = label[:3] # level provided as string else: Lbeta = float(label[1:3]) # level provided as number E = float(label[4:6]) minTauG = float(label[7:9]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_label(cls, label):\n return cls(label.specimen_id, label.views)", "def make_label_event(self, line):\n ret = MLFLabelEvent()\n tokens = line.split()\n n = len(tokens)\n if n == 1:\n ret.word_label = tokens[0]\n ret.start = None\n ret.en...
[ "0.616163", "0.60876155", "0.5580792", "0.5515266", "0.5447746", "0.54368335", "0.53632784", "0.5349861", "0.5341501", "0.53397423", "0.5294632", "0.5269414", "0.52547485", "0.5155434", "0.51529074", "0.5133967", "0.5097059", "0.5092845", "0.50801194", "0.50793135", "0.506558...
0.86213464
0
Validate that contact works at company.
def __call__(self, data): data_combiner = DataCombiner(self.instance, data) company = data_combiner.get_value(self.company_field) contact = data_combiner.get_value(self.contact_field) if contact.company != company: raise ValidationError({ self.contact_field: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_company(self, company: Company) -> Company:\n if company:\n company.has_perm(Subscription.SECOND, self.context[\"request\"].user)\n return company", "def full_contact_company(self,domain):\n if self.contact_api_key is None:\n click.secho(\"[!] No Full Conta...
[ "0.6468794", "0.5980664", "0.59506935", "0.5894009", "0.58926266", "0.5826065", "0.56606483", "0.56520915", "0.5587614", "0.55876005", "0.5551284", "0.55261856", "0.54993", "0.5498477", "0.5491925", "0.54838765", "0.54824877", "0.5412108", "0.5391571", "0.5360912", "0.5327758...
0.6208012
1
Validate that no other active quote exists.
def __call__(self, data=None): if self.instance.quote and not self.instance.quote.is_cancelled(): raise APIConflictException(self.message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_said(self, quote: str) -> bool:\n return any(q for q in self.quotes if q.content.lower() == quote.lower())", "def test_add_quote_but_file_contains_quote_already(self):\n path = tests.test_util.init_quotefile(self.tempdir, \"quotes1.txt\")\n quote = api.Quote(\" This is an added quot...
[ "0.5747989", "0.57406384", "0.5694497", "0.5638584", "0.54726636", "0.5431665", "0.5402564", "0.53784084", "0.5377113", "0.53460467", "0.5255905", "0.5229999", "0.5181424", "0.51718605", "0.5163591", "0.5128918", "0.5106957", "0.5106867", "0.50925434", "0.5089082", "0.508064"...
0.49599954
30
Validate that the actual_time field for all the assignees is set.
def __call__(self): if any(assignee.actual_time is None for assignee in self.order.assignees.all()): raise ValidationError({ api_settings.NON_FIELD_ERRORS_KEY: self.message, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, data=None):\n if not self.instance.assignees.count():\n raise ValidationError({\n 'assignees': [self.no_assignees_message],\n })\n\n if not self.instance.assignees.filter(is_lead=True).count():\n raise ValidationError({\n ...
[ "0.62578154", "0.60257274", "0.5846542", "0.5798009", "0.5765732", "0.57263684", "0.5691919", "0.56517375", "0.56238663", "0.55846256", "0.55471796", "0.55441684", "0.5480494", "0.5470317", "0.5445394", "0.54265475", "0.54178244", "0.5416805", "0.54017943", "0.53827286", "0.5...
0.79807216
0
returns dataframe with doji candle column
def doji(ohlc_df): df = ohlc_df.copy() avg_candle_size = abs(df['close']-df['open']).median()#abs(df["close"]- df["open"]).median() df["doji"] = abs(df["close"] - df["open"]) <= (0.05 * avg_candle_size) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doji(ohlc_df):\r\n df = ohlc_df.copy()\r\n avg_candle_size = abs(df[\"close\"] - df[\"open\"]).median()\r\n df[\"doji\"] = abs(df[\"close\"] - df[\"open\"]) <= (0.05 * avg_candle_size)\r\n return df", "def get_data_from_disc(symbol, usecols=['Date', 'Close', 'Open', 'High', 'Low', 'Adj Close', '...
[ "0.7177601", "0.617902", "0.6167698", "0.616418", "0.6136793", "0.6031459", "0.59011847", "0.58371955", "0.5828615", "0.5820551", "0.57958883", "0.5777113", "0.5771385", "0.5748469", "0.5708042", "0.5699576", "0.5694383", "0.5692249", "0.56770724", "0.567203", "0.567017", "...
0.70665765
1
Forward pass through CGCNN.
def forward( self, atom_fea, nbr_fea, atom_indices, neighbor_indices, crystal_atom_idx ) -> Tensor: crys_fea = self.material_nn( atom_fea, nbr_fea, atom_indices, neighbor_indices, crystal_atom_idx ) # apply neural network to map from learned features to target re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inp: torch.Tensor) -> torch.Tensor:\n x = self.conv1(inp)\n x = self.maxpool(x)\n\n for i in range(self._num_layers):\n x = getattr(self, \"C%d\" % (i + 1))(x)\n\n x = self.avgpool(x)\n x = x.view(x.size(0), -1)\n x = self.fc(x)\n return...
[ "0.6816531", "0.6782716", "0.6493475", "0.6476742", "0.64520603", "0.6427258", "0.6415382", "0.63828665", "0.637629", "0.6357232", "0.63075477", "0.627369", "0.62720245", "0.6257584", "0.6257211", "0.62189716", "0.6207396", "0.62021744", "0.6192087", "0.6192087", "0.6172831",...
0.0
-1
Forward pass through the ConvLayer.
def forward(self, atom_in_fea, nbr_fea, atom_indices, neighbor_indices) -> Tensor: # convolution atom_nbr_fea = atom_in_fea[neighbor_indices, :] atom_self_fea = atom_in_fea[atom_indices, :] total_fea = torch.cat([atom_self_fea, atom_nbr_fea, nbr_fea], dim=1) total_fea = self.fc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n # 2.2 BUG: Did Bob do anything wrong in the forward method?\n # HINT: Usually a CNN would expect correctly normalized data.\n # Roughly make input to be within -1 to 1 range\n x = (x - 127.5) / 127.5\n\n # Apply conv layers\n x = self.convs(x)\n\n...
[ "0.711918", "0.71191025", "0.7093731", "0.7038039", "0.70232356", "0.699296", "0.6987883", "0.6979936", "0.697402", "0.69594353", "0.69167703", "0.69167703", "0.6907656", "0.6907656", "0.68883425", "0.6863273", "0.6845201", "0.6836763", "0.68301606", "0.6823488", "0.68095106"...
0.0
-1
Assert that when retainUnsent is False, the count in `total_unsent_rows_removed` is at least 0
def test_disable_retainUnsent_logs(): stmt = sqlalchemy.select([_LOGGING_TABLE.c.total_unsent_rows_removed]).select_from(_LOGGING_TABLE).order_by( _LOGGING_TABLE.c.id.desc()).limit(1) config_info = read_config() config_info['retainUnsent'] = False open(config_file, 'w').close() with open(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_enable_retainUnsent_logs():\n stmt = sqlalchemy.select([_LOGGING_TABLE.c.total_unsent_rows_removed]).select_from(_LOGGING_TABLE).order_by(\n _LOGGING_TABLE.c.id.desc()).limit(1)\n config_info = read_config()\n config_info['retainUnsent'] = True\n open(config_file, 'w').close()\n with...
[ "0.6544264", "0.6492185", "0.62513465", "0.6145343", "0.58549976", "0.58342844", "0.57413626", "0.57136875", "0.5702678", "0.5669056", "0.5642327", "0.56340873", "0.5511554", "0.5508407", "0.54713744", "0.5463716", "0.5463716", "0.5460407", "0.54453796", "0.54184407", "0.5411...
0.63627756
2
Assert that when retainUnsent is True, the `total_unsent_rows_removed` is 0.
def test_enable_retainUnsent_logs(): stmt = sqlalchemy.select([_LOGGING_TABLE.c.total_unsent_rows_removed]).select_from(_LOGGING_TABLE).order_by( _LOGGING_TABLE.c.id.desc()).limit(1) config_info = read_config() config_info['retainUnsent'] = True open(config_file, 'w').close() with open(confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_enable_retainunsent_default_age():\n clean_tables()\n set_configuration()\n config = update_configuration(age=72, retain_unsent=True) \n assert config['age']['value'] == \"72\"\n assert config['retainUnsent']['value'] == \"True\" \n\n insert_into_reading()\n row_count = get_count() \n...
[ "0.65981007", "0.62875456", "0.62666833", "0.62274873", "0.5974208", "0.5842526", "0.56894517", "0.5583534", "0.5577256", "0.55751497", "0.5562179", "0.54568297", "0.54323435", "0.5418037", "0.5411867", "0.5398727", "0.5370703", "0.5356979", "0.5345173", "0.533924", "0.533924...
0.6449659
1
Assert that there aren't any residue rows remaining after delete.
def test_total_failed_to_remove(): stmt = sqlalchemy.select([_LOGGING_TABLE.c.total_failed_to_remove]).select_from(_LOGGING_TABLE) result = execute_command_with_return_value(stmt) assert [value[0] == 0 for value in result]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_an_extra_delete_is_not_sent(self):\n partition = uuid4()\n cluster = 1\n\n TestQueryUpdateModel.objects.create(\n partition=partition, cluster=cluster)\n\n obj = TestQueryUpdateModel.objects(\n partition=partition, cluster=cluster).first()\n\n self....
[ "0.6619022", "0.6572682", "0.65622807", "0.6496505", "0.64885324", "0.64030516", "0.6402442", "0.6355086", "0.6333897", "0.6311791", "0.6310154", "0.63090396", "0.62944275", "0.62850076", "0.62634355", "0.6246851", "0.62169945", "0.62087333", "0.62064046", "0.61764145", "0.61...
0.59676284
45
Return left edge of minimum magnitude bin
def get_min_mag_edge(self): return self.min_mag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_edge(f: SwimmingFish) -> float:\n if f.dx > 0:\n return f.posn.x\n else:\n return f.posn.x - f.fish.size", "def edgecomplete_left_vertex(self, X, w):\n h = self.op_norm(X, w[0])\n if self.K.is_zero(h):\n return None\n h -= w[1]\n if self.variant...
[ "0.6740905", "0.6382151", "0.6129807", "0.60924727", "0.6045674", "0.6012799", "0.5992438", "0.59662306", "0.5964623", "0.5947477", "0.59038836", "0.5887518", "0.5877542", "0.5858324", "0.582485", "0.58064526", "0.57795286", "0.57714194", "0.5745885", "0.5742873", "0.57419926...
0.7109807
0
Blit images to screen.
def blit_me(self): self.start_button.blit_me() self.title.blit_me() self.screen.blit(self.unicorn_img, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _blit_images(self):\n self.screen.blit(self.dial, (self.dialPos))\n self.screen.blit(self.rotatedImage, self.rotatedImageRectangle)", "def blit(self):\n self.screen.blit(self.image, self.rect)", "def blitme(self):\n self.screen.blit(self.image, self.rect)", "def blitme(self):\...
[ "0.78004557", "0.72737366", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7127933", "0.7100833", "0.7100833", "0.7100833", "0.7100659", "0.7100659", "0.7100659", "0.7100659", "0.7061471", "0.7044952", ...
0.61099
57
return Position of p's subtree key k or last node searched
def _subtree_search(self, p, k): if k == p.key(): return p elif k < p.key(): if self.left(p) is not None: return self._subtree_search(self.left(p), k) else: if self.right(p) is not None: return self._subtree_search(self.right(p)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _subtree_search(self, p, k):\n if k == p.key(): # found match\n return p\n elif k < p.key(): # search left subtree\n if self.left(p) is not None:\n return self._subtree_search(self.left(p), k)\n ...
[ "0.76520073", "0.7254559", "0.7033196", "0.69944155", "0.6934508", "0.69074726", "0.68335104", "0.6717298", "0.6690014", "0.66356456", "0.6634695", "0.6562115", "0.65234435", "0.6513386", "0.6502584", "0.648878", "0.6488224", "0.6463764", "0.64378124", "0.64058745", "0.63767"...
0.82677317
0
Convert and show image in matplotlib
def imshow(img): imadd(img) plt.ion() plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(path):\n img = mpimg.imread(path)\n imgplot = plt.imshow(img)\n plt.show()\n plt.close()", "def show_image(image):\r\n plt.imshow(image, cmap='gray')\r\n plt.show()", "def display_image(X):\n\n\tim = X.reshape(28, 28)\n\ttemp = plt.imshow(im)\n\tplt.show()", "def draw_image(s...
[ "0.7240341", "0.72171354", "0.72147304", "0.7109893", "0.7059927", "0.70595276", "0.70595276", "0.70595276", "0.6964306", "0.69348985", "0.6921574", "0.6881371", "0.6808193", "0.6787899", "0.67845756", "0.6767024", "0.67652357", "0.6749043", "0.6747291", "0.674624", "0.671015...
0.67624605
17
Returns parent directory location
def root_dir(): return Path(__file__).parent.parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent_dir(path):\n return os.path.dirname(path)", "def parent_dir_path(path):\n return absolute_path(os.path.dirname(path))", "def getParentDirectory():\n path = os.path.dirname(os.path.realpath(__file__))\n path = '/'.join( path.split('/')[:-1] )\n return path", "def parentOrThisDir(pa...
[ "0.8413406", "0.8372473", "0.82589805", "0.82514536", "0.8214239", "0.81748766", "0.8142769", "0.80121386", "0.7901326", "0.77953523", "0.7590437", "0.732964", "0.72327983", "0.7178573", "0.7162037", "0.7161591", "0.71206045", "0.70540994", "0.7022676", "0.69965327", "0.69786...
0.72297055
13
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AmountInfomationV2): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Vectorized haversine distance calculation
def haversine(p: np.ndarray, q: np.ndarray) -> float: d = q - p a = (math.sin(d[0] / 2.0) ** 2 + math.cos(p[0]) * math.cos(q[0]) * math.sin(d[1] / 2.0) ** 2) c = 2 * math.atan2(math.sqrt(a), math.sqrt(1.0 - a)) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine_dist(this_lat, this_lon, lat_vec, lon_vec):\n this_lat, this_lon, lat_vec, lon_vec = map(np.radians, (this_lat, this_lon, lat_vec, lon_vec))\n dlat = lat_vec - this_lat\n dlon = lon_vec - this_lon\n a = np.square(np.sin(dlat/2)) + np.cos(this_lat) * np.multiply(np.cos(lat_vec), np.square...
[ "0.76570636", "0.71194756", "0.70101315", "0.6953141", "0.68675005", "0.68037647", "0.6800873", "0.67691875", "0.6767622", "0.67247975", "0.6711416", "0.66254157", "0.65995014", "0.65977913", "0.65671486", "0.6563485", "0.6548713", "0.6532873", "0.65280765", "0.65091723", "0....
0.6652647
11
Vectorized haversine distance calculation
def earth_haversine(p: np.ndarray, q: np.ndarray) -> float: earth_radius = 6378137.0 return haversine(np.radians(p), np.radians(q)) * earth_radius
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine_dist(this_lat, this_lon, lat_vec, lon_vec):\n this_lat, this_lon, lat_vec, lon_vec = map(np.radians, (this_lat, this_lon, lat_vec, lon_vec))\n dlat = lat_vec - this_lat\n dlon = lon_vec - this_lon\n a = np.square(np.sin(dlat/2)) + np.cos(this_lat) * np.multiply(np.cos(lat_vec), np.square...
[ "0.7656346", "0.71199733", "0.7011706", "0.6954516", "0.6868793", "0.6804427", "0.68033296", "0.6770777", "0.67682624", "0.6726308", "0.6713218", "0.6652968", "0.6626013", "0.6601472", "0.6599804", "0.6569076", "0.656506", "0.65500146", "0.6535164", "0.6529891", "0.6510912", ...
0.62582076
59
Return or bind the executing device to output tensor.
def alloc(self, out=None): if out is not None: out._device = self._device.copy() return out return self._device.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device(self):\n return self._tensor.device", "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def device(self) -> torch.device:\n return self._device", "def run_on_device(self, *args, **kwargs) -> DeviceOutputs:\n ret...
[ "0.67755586", "0.6211564", "0.60707", "0.6029104", "0.5898456", "0.589778", "0.5896882", "0.589323", "0.5870643", "0.5797109", "0.5773679", "0.57615006", "0.5758959", "0.5733176", "0.5733176", "0.5733176", "0.5729339", "0.56980926", "0.5696714", "0.56568754", "0.5655757", "...
0.53547525
39
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.80936956", "0.809273", "0.795861", "0.78515965", "0.7842818", "0.78245074", "0.7766247", "0.7754811", "0.7747721", "0.7747721", "0.7747721", "0.7747721", "0.7747721", "0.7747721", "0.7747721", "0.7747721", "0.7719394", "0.766773", "0.76642597", "0.76496774", "0.7614337", ...
0.7810836
17
I run before every test in this class Creats a VGG16 model and gets the last layer,
def setUp(self): print("\n-------------------------------------\nIn Test_KerasLayers:", self._testMethodName) self.model = VGG16() self.last_layer = self.model.submodules[-1] ww.weightwatcher.keras = keras
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_vgg16():\n # base_model.summary():\n # ....\n # block5_conv4 (Conv2D) (None, 15, 15, 512) 2359808\n # _________________________________________________________________\n # block5_pool (MaxPooling2D) (None, 7, 7, 512) 0\n # _________________...
[ "0.71699524", "0.7156078", "0.7144145", "0.6992418", "0.67956144", "0.6720736", "0.66947323", "0.6686446", "0.6629766", "0.66060966", "0.65839607", "0.6548315", "0.6508151", "0.6502141", "0.6454946", "0.64524907", "0.6446467", "0.643815", "0.6415911", "0.6411335", "0.6406146"...
0.6039993
51
I run before every test in this class Creats a VGG16 model and gets the last layer,
def setUp(self): print("\n-------------------------------------\nIn Test_PyTorchLayers:", self._testMethodName) ww.weightwatcher.torch = torch self.model = models.resnet18() for layer in self.model.modules(): self.last_layer = layer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_vgg16():\n # base_model.summary():\n # ....\n # block5_conv4 (Conv2D) (None, 15, 15, 512) 2359808\n # _________________________________________________________________\n # block5_pool (MaxPooling2D) (None, 7, 7, 512) 0\n # _________________...
[ "0.7168294", "0.71543777", "0.71423453", "0.6990208", "0.67931354", "0.6719671", "0.6691702", "0.6684858", "0.66287065", "0.6604035", "0.658112", "0.65468466", "0.650707", "0.6503614", "0.6456134", "0.64508593", "0.6443264", "0.64390254", "0.6415212", "0.6408311", "0.6403717"...
0.0
-1
Remove any leftover temp files from failed tests; this should never be necessaery
def tearDownClass(cls): Test_Base._remove_all_ww_tmp_dirs() super().tearDownClass() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_temp_dir():\n files = glob.glob(f'{CONFIG_DIR}/tmp/*')\n for f in files:\n try:\n os.remove(f)\n except Exception:\n pass", "def tearDown(self) -> None:\n filtered = [f for f in glob.glob('steps/tests/test_output/*') if not re....
[ "0.78060484", "0.77982086", "0.77926356", "0.7736854", "0.7627535", "0.7540641", "0.75195307", "0.75190467", "0.7506287", "0.750539", "0.7436323", "0.73915875", "0.73809326", "0.7311558", "0.7304898", "0.7304511", "0.7295666", "0.7287898", "0.72855985", "0.7280487", "0.725396...
0.0
-1
Tests that if we create a temporary directory, and the test fails, that it is added to the tmp_dirs
def test_failed_test_tmpdir_removed(self): test_dir = None try: with TemporaryDirectory(dir=TEST_TMP_DIR, prefix="ww_") as model_dir: print(f"using {model_dir} as model_dir") self.assertTrue(model_dir.startswith(TEST_TMP_DIR)) test_dir = str(model_dir) print(f"checking {test_dir} ") self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tmp_dir():\n d = \"{home}/tmp\".format(home=os.path.expanduser('~'))\n assert os.path.isdir(d)\n assert os.access(d, os.W_OK) # W_OK is for writing, R_OK for reading, etc.", "def checkTmpDir(tmpDir,jobName):\n if tmpDir is None or tmpDir==\"\":\n tmpDir=tempfile.mkdtemp(suffix=jobName...
[ "0.78611225", "0.7789471", "0.77465194", "0.77359927", "0.7723105", "0.76571536", "0.7652669", "0.7494761", "0.74411243", "0.7390888", "0.7380444", "0.73603755", "0.7356869", "0.73471725", "0.724662", "0.7236655", "0.7219758", "0.7215304", "0.7201361", "0.7188414", "0.7184946...
0.7764006
2
Remove class specific weights_dir, and any leftover temp files from failed tests
def tearDownClass(cls): Test_Base._remove_ww_tmp_dir(cls.weights_dir) Test_Base._remove_all_ww_tmp_dirs() super().tearDownClass() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_and_remove_ww_tmp_dir(self):\n\t\t\n\t\tweights_dir = Test_WWFlatFiles._make_tmp_weights_dir()\n\t\tself.assertTrue(os.path.isdir(weights_dir))\n\t\t\n\t\tTest_Base._remove_ww_tmp_dir(weights_dir)\n\t\tself.assertFalse(os.path.isdir(weights_dir))\n\t\t\n\t\treturn", "def tearDown(self) -> None:\n ...
[ "0.7424175", "0.7176647", "0.7105716", "0.70257425", "0.7003182", "0.6930262", "0.69094855", "0.67877483", "0.67855895", "0.6771196", "0.67627794", "0.6758681", "0.673299", "0.67195857", "0.67174816", "0.67018116", "0.6695787", "0.6683954", "0.6681542", "0.6676443", "0.666886...
0.7654598
0
I run before every test in this class Creats a VGG16 model and gets the last layer,
def setUp(self): #import inspect print("\n-------------------------------------\nIn Test_PyStateDictLayers:", self._testMethodName) ww.weightwatcher.torch = torch self.model = models.resnet18().state_dict() #for cls in inspect.getmro(type(self.model)): # print(str(cls)) for key in self.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_vgg16():\n # base_model.summary():\n # ....\n # block5_conv4 (Conv2D) (None, 15, 15, 512) 2359808\n # _________________________________________________________________\n # block5_pool (MaxPooling2D) (None, 7, 7, 512) 0\n # _________________...
[ "0.7168294", "0.71543777", "0.71423453", "0.6990208", "0.67931354", "0.6719671", "0.6691702", "0.6684858", "0.66287065", "0.6604035", "0.658112", "0.65468466", "0.650707", "0.6503614", "0.6456134", "0.64508593", "0.6443264", "0.64390254", "0.6415212", "0.6408311", "0.6403717"...
0.0
-1
Test that ww.LAYER_TYPE.DENSE filter is applied only to DENSE layers
def test_model_layer_types_ww2x(self): details = self.watcher.describe(pool=False, min_evals=1) denseLayers = details[details.layer_type==str(LAYER_TYPE.DENSE)] denseCount = len(denseLayers) self.assertEqual(denseCount, 3, "3 dense layers, but {} found".format(denseCount)) conv2DLayers = details[d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_dense_layer_types(self):\n\t\tprint(\"test_filter_dense_layer_types\")\n\t\tdetails = self.watcher.describe(layers=[LAYER_TYPE.DENSE])\n\t\tprint(details)\n\t\t\n\t\tdenseLayers = details[details.layer_type==str(LAYER_TYPE.DENSE)]\n\t\tdenseCount = len(denseLayers)\n\n\t\tself.assertEqual(denseCoun...
[ "0.72056395", "0.6853185", "0.67411697", "0.5925648", "0.58145314", "0.55425835", "0.54277843", "0.54049164", "0.5355866", "0.52974844", "0.5289692", "0.52886176", "0.52618957", "0.5258047", "0.5256818", "0.52451396", "0.52286124", "0.52186435", "0.5201913", "0.51897806", "0....
0.5554918
5
Remove class specific weights_dir, and any leftover temp files from failed tests
def tearDownClass(cls): Test_Base._remove_ww_tmp_dir(cls.weights_dir) Test_Base._remove_all_ww_tmp_dirs() super().tearDownClass() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_and_remove_ww_tmp_dir(self):\n\t\t\n\t\tweights_dir = Test_WWFlatFiles._make_tmp_weights_dir()\n\t\tself.assertTrue(os.path.isdir(weights_dir))\n\t\t\n\t\tTest_Base._remove_ww_tmp_dir(weights_dir)\n\t\tself.assertFalse(os.path.isdir(weights_dir))\n\t\t\n\t\treturn", "def tearDown(self) -> None:\n ...
[ "0.7424175", "0.7176647", "0.7105716", "0.70257425", "0.7003182", "0.6930262", "0.69094855", "0.67877483", "0.67855895", "0.6771196", "0.67627794", "0.6758681", "0.673299", "0.67195857", "0.67174816", "0.67018116", "0.6695787", "0.6683954", "0.6681542", "0.6676443", "0.666886...
0.7654598
1
Generate and return the currently available prediction model. Model may be `None` if there is no currently available model.
def model(self) -> Optional[HaarModel]: cascade_file = self._paths["cascade_file"] model = None if os.path.isfile(cascade_file) and self.settings.class_index is not None: model = HaarModel(cascade_file, self.settings) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_model(self) -> Model:\n assert self.model_name\n\n print(\"Check if Model exists.\")\n if self.model_name in self.models:\n print(\"Model does exists.\")\n # if get_model(self.model_name).tags['train_py_hash'] == self.get_file_md5(\n # ...
[ "0.7133013", "0.711182", "0.7066499", "0.6942665", "0.6882", "0.6780109", "0.66772157", "0.66243124", "0.6547993", "0.6547592", "0.64965606", "0.6486453", "0.6448505", "0.64302766", "0.6423706", "0.642238", "0.64218825", "0.64057624", "0.63462746", "0.63136405", "0.6301953", ...
0.0
-1
ensure roll functionality works
def testRoll(self): nsides=3 die = BaseDie(nsides) lighted_die = LightedDie(nsides,colors={1:'blue',2:'yellow',3:'gold'}) self.assertEqual(die.last_roll,None) die.roll() lighted_die.roll() for d in [die,lighted_die]: self.assertTrue(d.last_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll():\n pass", "def hook_rolldice(self):\n return ui.roll(self)", "def rolldice(self):\n raise NotImplementedError()", "def roll(self):\n return self._roll", "def roll(self):\n return self._roll", "def roll(self):\n self.rolled = random.randint(1, 6)\n r...
[ "0.78988034", "0.69984275", "0.68144846", "0.6710742", "0.6710742", "0.6510638", "0.64724505", "0.6379821", "0.63268256", "0.6326657", "0.63209385", "0.6293037", "0.62467825", "0.6245015", "0.62369853", "0.62205154", "0.61906636", "0.61276203", "0.6089827", "0.6087172", "0.60...
0.62519413
12
remove the stuff that you built in setUp (e.g. directories) not needed for Die classes
def tearDown(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpClass(cls):\n if not os.path.exists(_TMP_DIR):\n os.makedirs(_TMP_DIR)\n if not os.path.exists(_SRC_MOD_DIR):\n os.makedirs(_SRC_MOD_DIR)\n\n remove_files(glob.iglob(os.path.join(_TMP_DIR, '*.*')))\n remove_files(glob.iglob(os.path.join(_SRC_MOD_DIR, '*.*'...
[ "0.730096", "0.7235276", "0.71437234", "0.7124335", "0.71212745", "0.7006987", "0.6999593", "0.69697315", "0.6957369", "0.69515526", "0.69515526", "0.6941795", "0.6935265", "0.6858815", "0.6858815", "0.68494093", "0.683472", "0.6833853", "0.682159", "0.681106", "0.681106", ...
0.0
-1
Takes a set of distributions over the [0,1] interval and translates them into softmax of their expected values
def forward(self, ps, T): exp_values = self.expected_value_calc(ps) probs = F.softmax(exp_values/T, dim=-1) return probs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(values):\n exps = np.exp(values)\n return exps / sum(exps)", "def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))", "def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))", "def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(ex...
[ "0.73730695", "0.71532553", "0.71532553", "0.7138015", "0.7133507", "0.7119097", "0.7119097", "0.7073773", "0.7073773", "0.7073773", "0.7073773", "0.7073773", "0.7073773", "0.7073773", "0.7073773", "0.7066461", "0.7062208", "0.7003875", "0.69743395", "0.6971242", "0.69638306"...
0.0
-1
Calculates the aggregation of probabilities assuming Thompson sampling. actions can be one index or actions1, actions2
def aggregate_distributions_by_policy(ps, policy_p, asserts = False): policy_p = policy_p/policy_p.sum(-1, keepdim=True) if asserts: assert all([p >= 0 for p in policy_p.view(-1)]) assert all([(p - 1.0).abs() < eps for p in policy_p.sum(-1)]) policy_p = policy_p.unsqueeze(len(policy_p.size()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n probs = np.ones(len(states))/2\n return probs", "def get_probs(self, states, actions):\n # YOUR CODE HERE\n \n # So we need to determine for every input state-action pair, what the resulting policy dist...
[ "0.6763311", "0.66574484", "0.6566668", "0.6504399", "0.6493721", "0.6406789", "0.6231681", "0.6153917", "0.6113219", "0.6106338", "0.609098", "0.6083855", "0.6067049", "0.60604006", "0.6016603", "0.600746", "0.6003862", "0.5999234", "0.5961963", "0.5959977", "0.5952519", "...
0.0
-1
Tokenizes a phrase using the nltk tokenizer. If the phrase already has subwords, these will be overwritten.
def tokenize_phrase(phrase): assert isinstance(phrase, Phrase) tokens = nltk.word_tokenize(phrase.phrase) phrase.add_words([Word(word=word) for word in tokens]) return phrase
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(sentence):\n return nltk.word_tokenize(sentence)", "def _remove_phrase_tokens(self, phrase: Phrase, tokenizer: Tokenizer = None) -> None:\n tokenizer = self._get_tokenizer(tokenizer)\n if tokenizer is None:\n return None\n tokens = tokenizer.tokenize(phrase.phrase_...
[ "0.6886672", "0.6772981", "0.66353106", "0.65527", "0.6473158", "0.64144146", "0.64010584", "0.6382285", "0.6368636", "0.636459", "0.63491786", "0.6308058", "0.63062394", "0.6271902", "0.6240912", "0.62335527", "0.61950946", "0.61872786", "0.61510533", "0.6143522", "0.6128763...
0.8272181
0
Write a DataFrame to CSV, creating the output directory if necessary. Log the output path and number of rows.
def write_csv(df: pd.DataFrame, outpath) -> None: logging.info('Writing detection records to disk') outdir = os.path.split(outpath)[0] if not os.path.exists(outdir): os.makedirs(outdir) df.to_csv(outpath, index=False) logging.info(f'{len(df)} records written to {outpath}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_df_to_csv(output_df,file_path):\n output_df\\\n .coalesce(1)\\\n .write\\\n .format(\"csv\")\\\n .option(\"header\",\"true\")\\\n .mode(\"overwrite\")\\\n .save(file_path)", "def write_df_tocsv(df, file_name):\n try:\n df.to_csv(os.path.join(script...
[ "0.7551525", "0.73792434", "0.7282722", "0.72569335", "0.72496927", "0.72234684", "0.72109115", "0.7204214", "0.71625125", "0.7120945", "0.71160054", "0.70913947", "0.70762366", "0.70755386", "0.7073337", "0.70104086", "0.6941631", "0.6923366", "0.6892683", "0.6856349", "0.68...
0.777608
0
Verify the parent name.
def VerifyParentForExport(organization, project, folder, attribute='root cloud asset'): if organization is None and project is None and folder is None: raise gcloud_exceptions.RequiredArgumentException( '--organization or --proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(obj, parent_name):\n if obj.parent is None:\n return False\n if obj.parent.name is None:\n return False\n elif obj.parent.name == parent_name:\n return True\n else:\n return has_parent(obj.parent, parent_name)", "def clean_parent(self):\r\n data = sel...
[ "0.6971745", "0.66671616", "0.6659929", "0.66385084", "0.6593543", "0.65022653", "0.6481075", "0.6472918", "0.64529395", "0.6449775", "0.64379877", "0.6420261", "0.641911", "0.639148", "0.63750476", "0.6349837", "0.6343843", "0.6343843", "0.63341004", "0.63258344", "0.6258896...
0.0
-1
Gets the parent name from organization Id, project Id, or folder Id.
def GetParentNameForExport(organization, project, folder, attribute='root cloud asset'): VerifyParentForExport(organization, project, folder, attribute) if organization: return 'organizations/{0}'.format(organization) if folder: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent(self, the_id: str) -> str:\n\n parents = self.parent_types[the_id]\n return parents[1] if len(parents) > 1 else ''", "def get_parent(self, id_) -> str:\n return list(self._nodes[id_]['parents'].keys())[0]", "def parent_id(self) -> str:\n return self._db_data.parent_id...
[ "0.769294", "0.7574789", "0.72668004", "0.7213511", "0.7172086", "0.7172086", "0.7136938", "0.71029955", "0.699289", "0.69741285", "0.6971407", "0.6917706", "0.6889737", "0.6842269", "0.6804137", "0.6779201", "0.6779201", "0.6738915", "0.67058074", "0.6656991", "0.6656106", ...
0.691313
12
Get the parent name from organization Number, project Id, or folder Number.
def GetFeedParent(organization, project, folder): if organization: return 'organizations/{0}'.format(organization) if folder: return 'folders/{0}'.format(folder) return 'projects/{0}'.format(project_util.GetProjectNumber(project))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parent(self, the_id: str) -> str:\n\n parents = self.parent_types[the_id]\n return parents[1] if len(parents) > 1 else ''", "def parent_id(self) -> str:\n return self._db_data.parent_id", "def parentname(self):\n return _coordsys.coordsys_parentname(self)", "def get_parent...
[ "0.74285823", "0.72129714", "0.7165588", "0.71459377", "0.714557", "0.7143463", "0.7143463", "0.70638025", "0.7050558", "0.7038914", "0.70210785", "0.6866854", "0.68090117", "0.67352647", "0.6734735", "0.6658442", "0.66483736", "0.66422474", "0.6626789", "0.6626789", "0.66190...
0.7091101
7