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
Wrapper for the `KLqp` loss function. $\\text{ELBO} = \mathbb{E}_{q(z; \lambda)} [ \log p(x, z) \log q(z; \lambda) ]$ KLqp supports 1. score function gradients [] 2. reparameterization gradients [] of the loss function. If the KL divergence between the variational model and the prior is tractable, then the loss functio...
def build_loss_and_gradients(self, var_list): is_reparameterizable = all([ rv.reparameterization_type == tf.contrib.distributions.FULLY_REPARAMETERIZED for rv in six.itervalues(self.latent_vars)]) is_analytic_kl = all([isinstance(z, Normal) and isinstance(qz, Normal) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_with_kl_constraint(avg_probs, current_log_probs,\n model, original_loss, delta, optimizer, args):\n\n # Compute g: a direction to minimize the original loss\n optimizer.zero_grad()\n original_loss.backward(retain_graph=True)\n g = [Variable(p.grad.data.clone()) if p....
[ "0.68900853", "0.6482017", "0.632404", "0.62792313", "0.62580585", "0.62458736", "0.62363786", "0.62348706", "0.6210023", "0.61915225", "0.6129789", "0.6127075", "0.6126387", "0.6120106", "0.6065313", "0.60520554", "0.60287595", "0.59630233", "0.59577453", "0.59396905", "0.59...
0.52682084
77
Returns all currently registered projects.
def getProjects(self): return self.__projects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n res = self.conn.cursor().execute(\"SELECT * FROM projects\")\n return res.fetchall()", "def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()", "def get_projects(self):\n return conf.projects", "def get_project...
[ "0.8232174", "0.8213778", "0.8167885", "0.80853397", "0.8077941", "0.8049537", "0.7977747", "0.79569495", "0.79529846", "0.78947264", "0.7880031", "0.7868536", "0.78635466", "0.78539145", "0.7827581", "0.7827504", "0.78244984", "0.77996415", "0.77203554", "0.77141595", "0.770...
0.7990014
6
A leaf of a Huffman tree, which has a weight at the root.
def huffman_leaf(letter, weight): return tree(weight, [tree(letter)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(tree):\n return root(tree)", "def add_leaf(self, leaf):\n cur_tree_size = self.tree_size\n leaf_hash = self.__hasher.hash_leaf(leaf)\n with self.__db.write_batch() as wb:\n wb.put(self.__leaves_db_prefix + encode_int(cur_tree_size), leaf_hash)\n wb.put(sel...
[ "0.6629063", "0.6332378", "0.63108844", "0.6250285", "0.6247452", "0.61471623", "0.61400557", "0.6054129", "0.6038064", "0.6011156", "0.60081345", "0.59723604", "0.58810776", "0.5842034", "0.5787143", "0.5688447", "0.56762534", "0.56469023", "0.56434786", "0.56082535", "0.560...
0.81441754
0
The letter of a Huffman leaf.
def letter(leaf): return root(branches(leaf)[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def huffman_leaf(letter, weight):\n return tree(weight, [tree(letter)])", "def letter_for(label):\n return \"ABCDEFGHIJ\"[label]", "def letter(self):\n return self._letter", "def letter(self) -> str:\n my_letter = None\n if self is LieType.A:\n my_letter = \"A\"\n ...
[ "0.70182246", "0.6601549", "0.64093137", "0.6372742", "0.62751746", "0.62067807", "0.6191819", "0.61568415", "0.6148431", "0.6148431", "0.6103339", "0.60758936", "0.6001261", "0.5989812", "0.59848124", "0.59508294", "0.59269017", "0.5878677", "0.5878677", "0.5830882", "0.5821...
0.80519587
0
compute the run id of engine at the runtime of this function. By default, this value will be computed based on the application start time, current time and training_interval.
def get_current_run_id(self): start_datetime = self.start_dt run_datetime = self._get_current_datetime() run_interval = self.training_interval time_since_start = run_datetime - start_datetime logger.info("Time between start and run_date: %s" % str(time_since_start)) run...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_id(self):\n if self._run_id is not None:\n return self._run_id\n run = mlflow.active_run()\n if run:\n return run.info.run_id\n raise DataSetError(\"Cannot find run id.\")", "def run_id(self) -> str:\n return self._step_execution_context.run_id", ...
[ "0.6934921", "0.6872438", "0.68548775", "0.67647004", "0.66075057", "0.6586421", "0.6543762", "0.65306723", "0.6504142", "0.6321504", "0.6228771", "0.60131", "0.5770896", "0.57361007", "0.5733273", "0.56807935", "0.56714046", "0.56198853", "0.5587097", "0.55847967", "0.557442...
0.76991
0
Test if the given points are on the same side of the given line.
def coplanar_points_are_on_same_side_of_line(a, b, p1, p2): check_shape_any(a, (3,), (-1, 3), name="a") vg.shape.check(locals(), "b", a.shape) vg.shape.check(locals(), "p1", a.shape) vg.shape.check(locals(), "p2", a.shape) # Uses "same-side technique" from http://blackpawn.com/texts/pointinpoly/def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_point_on_same_line(self, x, y = None):\n x, y = y is not None and (x, y) or (x[0], x[1])\n\n if self.is_vertical():\n return Point(x, 0) == Point(self.x_value, 0)\n else:\n return Point(0, y) == Point(0, (self.slope * x + self.y_intercept))", "def point_on_line(point:tuple, ...
[ "0.74170244", "0.71855146", "0.71448964", "0.6980559", "0.69723374", "0.6956834", "0.6953711", "0.68701255", "0.684277", "0.67966044", "0.6707503", "0.6707503", "0.6648274", "0.6643779", "0.6637488", "0.6630335", "0.6597161", "0.65915006", "0.65898955", "0.6585801", "0.658211...
0.72722757
1
Compare this instance to other object.
def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented if self.subreddit != other.subreddit: return False if len(self.posts) != len(other.posts): return False for index, post in enumerate(self.posts)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n pass", "def __eq__(self, other):\n pass", "def __eq__(self, other):\n raise NotImplementedError", "def __eq__(self, other):\n raise NotImplementedError", "def __eq__(self, other):\n raise NotImplementedError", "def __eq__(self, other):\n ...
[ "0.768888", "0.768888", "0.76152325", "0.76152325", "0.76152325", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", "0.7609072", ...
0.0
-1
Calculates the fitness for every animal in the population.
def fitness_landscape(self): for herb, carn in zip(self.herb_pop, self.carn_pop): herb.fitness_animal() carn.fitness_animal()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness(self):\n pass", "def _evaluate_fitness(self, population: Population):\n for n, individual in enumerate(population.individuals):\n\n # Dataset extraction using individual features\n X_data = self._create_dataset(individual, self._X)\n\n # Get scores for e...
[ "0.7405196", "0.7037434", "0.7036307", "0.6970731", "0.69456834", "0.690155", "0.68981326", "0.6892874", "0.68823236", "0.68382853", "0.6834492", "0.6832916", "0.677158", "0.67667514", "0.6760777", "0.6759302", "0.67455983", "0.6734069", "0.6700685", "0.6678594", "0.66626847"...
0.7136252
1
Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined.
def event_data_content_type(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "event_data_content_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_data_content_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"event_data_content_type\")", "def test_contentType(self):\n resource = self.eventSourceResource()\n response = self.render(resource)\n\n self.assertEquals(\n response.headers.getRawHeaders(...
[ "0.6560987", "0.5807389", "0.56702584", "0.56168985", "0.55562496", "0.5509294", "0.5385884", "0.53721076", "0.53538895", "0.53529537", "0.534253", "0.5285811", "0.5270306", "0.52256703", "0.5206983", "0.5124404", "0.50810504", "0.50729597", "0.50566006", "0.5043175", "0.5033...
0.7212311
0
The resource name of the trigger. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/triggers/{trigger}` format.
def name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_name(self) -> \"str\":\n return self._attrs.get(\"triggerName\")", "def ConvertTriggerArgsToRelativeName(trigger_provider, trigger_event,\n trigger_resource):\n resource_type = util.input_trigger_provider_registry.Event(\n trigger_provider, trigger_eve...
[ "0.7527124", "0.71120906", "0.7097534", "0.6576202", "0.63439", "0.6206786", "0.6195625", "0.6095322", "0.6064925", "0.6064925", "0.6064925", "0.6064925", "0.6064925", "0.59935707", "0.5957223", "0.5933082", "0.58648896", "0.5862364", "0.5842558", "0.57228655", "0.57228655", ...
0.0
-1
Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The `iam.serviceAccounts.actAs` permission must be granted on the service account to allow a principal to impersonate the service account. For more information, see the [Roles and permissions...
def service_account(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "service_account")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_account_email_address(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_account_email_address\")", "def gcp_service_account_email(self) -> Optional[str]:\n return pulumi.get(self, \"gcp_service_account_email\")", "def gcp_service_account_email(self) -> Optional...
[ "0.6133687", "0.6108488", "0.6108488", "0.6032894", "0.5943394", "0.5879571", "0.5351565", "0.5351565", "0.5191533", "0.51620245", "0.513324", "0.5090486", "0.5085342", "0.5080397", "0.5050701", "0.50213134", "0.5012026", "0.5009703", "0.5009703", "0.49995467", "0.49907267", ...
0.55330706
6
Get an existing Trigger resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Trigger': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = TriggerArgs.__new__(TriggerArgs) __props__.__dict__["channel"] = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_by_id(self, trigger_id):\n result = self._client.get(self._full_path(trigger_id + '/state'))\n if 'state' in result:\n trigger = self._client.get(self._full_path(trigger_id))\n return Trigger(self._client, **trigger)\n elif not 'trigger_id' in result:\n ...
[ "0.6664268", "0.59529215", "0.5468617", "0.54449636", "0.54146785", "0.53554785", "0.5273887", "0.52313375", "0.5222843", "0.5193451", "0.5148532", "0.51341647", "0.5119722", "0.5098134", "0.50060654", "0.49825457", "0.49800962", "0.49720207", "0.4955113", "0.49404675", "0.49...
0.70544523
0
Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined.
def event_data_content_type(self) -> pulumi.Output[str]: return pulumi.get(self, "event_data_content_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_data_content_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"event_data_content_type\")", "def test_contentType(self):\n resource = self.eventSourceResource()\n response = self.render(resource)\n\n self.assertEquals(\n response.headers.getRa...
[ "0.7212311", "0.5807389", "0.56702584", "0.56168985", "0.55562496", "0.5509294", "0.5385884", "0.53721076", "0.53538895", "0.53529537", "0.534253", "0.5285811", "0.5270306", "0.52256703", "0.5206983", "0.5124404", "0.50810504", "0.50729597", "0.50566006", "0.5043175", "0.5033...
0.6560987
1
The resource name of the trigger. Must be unique within the location of the project and must be in `projects/{project}/locations/{location}/triggers/{trigger}` format.
def name(self) -> pulumi.Output[str]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_name(self) -> \"str\":\n return self._attrs.get(\"triggerName\")", "def ConvertTriggerArgsToRelativeName(trigger_provider, trigger_event,\n trigger_resource):\n resource_type = util.input_trigger_provider_registry.Event(\n trigger_provider, trigger_eve...
[ "0.7528496", "0.7112121", "0.7099704", "0.6576377", "0.6344201", "0.6207036", "0.6197054", "0.6095968", "0.6064785", "0.6064785", "0.6064785", "0.6064785", "0.6064785", "0.59940827", "0.5957691", "0.5935215", "0.58648616", "0.5863149", "0.584258", "0.5722701", "0.5722701", ...
0.0
-1
Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The `iam.serviceAccounts.actAs` permission must be granted on the service account to allow a principal to impersonate the service account. For more information, see the [Roles and permissions...
def service_account(self) -> pulumi.Output[str]: return pulumi.get(self, "service_account")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_account_email_address(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_account_email_address\")", "def gcp_service_account_email(self) -> Optional[str]:\n return pulumi.get(self, \"gcp_service_account_email\")", "def gcp_service_account_email(self) -> Optional...
[ "0.61334777", "0.61078954", "0.61078954", "0.6032047", "0.5942802", "0.5879194", "0.5532153", "0.5532153", "0.5532153", "0.51906365", "0.51625776", "0.51324445", "0.5089288", "0.50852656", "0.50795794", "0.50515074", "0.5020405", "0.50107145", "0.50107145", "0.50097084", "0.4...
0.53499097
9
distance = distance in meters latitude = latitude in degrees at the equator, the distance of one degree is equal in latitude and longitude. at higher latitudes, a degree longitude is shorter in length, proportional to cos(latitude)
def dist_to_deg(self, distance, latitude): # d * (180 / pi) / earthRadius ==> degrees longitude # (degrees longitude) / cos(latitude) ==> degrees latitude lat = latitude if latitude >= 0 else -1 * latitude rad2deg = 180 / pi earthRadius = 6378160.0 latitudeCorrecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(lat0, lng0, lat1, lng1):\n # convert decimal degrees to radians \n lat0, lng0, lat1, lng1 = map(radians, [lat0, lng0, lat1, lng1])\n # haversine formula \n dlng = lng1 - lng0 \n dlat = lat1 - lat0 \n a = sin(dlat/2)**2 + cos(lat0) * cos(lat1) * sin(dlng/2)**2\n c = 2 * asin(sqrt(a...
[ "0.7291176", "0.7187439", "0.7159773", "0.7115488", "0.7083057", "0.7083054", "0.70236313", "0.70073986", "0.6996334", "0.6992556", "0.69876224", "0.69845194", "0.69737905", "0.69725025", "0.6957883", "0.6952544", "0.6950658", "0.6946815", "0.6935224", "0.68587995", "0.684884...
0.6883853
19
Returns a paragami patterned dictionary that stores the variational parameters.
def get_vb_params_paragami_object(n_obs, n_loci, n_allele, k_approx, prng_key = jax.random.PRNGKey(0)): vb_params_paragami = paragami.PatternDict() # variational beta parameters for population allele frequencies vb_params_paragami['pop_freq_dirichlet_params'] = \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):\n return {\"P\": self.P,\n \"T\": self.T}", "def gen_params(self) -> Dict:\n param_dict: Dict = {}\n\n gX_name: List[str] = ['g_leak', 'g_nav', 'g_kvhh', 'g_kva', 'g_kvsi', \n 'g_cav', 'g_kca', 'g_nap', 'g_kir']\n gX_log: np...
[ "0.6746157", "0.67407775", "0.6669498", "0.66103894", "0.65800023", "0.65667856", "0.6561565", "0.6501237", "0.6457837", "0.6451882", "0.6447351", "0.63874155", "0.635774", "0.6346617", "0.63194585", "0.63121516", "0.6268625", "0.625105", "0.62467444", "0.62391317", "0.622820...
0.6612321
3
Computes the negative ELBO
def get_kl(g_obs, vb_params_dict, prior_params_dict, gh_loc, gh_weights, e_log_phi = None, e_z = None): # get prior parameters dp_prior_alpha = prior_params_dict['dp_prior_alpha'] allele_prior_lambda_vec = prior_params_dict['allele_prior_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tot_neg_elbo(self):\n\n\n self.neg_elbo = tf.reduce_sum([-self.experts[i].elbo((self.X[self.partition[i]],self.Y[self.partition[i]])) for i in range(self.M)])\n \n return self.neg_elbo", "def get_elbo(self, current_params):\n return -self.full_neg_posterior(current_par...
[ "0.73968875", "0.73038846", "0.72931916", "0.71074796", "0.6851398", "0.6743591", "0.6587052", "0.6468686", "0.6459653", "0.6419109", "0.6404657", "0.6388871", "0.6327594", "0.62872165", "0.61879754", "0.61566", "0.6148018", "0.611185", "0.6104602", "0.60876495", "0.60703903"...
0.0
-1
Filter all whitespaces, Convert words if any of them are digits Fill with ones if not enough digits
def post_process(result): result = result.replace(' ', '') digits = re.findall('(\d)', result) words = re.findall('(\D+)', result) if digits: if len(digits) == NUM_OF_DIGITS: return ''.join(digits), SUCCESS_RATE ** len(digits) elif len(digits) < NUM_OF_DIGITS and words: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_words_digits(text):\n return \" \".join([word for word in str(text).split() if not any(c.isdigit() for c in word) ])", "def clean_numbers(self, x):\n\n # remove \"th\" after a number\n matches = re.findall(r'\\b\\d+\\s*th\\b', x)\n if len(matches) != 0:\n x = re.su...
[ "0.72251236", "0.67748106", "0.6644863", "0.6566686", "0.650942", "0.6358718", "0.63042414", "0.6283231", "0.6283231", "0.6274457", "0.6252032", "0.6249388", "0.6249388", "0.6249388", "0.6249388", "0.6249388", "0.6249388", "0.6249388", "0.618834", "0.61777395", "0.611291", ...
0.0
-1
Display image of raster data
def raster(axes, im, transform=None, colormap=None, vmin=None, vmax=None, pmin=0, pmax=100, Norm=None, rescale_kind='', title='', no_axes_ticks=True, use_rst_plot=True, titlesize=15, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(raster):\n gk.read(raster).show()", "def show(self, exec_rasterize = False):\n\n if (exec_rasterize):\n self.rasterize()\n\n Image.fromarray(self._image).show()", "def display_image(X):\n\n\tim = X.reshape(28, 28)\n\ttemp = plt.imshow(im)\n\tplt.show()", "def display(...
[ "0.7893569", "0.75363564", "0.744669", "0.7267164", "0.7173717", "0.7105649", "0.70548695", "0.69699675", "0.69640714", "0.6898163", "0.68798536", "0.68783903", "0.6810992", "0.68068826", "0.67968476", "0.67751694", "0.67265755", "0.6702968", "0.67016554", "0.66910845", "0.66...
0.0
-1
Convert an input continuous data array into a discrete set of values
def continuous_to_discrete(cont_data, bounds, values=[], labels=[]): N = len(bounds)-1 disc_data = cont_data.copy() assign_values = [] for ii in range(N): if len(values)==N: assign_val = values[ii] else: assign_val = (bounds[ii]+bounds[ii+1])/2.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_dataset(data):\n dataset = [0] * 10\n for value in data:\n dataset[value] += 1\n return dataset", "def discrete_to_continuous(times, discrete_times, discrete_values):\n # check to prevent passing continuous array\n if len(discrete_times) == len(times):\n warnings.warn(WA...
[ "0.71699566", "0.607232", "0.593621", "0.58375806", "0.58087695", "0.57421684", "0.5690183", "0.5684454", "0.5668925", "0.5665352", "0.56634355", "0.56569904", "0.5634984", "0.56327796", "0.5629107", "0.560005", "0.55868226", "0.55671644", "0.55163723", "0.5500659", "0.549059...
0.5896992
3
Deserialize the string representation of a buffer element.
def deserialize_elem(self, elem_str): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, str):\n try:\n end = 0\n start = end\n end += 1\n (self.result,) = _struct_B.unpack(str[start:end])\n return self\n except struct.error as e:\n raise genpy.DeserializationError(e) #most likely buffer underfill", "def deserialize(self, str):\n try:\n ...
[ "0.674524", "0.6662267", "0.65602696", "0.65602696", "0.65602696", "0.64507365", "0.64153343", "0.6387633", "0.6362902", "0.6341636", "0.63110876", "0.6284741", "0.62767416", "0.62604177", "0.6225106", "0.621679", "0.6201148", "0.6200175", "0.6199884", "0.6193373", "0.6189763...
0.7054377
0
Gets a collection of `InputExample`s for the train set.
def get_train_examples(self, data_dir): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_inputs(self, example):\n return example", "def get_train_examples(self):\n raise NotImplementedError()", "def get_train_examples(self, input_file):\r\n raise NotImplementedError()", "def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en...
[ "0.7351049", "0.71770567", "0.7129708", "0.6561692", "0.64234424", "0.6406103", "0.6342166", "0.62899595", "0.6285224", "0.62527674", "0.62523556", "0.6234897", "0.6223775", "0.6223775", "0.6209622", "0.6209622", "0.6209622", "0.6209622", "0.6209622", "0.6209622", "0.6209622"...
0.6250489
14
Gets a collection of `InputExample`s for the dev set.
def get_dev_examples(self, data_dir): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dev_examples(self, input_file):\r\n raise NotImplementedError()", "def get_train_inputs(self, example):\n return example", "def get_examples(self, env):\n return self.fam.c_get_examples(self, env)", "def get_dev_examples(self):\n raise NotImplementedError()", "def _create_ex...
[ "0.68112403", "0.6588688", "0.655683", "0.6552607", "0.64272827", "0.63816285", "0.6255956", "0.61930686", "0.61160946", "0.6094262", "0.6054992", "0.6051947", "0.5989807", "0.5927489", "0.5922901", "0.5920675", "0.59200704", "0.59155166", "0.59155166", "0.59155166", "0.59155...
0.5994604
15
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return (e_x / e_x.sum()).tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.723019", "0.7214918", "0.7201743", "0.72012...
0.7256868
17
Return the path to a file in the test data directory.
def get_data_path(file_name=None): if file_name is None: file_name = "" return os.path.join(DATA_DIR, file_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_data_path():\n return os.path.abspath(os.path.join(os.path.dirname(__file__), \"data\") + os.path.sep)", "def get_test_path():\n path, name = os.path.split(__file__)\n return os.path.join(path,\"..\", 'test-data')", "def get_testdata(file_name):\n return os.path.join(os.path.dirname(os...
[ "0.82615024", "0.8062583", "0.7889237", "0.78179234", "0.7788793", "0.77726173", "0.77565587", "0.77249026", "0.77249026", "0.77249026", "0.7673662", "0.758087", "0.7579649", "0.7566115", "0.7550184", "0.7515004", "0.75061375", "0.74991286", "0.74526143", "0.74416053", "0.741...
0.74947214
18
Return a list of fullyqualified module names given a list of module paths.
def _make_module_names(package_dir, paths): package_dir = os.path.abspath(package_dir) package_name = os.path.split(package_dir)[1] prefix_length = len(package_dir) module_names = [] for path in paths: path = os.path.abspath(path) # for example <path_to_package>/subpackage/module.py ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_modules(lookup_paths: list = None):\n result = []\n\n if lookup_paths is None:\n lookup_paths = analyzer_paths()\n\n for path in lookup_paths:\n analyzer_module_root = resource_filename(path, \"modules\")\n # analyzer_root = os.path.join(anchore_module_root, \"modules\")\n ...
[ "0.70386994", "0.6495619", "0.6366516", "0.63376963", "0.6204269", "0.6196428", "0.61547196", "0.61533344", "0.61254305", "0.610952", "0.60205704", "0.60119027", "0.59963655", "0.59962213", "0.5912001", "0.5906029", "0.5843177", "0.58385414", "0.5807259", "0.58069324", "0.580...
0.70556575
0
Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player.
def __init__(self, player): self.platform_list = pygame.sprite.Group() #self.enemy_list = pygame.sprite.Group() self.player = player self.bullet_list = pygame.sprite.Group() self.enemy_list = pygame.sprite.Group() self.active_sprite_list = pygame.sprite.Group() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, player):\n\t\tself.player = player", "def __init__(self, player):\n self.player = player", "def __init__(self, *args, **kwargs):\n super(Player, self).__init__(*args, **kwargs)", "def __init__(self, player):\n self.platform_list = pygame.sprite.Group()\n self.en...
[ "0.7723466", "0.75956756", "0.7080822", "0.69838494", "0.6965895", "0.6911038", "0.68912256", "0.6837422", "0.6836923", "0.679217", "0.6765404", "0.67430776", "0.6730644", "0.6728568", "0.67162573", "0.6632157", "0.6559857", "0.6552509", "0.65368444", "0.6519407", "0.64687115...
0.6484794
20
Aggregates error and warnings into a string.
def collect_errors_and_warnings(self) -> str: # Complete error message message = "----------------ERRORS----------------\n" if self.errors == "": message = "YOUR FILE IS VALIDATED!\n" logger.info(message) else: for error in self.errors.split("\n"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_str(messages: Iterable[Error]) -> str:\n return '\\n\\n'.join(str(m) for m in messages if is_error(m.code))", "def make_error_string(controller, errors):\n return \"\\n\".join([controller.get_string(error) for error in errors])", "def error(err):\n\n return str(err) + '\\n'", "def build_er...
[ "0.71931475", "0.68450123", "0.6776918", "0.6769705", "0.6703684", "0.6640929", "0.65966505", "0.6467154", "0.6438015", "0.6407107", "0.6403548", "0.63458395", "0.634041", "0.6338696", "0.6326961", "0.6317822", "0.63125527", "0.6281591", "0.6278593", "0.6224138", "0.6182535",...
0.7558138
0
Plot an image of the confident test class balance vs priots. Remember to call show().
def plot(self): raw_labels = self.make_raw_data()[1] balanced_labels = self.get_extra()[1] fig, ax1 = subplots() ax2 = ax1.twinx() x = array(range(1, NCLASSES + 1)) l1 = ax1.bar(x - 0.3, self.prior_sizes, width = 0.25, color = 'b', align = 'center', label = 'train') l2 = ax2.bar(x, bincount(raw_labels - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_prediction(self, img, probs, classes):\n\n # Convert results to dataframe for plotting\n result = pd.DataFrame({\"p\": probs}, index=classes)\n\n # Show the image\n fig = plt.figure(figsize=(16, 5))\n ax = plt.subplot(1, 2, 1)\n ax.imshow(img)\n\n # Set tit...
[ "0.7234953", "0.66816324", "0.6578972", "0.6426411", "0.6395686", "0.6394606", "0.6320956", "0.6304371", "0.6297272", "0.6296752", "0.6279036", "0.6259149", "0.62369764", "0.62252516", "0.6224758", "0.6210711", "0.62083244", "0.62076217", "0.6189309", "0.61661404", "0.6165463...
0.63018847
8
Return basic color of image like tupl (r, g, b)
def get_color(im_obj): #im = Image.open(path, 'r') x, y = im_obj.size r, g, b = 0, 0, 0 for i in xrange(x): for j in xrange(y): color_px = im_obj.getpixel((i, j)) #print color_px r += color_px[0] g += color_px[1] b += color_px[2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rgb(self, img, r, g, b):\r\n\r\n # Get specific bands of hyperspectral image\r\n red_channel = img[:, :, r]\r\n green_channel = img[:, :, g]\r\n blue_channel = img[:, :, b]\r\n\r\n img = np.stack((red_channel, green_channel, blue_channel), axis=2)\r\n img = img.ast...
[ "0.720816", "0.71280074", "0.7063926", "0.69618547", "0.6898233", "0.6884669", "0.68693835", "0.68319505", "0.6811928", "0.6807374", "0.6754152", "0.6738352", "0.6706087", "0.6706087", "0.6706087", "0.66923356", "0.66384465", "0.6635974", "0.66184354", "0.6610489", "0.6589336...
0.73444545
0
Return the nearest integer if it's almost equal to x.
def intify(x): return int(x) if almost_equal(x, round(x)) else x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_int(num):\n return int(np.round(num))", "def _nearest_bigger_power_of_two(x: int) -> int:\n y = 2\n while y < x:\n y *= 2\n return y", "def get_nearest_index(self, x_value: float) -> int:\n return int(np.argmax(self.x >= x_value))", "def _nearest_pow_2(x):\r\n a = mat...
[ "0.74189854", "0.7340782", "0.73302805", "0.71266115", "0.703698", "0.6833256", "0.6743659", "0.6699456", "0.669028", "0.6678402", "0.66610926", "0.65881914", "0.6571313", "0.6539544", "0.64896756", "0.64248997", "0.6376749", "0.6344317", "0.62936085", "0.6273339", "0.6268905...
0.64219457
16
Create an HLS conversion config given the PyTorch model. This function serves as the initial step in creating the custom conversion configuration. Users are advised to inspect the returned object to tweak the conversion configuration. The return object can be passed as `hls_config` parameter to `convert_from_pytorch_mo...
def config_from_pytorch_model( model, granularity='model', backend=None, default_precision='ap_fixed<16,6>', default_reuse_factor=1, inputs_channel_last=False, transpose_outputs=True, ): config = {} model_config = {} model_config['Precision'] = default_precision model_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_from_pytorch_model(\n model,\n input_shape,\n output_dir='my-hls-test',\n project_name='myproject',\n input_data_tb=None,\n output_data_tb=None,\n backend='Vivado',\n hls_config=None,\n **kwargs,\n):\n\n config = create_config(output_dir=output_dir, project_name=project_na...
[ "0.7461524", "0.6925069", "0.6755301", "0.6572167", "0.5534003", "0.55096805", "0.5470105", "0.54528636", "0.5390767", "0.52998084", "0.5255069", "0.51723737", "0.51698357", "0.5138294", "0.51198184", "0.5062472", "0.5040881", "0.5013411", "0.49798873", "0.49798873", "0.48997...
0.58520436
4
Create an HLS conversion config given the ONNX model. This function serves as the initial step in creating the custom conversion configuration. Users are advised to inspect the returned object to tweak the conversion configuration. The return object can be passed as `hls_config` parameter to `convert_from_onnx_model`.
def config_from_onnx_model( model, granularity='model', backend=None, default_precision='ap_fixed<16,6>', default_reuse_factor=1 ): config = {} model_config = {} model_config['Precision'] = default_precision model_config['ReuseFactor'] = default_reuse_factor model_config['Strategy'] = 'Latency...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_from_onnx_model(\n model,\n output_dir='my-hls-test',\n project_name='myproject',\n input_data_tb=None,\n output_data_tb=None,\n backend='Vivado',\n hls_config=None,\n **kwargs,\n):\n\n config = create_config(output_dir=output_dir, project_name=project_name, backend=backend, ...
[ "0.7301325", "0.70400625", "0.65490264", "0.64775497", "0.56490815", "0.5592838", "0.5342384", "0.5090161", "0.49024513", "0.4890289", "0.48846504", "0.4850616", "0.48251277", "0.47918108", "0.47730872", "0.47425902", "0.47322047", "0.4727486", "0.46928662", "0.4683179", "0.4...
0.5248681
7
Returns area of a triangle, given the lengths of its three sides.
def area_triangle_sss(side1,side2,side3): semi_perim=(side1+side2+side3)/2.0 return math.sqrt(semi_perim* (semi_perim - side1)* (semi_perim - side2)* (semi_perim - side3) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_of_a_triangle(length_1, length_2, length_3):\r\n half_perimeter = (length_1 + length_2 + length_3) / 2\r\n area = (half_perimeter * (half_perimeter-length_1) * (half_perimeter-length_2) * (half_perimeter-length_3)) ** 0.5\r\n return area", "def triangle_area(side1: number, side2: number, side3:...
[ "0.87911016", "0.8658985", "0.8508566", "0.84243774", "0.819941", "0.8175006", "0.8171563", "0.80696535", "0.8039152", "0.8035439", "0.7968383", "0.78984976", "0.788891", "0.7878595", "0.7827453", "0.77497125", "0.77371615", "0.77106893", "0.753484", "0.7527507", "0.7468373",...
0.8084914
7
Returns either a single graph (if year_range is None) or a dict of graphs over the sliding window length of ``window`` years, with start years as keys.
def create_graphs(df, what='authors', year_range=None, window=5, initials_only=False): if year_range is not None: graphs = {} for year in range(year_range[0], year_range[1] - window + 1): graph_df = df[(df.year >= year) & (df.year < year + window)] graphs[ye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_yearly_data(name, startyr=None, endyr=None, interpolated=False):\n varinfo = get_varinfo(name)\n \n if varinfo[\"type\"] == \"yearly\":\n data = get_data(varinfo[\"id\"], startyr=startyr, endyr=endyr)\n giddict = dict()\n sorteddata = sorted(data[\"cells\"], key=lambda vd: vd[...
[ "0.5269411", "0.5190986", "0.5006738", "0.49687514", "0.4935661", "0.48785335", "0.48539525", "0.48279837", "0.48143032", "0.48066932", "0.47910705", "0.4786768", "0.47674522", "0.47456458", "0.47083902", "0.46900523", "0.46799937", "0.46500027", "0.46379727", "0.4620617", "0...
0.70830053
0
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp((x.transpose()-x.max(axis=1)).transpose()) return e_x / np.sum(e_x,axis=1)[:,None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.77965075", "0.77608246", "0.7759328", "0.7757032", "0.76580364", "0.76580364", "0.76580364", "0.76580364", "0.7585873", "0.743174", "0.74079806", "0.7394367", "0.7358405", "0.73176855", "0.72691524", "0.72616005", "0.7257189", "0.7230358", "0.7215222", "0.72019553", "0.720...
0.7262539
15
Applies modifications to the model layers to create a new Graph. For example, simply changing `model.layers[idx].activation = new activation` does not change the graph. The entire graph needs to be updated with modified inbound and outbound tensors because of change in layer building function.
def apply_modifications(model, custom_objects=None): # The strategy is to save the modified model and load it back. This is done because setting the activation # in a Keras layer doesnt actually change the graph. We have to iterate the entire graph and change the # layer inbound and outbound nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_modifications(model):\n # The strategy is to save the modified model and load it back. This is done because setting the activation\n # in a Keras layer doesnt actually change the graph. We have to iterate the entire graph and change the\n # layer inbound and outbound nodes with modified tensors....
[ "0.6836061", "0.6461792", "0.61448425", "0.6055127", "0.6037738", "0.5958465", "0.5791402", "0.5758732", "0.57532626", "0.5723828", "0.5673097", "0.56672686", "0.5647007", "0.56293064", "0.5610936", "0.5578372", "0.5548246", "0.55481064", "0.55160874", "0.5499456", "0.5497684...
0.64286387
2
Gets the id_template_notificacao of this NotificacaoEmailRequest. {{{notificacao_email_request_id_template_notificacao_value}}}
def id_template_notificacao(self): return self._id_template_notificacao
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_id(self):\n return self._template_id", "def get_email_template_id(self):\n return self.email_template_id", "def template_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"template_id\")", "def template_id(self) -> Optional[pulumi.Input[str]]:\n retu...
[ "0.7114622", "0.70374846", "0.69906366", "0.69906366", "0.6980583", "0.69412744", "0.60990036", "0.59843904", "0.5898", "0.58535403", "0.578661", "0.578661", "0.5547381", "0.5440618", "0.5424508", "0.5393216", "0.5383324", "0.5383324", "0.5383324", "0.53409183", "0.5329118", ...
0.8227521
0
Returns true if both objects are equal
def __eq__(self, other): 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.7961088", "0.7961088", "0.79433626", "0.79303336", "0.7926563", "0.7897525", "0.78826123", "0.78826123", "0.78806067", "0.7872423", "0.7868354", "0.78668815", "0.7825702", "0.7819993", "0.78162885", "0.78078854", "0.78068...
0.79670393
14
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
Read and concatenate column in filenames. Function that given a set of filenames return the list of values concatenating all the columns with name "column_name"
def get_column_value_list( filenames: List[str], column_name: str, debug: Optional[bool] = False ) -> List[Any]: result = [] for file_name in filenames: # Open the file for reading file_in = codecs.open(file_name, 'rU') dialect = csv.Sniffer().sniff(file_in.read(1024)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_csv_column(file_name, column):\n list = []\n with open('../test_files/' + file_name, 'r') as infile:\n for x in infile.readlines():\n x = x.replace('\\n', '')\n # splitting based on ',' that are encountered in csv files.\n #column-1 because the range start from...
[ "0.63640857", "0.631962", "0.6295679", "0.62565404", "0.6157564", "0.6142793", "0.613844", "0.61266816", "0.60584956", "0.6027191", "0.60255545", "0.58198863", "0.5813853", "0.58008593", "0.57761157", "0.57126266", "0.5665515", "0.5655673", "0.5641441", "0.56021965", "0.55911...
0.6569102
0
Here we reproduce Keras default initialization weights to initialize Embeddings/LSTM weights
def reset(self): ih = (param for name, param in self.named_parameters() if 'weight_ih' in name) hh = (param for name, param in self.named_parameters() if 'weight_hh' in name) b = (param for name, param in self.named_parameters() if 'bias' in name) for t in ih: torch.nn.init.x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)", "def init_weights(model):\n ...", "def initialize_weights(self):\n for layer in self._cnn_layers:\n weights_initializer.WeightsInitializer.initialize_layer_or_model(layer)...
[ "0.76596117", "0.76275533", "0.7436651", "0.7407191", "0.7352844", "0.73059446", "0.72677785", "0.72517526", "0.72387", "0.7213071", "0.71898067", "0.71850336", "0.71850336", "0.71850336", "0.7114712", "0.71122175", "0.70926774", "0.70774394", "0.7076525", "0.7075444", "0.706...
0.0
-1
Returns the match text prefixed with backslash
def replace(match_obj): return '\\' + match_obj.group(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quotemeta(text):\n return re.sub(\"(\\W)\", r\"\\\\\\1\", text)", "def _escaped_find(regex, s, start, in_regex):\n\n while True:\n pos = s.find('/', start)\n if pos == -1:\n # no match, return to caller\n break\n elif pos == 0:\n ...
[ "0.5740594", "0.5707106", "0.5703096", "0.566577", "0.5623731", "0.55972743", "0.5544045", "0.55413556", "0.54939544", "0.54524845", "0.5428153", "0.53561056", "0.5307649", "0.52525395", "0.5227343", "0.5225453", "0.522216", "0.5200358", "0.5180486", "0.5112227", "0.5094415",...
0.64348507
0
Returns the match text without prefixed backslash.
def replace(match_obj): return match_obj.group(0)[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_match_str(self, match):\n return \"\"", "def trim_substr(self, match_obj):\n return match_obj.group(1).strip()", "def clean_substr(self, match_obj):\n x = MLStripper()\n x.feed(match_obj.group(1).strip())\n return x.get_fed_data()", "def unescape(text: str) -> str:\...
[ "0.6479382", "0.62134486", "0.5819163", "0.58039165", "0.5773892", "0.5711672", "0.56890905", "0.5649298", "0.56212735", "0.55826", "0.5558124", "0.55375564", "0.547145", "0.54647774", "0.54350424", "0.5428024", "0.5412989", "0.53950864", "0.5392613", "0.5383832", "0.53588223...
0.54068005
17
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194052", "0.8095069", "0.80293566", "0.8018802", "0.799371", "0.7990971", "0.7980545", "0.7975993", "0.79609", "0.7957234", "0.7937344", "0.79343724", "0.79341805", "0.79310715", "0.7926063", "0.79241866", "0.7923726", "0.79229325", "0.79226404", "0.79218584", "0.7917542"...
0.7814286
93
Initialize stub for Issue Tracker response mocking
def init_issue_tracker_mock(): fetch_mock = FetchServiceMock() apiproxy_stub_map.apiproxy.RegisterStub('urlfetch', fetch_mock)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_gae_issue_tracker_mock():\n # pylint: disable=protected-access\n\n from ggrc.utils.issue_tracker_mock import remote_stub\n\n urlfetch_stub = apiproxy_stub_map.apiproxy.GetStub('urlfetch')\n issue_tracker_stub = remote_stub.RemoteStub(\n urlfetch_stub._server,\n urlfetch_stub._path,\n ur...
[ "0.7386659", "0.65363044", "0.6340497", "0.62674654", "0.62129813", "0.61895066", "0.61725205", "0.614694", "0.61439806", "0.6137834", "0.6075611", "0.60703963", "0.6053186", "0.6027497", "0.6002204", "0.59917086", "0.5976239", "0.5976239", "0.5976239", "0.5976239", "0.597623...
0.8075672
0
Returns a tensor whose value represents the total loss. In particular, this adds any losses you have added with `tf.add_loss()` to any regularization losses that have been added by regularization parameters on layers constructors e.g. `tf.layers`. Be very sure to use this if you are constructing a loss_op manually. Oth...
def get_total_loss(add_regularization_losses=True, graph=None, name="total_loss"): losses = tf.losses.get_losses() graph = graph or tf.get_default_graph() if add_regularization_losses: losses += [get_or_create_regularization_loss(graph)] return tf.add_n(losses, name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_loss_summaries(total_loss):\n loss_averages = tf.train.ExponentialMovingAverage(0.9, name='avg')\n losses = tf.get_collection('losses')\n loss_averages_op = loss_averages.apply(losses + [total_loss])\n\n return loss_averages_op", "def build_total_loss(logits,\n onehot_lab...
[ "0.70590365", "0.6962377", "0.6938214", "0.68584836", "0.6852431", "0.68499345", "0.68452966", "0.6840026", "0.6838089", "0.6838089", "0.6832295", "0.68093145", "0.6790526", "0.6778382", "0.67709726", "0.676204", "0.6753427", "0.67327386", "0.67311233", "0.6610222", "0.649623...
0.82021725
0
returns a time delta in seconds from datetimeobjects
def secondsCount(timestamp1, timestamp2): return timestamp1 - timestamp2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seconds_calc(delta):\n return (delta.hours * 3600) + (delta.minutes * 60) + delta.seconds", "def time_difference(time1: Time, time2: Time) -> float:\n dsec = time1.sec - time2.sec\n dnanosec = time1.nanosec - time2.nanosec\n dt = dsec + dnanosec/(10**9)\n return dt", "def delta_seconds(befor...
[ "0.7363739", "0.7109235", "0.7095618", "0.70908105", "0.7088086", "0.704322", "0.6955998", "0.6923005", "0.6885239", "0.6845636", "0.6823303", "0.6813249", "0.6808067", "0.6763371", "0.6758734", "0.67367667", "0.6716897", "0.6705776", "0.66929144", "0.6654961", "0.6619118", ...
0.0
-1
We POST (in v1) to a resource that doesn't exist in v1 it only exists in v2. We also POST (in v2) to a resource that doesn't exist in v2 it only exists in v1. These should produce a 404 error.
def test_post_object_to_nonexistent_resource(self): connection = self.get_connection() post_data = '{"content": "A new business.", "is_active": true, "title": "New Title", "slug": "new-title", "user": "/api/users/1/"}' connection.request('POST', '/api/businesses/', body=post_data, headers={'Acc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_post():\n for resource in resources:\n\n if resource.get(\"data\").get(\"ip\") == request.get_json().get(\"ip\"):\n # acquire lock\n res_lock = resource.get(\"lock\")\n res_lock.acquire()\n\n # POST if not available\n if resource.get(\"ava...
[ "0.62531054", "0.61222005", "0.61111087", "0.6018172", "0.59807056", "0.58493876", "0.5812694", "0.5721328", "0.5714352", "0.57070464", "0.56668746", "0.5659319", "0.5636961", "0.5607994", "0.56063944", "0.56028223", "0.5596327", "0.5590623", "0.55894685", "0.55888873", "0.55...
0.7025032
0
This function tests whether an object is an array
def isarray(a): try: validity=isinstance(a,ndarray) except: validity=False return validity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsArray(obj):\n return isinstance(obj, (list, tuple))", "def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstance(obj, pd.Series):\n return True\n elif isinstance(obj, pd.DataFrame):\n retur...
[ "0.8379769", "0.829513", "0.7839428", "0.7759032", "0.7754858", "0.76591754", "0.7634977", "0.76282203", "0.7557676", "0.7516066", "0.74444056", "0.7409231", "0.7174292", "0.71518314", "0.70938367", "0.70022154", "0.6997975", "0.69805765", "0.6864733", "0.684019", "0.6807015"...
0.73872876
12
The time at which the environment group was created as milliseconds since epoch.
def created_at(self) -> str: return pulumi.get(self, "created_at")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def create_time(self):\n return self._create_time", "def creation_timestamp(self):\n\n return self.get_signingTime()", "def get_timestamp(self):\n return datetime.dat...
[ "0.75439554", "0.75439554", "0.75439554", "0.7326255", "0.72798306", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143", "0.7259143",...
0.0
-1
ID of the environment group.
def name(self) -> str: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def id(self):\n return self._group", "def group_id(self):\n return self._id", "def group_id(self):\n return self._group_id", "def ...
[ "0.8271999", "0.8271999", "0.80289644", "0.79595613", "0.78142315", "0.78142315", "0.78142315", "0.7811997", "0.7766565", "0.7762624", "0.77274024", "0.76587576", "0.75260514", "0.7503671", "0.7503671", "0.7503671", "0.75032634", "0.7465635", "0.7465635", "0.7465635", "0.7465...
0.0
-1
Get subexpression precedence 0 is closestbinding precedence Subexpressions must be parenthesized when their parent expression has a lower return value from this function than they do. If the parent expression has equal precedence, then grouping is dependent upon associativity.
def precedence(ob): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precedence_level(): #was paren_precedence_level\n\n def _precedence_level():\n def f(raw):\n ((_,i),pos) = raw\n if len(pos)== 0:\n l = 'no'\n else:\n l = pos[0][0][1]\n return (int(i),l)\n ...
[ "0.7410167", "0.7192057", "0.6908405", "0.6671382", "0.62505156", "0.6247703", "0.6138468", "0.6061801", "0.6055006", "0.59205395", "0.5787801", "0.5766044", "0.5755721", "0.5680451", "0.5671821", "0.5575929", "0.5534529", "0.55231225", "0.5496484", "0.5486519", "0.5473229", ...
0.7084304
2
Define a line segment.
def __init__(self, start: np.ndarray, end: np.ndarray): self.start = np.reshape(start, 2) self.end = np.reshape(end, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLineSegment(self):\n return _libsbml.Layout_createLineSegment(self)", "def _defLine(self):\n self._dline=GPath(points = [0,100,GAME_WIDTH,100], linewidth = 1.5,\n linecolor = 'cyan')", "def createLineSegment(self):\n return _libsbml.GeneralGlyph_createLineSegment(self)...
[ "0.7403532", "0.735248", "0.7135371", "0.70608056", "0.70471466", "0.7045007", "0.6809255", "0.6801989", "0.6763754", "0.6719506", "0.66514254", "0.6616926", "0.65939415", "0.6563944", "0.65485257", "0.6533833", "0.64750946", "0.64501786", "0.6443286", "0.6405445", "0.6405234...
0.0
-1
Define a circular arc. Note that the direction the arc is traversed can be reversed by switching the start_degrees and end_degrees arguments.
def __init__(self, centre: np.ndarray, radius: float, start_degrees: float, end_degrees: float): self.centre = np.reshape(centre, 2) self.radius = radius self.start_degrees = start_degrees self.end_degrees = end_degrees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arc(self, x, y, radius, startangle=0, endangle=2 * pi, anticlockwise=False):\n self._impl.arc(x, y, radius, startangle, endangle, anticlockwise)", "def Arc(self, center=(0.,0.), radius=1., nrad=16, ncirc=40,\n start_angle=0., end_angle=np.pi/2., element_type=\"tri\",\n refinement=False, ...
[ "0.7706201", "0.74044263", "0.7081762", "0.70646423", "0.68753135", "0.6868577", "0.67945206", "0.6794497", "0.6733344", "0.67031956", "0.66889745", "0.666101", "0.6658555", "0.6598877", "0.65618527", "0.6506931", "0.645052", "0.6428449", "0.6421859", "0.6384995", "0.6382098"...
0.62551045
29
Returns a string representation of the element set.
def __str__(self): return ("Element set with name {0} containing elements with the " "following ids {1}".format(self.name, self.ids))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n # string representation includes values of all inner fields\n return \"Nodeset: \" + \"\\n\".join([node.__str__() for node in self.nodeset]) + \"\\n\"", "def __repr__(self):\n return 'TreeSet([{0}])'.format(','.join(str(item) for item in self))", "def rsset2str(self, e...
[ "0.7763894", "0.7456162", "0.73500264", "0.7297258", "0.71224385", "0.7106639", "0.70656455", "0.70219916", "0.69556755", "0.69194734", "0.69095916", "0.67918104", "0.6740799", "0.665822", "0.66413724", "0.6627908", "0.6516216", "0.64769197", "0.6475422", "0.64434963", "0.643...
0.7877685
0
Determines whether file1 is lexigraphically 'before' file2.
def CompareFilenames(self, file1, file2): f1_segments = file1.split('/') f2_segments = file2.split('/') segment_ptr = 0 while (segment_ptr < len(f1_segments) and segment_ptr < len(f2_segments) and f1_segments[segment_ptr] == f2_segments[segment_ptr]): segment_ptr += 1 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comes_before(a, b):\n if a.freq < b.freq:\n return True\n elif a.freq == b.freq:\n if a.char < b.char:\n return True\n else:\n return False\n return False", "def comes_before(a, b):\r\n \r\n if a.freq < b.freq:\r\n return True \r\n elif a.freq =...
[ "0.6019734", "0.59432656", "0.58737034", "0.5836916", "0.57062745", "0.5642569", "0.5642569", "0.56135684", "0.5591823", "0.5591823", "0.5560287", "0.55281675", "0.5526684", "0.5487086", "0.5456754", "0.5449946", "0.53967285", "0.5355182", "0.5355176", "0.53212875", "0.530026...
0.5473703
14
Set caching headers for the request.
def SetCachingHeaders(self, revalidate): max_age = self.MAX_AGE #self.response.headers['Expires'] = email.Utils.formatdate( # time.time() + max_age, usegmt=True) cache_control = [] if self.PUBLIC: cache_control.append('public') cache_control.append('max-age=%d' % max_age) if revalid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetCacheHeaders(self, response):\n headers = framework_helpers.StaticCacheHeaders()\n for name, value in headers:\n response.headers[name] = value", "def add_cache_headers(headers, cached):\n # type: (dict, dict) -> None\n if cached[\"etag\"] is not None:\n headers[\"If-None-Match\"] ...
[ "0.8172239", "0.75542694", "0.72784966", "0.7131047", "0.70837665", "0.70837665", "0.70479906", "0.70066833", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585", "0.6995585...
0.7740348
1
Returns an unsaved pending mission affectation matching this virtual affectation.
def to_pending_mission_affectation(self): pma = PendingMissionAffectation() pma.pending_mission_id = self.pending_bargain_shared_mission.pending_mission_id pma.mission_grid_id = self.mission_grid_id pma.folk = self.folk return pma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_mission(self):\n try:\n return self.missions[self.status.mission_task_list[0]]\n except KeyError:\n return None", "def start(self):\n\t\tpm = PendingMission(mission_id=self.mission_id, kingdom_id=self.kingdom_id)\n\t\tpm.save()\n\t\t\n\t\treturn pm", "def get_pen...
[ "0.5990928", "0.5823332", "0.5756806", "0.5729823", "0.55847603", "0.5259515", "0.5232678", "0.519658", "0.51835024", "0.51695836", "0.5163903", "0.5047908", "0.5047739", "0.502301", "0.49482068", "0.49456456", "0.49444503", "0.4942401", "0.49412155", "0.49237147", "0.4920354...
0.74044937
0
The ID of the CEN instance.
def cen_id(self) -> pulumi.Input[str]: return pulumi.get(self, "cen_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_id\")", "def cen_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_id\")", "def GetID(self):\n return hex(id(self()))", "def get_cid(self):\n\t\tif self.client is None:\n\t\t\traise UsageError(...
[ "0.8129587", "0.7574239", "0.73882943", "0.7371349", "0.72498125", "0.723656", "0.7211935", "0.7115196", "0.7108107", "0.70960236", "0.70884943", "0.7077688", "0.7066497", "0.70593053", "0.7050281", "0.7050281", "0.7050281", "0.7050281", "0.7035081", "0.7035081", "0.70322824"...
0.7913691
1
The ID of the region to which the CEN instance belongs.
def cen_region_id(self) -> pulumi.Input[str]: return pulumi.get(self, "cen_region_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_region_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_region_id\")", "def cen_region_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_region_id\")", "def region_id(self) -> str:\n return self._region_id", "def region_id(self):\n ret...
[ "0.8768245", "0.84267455", "0.83769083", "0.83741206", "0.74363637", "0.7431856", "0.7431856", "0.7431856", "0.7431856", "0.7431856", "0.7431856", "0.7424926", "0.73096526", "0.7297636", "0.7297636", "0.72571874", "0.7183217", "0.7183217", "0.7183217", "0.7183217", "0.7183217...
0.8633322
1
The ID of the CEN instance.
def cen_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "cen_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_id\")", "def cen_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_id\")", "def GetID(self):\n return hex(id(self()))", "def get_cid(self):\n\t\tif self.client is None:\n\t\t\traise UsageError(\"Not conn...
[ "0.8128811", "0.7912667", "0.738902", "0.7368713", "0.72486544", "0.72370803", "0.72106427", "0.7115544", "0.71077794", "0.7094682", "0.7088395", "0.7077093", "0.7066089", "0.7059786", "0.7049962", "0.7049962", "0.7049962", "0.7049962", "0.7034844", "0.7034844", "0.70329654",...
0.75731
2
The ID of the region to which the CEN instance belongs.
def cen_region_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "cen_region_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_region_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_region_id\")", "def cen_region_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_region_id\")", "def region_id(self) -> str:\n return self._region_id", "def region_id(self):\n return self._...
[ "0.8768542", "0.86330634", "0.8376628", "0.8374121", "0.7434355", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.7423311", "0.7307992", "0.72962", "0.72962", "0.72552586", "0.71815133", "0.71815133", "0.71815133", "0.71815133", "0.71815...
0.8426626
2
The ID of the CEN instance.
def cen_id(self) -> pulumi.Output[str]: return pulumi.get(self, "cen_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_id\")", "def cen_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_id\")", "def GetID(self):\n return hex(id(self()))", "def get_cid(self):\n\t\tif self.client is None:\n\t\t\traise UsageError(\...
[ "0.7912667", "0.75731", "0.738902", "0.7368713", "0.72486544", "0.72370803", "0.72106427", "0.7115544", "0.71077794", "0.7094682", "0.7088395", "0.7077093", "0.7066089", "0.7059786", "0.7049962", "0.7049962", "0.7049962", "0.7049962", "0.7034844", "0.7034844", "0.70329654", ...
0.8128811
0
The ID of the region to which the CEN instance belongs.
def cen_region_id(self) -> pulumi.Output[str]: return pulumi.get(self, "cen_region_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cen_region_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_region_id\")", "def cen_region_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_region_id\")", "def region_id(self) -> str:\n return self._region_id", "def region_id(self):\n retu...
[ "0.86330634", "0.8426626", "0.8376628", "0.8374121", "0.7434355", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.74298704", "0.7423311", "0.7307992", "0.72962", "0.72962", "0.72552586", "0.71815133", "0.71815133", "0.71815133", "0.71815133", "0.71815...
0.8768542
0
Assuming spherical shape, calculate surface area
def get_surface_area4flight(flight_ID='C225', instrument='PCASP', plt_up_values=False, ds=None): # - Consider the surface area Exclude the first channel # Retrieve calibration for mineral dust d = get_FAAM_mineral_dust_calibration(instrument=instrument) # Get the bin widths a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def sphere_area(radius : number) -> number:\n area = 4*pi*radius*radius\n return area", "def sphereArea(radius):\n area = 4 * math.pi * radius ** 2\n return area", "def compute_surface_area(self):\n return np.su...
[ "0.7615096", "0.7506731", "0.7414192", "0.7282655", "0.723439", "0.7155613", "0.7120686", "0.7095367", "0.7078435", "0.69903225", "0.69597626", "0.68471515", "0.68458533", "0.68382657", "0.67759347", "0.6771191", "0.6749541", "0.66781294", "0.66585964", "0.6658561", "0.665820...
0.0
-1
plot a gradient of a color map
def plot_cmap(cmap): gradient = np.linspace(0, 1, 256) gradient = np.vstack((gradient, gradient)) pylab.imshow(gradient, aspect='auto', cmap=cmap) pylab.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient_cmap(gcolors, nsteps=256, bounds=None):\n from matplotlib.colors import LinearSegmentedColormap\n\n ncolors = len(gcolors)\n if bounds is None:\n bounds = np.linspace(0, 1, ncolors)\n\n reds = []\n greens = []\n blues = []\n alphas = []\n for b, c in zip(bounds, gcolors)...
[ "0.66340154", "0.63818365", "0.61968935", "0.61480755", "0.6051361", "0.6049797", "0.6047201", "0.60255486", "0.60208243", "0.59802973", "0.5910603", "0.5875477", "0.58667725", "0.57736564", "0.5756684", "0.57145125", "0.5687927", "0.56707996", "0.56534827", "0.5645068", "0.5...
0.7869021
0
To be able to run the project without the Azure Service, i.e. without the environment settings, the key error is catched and None is returned instead.
def _get_environ(self, name): try: return os.environ[name] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_not_found(self):\n runner = CliRunner()\n\n with patch(\"greynoise.cli.decorator.load_config\") as load_config:\n load_config.return_value = {\"api_key\": \"\"}\n result = runner.invoke(\n subcommand.quick,\n [\"0.0.0.0\"],\n ...
[ "0.5552222", "0.55331784", "0.55094093", "0.55000776", "0.54919666", "0.5473788", "0.5452547", "0.54141223", "0.5392848", "0.53549236", "0.5340996", "0.5318307", "0.5298921", "0.52967286", "0.5273035", "0.5271344", "0.5269559", "0.52559674", "0.5226145", "0.52166414", "0.5215...
0.0
-1
Construct a `CameraGeometry` by guessing the appropriate quantities from a list of pixel positions.
def guess(cls, pix_x, pix_y, optical_foclen): return guess_camera_geometry(pix_x, pix_y, optical_foclen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_camera_geometry(pix_x: u.m, pix_y: u.m, optical_foclen: u.m):\n\n dist = get_min_pixel_seperation(pix_x, pix_y)\n\n tel_type, cam_id, pix_type, pix_rotation, cam_rotation = _guess_camera_type(\n len(pix_x), optical_foclen\n )\n\n if pix_type.startswith('hex'):\n rad = dist / np....
[ "0.5607857", "0.53514856", "0.5266881", "0.51104605", "0.5036004", "0.49391848", "0.49362126", "0.49089065", "0.4877585", "0.4823731", "0.47753185", "0.47699037", "0.47602814", "0.47569388", "0.47489533", "0.47236082", "0.47233605", "0.46811467", "0.46809226", "0.46740478", "...
0.47435787
15
Indicates how many choices user has in active menu.
def display_menu_options(length): print('\n***********************************************\nVeuillez choisir une option entre 1 et', str(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_of_choices(self) -> int:\n return len(self._choices)", "def choices(self):\n self._choices = self.getChoices()\n return len(self._choices)", "def size(self):\n return len(self.selected)", "def num_considered(self):\n return self._current", "def get_control_cou...
[ "0.75667787", "0.7235539", "0.64158183", "0.6394594", "0.6364336", "0.6334607", "0.6306994", "0.6225296", "0.6217917", "0.6186261", "0.605343", "0.60319334", "0.6027652", "0.6023834", "0.5996821", "0.599374", "0.5991132", "0.598786", "0.5984303", "0.59722424", "0.59562916", ...
0.0
-1
Returns the index.html template.
def index(request): return render_to_response('norc/index.html', { 'sqs': 'norc.sqs' in settings.INSTALLED_APPS, 'is_superuser': request.user.is_superuser, 'reports': reports.all, 'sections': settings.STATUS_TABLES, "requests": { "executors": map(Request.name, Exe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index():\n return render_template('index.html')", "def index():\r\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\r\n return render_template('index.html')", "def index():\r\n return render_template('index.h...
[ "0.8746624", "0.8595454", "0.85802954", "0.85603595", "0.85603595", "0.85573685", "0.85573685", "0.8556325", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", "0.85119885", ...
0.0
-1
Creates an inactive Collision Avoidance Table.
def empty(): return CAT([], 0, 0, active=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocess_arena(self):\n # Create tables\n for i, (offset, rot, half_size, friction, legs) in enumerate(\n zip(self.table_offsets, self.table_rots, self.table_half_sizes, self.table_frictions, self.has_legs)\n ):\n self._add_table(\n name=f\"table{i}...
[ "0.57063633", "0.57042825", "0.5311133", "0.5308168", "0.52781355", "0.52446836", "0.5230063", "0.5230063", "0.52136004", "0.52104086", "0.52020776", "0.5195589", "0.5184808", "0.51805425", "0.51562446", "0.5140564", "0.51379704", "0.51300126", "0.5124686", "0.511761", "0.508...
0.0
-1
An adaptive learning rate optimizer
def adadelta(lr, tparams, grads, cost, args): zipped_grads = [theano.shared(p.get_value() * np_floatX(0.), name='%s_grad' % k) for k, p in tparams.iteritems()] running_up2 = [theano.shared(p.get_value() * np_floatX(0.), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(optimizer):\n for group in optimizer.param_groups:\n if 'step' not in group:\n group['step'] = 0\n group['step'] += 1\n\n group['lr'] = args.lr / (1 + group['step'] * args.lr_decay)", "def adjust_learning_rate(optimizer):\n for group in optimizer.par...
[ "0.7575125", "0.7522171", "0.7404224", "0.7299639", "0.7291133", "0.72832596", "0.72458553", "0.7220955", "0.721602", "0.7193964", "0.71890086", "0.71766293", "0.71744925", "0.71744925", "0.71744925", "0.7173366", "0.7170064", "0.71644264", "0.7160069", "0.71586156", "0.71575...
0.0
-1
A variant of SGD that scales the step size by running average of the recent step norms.
def rmsprop(lr, tparams, grads, cost, args): zipped_grads = [theano.shared(p.get_value() * np_floatX(0.), name='%s_grad' % k) for k, p in tparams.iteritems()] running_grads = [theano.shared(p.get_value() * np_floatX(0.), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BatchNormalize(S):\n mu = np.mean(S, axis=0)\n v = np.mean((S-mu)**2, axis=0)\n S = (S - mu) / np.sqrt(v + epsilon)\n return S", "def scale(step_size: float) -> GradientTransformation:\n return _scale(step_size=step_size, already_flattened=False)", "def batch_normalization(x, phase_train, ou...
[ "0.60944784", "0.60888964", "0.6012642", "0.5988588", "0.58456695", "0.5814569", "0.5808109", "0.5802307", "0.57968444", "0.57758987", "0.5741234", "0.57291794", "0.5693614", "0.5693342", "0.5682889", "0.5674417", "0.5603468", "0.5597444", "0.55923", "0.5574284", "0.55694073"...
0.0
-1
reads all handlers from self._message_handlers and takes first whose filter returns True
def _apply_msg_filter(self,message): for h in self._message_handlers: if h.filter(message): h.handler(message) break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_handlers(self):\n\t\treturn self.message_handlers", "def iter_message_handlers(self):\n for name in dir(self):\n attr = getattr(self, name)\n if isinstance(attr, MessageHandler):\n yield attr", "def filter_handler_results(self, handler_name):\n ...
[ "0.6820144", "0.6651281", "0.61039954", "0.5932053", "0.593016", "0.5848596", "0.58125204", "0.5779794", "0.5708292", "0.5672056", "0.55933034", "0.55838126", "0.5558838", "0.54958034", "0.54236835", "0.538808", "0.5385515", "0.5368192", "0.53667814", "0.53367543", "0.5335005...
0.77054274
0
Destroys local TDLib database and loses login
def destroy(self): data = {} res = self._send_data('destroy',data) return res.ok_received
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tteardown_class(self):\n os.close(self.db_fd)\n os.unlink(app.config['DATABASE'])", "def tearDown(self):\n app.db.drop_database('local')\n app.db.close()", "def tearDown(self):\n get_connection().drop_database('test_monstor_registration')", "def tearDown(self):\n ...
[ "0.7708017", "0.76760745", "0.752587", "0.74767965", "0.74759954", "0.74235755", "0.7402838", "0.73347026", "0.72969216", "0.7296139", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058", "0.7281058"...
0.0
-1
appends reply buttons to the TDLib.sendMessage
def append_inline_keyboard(self, message, user_id, post_id): m = message.copy() reactions = self.app.bot.reactions buttons = [] for key in reactions: r = reactions[key] data = self.app.hash.hash_b64encode(f'VOTE {user_id} {post_id} {r.id}') b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reply_message(self, update, message, keyboard: List[List[str]] = None, inline_keyboard=False):\n if keyboard is not None:\n if not inline_keyboard:\n update.message.reply_text(message,\n reply_markup=ReplyKeyboardMarkup(\n ...
[ "0.66660607", "0.66242087", "0.64173955", "0.620497", "0.6109635", "0.60981923", "0.60535604", "0.59188056", "0.5848731", "0.57363856", "0.57138145", "0.56981796", "0.56913376", "0.56779367", "0.56243765", "0.56243765", "0.55877984", "0.55416846", "0.55250967", "0.5514992", "...
0.61722964
4
hashes string with salt and returns string with truncated salt appended
def hash_with_salt(self, s): data = f'{s} {self.salt}'.encode('ascii') # encode string to raw bytes object hash_obj = hashlib.md5(data) # hash it if self.trunc > 0: hash_txt = hash_obj.hexdigest()[0:self.trunc] # get truncated hash symbols else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_hashed_password(cleartext,salt=None):\n \n if not salt:\n salt = make_salt(5)\n return \"%s|%s\" % (salt,hashlib.sha256(salt + cleartext).hexdigest())", "def apply_hash (self, s):\r\n m = md5()\r\n m.update (s)\r\n d = m.digest()\r\n # base64.encodestring tack...
[ "0.7323806", "0.72268057", "0.72120243", "0.718012", "0.71337366", "0.707762", "0.7076287", "0.7068321", "0.7064799", "0.70572364", "0.7040667", "0.70399886", "0.70274276", "0.70208615", "0.6993306", "0.69835466", "0.6980138", "0.6939247", "0.6939247", "0.6921311", "0.6884623...
0.8599195
0
tests if string was hashed with proper salt
def test_string(self, s): data = s.split(' ') origin = ' '.join(data[0:-1]) if not origin: return False origin_hashed = self.hash_with_salt(origin) return origin_hashed == s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_hash_with_salt(self):\n self.assertEqual(get_user_hash(\"johndoe\", salt=\"jane\").hex()[:6], \"fb0bf4\")", "def test_user_hash_without_salt(self):\n salt_bytes = \"my salt\".encode()\n salt_hex = salt_bytes.hex()\n with set_env(CSCI_SALT=salt_hex):\n expected...
[ "0.79691917", "0.7714933", "0.7597521", "0.75918525", "0.7473177", "0.7352375", "0.71297425", "0.71163315", "0.71050775", "0.7096908", "0.70124876", "0.6988462", "0.6960958", "0.69052094", "0.68888384", "0.68888384", "0.6875559", "0.6772057", "0.6723302", "0.6660236", "0.6631...
0.71053034
8
return tangent angle to a circle placed at (dist, 0.0) with radius=radius For nonexisting tangent use 100 degrees and too far (2 times radius) circle return None
def tangent_circle(dist, radius): if dist < 3 * radius: if dist >= radius: return math.asin(radius/float(dist)) return math.radians(100) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_allowable_angle(self, dist: float) -> float:\n angle = math.atan(self.TRUE_TARGET_RADIUS / dist)\n # print(f\"angle tolerance +- {angle} true target radius{self.TRUE_TARGET_RADIUS}\")\n return angle", "def distance_to(self, circle):\n diff = tuple(map(sub, self.pos, circle.po...
[ "0.6546972", "0.6223502", "0.6056518", "0.599725", "0.5958573", "0.59585696", "0.588909", "0.58879834", "0.5874164", "0.5802152", "0.57763994", "0.57763994", "0.57113194", "0.56971276", "0.5663912", "0.5660724", "0.5652065", "0.5644036", "0.56128615", "0.5568074", "0.556712",...
0.9004636
0
Compute softmax values for x.
def softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out", "def softmax(self, x):\n if x.ndim == 1:\n x = x.reshape((1, -1))\n ...
[ "0.9059868", "0.8899648", "0.88992727", "0.8894093", "0.88827974", "0.8879948", "0.8876861", "0.8872141", "0.8861067", "0.88539517", "0.8842701", "0.88314116", "0.8819078", "0.88159597", "0.88159597", "0.87916064", "0.877713", "0.87762564", "0.87762564", "0.87762564", "0.8776...
0.86450934
62
A contains method to check whether the given string is in the legitimate words or not.
def __contains__(self, query): # a contains method if query in self._languageSet or query[0].lower( ) +query[1:] in self._languageSet: # check if the given string is in language set or not return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_word(words, word):\r\n if word in words:\r\n return True\r\n else:\r\n return False", "def _words_in_text(word, text):\n\n regexword = \"\\\\b\" + word + \"\\\\b\"\n\n return True if re.search(regexword, text, re.IGNORECASE) else False", "def check_word_in_list_in_string(lis...
[ "0.7779192", "0.73191184", "0.7076533", "0.70544493", "0.7051783", "0.7037327", "0.70353645", "0.6990022", "0.6990022", "0.6990022", "0.696886", "0.69671553", "0.6955121", "0.6934601", "0.6922396", "0.69022244", "0.6887796", "0.68768114", "0.68710923", "0.6854681", "0.6851432...
0.6463568
59
return true if an authenticated (validated) session has been established and has not expired.
def sessionValid(self): return self.request.getSession().isValid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isExpired(self):\n return self.sess is not None and not self.sess.isValid()", "def is_session_valid(self, logonTimestamp):\n time_diff = time.time() - logonTimestamp\n return (time_diff / 60) < self.session_time_limit", "def any_active(self):\n for session_id in self.get_session...
[ "0.79456645", "0.74243605", "0.7388761", "0.7224467", "0.7215239", "0.7206501", "0.7187858", "0.71670157", "0.7165557", "0.71546113", "0.7147789", "0.7086114", "0.7075168", "0.7067662", "0.70583296", "0.70458853", "0.7038191", "0.7036178", "0.702764", "0.7019293", "0.7019244"...
0.7795629
1
return True if it appears that the user session is new, meaning that either the user has not or never logged in. False means that the user has either logged in or that the session has recently expired.
def sessionNew(self): return self.request.getSession().isNew();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLoggedOut(self):\n return self.sess is None or self.sess.isNew()", "def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n return False\n\n # if self.user == None:\n # return False\n return True", "def isLoggedIn(self):\n session = sel...
[ "0.7538963", "0.7391871", "0.73093146", "0.706602", "0.7054157", "0.7000122", "0.6970512", "0.69608283", "0.6897448", "0.68822265", "0.6850178", "0.68153775", "0.6785952", "0.6745875", "0.6680256", "0.6653168", "0.6630136", "0.66185266", "0.65697956", "0.6569035", "0.6565668"...
0.77059174
0
return the login status as one of the class enumerations, NONE, ACTIVE, or EXPIRED.
def getState(self): if self.isLoggedOut(): return self.NONE elif self.isActive(): return self.ACTIVE else: return self.EXPIRED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status(self):\n statuses = dict(ACTIVITY_STATUS_CHOICES)\n return statuses.get(self.status, \"N/A\")", "def status_enum(self):\n return self.valid_statuses()", "def get_status(self):\n # TODO retrieve from db if not set\n return self.status", "def get_status(self):\...
[ "0.6811044", "0.6781024", "0.6690842", "0.65686095", "0.6412647", "0.6412647", "0.6412647", "0.6330659", "0.6282517", "0.6259049", "0.6259049", "0.62583286", "0.62389505", "0.62379503", "0.62284124", "0.62180954", "0.6191532", "0.6191532", "0.61899215", "0.6189118", "0.614197...
0.64204526
4
return True if the session does not exist, indicating that the user logged out or otherwise has never logged in.
def isLoggedOut(self): return self.sess is None or self.sess.isNew()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLoggedIn(self):\n session = self.getSession()\n if session is not None:\n return True\n return False", "def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n return False\n\n # if self.user == None:\n # return False\n ...
[ "0.7960414", "0.7560247", "0.7528694", "0.7464559", "0.7439468", "0.7414775", "0.7391465", "0.73498595", "0.7270838", "0.72499835", "0.7211819", "0.69925684", "0.69776183", "0.69462925", "0.6839284", "0.677237", "0.6768205", "0.6759924", "0.67335975", "0.6708057", "0.67079705...
0.8131906
0
transform matrix in sparse coo_matrix to sparse tensor of torch INPUT coo matrix in sparse coo_matrix format OUTPUT coo matrix in torch.sparse.tensor
def coo2st(coo): values = coo.data indices = np.vstack((coo.row, coo.col)) i = torch.LongTensor(indices) v = torch.FloatTensor(values) shape = coo.shape return torch.sparse.FloatTensor(i, v, torch.Size(shape))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_mx_to_torch_sparse_tensor(sparse_mx):\n \n # sparse_mx = sparse_mx.astype(np.float32)\n indices = torch.from_numpy(\n np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))\n values = torch.from_numpy(sparse_mx.data)\n shape = torch.Size(sparse_mx.shape)\n return torch.spars...
[ "0.7659068", "0.7558786", "0.74205446", "0.7398961", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73909533", "0.73694897", "0.736347", "0.7357027", "0...
0.73584837
19
Check if this element contains no bytes.
def is_empty(self): return not bool(self._bytes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self) -> bool:\n return self.size_bytes == 0", "def empty(self):\n return 0 >= len(self.__data)", "def empty(self):\r\n return self.getSize() == 0", "def is_empty(self):\r\n return self.buff==[]", "def is_empty(self):\n return len(self.data) == 0", "def is_empt...
[ "0.71236455", "0.70640343", "0.70586455", "0.69462913", "0.6941436", "0.6916584", "0.6891693", "0.6877218", "0.6877218", "0.6877218", "0.6877218", "0.6877218", "0.6877218", "0.6877218", "0.68745804", "0.68534386", "0.6840915", "0.68221784", "0.67716426", "0.67669696", "0.6752...
0.79667604
0
Hack __eq__ that checks equality if we have FExprs and checks object ID equality otherwise.
def evil_hack(self, other): if isinstance(other, FExpr): return other == self return isinstance(other, self.__class__) and self.id == other.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def...
[ "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7341255", "0.7188106", "...
0.7629236
0
Gets the ID associated with an object.
def get_id(obj): if obj is None: return None obj_jid = getattr(obj, self.field.join_field.name) if obj_jid is None: raise Exception("Object must be saved before it can be \ attached via JeevesForeignKey.") cache[obj_jid]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_id(o):\n return id(o)", "def getid(obj):\n\n # Try to return the object's UUID first, if we have a UUID.\n try:\n if obj.uuid:\n return obj.uuid\n except AttributeError:\n pass\n try:\n return obj.id\n except AttributeError:\n return obj", "de...
[ "0.8341478", "0.8317972", "0.8154818", "0.80879325", "0.78301746", "0.78286046", "0.7808978", "0.7808978", "0.77959096", "0.77959096", "0.77959096", "0.77134407", "0.7631838", "0.76130235", "0.76020837", "0.76020837", "0.7601563", "0.7583788", "0.7583788", "0.7583788", "0.758...
0.0
-1
A list of Reference objects representing tags, heads and remote references.
def references(self) -> "IterableList[Reference]": return Reference.list_items(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def References(self, default=[{}]):\n tmp = self.data.get('metadata', {}).get('references', default)\n return [HEP.ReferenceObject(i) for i in tmp]", "def list_refs(self):\n pass", "def references(self):\n return self.header('References', '').split()", "def references(self...
[ "0.76388407", "0.7497304", "0.74670535", "0.7447669", "0.74251896", "0.73717904", "0.7346691", "0.7213302", "0.7202282", "0.71578926", "0.7128635", "0.7120887", "0.709356", "0.702713", "0.68480635", "0.66500163", "0.66306657", "0.652262", "0.6441418", "0.6441418", "0.64324945...
0.81828594
0
Create a new tag reference. For more documentation, please see the TagReference.create method.
def create_tag( self, path: PathLike, ref: Union[str, "SymbolicReference"] = "HEAD", message: Optional[str] = None, force: bool = False, **kwargs: Any, ) -> TagReference: return TagReference.create(self, path, ref, message, force, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ref(self, commit_id=None):\n pass", "def create(self, name, tag):\n\n\t\turl_json = urllib.urlencode({\"name\": name, \"tag\": tag})\n\t\treturn self._create(\"/tag?json_hash=%s\" % url_json, \"tag\")", "def create(self, params={}, **options):\n return self.client.post(\"/tags\", param...
[ "0.59600246", "0.5921391", "0.5677583", "0.5571974", "0.5454277", "0.5450359", "0.5311379", "0.5293005", "0.5243687", "0.52253234", "0.5220693", "0.5210611", "0.51849747", "0.5182306", "0.51744187", "0.5162945", "0.51305825", "0.50870734", "0.5077504", "0.50474465", "0.503864...
0.76285815
0
The name of the currently active branch.
def active_branch(self) -> Head: # reveal_type(self.head.reference) # => Reference return self.head.reference
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_branch(self):\n return self.repo.active_branch.name", "def get_current_branch_name(self):\n # type: () -> Optional[str]\n branch = self.get_current_branch()\n if branch:\n return branch.name\n return None", "def branch_name(self):\n return f'phab-...
[ "0.8699686", "0.85451937", "0.7957353", "0.79350233", "0.7904023", "0.77474046", "0.765242", "0.7461496", "0.73491174", "0.7286525", "0.7278517", "0.72571534", "0.7169811", "0.71606755", "0.71019185", "0.7006258", "0.6991655", "0.6991655", "0.6943995", "0.67782766", "0.677093...
0.63962775
32
model.add(Conv2D(64, kernel_size=3, activation='relu', input_shape=(size, size, 1))) model.add(Conv2D(32, kernel_size=3, activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(128, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(10, activa...
def run_model(x_train, y_train, x_test, y_test, plot_type, epochs, size): # Create the sequential model from keras (CNN) #TODO: Add batch normalization layers # Add the layers to the sequential model model = Sequential() model.add(Conv2D(64, kernel_size=3, use_bias=False, inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CNN_model():\n prob = 0.1\n model = Sequential()\n # model.add(Conv2D(filters = 32, kernel_size = (5,5),padding = 'Same',\n # activation ='relu', input_shape = (28,28,1)))\n # model.add(Conv2D(filters = 64, kernel_size = (5,5),padding = 'Same',\n # activation =...
[ "0.825359", "0.8117493", "0.81072277", "0.79179156", "0.7861119", "0.7733226", "0.76186734", "0.75931895", "0.75521505", "0.7516829", "0.7458402", "0.7416079", "0.7397461", "0.73924077", "0.73674744", "0.7363147", "0.73367846", "0.7321101", "0.7261899", "0.725455", "0.724929"...
0.0
-1
The shortest distance between two objects at specified times.
def closest_distance(self, time, other_object, other_time): ti = np.where(self.times == time)[0][0] oti = np.where(other_object.times == other_time)[0][0] xs = self.x[ti].ravel()[self.masks[ti].ravel() == 1] xs = xs.reshape(xs.size, 1) ys = self.y[ti].ravel()[self.masks[ti].ravel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_distance(object_1, object_2):\n\n # package import\n import numpy as np\n\n # main algorithm\n minimum_distance = 100000\n\n for coord_1 in object_1:\n for coord_2 in object_2:\n distance_btwn_coords = np.linalg.norm(coord_1 - coord_2)\n if distance_btwn_coor...
[ "0.6308728", "0.6308175", "0.6306714", "0.6151658", "0.59401333", "0.5889106", "0.58839244", "0.5882022", "0.58807635", "0.5862003", "0.5818082", "0.57882285", "0.57865316", "0.5778319", "0.5778047", "0.5778047", "0.5778047", "0.5778047", "0.5778047", "0.5773194", "0.5765998"...
0.70089066
0
Gets the largest size of the object over all timesteps.
def max_size(self): sizes = np.array([m.sum() for m in self.masks]) return sizes.max()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_size(self):\n max_size = 0\n file = h5py.File(self.filename, 'r')\n for idx in range(len(self)):\n label = self.labels[idx]\n timestamps_group = file['/'][self.mode + '_timestamps']\n timestamps_dset = timestamps_group[label]\n size = len...
[ "0.7012551", "0.67402315", "0.6680056", "0.6625371", "0.6563832", "0.6447255", "0.6357856", "0.635138", "0.63320804", "0.63311017", "0.6328128", "0.6269386", "0.62429184", "0.624122", "0.62085855", "0.62066364", "0.62057835", "0.61972684", "0.6194075", "0.6194075", "0.6194075...
0.64041656
6
Calculate the contour around the edge of the binary mask for the object. For objects with interior holes or multiple connections, binary dilation, hole filling, and erosion are used to generate a single edge contour instead of multiple contours.
def boundary_contour(self, time): ti = np.where(time == self.times)[0][0] image_mask = binary_erosion(binary_fill_holes(binary_dilation(self.masks[ti]))) padded_mask = np.pad(image_mask, 1, 'constant', constant_values=0) c_out = find_contours(padded_mask, level=0.5, fully_connected="high...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findEdge(imdata):\n\n # remove border effect\n imdata[:,0] = imdata[:,1]\n \n # threshold segmentation\n #val = filter.threshold_otsu(imdata)\n val = 500\n mask = imdata >val\n\n contour = np.floor(find_contours(mask, 0.5, fully_connected='low', positive_orientation='low')[0])\n cont...
[ "0.63093513", "0.62753314", "0.6211457", "0.61806417", "0.61163265", "0.60910255", "0.59792846", "0.5959632", "0.59148586", "0.59143555", "0.5834718", "0.58236706", "0.5821015", "0.5793158", "0.5724879", "0.56962913", "0.56814724", "0.56372774", "0.562388", "0.5601187", "0.55...
0.56241554
18
Sets the learning rate to the initial learning rate decayed by 10 every n epochs
def adjust_learning_rate(init_lr, optimizer, epoch, n=100): init_lr = init_lr * (0.1 ** (epoch // n)) print('learning rate : ', init_lr) for param_group in optimizer.param_groups: param_group['lr'] = init_lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def update_learning_rate(self) -> None:\n self.epsilon = self.initial_epsilon / (1. + self.rate_decay * self.n_it)\n return", "def initialize_learning_rate(...
[ "0.78460795", "0.78460795", "0.758223", "0.7554002", "0.74850243", "0.74832", "0.74089915", "0.7324907", "0.7323229", "0.7320384", "0.73046774", "0.72751737", "0.72751737", "0.7253285", "0.725238", "0.7228168", "0.7220572", "0.7220149", "0.72192925", "0.72192925", "0.72192925...
0.78172106
2
get word and pos lists from raw text you need a tokenizer to toke syntactic word and
def get_word_pos_list(self, raw_text): raw_text = raw_text.strip() word_list = [] pos_list = [] # pdb.set_trace() seg_list = jieba.posseg.cut(raw_text,HMM=False) # 默认是精确模式 for word, flag in seg_list: # remove the punctuation, we will keep punctuation as proso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n global TOK\n tokens = TOK.tokenize(text)\n output = {\n 'words': tokens.words(),\n 'offsets': tokens.offsets(),\n 'pos': tokens.pos(),\n 'lemma': tokens.lemmas(),\n 'ner': tokens.entities(),\n }\n return output", "def _tokenize(text, languag...
[ "0.7470431", "0.7395416", "0.70028955", "0.69835544", "0.6983043", "0.69734746", "0.69718397", "0.6965676", "0.6950102", "0.6923767", "0.69043654", "0.6903462", "0.68873143", "0.68592477", "0.68408453", "0.68376726", "0.67986983", "0.6785129", "0.6743991", "0.67269915", "0.67...
0.7505949
0