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
Overloaded eq operator for dicts.
def equals_dict(self, other: GenoDistribDict): return self.to_json_dict() == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return dict.__eq__(self, other)", "def __eq__(self, other):\n return self.__dict__ == other", "def __eq__(self, other):\n #duck type our way to sanity:\n if not hasattr(other, 'keys'): return False\n #OK, it's a dict-ish thing\n try:\n ...
[ "0.7734938", "0.7130402", "0.701994", "0.69924974", "0.6952616", "0.6949937", "0.69237036", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", "0.6897696", ...
0.6822083
57
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
70
Return a filename of the configuration file. Local file has a higher priority than in the config_path.
def _resolve_conf_name(conf_type): fnm = config_names[conf_type] if os.path.isfile(fnm): return fnm elif os.path.isfile(config_path + fnm): return config_path + fnm else: raise RuntimeError("Missing configuration file for %s" % conf_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configFilename(self):\n return self.name()+'.py'", "def config_file_name(self):\n return self._config_file_name", "def getConfigFileName(self):\n return self._configFileName", "def _get_config_filepath(self):\n\t\tif self.configfilepath is None:\n\t\t\treturn os.path.join(self.workdi...
[ "0.7674557", "0.7577269", "0.7527643", "0.74998224", "0.74790835", "0.736693", "0.73346114", "0.73146594", "0.7310027", "0.7308779", "0.730687", "0.7267295", "0.7215124", "0.716434", "0.705033", "0.70417315", "0.7031546", "0.7020565", "0.7020533", "0.70188606", "0.6963868", ...
0.62482184
57
Look up user by ID. For missing users this must return None, otherwise it must return a corresponding `UserEntry`.
def lookup(self, user_id): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_by_id(self, _id):\n user_resp = self._db.Users(database_pb2.UsersRequest(\n request_type=database_pb2.UsersRequest.FIND,\n match=database_pb2.UsersEntry(global_id=_id)))\n if user_resp.result_type != database_pb2.UsersResponse.OK:\n self._logger.warning(...
[ "0.8057866", "0.79022884", "0.78792036", "0.78340226", "0.7804364", "0.76193124", "0.75746727", "0.7522016", "0.7500068", "0.74911827", "0.7489803", "0.74704903", "0.74547833", "0.74368376", "0.7410602", "0.7393956", "0.73388", "0.730953", "0.7306555", "0.7289546", "0.7279675...
0.0
-1
test_delete_route Test if the route has succesfully been deleted in the database
def test_delete_route(self): delete = { 'ip': 'test_ip', 'next_hop': 'test_nexthop', 'communities': 'test_commu' } route_id = self.database.add_route(delete) self.database.delete_route({'_id': route_id}) route = self.database.route.find_one({'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_namespaced_route(self):\n pass", "def test_delete():\n\n start_ln = len(routes.routes['DELETE'])\n\n @delete('/s/foo')\n def foo_route(request):\n return 200, ''\n\n for path, fn in routes.routes['DELETE']:\n if fn == foo_route:\n found = (path, fn)\n ...
[ "0.7787011", "0.77240497", "0.7403045", "0.7308301", "0.7291089", "0.71428454", "0.710142", "0.69899493", "0.69888437", "0.69677615", "0.6964013", "0.6945771", "0.69411343", "0.69218403", "0.6909675", "0.6903634", "0.68765587", "0.6861288", "0.68479794", "0.6839981", "0.68307...
0.8715654
0
Overrides the default widget for Foreignkey fields if they are specified in the related_search_fields class attribute.
def formfield_for_dbfield(self, db_field, **kwargs): if (isinstance(db_field, ForeignKey) and db_field.name in self.related_search_fields): kwargs['widget'] = fk_lookup.FkLookup(db_field.rel.to) return super(AutocompleteMixin, self).formfield_for_dbfield(db_field, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formfield_for_foreignkey(self, db_field, request, **kwargs):\n if db_field.name == 'client':\n if 'add' in request.path and hasattr(request.user, 'salesman'):\n kwargs[\"queryset\"] = Client.objects.filter(sales_contact=request.user.salesman)\n elif 'change' in reque...
[ "0.55847335", "0.55709255", "0.55234796", "0.5447261", "0.5446156", "0.54081744", "0.5400616", "0.53613204", "0.53571355", "0.5312685", "0.52836233", "0.52801436", "0.52327037", "0.5206789", "0.5180228", "0.5120262", "0.49074736", "0.48317558", "0.48191133", "0.47492185", "0....
0.7770927
0
A next(iterable) that drops everything but the last item
def last(iterable): it = iter(iterable) item = next(it) for item in it: pass return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(iterator):\n item = None\n for item in iterator:\n pass\n return item", "def return_last(iter):\n for thing in iter:\n pass\n return thing", "def last(seq):\n try:\n return seq[-1]\n except TypeError:\n old = None\n it = iter(seq)\n while ...
[ "0.7735516", "0.74266607", "0.719169", "0.7073384", "0.7062439", "0.6585514", "0.65723264", "0.64379543", "0.6400359", "0.6313871", "0.62097245", "0.61574733", "0.61574733", "0.61574733", "0.6129757", "0.61083585", "0.60796285", "0.6044209", "0.6024305", "0.59958494", "0.5984...
0.80694884
0
Generator for an iterable that has to yield one extra value BEFORE iterating over its contents. >>> next(prepend(2, [])) 2 >>> list(prepend(True, range(5))) [True, 0, 1, 2, 3, 4]
def prepend(value, iterable): yield value yield from iterable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_previous(iterable, *, fillvalue=None):\n previous = fillvalue\n for item in iterable:\n yield previous, item\n previous = item", "def with_prev(gen):\n prev = next(gen)\n for el in gen:\n yield prev, el\n prev = el", "def PeekIterable(iterable):\n try:\n hea...
[ "0.6232495", "0.6106798", "0.6082866", "0.60570407", "0.5983118", "0.59649885", "0.5910621", "0.5782151", "0.5782151", "0.5782151", "0.5716061", "0.5698885", "0.5656689", "0.5652747", "0.5642387", "0.5598982", "0.5590407", "0.5578573", "0.5553445", "0.55392593", "0.5536332", ...
0.7897072
0
Renders the aboutus.html page
def aboutus(request): return render(request, 'aboutus.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about_us():\r\n return render_template(\"about_us.html\")", "def about_us():\n\n return render_template('about_us.html')", "def about_us():\n return render_template('home/about-us.html')", "def about():\n return render_template('about.html', title='About')", "def aboutus():\n return ...
[ "0.88278824", "0.88200504", "0.8723893", "0.86820245", "0.8681237", "0.8640849", "0.8623448", "0.859646", "0.8480329", "0.84482694", "0.8432581", "0.842732", "0.8400996", "0.83686125", "0.8354835", "0.83520776", "0.83520776", "0.83520776", "0.83520776", "0.83520776", "0.83520...
0.87045795
3
Helper method to retreive the current_score from the Score model.
def get_item(query, key): for element in query: if (list(element)[0].get('game__name') == key): return list(element)[0].get('current_score') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_score(self):\n\n # Return the player's current turn score\n return self._current_score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return self.score", "def get_score(self):\n return s...
[ "0.74065584", "0.7271781", "0.7271781", "0.7271781", "0.7164975", "0.70929486", "0.70755327", "0.70755327", "0.70755327", "0.70167345", "0.69945574", "0.69433594", "0.69012886", "0.6845912", "0.68448263", "0.67868507", "0.670923", "0.662623", "0.66022635", "0.65548366", "0.65...
0.5894674
54
Return a list of supported product types.
def product_types(self): return list(self._product_type_plugins.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_types(self):\n return self._product_types", "def list(self, request):\n product_types = ProductType.objects.all()\n serializer = ProductTypeSerializer(product_types, many=True)\n\n return Response(serializer.data, status=status.HTTP_200_OK)", "def product_type(self):\n ...
[ "0.8219866", "0.70900345", "0.68372416", "0.6760887", "0.6620388", "0.6575468", "0.6513892", "0.6455527", "0.640012", "0.6325782", "0.62962794", "0.6286644", "0.6236502", "0.623388", "0.62244517", "0.6140679", "0.6103262", "0.61016834", "0.6090889", "0.604282", "0.6039738", ...
0.8217488
1
Return a list of supported remote_backends.
def remote_backends(self): return list(self._remote_backend_plugins.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_backends(compact=True):\n warnings.warn(\n \"remote_backends() will be deprecated in upcoming versions (>0.5). \"\n \"using filters instead is recommended (i.e. available_backends({'local': False}).\",\n DeprecationWarning)\n return available_backends({'local': False}, compact...
[ "0.7744013", "0.73592526", "0.72704685", "0.69943446", "0.66982514", "0.6656527", "0.6545892", "0.6495762", "0.64870316", "0.64312637", "0.63103145", "0.63056195", "0.6296503", "0.62921184", "0.6231428", "0.62025946", "0.6106119", "0.6087119", "0.602616", "0.6025417", "0.5970...
0.87564415
0
Register a product type.
def register_product_type(self, product_type, plugin): if product_type in self._product_type_plugins: raise Error("redefinition of product type: \"%s\"" % product_type) # Quick verify of the plugin interface for attr in ['use_enclosing_directory', 'use_hash']: if not has...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registerType(cls, type):\n # NOTE Subclasses must be registered via this method in order to be initialized from XML, etc.\n cls.componentTypes[type.__name__] = type\n #print \"Component.registerType(): Component type \\'\" + type.__name__ + \"\\' registered.\" # [debug]", "def register(cls, package...
[ "0.6974019", "0.669515", "0.65829057", "0.65399706", "0.6479371", "0.641708", "0.6391343", "0.6288516", "0.61736554", "0.61482215", "0.61388344", "0.61263615", "0.6089745", "0.60595906", "0.5905931", "0.5900134", "0.5897795", "0.58883035", "0.5886436", "0.5886436", "0.5878597...
0.7973618
0
Retrieve one or more products from the archive. Return the number of products retrieved.
def retrieve(self, where="", parameters={}, target_path=os.path.curdir, use_symlinks=False): products = self.search(where=where, parameters=parameters) for product in products: if not product.core.active or 'archive_path' not in product.core: raise Error("product '%s' (%s) no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_products(self):\n return self._make_get_request(self._urls['products'])", "def products(self, start=None, limit=None):\r\n params = base.get_params(None, locals())\r\n url = '{0}/products'.format(self.get_url())\r\n return http.Request('GET', url, params), parsers.parse_json"...
[ "0.65875596", "0.6477085", "0.64648587", "0.6396797", "0.6395952", "0.637698", "0.63318473", "0.6317465", "0.6299458", "0.6202053", "0.6164179", "0.6141579", "0.610373", "0.6095371", "0.6012703", "0.5942648", "0.5938733", "0.5936196", "0.58696485", "0.5862668", "0.583268", ...
0.67018837
0
Verify the hash for one or more products in the archive. Returns a list of UUIDs of products for which the verification failed. This will be an empty list '[]' if all products match their hash. Products that are not active or are not in the archive will be skipped. If there is no hash available in the metadata for a pr...
def verify_hash(self, where="", parameters={}): failed_products = [] products = self.search(where=where, parameters=parameters) for product in products: if product.core.active and 'archive_path' in product.core: if 'hash' not in product.core: raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_products(self, adi):\r\n results = []\r\n products = self.get_products(adi)\r\n for product in products[\"data\"][\"products\"]:\r\n print(\"Checking product '{}'... \".format(product[\"name\"]), end='')\r\n detail = self.get_product_detail(adi, product_id=produ...
[ "0.6280241", "0.62082356", "0.6165836", "0.5935804", "0.56277037", "0.5514684", "0.5357622", "0.5269648", "0.52295303", "0.5217685", "0.51640415", "0.5161442", "0.51568073", "0.51237214", "0.50548756", "0.5037372", "0.49907994", "0.49762258", "0.49687105", "0.49537364", "0.49...
0.82221264
0
Update product properties in the product catalogue. The UUID of the product to update will be taken from the "core.uuid" property if it is present in the specified properties. Otherwise, the UUID should be provided separately. This function allows any property to be changed with the exception of the product UUID, and t...
def update_properties(self, properties, uuid=None, create_namespaces=False): if create_namespaces: if 'core' in properties and 'uuid' in properties.core: uuid = properties.core.uuid if uuid is None else uuid if uuid != properties.core.uuid: raise E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_properties(self, uuid, disable_hooks=False, use_current_path=False):\n restricted_properties = set([\"uuid\", \"active\", \"hash\", \"size\", \"metadata_date\", \"archive_date\", \"archive_path\",\n \"product_type\", \"physical_name\"])\n\n product = se...
[ "0.69109875", "0.61432636", "0.59970045", "0.5834772", "0.5791002", "0.578084", "0.5744942", "0.5706113", "0.56943005", "0.5688408", "0.56860477", "0.55909395", "0.5561773", "0.55497265", "0.54576415", "0.5445328", "0.54084617", "0.53886116", "0.5377363", "0.5374274", "0.5298...
0.82675487
0
Rebuilds product properties by reextracting these properties (using product type plugins) from the products stored in the archive. Only properties and tags that are returned by the product type plugin will be updated. Other properties or tags will remain as they were.
def rebuild_properties(self, uuid, disable_hooks=False, use_current_path=False): restricted_properties = set(["uuid", "active", "hash", "size", "metadata_date", "archive_date", "archive_path", "product_type", "physical_name"]) product = self._get_product(uuid) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_pull_properties(self, uuid, verify_hash=False, disable_hooks=False, use_current_path=False):\n product = self._get_product(uuid)\n if 'archive_path' not in product.core:\n raise Error(\"cannot update missing product\")\n if 'remote_url' not in product.core:\n ...
[ "0.6287688", "0.6216242", "0.6149274", "0.5680912", "0.5629188", "0.5297808", "0.523425", "0.5211133", "0.5169436", "0.5167846", "0.51344234", "0.5075289", "0.5063529", "0.50621957", "0.5053694", "0.5038314", "0.5010851", "0.49597308", "0.49588162", "0.49508813", "0.49242494"...
0.72840333
0
Return the tags of a product.
def tags(self, uuid): return self._backend.tags(uuid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products(self):\n return list(Product.select())", "def products(self):\r\n return self._products", "def get_products(self):\n return [item.code for item in self._products]", "def products(self):\n return self._products", "def get(self, currency, entity):\n check_inputs(cu...
[ "0.6845557", "0.6748483", "0.66972214", "0.66572946", "0.6622007", "0.6478578", "0.6415721", "0.6360708", "0.63582206", "0.63568664", "0.6335542", "0.6320746", "0.63146895", "0.6313989", "0.6287221", "0.62085724", "0.6205336", "0.62019557", "0.6161925", "0.6153293", "0.615329...
0.60293865
50
Return the UUIDs of the products that are linked to the given product as source products.
def source_products(self, uuid): return self._backend.source_products(uuid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_linked_products(\n self, product: DatasetType, kind=\"source\", sample_percentage=0.05\n ) -> List[str]:\n if kind not in (\"source\", \"derived\"):\n raise ValueError(f\"Unexpected kind of link: {kind!r}\")\n if not 0.0 < sample_percentage <= 100.0:\n raise V...
[ "0.6549151", "0.60804164", "0.59435666", "0.58589983", "0.5637334", "0.5571004", "0.55621344", "0.5557911", "0.55258363", "0.55203146", "0.548638", "0.54822534", "0.5470797", "0.5402522", "0.5383835", "0.53715324", "0.5354779", "0.5345139", "0.5345071", "0.52918357", "0.52696...
0.7577311
0
Return the path on disk where the product with the specified product.
def product_path(self, uuid_or_name_or_properties): if isinstance(uuid_or_name_or_properties, Struct): product = uuid_or_name_or_properties elif isinstance(uuid_or_name_or_properties, uuid.UUID): products = self.search(where="uuid == @uuid", parameters={"uuid": uuid_or_name_or_pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self):\n path = os.path.join(self.base_dir, self.store().replace(' ', '_'), self.package_name())\n return os.path.abspath(path)", "def product_image_file_path(instance, filename):\n ext = os.path.splitext(filename)[1]\n filename = f'{uuid.uuid4()}{ext}'\n\n return os.path.join('up...
[ "0.66581666", "0.6521602", "0.6365979", "0.63475156", "0.6304031", "0.6241721", "0.6169996", "0.6107268", "0.61008763", "0.60917085", "0.60917085", "0.60872173", "0.6083444", "0.6069185", "0.6068569", "0.60388005", "0.6028238", "0.6014138", "0.5984737", "0.59700567", "0.59700...
0.7029384
0
Close the archive immediately instead of when (and if) the archive instance is collected. Using the archive after calling this function results in undefined behavior.
def close(self): self._backend.disconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\r\n if self._archive != None:\r\n self._isOpened = False\r\n self._archive.close()", "def test_deferred_close_by_archive(self):\n z = ZipFile(self.f, 'r')\n self.assertIsNotNone(z._a)\n self.assertIsNone(z._stream)\n z.close()\n sel...
[ "0.81310314", "0.74738985", "0.7272109", "0.7161171", "0.6951734", "0.6904713", "0.68161744", "0.67221016", "0.66291845", "0.65386057", "0.6496994", "0.6468334", "0.64180815", "0.6382644", "0.63772255", "0.6355712", "0.6318249", "0.6312334", "0.63093764", "0.62538016", "0.621...
0.0
-1
Asserts that a projectroletemplatebinding cannot reference a cluster roletemplate
def test_context_prtb(admin_mc, admin_pc, remove_resource, user_mc): admin_client = admin_mc.client project = admin_pc.project with pytest.raises(ApiError) as e: prtb = admin_client.create_project_role_template_binding( name="prtb-" + random_str(), user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_main_failing_bad_layout_path(self):\n args = [\"-l\", \"not-a-path-to-a-layout\", \"-k\", self.alice_path]\n self.assert_cli_sys_exit(args, 1)", "def test_context_crtb(admin_mc, admin_cc, remove_resource,\n user_mc):\n admin_client = admin_mc.client\n\n with pyte...
[ "0.56467474", "0.56175196", "0.5608866", "0.55199414", "0.5487587", "0.5484451", "0.5476972", "0.5463735", "0.5457674", "0.54571027", "0.5430074", "0.54227066", "0.5412726", "0.5378101", "0.53676176", "0.5346534", "0.5326945", "0.53243876", "0.5312295", "0.5306646", "0.530160...
0.5755993
0
Initialize an empty profile.
def __init__(self): self._ngrams = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, profile: AskarProfile):\n self._profile = profile", "def _init_profiles(self):\n self._profiles = {\n k: np.zeros((len(self.hybrid_time_index), len(self.hybrid_meta)),\n dtype=np.float32)\n for k in OUTPUT_PROFILE_NAMES}", "def __ini...
[ "0.6765257", "0.6746474", "0.66360116", "0.6615768", "0.6615704", "0.6336736", "0.6255449", "0.6246481", "0.6236599", "0.6195187", "0.6144271", "0.6067304", "0.6060738", "0.60265875", "0.5995453", "0.5921014", "0.5917391", "0.5911467", "0.5898272", "0.5882924", "0.5861778", ...
0.0
-1
Save the profile to a file in JSON format.
def save_as_json(self, file_path): with open(file_path, 'w') as fd: json.dump(self._ngrams, fd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, filename):\n content = self.to_dict()\n with open(filename, 'w') as f:\n json.dump(content, f)", "def save_to_jsonl(self, profile_file):\n with open(profile_file, \"w\") as out_f:\n for qid in tqdm(self.get_all_qids(), disable=not self.verbose):\n ...
[ "0.73756397", "0.72824854", "0.72257376", "0.7224689", "0.72077215", "0.7189077", "0.7181774", "0.7106411", "0.70856184", "0.70704484", "0.7019153", "0.701376", "0.70137084", "0.699576", "0.6984957", "0.69791085", "0.6976532", "0.69702166", "0.6944688", "0.69426674", "0.69378...
0.0
-1
Common NGrams (CNG) profile dissimilarity. See Vlado Keselj, Fuchun Peng, Nick Cercone, and Calvin Thomas (2003). "Ngrambased Author Profiles for Authorship Attribution". In Proceedings of the Conference Pacific Association for Computational Linguistics, PACLING'03, Nova Scotia, Canada, pp. 255264.
def cng_dissimilarity(self, other): dissimilarity = 0.0 for ngram in set(self) | set(other): dissimilarity += (2 * (self[ngram] - other[ngram]) / (self[ngram] + other[ngram])) ** 2 return dissimilarity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nDCG_p(results, topic, p):\n return DCG_p(results, topic, p) / IDCG_p(topic, p)", "def ndcg(self, gt, pred, k):\n k = min(k, len(pred))\n idcg = self.idcg(k)\n dcg_k = sum([int(pred[i] in gt) / math.log(i + 2, 2) for i in range(k)])\n return dcg_k / idcg", "def part3c_2():\n ...
[ "0.6050268", "0.5992378", "0.58809334", "0.5745066", "0.57304984", "0.57105285", "0.5693535", "0.56534797", "0.55507934", "0.5543589", "0.5452582", "0.5444699", "0.5436144", "0.5431215", "0.5407578", "0.5402294", "0.5353368", "0.5337469", "0.53267956", "0.53204817", "0.530622...
0.6296485
0
Tests the creation of a valid product
def test_product(self): self.assertEqual(self.test_product.name, self.test_product_name) self.assertEqual(self.test_product.price, self.test_product_price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_valid_product(self):\n product_name = \"Swift Iris\"\n size = Size.SIZE_4_5\n colour = \"Red\"\n price = 47.00\n product_type = ProductType.SHOE\n product_code = \"A\"\n department = Department.LADIES\n\n product = Product(\n name=p...
[ "0.81507206", "0.80662066", "0.7835132", "0.7700349", "0.76735646", "0.7428678", "0.7415076", "0.7415023", "0.7407408", "0.7395658", "0.7372192", "0.73639095", "0.7347199", "0.7262544", "0.7218001", "0.7205331", "0.72042835", "0.7123976", "0.7116961", "0.7077709", "0.7061031"...
0.71889794
17
Initialize a new Rectangle.
def __init__(self, width, height, x=0, y=0, id=None): self.width = width self.height = height self.x = x self.y = y super().__init__(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, height, width):\n\n\t\t# _width and _height are internal (private) Rectangle Instance's attributes. This is something\n\t\t# We keep to ourselves to make sure the User can't just update these attrs randomly and also\n\t\t# so that the code has backward compatibility.\n\t\tself._width = None\n\t\...
[ "0.7936503", "0.77226716", "0.74967", "0.7314541", "0.7269323", "0.72602755", "0.70439965", "0.70439965", "0.6842651", "0.6795683", "0.679287", "0.67238736", "0.668277", "0.6677739", "0.66191846", "0.65806", "0.6573696", "0.65351784", "0.650519", "0.6475064", "0.6461367", "...
0.6289143
32
Set/get the height of the Rectangle.
def height(self): return self.__height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHeight(self, *args):\n return _libsbml.BoundingBox_setHeight(self, *args)", "def height(self, value):\n self._el._parent.execute_script(\"arguments[0].height = arguments[1]\", self._el, value)\n self.changed = True", "def height(self, value):\n self._el._parent.execute_script...
[ "0.74932986", "0.73123884", "0.73123884", "0.7286485", "0.7256855", "0.7256855", "0.7256855", "0.7232312", "0.72075623", "0.7189129", "0.71833915", "0.7181762", "0.7172583", "0.7172583", "0.7172583", "0.7172583", "0.71160036", "0.70973444", "0.70973444", "0.7077501", "0.70562...
0.6882303
54
Set/get the y of the Rectangle.
def y(self): return self.__y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setY(self, y):\r\n\t\tself._y=y", "def setY(self, y):\n self.y = y\n pass", "def setY(self, *args):\n return _libsbml.BoundingBox_setY(self, *args)", "def SetY(self, y):\r\n\r\n self._y = y", "def set_y(self, y):\n self._y = y", "def get_y_position(self): \n ...
[ "0.7721418", "0.76965046", "0.7666879", "0.7602051", "0.75384194", "0.74419653", "0.73419136", "0.73414415", "0.7315239", "0.73070264", "0.72914", "0.7236974", "0.72315776", "0.722977", "0.7210747", "0.7181962", "0.7181962", "0.7181145", "0.7159526", "0.7153093", "0.71481055"...
0.6252964
85
Return the area of the Rectangle.
def area(self): return self.width * self.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n area = self.__width * self.__height\n return area", "def area(self):\n\n bbox = self.bbox\n area = Box.calculate_bbox_area(bbox, bbox_type=self.bbox_type)\n\n return area", "def area(self):\n area = self.__length * self.__width\n\n return area"...
[ "0.84256965", "0.8307705", "0.8277125", "0.8190083", "0.8190083", "0.8190083", "0.8152408", "0.8147033", "0.812857", "0.812857", "0.8106875", "0.80976504", "0.80922467", "0.80922467", "0.80922467", "0.80922467", "0.80922467", "0.80828065", "0.80753434", "0.80753434", "0.80753...
0.8021519
28
Return the dictionary representation of a Rectangle.
def to_dictionary(self): return { "id": self.id, "width": self.width, "height": self.height, "x": self.x, "y": self.y }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangledict(self):\n return rectangledict(self.rectangles)", "def to_dictionary(self):\n rect = {\n \"x\": self.x,\n \"y\": self.y,\n \"id\": self.id,\n \"height\": self.height,\n \"width\": self.width\n }\n return(rect)", ...
[ "0.83361703", "0.83046347", "0.8224458", "0.8041938", "0.79366803", "0.7806136", "0.77430755", "0.72091544", "0.70756733", "0.7039182", "0.6913016", "0.6902803", "0.6863135", "0.68106705", "0.6761757", "0.67571115", "0.6747295", "0.6731295", "0.66895795", "0.66878337", "0.668...
0.6794483
14
Return the latest backup file name.
def get_latest_backup(self, encrypted=None, compressed=None, content_type=None, database=None): files = self.list_backups(encrypted=encrypted, compressed=compressed, content_type=content_type, database=database) if not files: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_backup(self):\n cur_status = self.status()\n latest = cur_status.get_latest_backup()\n if latest is None:\n return None\n return join(self.remote_path, latest.key)", "def backup_filename(self):\n if hasattr(self, \"_backup_filename\"):\n ret...
[ "0.786407", "0.7452626", "0.70712197", "0.7048062", "0.70075417", "0.6934767", "0.6737338", "0.66744536", "0.6662619", "0.6613476", "0.6594731", "0.6590844", "0.6589119", "0.6586623", "0.6580214", "0.6580214", "0.6577203", "0.6537979", "0.6535888", "0.65311784", "0.6521709", ...
0.6634695
9
Return the older backup's file name.
def get_older_backup(self, encrypted=None, compressed=None, content_type=None, database=None): files = self.list_backups(encrypted=encrypted, compressed=compressed, content_type=content_type, database=database) if not files: raise F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_filename(self):\n if hasattr(self, \"_backup_filename\"):\n return self._backup_filename\n else:\n return None", "def backup_file(self):\n _backupO = Backups()\n _backupFilename = _backupO.backup_file(self.job[\"JSONfileToBeEdited\"])\n return '...
[ "0.70273614", "0.67878276", "0.65203625", "0.636996", "0.6301959", "0.6295428", "0.626401", "0.62311023", "0.62311023", "0.61013705", "0.60973877", "0.6071244", "0.6041886", "0.60322386", "0.5988039", "0.5953184", "0.5930891", "0.59109217", "0.58913505", "0.5878754", "0.58620...
0.6588088
2
Initialize parameters of the linear dimension object.
def __init__(self, low, high): self.low, self.high = low, high self.__diff = self.high - self.low if self.low >= self.high: raise ValueError( "Invalid ordering of low and high dimensions:\t{} >= {}".format( self.low, self.high ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, variables, dims):\n self._variables = variables\n self._dims = dims", "def __init__(self, dimension, n):\n self.dimension = dimension\n self.n = n\n self.basis = None", "def __init__(self, space):\n super().__init__(space=space, linear=False, grad_li...
[ "0.69876623", "0.6624698", "0.6579962", "0.65678084", "0.6517504", "0.6479824", "0.64639306", "0.6433332", "0.6433332", "0.6433332", "0.64273274", "0.64159024", "0.6396305", "0.63834316", "0.6354861", "0.63217795", "0.63131666", "0.63118315", "0.6306143", "0.6306143", "0.6306...
0.0
-1
validate password against hashed form
def check_password(self, password): return check_password_hash(self.password_hash, password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n return check_password_hash(self.password_hash, password)", "def valid_pw(password, h):\n salt = h.split(',')[0]\n return h == make_pw_hash(password, salt)", "def valid_pwd(name, password, h):\n salt = h.split(',')[0]\n return h == make_pwd_hash(name, passwo...
[ "0.76755613", "0.7614503", "0.75697756", "0.7553685", "0.74800146", "0.74779934", "0.7465359", "0.7455035", "0.7415723", "0.73403245", "0.7323965", "0.7318655", "0.73145914", "0.7307957", "0.73055565", "0.72890407", "0.7273916", "0.7250574", "0.7245444", "0.72283304", "0.7213...
0.70812887
38
Returns a string representation of self
def __str__(self): self.vals.sort() return '{' + ','.join([str(e) for e in self.vals]) + '}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString(self) -> str:\n raise NotImplementedError", "def to_string(self):\r\n return self.__str__()", "def __str__ (self) :\n\n return self.as_string()", "def __repr__(self) -> str:\n return str(self)", "def __repr__(self):\n\n return str(self)", "def __repr__(self...
[ "0.876418", "0.865624", "0.85889566", "0.85298634", "0.8518137", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.85173774", "0.8498211", "0.8469978", "0....
0.0
-1
This function returns an export csv action 'fields' and 'exclude' work like in django ModelForm 'header' is whether or not to output the column names as the first row
def export_ho_dan_as_excel_action(fields=None, exclude=None, header=True): def export_as_excel(modeladmin, request, queryset): opts = modeladmin.model._meta field_names = ["name", "status", "location", "tinh", "xa", "huyen", "phone", "cuuho", "update_time", "note"] dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_csv_action(description=\"Export as CSV\",\n fields=None,\n exclude=None,\n header=True,\n manyToManySep=';'):\n def export_as_csv(modeladmin, request, queryset):\n \"\"\" Generic csv export admin action.\n ...
[ "0.7395985", "0.7350825", "0.72143453", "0.714042", "0.7080893", "0.6891942", "0.6834614", "0.6784072", "0.6756123", "0.67249477", "0.66658115", "0.64937115", "0.64831513", "0.6476352", "0.6327553", "0.62494195", "0.624581", "0.624384", "0.61966646", "0.6124925", "0.60819596"...
0.6551483
11
Return Device object from DirecTV API response.
def update_from_dict(self, data: dict) -> "Device": if "info" in data and data["info"]: self.info = Info.from_dict(data["info"]) if "locations" in data and data["locations"]: locations = [Location.from_dict(location) for location in data["locations"]] self.locations ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device(self, dev_id):\n return self.api_request('GET', self.url + '/device/' + str(dev_id), {})", "def getDeviceInfo():\n url = \"https://api.roblox.com/reference/deviceinfo\"\n r = requests.get(url)\n j = json.loads(r.text)\n return j", "def device(self, **kwargs):\n...
[ "0.625017", "0.6110964", "0.6025792", "0.6025792", "0.6025792", "0.6025792", "0.5936898", "0.58599025", "0.5856658", "0.5775786", "0.57171625", "0.56692517", "0.5647682", "0.55723184", "0.55544865", "0.555387", "0.5540738", "0.5532975", "0.5525827", "0.55252296", "0.55184966"...
0.0
-1
Get current event status.
def event_get_status(): event = Event.query.filter_by(is_current=True).first() or \ Event.query.order_by(Event.id.desc()).first() if not event: return jsonify(status='') return jsonify(status=event.status_text or '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event_status(self):\n return self.event_status", "def get_status(cls, request, status):\n event_status = request.dbsession.query(cls)\\\n .filter_by(status=status).one()\n return event_status", "def get_status(self):\n return self._status", "def get_status(self)...
[ "0.8938857", "0.7700905", "0.7469931", "0.7449434", "0.7449434", "0.7449434", "0.7449415", "0.7351793", "0.72412336", "0.72248316", "0.72013944", "0.7188464", "0.71847034", "0.71847034", "0.717363", "0.7169672", "0.7163438", "0.71320313", "0.71320313", "0.71320313", "0.713203...
0.75907886
2
Enable uploading images and files into a project.
def project_uploader(): if not current_app.config['S3_KEY']: return '' if len(request.files) == 0: return 'No files selected' img = request.files['file'] if not img or img.filename == '': return 'No filename' ext = img.filename.split('.')[-1].lower() if ext not in ACCEPTE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_files(self, context, instance_ref, bless_files):\n raise Exception(\"Uploading files to the image service is not supported.\")", "def pub_upload(args, project=\"\", base_url=\"\", api_key=\"\"):\n project, base_url, api_key, updated = get_project_config(\n project=project, base_url=ba...
[ "0.62724644", "0.62208575", "0.6104093", "0.5806353", "0.5691502", "0.56647", "0.5651401", "0.56278884", "0.5623148", "0.5617371", "0.5587869", "0.55826974", "0.55322576", "0.55256295", "0.5463242", "0.5428302", "0.53985643", "0.53737175", "0.53721714", "0.533297", "0.5325466...
0.5554662
12
Getter method for min_tx_interval, mapped from YANG variable /brocade_mpls_rpc/show_mpls_bfd/output/min_tx_interval (uint32)
def _get_min_tx_interval(self): return self.__min_tx_interval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_min_tx_interval(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"min-tx-interval\", rest_name=\"min-tx-interval\",...
[ "0.7826117", "0.64016116", "0.63458115", "0.63417697", "0.6039835", "0.5896331", "0.58370703", "0.5651912", "0.56466264", "0.5526516", "0.5477495", "0.54640245", "0.53912234", "0.5390453", "0.53819704", "0.53491396", "0.53230727", "0.53230727", "0.5286603", "0.5286603", "0.52...
0.71102995
1
Setter method for min_tx_interval, mapped from YANG variable /brocade_mpls_rpc/show_mpls_bfd/output/min_tx_interval (uint32)
def _set_min_tx_interval(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="min-tx-interval", rest_name="min-tx-interval", parent=self, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_min_rx_interval(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"min-rx-interval\", rest_name=\"min-rx-interval\",...
[ "0.68950593", "0.6674112", "0.62658423", "0.5828375", "0.5819644", "0.5774659", "0.53799266", "0.5330847", "0.5329648", "0.5329648", "0.5329648", "0.5274797", "0.52572495", "0.5256505", "0.5255506", "0.5255506", "0.5239151", "0.5239151", "0.52170163", "0.5174188", "0.51614475...
0.84824663
0
Getter method for min_rx_interval, mapped from YANG variable /brocade_mpls_rpc/show_mpls_bfd/output/min_rx_interval (uint32)
def _get_min_rx_interval(self): return self.__min_rx_interval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_min_rx_interval(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"min-rx-interval\", rest_name=\"min-rx-interval\",...
[ "0.8070217", "0.6476246", "0.62495947", "0.6049401", "0.59595734", "0.5948437", "0.59104884", "0.5647157", "0.5605092", "0.55884486", "0.55884486", "0.55836874", "0.5461118", "0.54228646", "0.5388751", "0.5277424", "0.5213984", "0.51641953", "0.5078633", "0.5078633", "0.50632...
0.74829185
1
Setter method for min_rx_interval, mapped from YANG variable /brocade_mpls_rpc/show_mpls_bfd/output/min_rx_interval (uint32)
def _set_min_rx_interval(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="min-rx-interval", rest_name="min-rx-interval", parent=self, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_min_rx_interval(self):\n return self.__min_rx_interval", "def _set_min_tx_interval(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_...
[ "0.71418947", "0.7035566", "0.58583724", "0.5786503", "0.57334495", "0.5618006", "0.5578617", "0.5454128", "0.54388124", "0.5413293", "0.53771466", "0.52867633", "0.52867633", "0.52507234", "0.509515", "0.50449187", "0.49391502", "0.4857132", "0.4853257", "0.48439223", "0.476...
0.8679351
0
Initialize ResourceAuth with related Resource and auth dict.
def init(self, auth_dict=None): self.auth_dict = auth_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_auth(\n self,\n auth: t.Optional[AuthModel] = None,\n log_level: t.Union[str, int] = LOG_LEVEL_AUTH,\n ) -> AuthModel:\n if not isinstance(auth, AuthModel):\n if self.CREDENTIALS:\n auth: AuthCredentials = AuthCredentials(\n user...
[ "0.6662919", "0.6601439", "0.64752644", "0.64678025", "0.6462565", "0.6433994", "0.6324557", "0.6309361", "0.63011605", "0.62602836", "0.62174743", "0.6212133", "0.61939454", "0.61910677", "0.61648697", "0.6164051", "0.6145872", "0.61208147", "0.6119392", "0.6091515", "0.6062...
0.70893055
0
Plot matrix as colored subplot, with red positive and blue negative.
def plot_real_matrix(M, name='', outpath=None, fig='auto', climv=None, cmap="coolwarm", show=False, close=True, fontsize=None): if climv is None: climv = np.max(np.abs(M.ravel())) climvs = (-climv, climv) else: climvs = climv if fig == 'auto': fig = plt....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotmatrix(figurename,matrix,format='png',title=None,**kwargs):\n \n clip_min = kwargs.pop('clip_min', -np.inf)\n clip_max = kwargs.pop('clip_max', np.inf)\n cmap = kwargs.pop('cmap',cm.Reds)\n fig = plt.figure()\n if 'ticklabels1' in kwargs:\n plt.yticks(range(matrix.shape[0]))\n...
[ "0.6094342", "0.6091157", "0.59460735", "0.58599055", "0.5792967", "0.57603824", "0.57481116", "0.5735205", "0.5715173", "0.57018065", "0.5695536", "0.56947273", "0.56642234", "0.5659708", "0.5656565", "0.5655492", "0.5633763", "0.5613708", "0.5598886", "0.557277", "0.5542246...
0.5520894
23
Get a list of n marker style keys for matplotlib marker='' arguments, in a nicely defined order (so bizarre markers appear only for large n). If n < 28 (which is the number of 'nice' buildin markers, meaning ones I deem reasonably suitable for a plot, then all are distinct. Otherwise, some repeat.
def get_markerstyles(n=None): all_markers = ['o', 'D', 's', '2', '*', 'h', '8', 'v', 'x', '+', 5, 'd', '>', 7, '.', '1', 'p', '3', 6, 0, 1, 2, 3, 4, '4', '<', 'H', '^'] # Note: 0: 'tickleft', 1: 'tickright', 2: 'tickup', 3: 'tickdown', 4: 'caretleft', 'D': 'diamond', 6: 'caretup', # 7: '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_markers(num_markers):\n markers = ['^','o','P','X','*', 'd','<', '>', ',','|', '1','2','3','4','s','p','*','h','+']\n if(num_markers>18):\n sys.exit(\"cannot create more than 18 markers, refactor your code; force exiting\")\n\n return markers[0:num_markers]", "def getColors_Markers(keys: ...
[ "0.73227453", "0.6869567", "0.61585176", "0.5591972", "0.5485686", "0.54761827", "0.54427314", "0.5424429", "0.539441", "0.539441", "0.537975", "0.53620696", "0.5236537", "0.5202241", "0.5148099", "0.51101273", "0.5108227", "0.5077027", "0.50729996", "0.50719774", "0.505123",...
0.7940672
0
Creates a plot with one axis in the center of the canvas and a horizontal colorbar above it.
def initialize_1panel_cbar_fig(Wfig=90, Hfig=None, x0frac=0.15, y0frac=0.1, wsfrac=0.4, hsfrac=None, wcbarfrac=0.05, hcbarfrac=0.7, vspace=8, hspace=5, tspace=10, fontsize=8): # Make figure x0 = Wfig * x0frac y0 = Wfig * y0frac ws = Wfig * ws...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotColorbar(self):\n self.removeColorbar()\n\n # X Y W H\n self._colorbarax = self.figure.add_axes([0.02,-0.06,0.97,0.05])\n\n mx = self.images[0].get_clim()[1]\n mn = self.images[0].get_clim()[0]\n dm = (mx-mn)\n ...
[ "0.7056555", "0.62840164", "0.62683386", "0.6228227", "0.61582124", "0.61053264", "0.6100364", "0.6069845", "0.60556936", "0.605375", "0.60509396", "0.60222924", "0.6002827", "0.593155", "0.5830696", "0.57771343", "0.57617164", "0.574958", "0.5732593", "0.571067", "0.570361",...
0.5506739
43
Creates a plot with one axis in the center of the canvas and a horizontal colorbar above it.
def initialize_1panel_centered_cbar_fig(Wfig=90, Hfig=None, y0frac=0.1, wsfrac=0.4, hsfrac=None, wcbarfrac=0.05, hcbarfrac=0.7, vspace=8, hspace=5, tspace=10, fontsize=8): # Make figure y0 = Wfig * y0frac ws = Wfig * wsfrac ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotColorbar(self):\n self.removeColorbar()\n\n # X Y W H\n self._colorbarax = self.figure.add_axes([0.02,-0.06,0.97,0.05])\n\n mx = self.images[0].get_clim()[1]\n mn = self.images[0].get_clim()[0]\n dm = (mx-mn)\n ...
[ "0.70557404", "0.6285542", "0.6270355", "0.6227165", "0.61601096", "0.6106595", "0.60995483", "0.6070157", "0.6056419", "0.6055571", "0.60484546", "0.6024295", "0.6002073", "0.59298563", "0.58327335", "0.5776537", "0.5762749", "0.5750481", "0.57331026", "0.57112336", "0.57011...
0.56577885
26
Creates a plot with one axis instance in the center of the canvas, with colorbar above the axis.
def initialize_1panel_cbar_cent(Wfig=90, Hfig=None, wsfrac=0.4, hsfrac=None, cbar_pos='above', wcbarfrac=0.6, hcbarfrac=0.05, cbar_label='', vspace=8, hspace=5, tspace=10, fontsize=8, evenpix=True, dpi=150): # Make figure if Hfig is None: H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotColorbar(self):\n self.removeColorbar()\n\n # X Y W H\n self._colorbarax = self.figure.add_axes([0.02,-0.06,0.97,0.05])\n\n mx = self.images[0].get_clim()[1]\n mn = self.images[0].get_clim()[0]\n dm = (mx-mn)\n ...
[ "0.65393037", "0.6325879", "0.6319833", "0.62098336", "0.6200329", "0.6188909", "0.6183949", "0.5988685", "0.59753543", "0.59351426", "0.5919195", "0.5916663", "0.58826715", "0.585781", "0.5799899", "0.5799899", "0.5799899", "0.5784247", "0.57731736", "0.57651746", "0.5759896...
0.5186756
99
Test if incorrect limit is handled
def test_init_err_limit(self): with self.assertRaises(InitializationException): pyint = Interpreter(limit=INVALID_LIMIT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_limit(limit_value):\n try:\n limit = int(limit_value)\n except ValueError:\n raise SystemExit('The argument \"limit\" should be a positive number')\n else:\n if limit < 1:\n raise SystemExit('The argument \"limit\" should be greater than 0')\n else:\n ...
[ "0.77472335", "0.74289215", "0.74269485", "0.74133515", "0.7005978", "0.6979232", "0.69783914", "0.6819109", "0.68095493", "0.6763382", "0.6756107", "0.6754542", "0.67336994", "0.6732243", "0.6720987", "0.66949856", "0.66882277", "0.6675767", "0.6641692", "0.6635802", "0.6604...
0.0
-1
Convert row to column keyvalue pari. row is of the form (rowno., [(colno., element)]) Return value is of the form [(colno., (rowno., element))]
def row_to_colKey(row): return [(i[0], (row[0], i[1])) for i in row[1]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toRowKey(line):\n elems = line.split()\n row = int(elems[0])\n col = int(elems[1])\n elem = float(elems[2])\n return (row, (col, elem))", "def _convert_row(self, row) :\n\n self.row_id += 1\n data = [self.row_id]\n\n if type(row) == type({}) :\n data.extend(row....
[ "0.6835737", "0.65197295", "0.6481791", "0.6131379", "0.5878179", "0.5796283", "0.5796283", "0.5700547", "0.5697301", "0.5668192", "0.56678593", "0.5660129", "0.5615908", "0.5610804", "0.56065536", "0.5601331", "0.55840164", "0.55537975", "0.54551494", "0.54465437", "0.543703...
0.79248494
0
Find the dot product of the given two vectors. vi is of the form [(rowno., elem)].
def dot_prod(v1, v2): dp = 0 j = 0 for i in range(len(v1)): while j<len(v2) and v1[i][0]>v2[j][0]: j = j + 1 p = 0 if j>=len(v2) or v2[j][0]>v1[i][0] else v2[j][1]*v1[i][1] dp = dp + p return dp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot_vectors(u, v):\n return u[0] * v[0] + u[1] * v[1] + u[2] * v[2]", "def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)", "def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))", "def dot( v1, v2 ):\n return sum( x*y for x,y in izip(v1,v2) )", "def vector_dot(v1,v2):\n retur...
[ "0.7828132", "0.7515441", "0.75103533", "0.7422929", "0.7380294", "0.7369622", "0.7334228", "0.7308152", "0.7257924", "0.7248561", "0.72344184", "0.72239316", "0.72134674", "0.72083634", "0.72057617", "0.7139432", "0.71272117", "0.7124091", "0.7118707", "0.71171933", "0.71085...
0.68945885
42
Convert similarity pair of the form ((colno.1, colno.2), sim) into the new form [(colno.1, (sim, colno.2)), (colno.2, (sim, colno.1))].
def extract_sim(sim_pair): cn1 = sim_pair[0][0] cn2 = sim_pair[0][1] sim = sim_pair[1] return [(cn1, (sim, cn2)), (cn2, (sim, cn1))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_similarities(self) -> List[float]:\n sims = list()\n for i, r in self.sim_data.iterrows():\n if isinstance(self.model, FastTextWrapper):\n vecs = self.model.inference([r[\"Word 1\"], r[\"Word 2\"]])\n else:\n vecs = self.model.inferenc...
[ "0.6235951", "0.6159378", "0.5901663", "0.58472914", "0.5829327", "0.5707323", "0.5703407", "0.56260306", "0.55599004", "0.5538584", "0.55086714", "0.54975855", "0.54756165", "0.5458917", "0.5429115", "0.535494", "0.53113675", "0.53062195", "0.5299905", "0.5276664", "0.525498...
0.74895144
0
Turn Exported protos with embedded metadata into a nested dict.
def _GetNestedDict(self, value): row = {} for type_info in value.__class__.type_infos: if isinstance(type_info, rdf_structs.ProtoBinary): # JSON files have to be UTF-8 encoded and dumping arbitrary binary # strings is not possible. We offer optional export of such fields # through ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _CustomToAPIRepr(self: entries.ProtobufEntry) -> Dict[str, Any]:\n info = super(entries.ProtobufEntry, self).to_api_repr() # type: ignore\n info['protoPayload'] = self.payload # type: ignore\n return info # type: ignore", "def to_dict(self):\n result = {}\n\n for attr, _ in six.iteritems(...
[ "0.58404046", "0.5724735", "0.5675133", "0.566323", "0.5642891", "0.56219316", "0.56019783", "0.55668813", "0.5564634", "0.5462427", "0.5427521", "0.5426814", "0.54206395", "0.5399793", "0.5379353", "0.5379119", "0.5377301", "0.5343886", "0.5343715", "0.5321437", "0.5319681",...
0.6311489
0
Creates a new gzipped output tempfile for the output type. We write to JSON data to gzip_filehandle to get compressed data. We hold a reference to the original filehandle (gzip_filehandle_parent) so we can pass the gzip data to bigquery.
def _CreateOutputFileHandles(self, output_type): gzip_filehandle_parent = tempfile.NamedTemporaryFile(suffix=output_type) gzip_filehandle = gzip.GzipFile(gzip_filehandle_parent.name, "wb", self.GZIP_COMPRESSION_LEVEL, gzip_filehandle_parent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n output_type=None,\n gzip_filehandle=None,\n gzip_filehandle_parent=None,\n schema=None):\n self.output_type = output_type\n self.gzip_filehandle = gzip_filehandle\n self.schema = schema\n self.gzip_filehandle_parent = gzip_fil...
[ "0.6375038", "0.62494874", "0.5977528", "0.5934772", "0.58849186", "0.58763736", "0.57942986", "0.5733927", "0.56851006", "0.56404847", "0.5637789", "0.5622034", "0.5584106", "0.5564874", "0.5558789", "0.5531875", "0.5512704", "0.5480884", "0.5467962", "0.54047835", "0.538324...
0.7193595
0
Returns the voicechannel the player is connected to
def connected_channel(self): if not self.channel_id: return None return self._bot.get_channel(int(self.channel_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voice_channel(member: discord.Member) -> discord.VoiceChannel | None:\n if member.voice is None or member.voice.channel is None:\n return None\n if isinstance(member.voice.channel, discord.VoiceChannel):\n return member.voice.channel\n return None", "def getChannel(self):\r\n re...
[ "0.7090495", "0.69131994", "0.6697117", "0.6697117", "0.6689458", "0.66403013", "0.6624574", "0.66189635", "0.6484971", "0.6432825", "0.6421691", "0.63586956", "0.6355906", "0.6193075", "0.6193075", "0.6150019", "0.61282647", "0.6125392", "0.61015314", "0.609592", "0.599074",...
0.74945366
0
Sky model (`~gammapy.modeling.models.SkyModel`). ``which="point"`` Sky model for point source analysis ``which="extended"`` Sky model for extended source analysis. Only available for some sources. Raise ValueError if not available. According to the paper, the radius of the extended source model is only a rough estimate...
def sky_model(self, which="point"): return SkyModel( spatial_model=self.spatial_model(which), spectral_model=self.spectral_model(which), name=self.name, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spatial_model(self, which=\"point\"):\n idx = self._get_idx(which)\n pars = {\"lon_0\": self.data.glon, \"lat_0\": self.data.glat, \"frame\": \"galactic\"}\n\n if idx == 0:\n tag = \"PointSpatialModel\"\n else:\n tag = \"DiskSpatialModel\"\n pars[\"r...
[ "0.5437156", "0.53255624", "0.5130373", "0.49601924", "0.48354834", "0.47549045", "0.47509688", "0.4671858", "0.4629073", "0.4562977", "0.45555773", "0.4528305", "0.45221406", "0.44898465", "0.44845927", "0.4396012", "0.4385668", "0.4347196", "0.4345946", "0.42967695", "0.428...
0.65332294
0
Returns whether or not the given square is empty on this board.
def is_empty(self, square: Square): return self.state[0][square.row][square.col] == 0 and self.state[1][square.row][square.col] == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_square_empty(self, clicked_square: Square) -> bool:\n return clicked_square not in self.obstacles", "def is_empty(self, row, col):\n return self._cells[row][col] != FULL", "def is_empty(self, row, column):\n\n return self.board[row][column] == placeholder", "def checkEmpty(grid):\...
[ "0.83159214", "0.75522256", "0.75399756", "0.75134146", "0.74355346", "0.7248117", "0.71973926", "0.71971345", "0.7184747", "0.7155277", "0.7146363", "0.7094498", "0.7092787", "0.70765316", "0.70487857", "0.70436597", "0.7018462", "0.69958687", "0.6980756", "0.6950018", "0.69...
0.8834229
0
Returns a playable square in this column if it exists.
def playable_square(self, col) -> Square: for row in reversed(range(len(self.state[0]))): square = Square(row, col) if self.is_empty(square): return square
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_square(self, row, col):\n\n return self.board[row][col]", "def square(self, row, col):\n return self.board[row][col]", "def square(self, row, col):\n return self._board[row][col]", "def playable_squares(self) -> Set[Square]:\n squares = set()\n for col in range(len(...
[ "0.67292863", "0.6607546", "0.652702", "0.6482836", "0.61690897", "0.6067124", "0.60404146", "0.60404146", "0.5942759", "0.59255123", "0.59190416", "0.59083104", "0.5778388", "0.5681745", "0.5620457", "0.55785054", "0.55779374", "0.55662", "0.5553752", "0.5500864", "0.5491363...
0.8182852
0
Returns a set of potential groups that this player has in this board state.
def potential_groups(self, player) -> Set[Group]: directions = [ (-1, 1), # up-right diagonal (0, 1), # horizontal (1, 1), # down-right diagonal (1, 0), # vertical ] groups = set() for row in range(len(self.state[0])): for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def potential_groups_by_square(self) -> Dict[Square, Set[Group]]:\n square_to_groups = {}\n for row in range(len(self.state[0])):\n for col in range(len(self.state[0][0])):\n square_to_groups[Square(row=row, col=col)] = set()\n\n groups = self.potential_groups(self.pl...
[ "0.72241515", "0.70298755", "0.70214945", "0.69351935", "0.686894", "0.686894", "0.686894", "0.6722046", "0.6699945", "0.6647342", "0.6584282", "0.65582335", "0.64610934", "0.6449998", "0.63954824", "0.63922346", "0.6375828", "0.6363518", "0.63477296", "0.6337132", "0.6304375...
0.84782624
0
Returns whether or not the given group is a group that belongs to the player.
def is_potential_group(self, player: int, row: int, col: int, row_diff: int, col_diff: int): opponent = 1 - player for _ in range(4): square = Square(row, col) if not self.is_valid(square): return False if self.state[opponent][row][col]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_group(self, group_name):\n\n return group_name in self._group", "def is_in_group(self, group):\n return group in self.get_all_groups()", "def has_group(group, user, request):\n return group_names[group] in groupfinder(user.username, request)", "def is_in_group(user, group_name):\n...
[ "0.79787964", "0.7738491", "0.73714805", "0.72446895", "0.71948093", "0.71695703", "0.7143945", "0.7140648", "0.7139959", "0.7133091", "0.7118469", "0.70977026", "0.7089419", "0.7084722", "0.707707", "0.7070512", "0.7065558", "0.7054569", "0.69646424", "0.6936707", "0.6904927...
0.65866184
31
Returns a set of empty squares in this board state.
def empty_squares(self) -> Set[Square]: squares = set() for row in range(len(self.state[0])): for col in range(len(self.state[0][0])): if self.state[0][row][col] == 0 and self.state[1][row][col] == 0: squares.add(Square(row=row, col=col)) return sq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_empty_squares(self):\n empty = []\n for row in range(self._dim):\n for col in range(self._dim):\n if self._board[row][col] == EMPTY:\n empty.append((row, col))\n return empty", "def get_empty_squares(self):\n return self.empty_squar...
[ "0.85066783", "0.8149204", "0.79428655", "0.77471286", "0.7505049", "0.7371407", "0.73128897", "0.72769076", "0.72023207", "0.71892613", "0.7158011", "0.7101757", "0.70922935", "0.70294994", "0.7003079", "0.6952136", "0.6808277", "0.67831254", "0.6729714", "0.67219484", "0.67...
0.88503826
0
Accessor method for labels. If a LinearRegression object is initialized without specifying labels, labels will be None. linear_regression() cannot be called until labels is a numpy array of dependent variables; call set_labels(new_labels) to fix this.
def get_labels(self): return self.labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels(self):\r\n raise NotImplementedError()", "def get_labels(self):\r\n raise NotImplementedError()", "def get_labels(self):\r\n raise NotImplementedError()", "def get_labels(self):\r\n raise NotImplementedError()", "def get_labels(self):\r\n raise NotImplementedEr...
[ "0.6255963", "0.621236", "0.621236", "0.621236", "0.621236", "0.621236", "0.621236", "0.621236", "0.621236", "0.6186873", "0.6186873", "0.6186873", "0.61738163", "0.616763", "0.6161263", "0.6161263", "0.6161263", "0.6161263", "0.6161263", "0.6161263", "0.6161263", "0.616126...
0.58015484
47
Accessor method for coefficients that satisfy regression model. Will return None if linear_regression() hasn't been called, yet.
def get_coefficients(self): return self.coefficients
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_coef(self):\n try:\n model_coef = self.cmodel.coef_\n except:\n model_coef = 'Model does not have a .coef_ attribute.'\n\n return model_coef", "def coefficients(self):\r\n return self.coef_['x']", "def lm(self):\n return self._lm", "def get_...
[ "0.70574886", "0.6743434", "0.6734183", "0.6700487", "0.64962935", "0.6456678", "0.64183086", "0.6362699", "0.63533825", "0.6326549", "0.62956065", "0.62459344", "0.6225122", "0.61861765", "0.61861765", "0.61010855", "0.6079058", "0.60414094", "0.6007075", "0.5972159", "0.596...
0.67228955
4
Accessor method for mean squared error of linear regression model. Will return None if linear_regression() hasn't been called, yet.
def get_mean_squared_error(self): return self.mean_squared_error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_mean_squared_error(self, X, y):\n mserror = 0\n results = self.predict(X)\n \n mserror = mean_squared_error(results,y)\n #print(error)\n return mserror", "def mean_squared_error(self):\n print('Mean squared error regression loss: ' + str(mean_squared...
[ "0.7243938", "0.7199598", "0.6919505", "0.69061196", "0.6588003", "0.6580239", "0.64656407", "0.6361674", "0.6361674", "0.63538164", "0.63502324", "0.629396", "0.6284038", "0.6257607", "0.6210609", "0.62098366", "0.6196583", "0.6190823", "0.6188981", "0.61768544", "0.6154069"...
0.76021814
0
Accessor method for coefficient of determination of linear regression model. Will return None if linear_regression() hasn't been called, yet.
def get_r2_score(self): return self.r2_score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_coef(self):\n try:\n model_coef = self.cmodel.coef_\n except:\n model_coef = 'Model does not have a .coef_ attribute.'\n\n return model_coef", "def lm(self):\n return self._lm", "def coefficient(self) -> float:\n ...", "def getCoefficientSaf...
[ "0.70084864", "0.6634967", "0.6404118", "0.6400864", "0.6395131", "0.62828237", "0.6204406", "0.6111435", "0.60420996", "0.60075337", "0.5977254", "0.5976802", "0.5970829", "0.59351796", "0.59228295", "0.57830125", "0.57782567", "0.5770309", "0.57163376", "0.57075703", "0.570...
0.0
-1
I initialize an empty max heap.
def __init__(self, list = []): # initialize empty heap self.heap = [] # initialize heap with provided list for element in list: self.add(element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.min_heap = []\n self.max_heap = []\n self.size_max, self.size_min = 0, 0", "def __init__(self):\n self.__max_heap = []\n self.__min_heap = []", "def __init__(self):\n self.minheap = []\n self.maxheap = []\n self.len_min = self.l...
[ "0.80486155", "0.80210745", "0.79272044", "0.7906853", "0.78962034", "0.78873086", "0.78836834", "0.78645575", "0.78212047", "0.7765958", "0.7720623", "0.77044976", "0.7698853", "0.7679848", "0.75585717", "0.7470946", "0.7463515", "0.7463515", "0.7463515", "0.74573624", "0.74...
0.67820907
36
Create a logger. Create a logger that logs to logdir.
def create_logger(log_dir=None): if log_dir and not os.path.exists(log_dir): os.makedirs(log_dir) log_format = '%(asctime)s %(process)d [%(levelname)s] %(message)s' logging.basicConfig(level=logging.INFO, format=log_format) logger = logging.getLogger('es_on_gke') if log_dir: log_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_logger(self, log_dir: str) -> logging.Logger:\n self.log_dir = log_dir\n self.log_file = os.path.join(log_dir, self.name)\n os.makedirs(self.log_dir, exist_ok=True)\n logger = logging.getLogger(self.log_file)\n logger.setLevel(logging.DEBUG)\n handler = logging...
[ "0.84056383", "0.79539937", "0.7774447", "0.76155627", "0.7537461", "0.751334", "0.74908894", "0.73809665", "0.7350756", "0.73394173", "0.7337063", "0.73340034", "0.7302599", "0.7301015", "0.7290823", "0.7244807", "0.72348523", "0.7216337", "0.7195481", "0.71834", "0.7159917"...
0.8193643
1
Return True if any state in `self.send_on` meets given conditions, thus meaning that a notification mail should be sent.
def _should_send(self, rebuild, success, canceled): should_send = False should_send_mapping = { self.MANUAL_SUCCESS: not rebuild and success, self.MANUAL_FAIL: not rebuild and not success, self.AUTO_SUCCESS: rebuild and success, self.AUTO_FAIL: rebuild an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_notify(self, last_notification):\n return (\n features.is_enabled(features.EMAIL_NOTIFICATIONS)\n and self.notification_settings.via_email\n and api.can_email_user(self.user)\n and super().can_notify(last_notification)\n )", "def check_notify(self...
[ "0.6447797", "0.6441992", "0.6321049", "0.621794", "0.6195668", "0.6027472", "0.5962291", "0.5894459", "0.5891517", "0.58449286", "0.5717369", "0.5687895", "0.56698895", "0.5572511", "0.55353504", "0.5522655", "0.5472778", "0.5470718", "0.5468091", "0.54011536", "0.53561306",...
0.63351804
2
returns True if number is even and False if number is odd
def is_even(number): if ((number%2) == 0): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd(number):\r\n return number % 2 != 0", "def is_odd(number):\n return (number%2)==1", "def is_odd(number: int) -> bool:\n return number % 2 != 0", "def is_even(number):\n return (number%2)==0", "def is_even(num):\n return num % 2 == 0", "def is_even(number):\n return number % 2...
[ "0.8995961", "0.8946567", "0.89006495", "0.88564795", "0.8796605", "0.8778937", "0.8769179", "0.87660277", "0.87248147", "0.86749524", "0.8654018", "0.860883", "0.8519212", "0.851492", "0.850742", "0.8469702", "0.8453671", "0.8411212", "0.8403298", "0.8363185", "0.83395505", ...
0.8846381
4
Returns true if hour corresponds to 11am or 12 pm
def is_lunchtime(hour, is_am): if (hour > 1) and (hour <= 12): if (hour == 11) and (is_am == True): return True elif (hour == 12) and (is_am == False): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_night_hours(time):\n if time == datetime.time(22, 0, 0, 0):\n return True\n return time.hour in [22, 23, 0, 1, 2, 3, 4, 5]", "def is_market_hours():\n now = datetime.datetime.now()\n day = now.weekday()\n time = now.hour * 100 + now.minute\n\n if day > 4:\n return False\n\n...
[ "0.7166708", "0.714125", "0.69929546", "0.69457644", "0.68657666", "0.68433183", "0.6726819", "0.6708987", "0.6696602", "0.6674655", "0.6631636", "0.657646", "0.65666765", "0.6563609", "0.6549672", "0.6549672", "0.6513545", "0.65090644", "0.64952636", "0.6433562", "0.6310567"...
0.8060852
0
This function returns a string in the form of name and age
def name_and_age(name, age): if age > 0: name_age = name + " is " + str(age) + " years old." else: name_age = "Error: Invalid age" return name_age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age(self):\n\n years, months, days = calculate_age(self.birthdate)\n if years:\n return \"%d year%s old\" % (years, \"s\" if years > 1 else \"\")\n elif months:\n return \"%d month%s old\" % (months, \"s\" if months > 1 else \"\")\n else:\n return \"...
[ "0.68554896", "0.67722595", "0.6758327", "0.66160583", "0.6427846", "0.6359766", "0.61687154", "0.61437225", "0.6125801", "0.6084292", "0.60463184", "0.6009532", "0.6009146", "0.5999762", "0.593721", "0.592768", "0.5922974", "0.591782", "0.58732927", "0.5871039", "0.5821816",...
0.75895894
0
Symmetrically normalize adjacency matrix.
def normalize_adj(adj): # 图归一化操作 adj = sp.coo_matrix(adj) # A_hat rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = sp.diags(d_inv_sqrt) # D_hat return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)", "def normalize_adj(adj):\n adj = sp.coo_mat...
[ "0.788518", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7691616", "0.759434", "0.7335597", "0.730491", "0.72684425", "0.688461", "0.68616927", "0.686005", "0.6832041", "0.682895", "0.6750887", "0.67...
0.7566608
12
Return an Ellipse patch instance from matplotlib.patches for this ellipse
def patch(self, **kwargs): return patches.Ellipse(self.center, 2.0 * self.a, 2.0 * self.b, angle=numpy.rad2deg(self.tilt), **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _proc_ellipse(self, tokens, filled):\n\n component = Ellipse(pen=self.pen,\n x_origin=tokens[\"x0\"],\n y_origin=tokens[\"y0\"],\n e_width=tokens[\"w\"],\n e_height=tokens[\"h\"],\n ...
[ "0.65945953", "0.61935246", "0.6154161", "0.6123702", "0.60098684", "0.5940953", "0.5924767", "0.59018517", "0.59006786", "0.58717334", "0.58072096", "0.58057433", "0.57742643", "0.57475346", "0.57409024", "0.5738625", "0.5737567", "0.57166505", "0.57026666", "0.56491125", "0...
0.69569016
0
Plot the ellipse The ellipse can be added to an existing plot via the optional 'axes' argument.
def plot(self, axes=None, majaxis=False, minaxis=False, smajaxis=False, sminaxis=False, linestyle=None, linewidth=None, color=None, fill=False, axis_kw=None, **kwargs): if axes is None: axes = pyplot.gca(aspect='equal') if axis_kw is None: axis_kw = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self, radius=None, **kwargs):\n self.plot_ellipse(radius, **kwargs)", "def plot_ellipse(center, covariance, alpha, color):\n # eigenvalues and eigenvector of matrix covariance\n eigenvalues, eigenvector = np.linalg.eigh(covariance)\n order = eigenvalues.argsort()[::-1]\n eigenvector =...
[ "0.73965615", "0.72667027", "0.70991796", "0.70283055", "0.7012237", "0.700228", "0.6987237", "0.6853574", "0.6805294", "0.67727125", "0.657724", "0.65465426", "0.6507691", "0.6499377", "0.64244473", "0.6396785", "0.638772", "0.638001", "0.6377777", "0.63685375", "0.63627416"...
0.0
-1
convert boxes 4_points means 12 format, where each point is (x, y) | | 43 min_max means [x_min, y_min, x_max, y_max] format 4_random means the same as 4_points but in other order xywh means [x, y, w, h] format, where (x, y) is a left up point
def convert_boxes(boxes, input_format='4_points', output_format='min_max'): if input_format == output_format: return boxes new_boxes = [] if input_format == '4_points' and output_format == 'min_max': for box in boxes: x = [point[0] for point in box] y = [point[1] for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateBoxPoints(frame_resolution, min_dim_rect = 80, max_dim_rect = 160, limit_x = (-1, -1), limit_y = (-1, -1)):\n \n randint = np.random.randint\n \n #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n # Generate point 1 (pt1)\n \n if(limit_x != (-1, -1)): x1 = randint(limi...
[ "0.63503706", "0.61511046", "0.6136292", "0.6111273", "0.60673106", "0.6062537", "0.60597676", "0.60500383", "0.6032146", "0.6022003", "0.6019684", "0.59690785", "0.5959766", "0.5900034", "0.58712333", "0.5850441", "0.58166414", "0.58001655", "0.57612735", "0.575495", "0.5739...
0.77332747
0
Calculate the average precision and hit_precision from two sides, i.e., sourcetotarget and targettosource.
def bi_hit_x(sims: Tensor, k: int, test: tuple) -> tuple: row, col = [list(i) for i in zip(*test)] target = sims[row, col].reshape((-1, 1)) left = sims[row] right = sims.t()[col] # match users from source to target c_l, h_l = score(left, target, k) # match users from target to source c_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_precision(targets, preds):\n intersection_foreground = targets * preds\n n_intersection_foreground = float(np.sum(intersection_foreground))\n n_preds = float(np.sum(preds))\n\n return n_intersection_foreground / (n_preds + 1e-7)", "def calculate_accuracy(targets, preds):...
[ "0.6420047", "0.61335766", "0.59710246", "0.59405875", "0.59042376", "0.58542496", "0.5830855", "0.58284765", "0.5791798", "0.5775098", "0.576796", "0.57113105", "0.57026315", "0.5697481", "0.5697409", "0.5692577", "0.56899244", "0.56663805", "0.56563103", "0.5648153", "0.561...
0.0
-1
Get the privilege level for this authenticated user.
def _get_priv_level(auth_user): if auth_user in user_priv: return user_priv.get(auth_user) return 'identity' #return self.schd.config.cfg['cylc']['authentication']['public']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permission_level(self):\n username = self.get_current_user()\n user = User.get_user(username)\n \n if user is not None:\n return user.permission_level\n return PERMISSION_LEVEL_NONE", "def priv_level(self):\n return self._priv_level", "def getAdminLevel(...
[ "0.7578827", "0.7207058", "0.67627454", "0.6615166", "0.65755373", "0.630776", "0.60861", "0.60861", "0.6066519", "0.6066519", "0.6066519", "0.6066519", "0.6050581", "0.6050581", "0.60288143", "0.5931998", "0.5884237", "0.58446556", "0.58446556", "0.5776573", "0.5772909", "...
0.71653306
2
Check whether i is tensor or initialization function or tf.Variable; return tf.Variable;
def tofov(i, shape=None, var_params=None): if isinstance(i, tf.Variable): # i is already a tf.Variable -> nothing to do return i else: # i is either a tensor or initializer -> turn it into a tensor with tof() i = tof(i, shape) # and then turn it into a tf.Variable ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tvar(x):\n return type(x) is T.TensorVariable", "def init_once(x, name):\n return tf.get_variable(name, initializer=x, trainable=False)", "def tf(self):\n if tf.is_tensor(self._tf) or isinstance(self._tf, tf.Variable):\n return self._tf # pytype: disable=bad-return-type\n else:\n re...
[ "0.65832657", "0.6299467", "0.6173125", "0.60080224", "0.59727955", "0.5918476", "0.5866038", "0.5831869", "0.5738762", "0.5737299", "0.57166415", "0.57166415", "0.57148653", "0.5707321", "0.57068855", "0.5702841", "0.5674575", "0.5666734", "0.56615335", "0.5653773", "0.56092...
0.607636
3
Broadcastable version of tensorflow dot product between tensor_nd ad tensor_2d
def dot_product(tensor_nd, tensor_2d): # Get shape and replace unknown shapes (None) with -1 shape_nd = tensor_nd.get_shape().as_list() shape_nd = [s if isinstance(s, int) else -1 for s in shape_nd] shape_2d = tensor_2d.get_shape().as_list() if len(shape_2d) > 2: raise ValueError("tensor_2d ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(x, y):\n if ndim(x) is not None and (ndim(x) > 2 or ndim(y) > 2):\n x_shape = []\n for i, s in zip(x.get_shape().as_list(), tf.unstack(tf.shape(x))):\n if i is not None:\n x_shape.append(i)\n else:\n x_shape.append(s)\n x_shape = t...
[ "0.7190017", "0.7131776", "0.7080111", "0.7056554", "0.7006535", "0.7004237", "0.6998453", "0.69318366", "0.6918302", "0.6918302", "0.6918302", "0.6918302", "0.6910907", "0.68892366", "0.6883586", "0.68029726", "0.6802441", "0.67905957", "0.6776764", "0.6717106", "0.67169183"...
0.7543577
0
Deconvolution/upscaling/transposed convolution based on tf.nn.conv2d_transpose but with broadcasting
def conv2d_transpose2d(x, W, output_shape, strides=(1, 1, 1, 1), padding='SAME', data_format='NHWC'): x_shape = x.get_shape().as_list() x_shape = [s if isinstance(s, int) else -1 for s in x_shape] # Flatten matrix in first dimensions if necessary (join samples and sequence positions) if len(x_shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconv2d_bn_act(inputs, filters, kernel_size, kernel_init, activation, strides, padding=\"SAME\"):\n _tmp = tf.layers.conv2d_transpose(inputs=inputs, filters=filters, kernel_size=kernel_size,\n kernel_initializer=kernel_init, activation=None, strides=strides, padding=padding)\n ...
[ "0.7548085", "0.7354713", "0.70609957", "0.70491564", "0.7005541", "0.696151", "0.6955952", "0.6907809", "0.69037104", "0.68991786", "0.6885345", "0.68437415", "0.6816721", "0.67774105", "0.67774105", "0.67581123", "0.67204267", "0.669832", "0.66709447", "0.66709447", "0.6670...
0.6553735
36
Get input from Layer class or tensor Check if input is available via get_output() function or turn tensor into lambda expressions instead; Also try to fetch shape of incoming via get_output_shape(); Returns
def get_input(incoming): try: return incoming.get_output, incoming.get_output_shape() except AttributeError: return lambda **kwargs: incoming, [d if isinstance(d, int) else -1 for d in incoming.get_shape().as_list()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_tensor(self):\n if self._direct_feed_dict:\n raise TypeError('This loom has direct_feed_dict set, '\n 'so it has no input tensor')\n return self._loom_input_tensor", "def __call__(self, x_input):\n reuse = True if self.built else None\n net = load_kaffe_model(self....
[ "0.61650896", "0.6150305", "0.6135538", "0.6122236", "0.6043649", "0.60164464", "0.60135984", "0.60135984", "0.60135984", "0.60135984", "0.60135984", "0.60135984", "0.60135984", "0.60069585", "0.60033274", "0.59808654", "0.59787905", "0.59767944", "0.59752643", "0.5965256", "...
0.63140637
0
Dropout layer using tensorflow dropout
def __init__(self, incoming, prob, noise_shape=None, selu_dropout: bool = False, training: bool = True, name='DropoutLayer'): super(DropoutLayer, self).__init__() with tf.variable_scope(name) as self.layer_scope: self.incoming, self.incoming_shape = get_input(incoming) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dropout_layer(self):\n return tf.keras.layers.Dropout(rate=self.dropout)", "def dropout_keras_model():\n\n inputs = tf.keras.Input(shape=(10, 10, 3,))\n x = tf.keras.layers.Conv2D(16, (3, 3))(inputs)\n x = tf.keras.layers.Dropout(rate=.4)(x)\n x = tf.identity(x)\n x = tf.keras.la...
[ "0.7875832", "0.768289", "0.7658809", "0.7641778", "0.7603015", "0.75842077", "0.7556132", "0.7538353", "0.7516811", "0.74463445", "0.74421066", "0.737448", "0.7326112", "0.7267434", "0.7149956", "0.7005378", "0.6939711", "0.6896348", "0.6875648", "0.68629616", "0.6823762", ...
0.66280717
34
Batchnorm layer using tensorflow batch_nomralization
def __init__(self, incoming, training: bool = True, data_format="NHWC", name='BatchnormLayer'): super(BatchnormLayer, self).__init__() with tf.variable_scope(name) as self.layer_scope: self.incoming, self.incoming_shape = get_input(incoming) if len(self.incoming_shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_norm(x: tf.Tensor) -> tf.Tensor:\n return slim.batch_norm(x, activation_fn=tf.nn.relu, scope='postnorm')", "def batch_normal(x, is_train, name, activation_fn=None):\n with tf.name_scope(name), tf.variable_scope(name):\n outputs = tf.contrib.layers.batch_norm(x,\n ...
[ "0.7989968", "0.7713401", "0.7681184", "0.761365", "0.75832206", "0.75446737", "0.75374955", "0.74729687", "0.74712235", "0.7394378", "0.7361207", "0.73561025", "0.7355495", "0.7335824", "0.72099376", "0.71998966", "0.7164149", "0.715257", "0.7116876", "0.71154886", "0.708903...
0.0
-1
Compute and yield relative sequence position and net_fwd per real sequence position Compute net_fwd as specified by precomp_fwds (precompute it for all inputs or compute it online for each
def comp_net_fwd(self, incoming, start_at=0): precomp_fwds = self.precomp_fwds W_fwd = self.W_fwd_conc if precomp_fwds: # Pre compute net input net_fwd_precomp = dot_product(incoming, W_fwd) else: net_fwd_precomp = None # loop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_net_fwd(self, incoming, start_at=0):\n precomp_fwds = self.precomp_fwds\n W_fwd = self.W_fwd_conc\n \n if precomp_fwds:\n # Precompute convolution over all sequence positions for forward inputs\n net_fwd_precomp = conv2d(incoming, W_fwd, dilation_rate=self...
[ "0.69663125", "0.625439", "0.6064099", "0.6017496", "0.5759355", "0.572432", "0.5719969", "0.5708725", "0.5701655", "0.5660107", "0.56319904", "0.5627411", "0.5585208", "0.5576711", "0.5484858", "0.5482995", "0.54714686", "0.54661226", "0.5465288", "0.5406316", "0.5400592", ...
0.70017385
0
Compute and yield relative sequence position and net_fwd per real sequence position Compute net_fwd as specified by precomp_fwds (precompute it for all inputs or compute it online for each
def comp_net_fwd(self, incoming, start_at=0): precomp_fwds = self.precomp_fwds W_fwd = self.W_fwd_conc if precomp_fwds: # Pre compute net input net_fwd_precomp = dot_product(incoming, W_fwd) else: net_fwd_precomp = None # loop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_net_fwd(self, incoming, start_at=0):\n precomp_fwds = self.precomp_fwds\n W_fwd = self.W_fwd_conc\n \n if precomp_fwds:\n # Precompute convolution over all sequence positions for forward inputs\n net_fwd_precomp = conv2d(incoming, W_fwd, dilation_rate=self...
[ "0.69650894", "0.6253838", "0.60651195", "0.6018487", "0.57606065", "0.5724673", "0.5720759", "0.5709719", "0.57034785", "0.56614566", "0.56337416", "0.56270134", "0.5585598", "0.55771625", "0.54853976", "0.5484125", "0.54716164", "0.5466882", "0.5466582", "0.54074615", "0.54...
0.70007
1
Compute and yield relative sequence position and net_fwd per real sequence position Compute net_fwd as specified by precomp_fwds (precompute it for all inputs or compute it online for each
def comp_net_fwd(self, incoming, start_at=0): # loop through sequence positions and return respective net_fwd for relative_seq_pos, real_seq_pos in enumerate(range(start_at, self.incoming_shape[1])): # If first sequence positions are unknown, pad beginning of sequence with first seq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_net_fwd(self, incoming, start_at=0):\n precomp_fwds = self.precomp_fwds\n W_fwd = self.W_fwd_conc\n \n if precomp_fwds:\n # Pre compute net input\n net_fwd_precomp = dot_product(incoming, W_fwd)\n else:\n net_fwd_precomp = None\n \...
[ "0.7000766", "0.7000766", "0.69653696", "0.60651237", "0.6018592", "0.57606804", "0.5726121", "0.5720322", "0.5709651", "0.5702845", "0.56618315", "0.5632966", "0.5627277", "0.5584929", "0.5576653", "0.5485802", "0.5484853", "0.5470992", "0.5467491", "0.5466113", "0.5406667",...
0.62544185
3
Deconvolution (upscaling) layer, based on tf.nn.conv2d_transpose but capable of broadcasting over time series see tensorflow tf.nn.conv2d_transpose function for further details on parameters
def __init__(self, incoming, W=None, b=tf.zeros, ksize: int = None, num_outputs: int = None, weight_initializer=None, a=tf.nn.elu, output_shape=None, strides=(1, 2, 2, 1), padding='SAME', data_format='NHWC', name='DeConvLayer'): super(DeConvLayer, self).__init_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_deconv2d(input_layer, num_classes, kernel_size=4, strides=(2, 2)):\n return tf.layers.conv2d_transpose(input_layer, num_classes, kernel_size, strides=strides, padding='same',\n kernel_initializer=tf.truncated_normal_initializer(stddev=0.01),\n ...
[ "0.7136905", "0.69529784", "0.6942001", "0.6939901", "0.6913637", "0.6911036", "0.68164784", "0.67583627", "0.6747361", "0.67132974", "0.6708567", "0.6695943", "0.6630902", "0.64961034", "0.6470119", "0.64699084", "0.63889337", "0.6377556", "0.63745767", "0.63693124", "0.6357...
0.614982
34
Compute and yield relative sequence position and net_fwd per real sequence position Compute net_fwd as specified by precomp_fwds (precompute it for all inputs or compute it online for each
def comp_net_fwd(self, incoming, start_at=0): precomp_fwds = self.precomp_fwds W_fwd = self.W_fwd_conc if precomp_fwds: # Precompute convolution over all sequence positions for forward inputs net_fwd_precomp = conv2d(incoming, W_fwd, dilation_rate=self.dilation_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_net_fwd(self, incoming, start_at=0):\n precomp_fwds = self.precomp_fwds\n W_fwd = self.W_fwd_conc\n \n if precomp_fwds:\n # Pre compute net input\n net_fwd_precomp = dot_product(incoming, W_fwd)\n else:\n net_fwd_precomp = None\n \...
[ "0.70017385", "0.70017385", "0.625439", "0.6064099", "0.6017496", "0.5759355", "0.572432", "0.5719969", "0.5708725", "0.5701655", "0.5660107", "0.56319904", "0.5627411", "0.5585208", "0.5576711", "0.5484858", "0.5482995", "0.54714686", "0.54661226", "0.5465288", "0.5406316", ...
0.69663125
2
Adds activation function to incoming
def __init__(self, incoming, a=tf.identity, name='ActivationLayer'): super(ActivationLayer, self).__init__() with tf.variable_scope(name) as self.layer_scope: self.incoming, self.incoming_shape = get_input(incoming) self.out = None self.a = a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_activation_function(self):\n # Add the activation function\n if not self.activation_function is None:\n # Check if it is a string\n if isinstance(self.activation_function, str):\n activation_function = get_activation_function_by_name(\n ...
[ "0.7060134", "0.69893706", "0.6861664", "0.6846936", "0.68421626", "0.68421626", "0.68383723", "0.68133014", "0.67312187", "0.6645733", "0.6590262", "0.65360034", "0.65196776", "0.6483642", "0.643248", "0.63933015", "0.6385933", "0.6374501", "0.6371252", "0.6292215", "0.62755...
0.6185337
30
Find the highest index `i` in the array such that sum(arr[0] + arr[1] + ... + arr[i 1]) <= prefixsum It directly exploits the property that segment trees provide an efficient way of calculating cumulative sums of elements. If array values are probabilities, this function allows to sample indexes according to the discre...
def find_prefixsum_idx(self, prefixsum): assert 0 <= prefixsum <= self.sum() + 1e-5 idx = 1 while idx < self._capacity: # while non-leaf if self._value[2 * idx] > prefixsum: idx = 2 * idx else: prefixsum -= self._value[2 * idx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_prefixsum_index(self, prefixsum):\n assert 0 <= prefixsum <= self.sum() + 1e-5\n index = 1\n while index < self.capacity: # while non-leaf\n if self.value[2*index] > prefixsum:\n index = 2*index\n else:\n prefixsum -= self.value[2*i...
[ "0.7139634", "0.6916158", "0.60885596", "0.58948404", "0.57119167", "0.5645507", "0.55998373", "0.54720604", "0.5449965", "0.5400036", "0.53947735", "0.53683245", "0.5339964", "0.53054994", "0.5240967", "0.5227885", "0.5196431", "0.51737237", "0.51703775", "0.51613086", "0.51...
0.7161625
2
The default max length of the label of items. If the label is longer than this, the label is truncated using the ``truncatechars`` django template filter. If you return None or another boolean false falue from this method, labels are not truncated.
def get_default_item_label_maxlength(self): return 15
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_active_item_label_maxlength(self):\n return 25", "def _max_length(self):\n return self.__max_length", "def max_length(self):\n\t\treturn self._max_length", "def trim_display_field(self, value, max_length):\n if not value:\n return ''\n if len(value) > max_length:\n ...
[ "0.7679201", "0.66166586", "0.6495959", "0.639693", "0.63289946", "0.62750596", "0.61518353", "0.61105233", "0.60647446", "0.60276127", "0.58647275", "0.5819335", "0.5804234", "0.57711405", "0.57711405", "0.5764961", "0.57435244", "0.57435244", "0.57435244", "0.5719635", "0.5...
0.7975563
0
The default max length of the label of active items. If the label is longer than this, the label is truncated using the ``truncatechars`` django template filter. If you return None or another boolean false falue from this method, labels are not truncated.
def get_default_active_item_label_maxlength(self): return 25
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_item_label_maxlength(self):\n return 15", "def _max_length(self):\n return self.__max_length", "def max_length(self):\n\t\treturn self._max_length", "def trim_display_field(self, value, max_length):\n if not value:\n return ''\n if len(value) > max_length:\n retu...
[ "0.79805756", "0.6557482", "0.6449503", "0.62958014", "0.6286223", "0.6247241", "0.600977", "0.59981185", "0.5972936", "0.5906029", "0.5906029", "0.5906029", "0.5896021", "0.5896021", "0.5884908", "0.5775769", "0.5775769", "0.5775769", "0.5775769", "0.5775769", "0.5775769", ...
0.8198782
0
Insert a renderable object at a specific index in the breadcrumb list.
def insert_item_renderable(self, index, renderable_object): if index < len(self.breadcrumb_item_list): self.breadcrumb_item_list.insert(index, renderable_object) else: self.append_item_renderable(renderable_object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, index, p_object): # real signature unknown; restored from __doc__\n pass", "def insert(self, index, item):\n # type: (int, Any) -> None\n return list.insert(self, index, self.ref(item))", "def insert(self, index, item):\n if index > len(self):\n raise Ind...
[ "0.69266653", "0.6773136", "0.67511034", "0.6712625", "0.66568214", "0.6655919", "0.65623254", "0.6505517", "0.648724", "0.6463628", "0.6463616", "0.64383274", "0.64244473", "0.6424015", "0.63401896", "0.62850136", "0.6282452", "0.6248896", "0.62212265", "0.61892116", "0.6130...
0.8542642
0
Add this node's data to the dict representation of the signal.
def add_nfb_export_data(self, signal: dict): signal["fSmoothingFactor"] = self.smoothingFactor() signal["method"] = self.method() signal["sTemporalSmootherType"] = self.smootherType()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addData(self, d):\n self.__populateDict(self._data, d)", "def add_data(self, data):\n self.data = data", "def add_data(self, data):\n self._data += data", "def add_data(self, data):\n self.data = self.data + data", "def push(self, data: Dict[str, np.ndarray]) -> None:\n ...
[ "0.657571", "0.6457453", "0.6342921", "0.63329154", "0.63285583", "0.63213664", "0.63130283", "0.6204496", "0.60742986", "0.604354", "0.5961246", "0.58753407", "0.5852941", "0.58442676", "0.5843292", "0.5836225", "0.58113503", "0.58089757", "0.5737056", "0.5724209", "0.572420...
0.5459159
49
Returns the distance from elem_a to elem_b, or 1 if either element is not present in the matrix.
def dist(self, elem_a, elem_b): # Default to empty dict in case the key doesn't exist to simplify # return logic direct_dist = self.distMap.get(elem_a, {}).get(elem_b) if direct_dist is None: reverse_dist = self.distMap.get(elem_b, {}).get(elem_a) if reverse_dist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _distance(self, a, b):\n\n return self.distance_matrix[a - 1][b - 1]", "def _dist(A, B):\n return np.sqrt(np.einsum(\"ijk->ij\", (A[:, None, :] - B) ** 2))", "def distance(a: object, b: object) -> object:\n n, m = len(a), len(b)\n if n > m:\n # Make sure n <= m, to use O(min(n,m)...
[ "0.6465332", "0.642568", "0.63018084", "0.629897", "0.6236811", "0.6219773", "0.61129177", "0.6111424", "0.6104798", "0.60095483", "0.59766835", "0.59545386", "0.5908294", "0.5908294", "0.5902935", "0.5902935", "0.58972406", "0.5885738", "0.5829552", "0.5814935", "0.5808129",...
0.6193653
6
Function to check if SOM; x_axis and y_axis provided are equal to 0.
def check_x_and_y_axis_len(self, x_axis, y_axis): if x_axis ==0: raise ValueError("Error! SOM X-Axis is 0!") if y_axis==0: raise ValueError("Error! SOM Y-Axis is 0!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_zero(self):\n return self._x == 0 and self._y == 0", "def __nonzero__(self):\n return not self.as_point == (0, 0)", "def axis_is_valid(self, axis: int, node: Node) -> bool:\n\n if axis % 2 == 0 and node.was_split_on == \"lat\":\n validity = True\n elif axis % 2 != ...
[ "0.6885343", "0.64256316", "0.63767207", "0.63508445", "0.61729044", "0.613715", "0.6015564", "0.6008739", "0.59655416", "0.5890281", "0.58728695", "0.5752834", "0.5735067", "0.5715555", "0.5707421", "0.56894547", "0.5688735", "0.5680683", "0.56705564", "0.5658858", "0.565373...
0.7339566
0
For Initializing Random Weights to be provided to Neurons
def random_weights_init(self, data): self.check_input_dimension(data) for i in range(self.y_axis): for j in range(self.x_axis): rand_i = self.random_generator.randint(len(data)) self.weights[i][j] = data[rand_i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)", "def InitWeights(self):\n self.w = -1 + 2 * np.random.rand(self.num_of_inputs,)\n self.w0 = -1 + 2 * np.random.rand()", "def initWeights(self):\n self.weights = []\n self.bias = []\n ...
[ "0.7796188", "0.7761938", "0.75133497", "0.74933064", "0.7407989", "0.7355484", "0.7355291", "0.7354264", "0.7350306", "0.73423654", "0.73379487", "0.7279795", "0.7242693", "0.72423935", "0.7227546", "0.71659136", "0.7150323", "0.71481395", "0.7148041", "0.71166545", "0.70660...
0.70466655
23
Return Updated Learning Rate for the different iteration
def currentLearningRate(self, currentIteration, lambda1): return self.learning_rate * np.exp(-currentIteration / lambda1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = ...
[ "0.77186495", "0.7631545", "0.7558147", "0.751957", "0.74922234", "0.74551815", "0.74551815", "0.7396376", "0.7359491", "0.7356808", "0.73421997", "0.73402005", "0.72733974", "0.72267956", "0.7178108", "0.7166493", "0.7117103", "0.71154624", "0.7085465", "0.70778644", "0.7065...
0.6693276
32