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
Initializes a map representation of this tag's attributes, if not already initialized.
def _getAttrMap(self): if not getattr(self, 'attrMap'): self.attrMap = {} for (key, value) in self.attrs: self.attrMap[key] = value return self.attrMap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_attributes(self):\n self.attr = {\n 'name': None,\n 'tags': [],\n 'openHours': None,\n 'type': None,\n 'parent': None,\n 'locationId': None,\n 'bannerAbbreviation': None,\n 'arcGisAbbreviation': None,\n ...
[ "0.7487391", "0.6713859", "0.66014045", "0.64705884", "0.6372751", "0.6362322", "0.6319063", "0.6260433", "0.62544364", "0.6217591", "0.6142135", "0.6101045", "0.6075883", "0.60653085", "0.604344", "0.6025885", "0.5991079", "0.5953464", "0.59456736", "0.5913597", "0.59078175"...
0.7054326
1
Returns true iff the given string is the name of a selfclosing tag according to this parser.
def isSelfClosingTag(self, name): return self.SELF_CLOSING_TAGS.has_key(name) \ or self.instanceSelfClosingTags.has_key(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_tag(t):\n return len(t) > 1 and t.startswith('#') and not t.startswith('##') and t", "def _is_close_tag(self, tokenized_line):\n if tokenized_line[0] == '</':\n return True\n else:\n return False", "def handle_close_tag(self, token, lexer):\n prefix, tag=sel...
[ "0.62254375", "0.61163104", "0.5978375", "0.5958761", "0.5866235", "0.5857068", "0.58318394", "0.56923175", "0.5683027", "0.5683027", "0.5628361", "0.56242216", "0.55386734", "0.5526437", "0.5510112", "0.5499107", "0.5484607", "0.5472337", "0.5457144", "0.5455753", "0.5410698...
0.7856639
0
This is the string that is printed out if we call the print function on an instance of this object
def __repr__(self): return f"User(id: '{self.id}', user_handle: '{self.user_handle}'"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n print(str(self))", "def print(self):\n\n print(self)", "def __str__(self):\r\n return repr(self)", "def __str__(self):\n return self.printable()", "def display(self):\n print(self)", "def __str__(self):\n return repr(self)", "def __str__(se...
[ "0.8116625", "0.804884", "0.801779", "0.798847", "0.7965362", "0.79382825", "0.7926761", "0.7922701", "0.7911669", "0.79098296", "0.7897442", "0.7843441", "0.7840589", "0.78358334", "0.78358334", "0.7833542", "0.78192323", "0.78192323", "0.78192323", "0.781501", "0.77807456",...
0.0
-1
This function performs onehot encoding of the columns
def one_hot_encode(df, colnames): for col in colnames: oh_df = get_dummies(df[col], prefix=col) df = concat([oh_df, df], axis=1) df = df.drop([col], axis=1) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(df, col):\n return pd.get_dummies(df, columns=[col], drop_first=True)", "def one_hot_encode(df, ohe_cols):\n return pd.get_dummies(df, columns=ohe_cols)", "def one_hot_encoder(df, cols):\r\n\r\n for col in cols:\r\n if(\"admission\" in col):\r\n dummies = pd.get_du...
[ "0.850138", "0.84558326", "0.845085", "0.8415357", "0.8350854", "0.8321238", "0.8318007", "0.82246035", "0.8130311", "0.80474687", "0.8035327", "0.7861214", "0.7857943", "0.784751", "0.77966887", "0.778328", "0.77526516", "0.7723961", "0.76888716", "0.76746696", "0.7672492", ...
0.83102226
7
Returns application instance configuration object
def get_app_instances_configs(self, instance_id=None, instance_alias=None, app_full_name=None): try: if instance_id: return filter(lambda app_inst: app_inst["id"] == instance_id, self.app_instances_configs) elif instance_alias: return filter(lambda app_ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance(app: Sanic = None):\n if Configs.__instance is None:\n Configs(app)\n return Configs.__instance", "def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance", "def get_config(cls...
[ "0.7676737", "0.7607243", "0.7576757", "0.7368922", "0.7350077", "0.7350077", "0.73100847", "0.730721", "0.7258184", "0.7252985", "0.72119373", "0.72119373", "0.720853", "0.7175289", "0.71659356", "0.7159841", "0.7139731", "0.71076775", "0.70576525", "0.70576525", "0.70576525...
0.0
-1
Sets the parent_site_initial_id of this GlobalSiteParent.
def parent_site_initial_id(self, parent_site_initial_id): self._parent_site_initial_id = parent_site_initial_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_site_oid(self, parent_site_oid):\n\n self._parent_site_oid = parent_site_oid", "def parent_site_name(self, parent_site_name):\n\n self._parent_site_name = parent_site_name", "def parent_id(self, parent_id):\n\n self._parent_id = parent_id", "def parent_id(self, parent_id):\n\n...
[ "0.7645879", "0.70563346", "0.6554944", "0.6554944", "0.6554944", "0.6554944", "0.64079505", "0.6383392", "0.6357112", "0.63562375", "0.6240596", "0.62135303", "0.6212923", "0.61993694", "0.6112326", "0.60972106", "0.6065486", "0.6038881", "0.59760267", "0.59584934", "0.59584...
0.91338617
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, GlobalSiteParent): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, GlobalSiteParent): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Constructor for the InsuranceCentreData class
def __init__(self, id=None, person_id=None, personality_type=None, insurance_centre_type=None, register_status=None, center_name=None, center_code=None, registration_number=Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, centre):\n super().__init__()\n self.centre = centre", "def __init__(self):\n ## self.clusters[cluster] = list of coordinates\n self.clusters = {}\n ## self.centroids[cluster] = centroid\n self.centroids = {}", "def __init__(self, input_data):\n ...
[ "0.6587704", "0.63431925", "0.6314941", "0.6294676", "0.62852603", "0.61747736", "0.6167209", "0.6111887", "0.60989517", "0.60989517", "0.60937387", "0.60833323", "0.60797715", "0.6063183", "0.60565287", "0.604608", "0.6044945", "0.6004883", "0.6001485", "0.59967303", "0.5982...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary id = dictionary.get('id') person_id = dictionary.get('personId') personality_type = dictionary.get('personalityType') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.0
-1
Test if device has given group address.
def has_group_address(self, group_address): return self.switch.has_group_address(group_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_has_group_address(self):\n xknx = XKNX(loop=self.loop)\n sensor = Sensor(\n xknx,\n 'TestSensor',\n value_type='temperature',\n group_address_state='1/2/3')\n self.assertTrue(sensor.has_group_address(GroupAddress('1/2/3')))\n self.ass...
[ "0.74173033", "0.73575747", "0.7055108", "0.6841339", "0.6833937", "0.6792075", "0.66296726", "0.6550266", "0.652723", "0.6437514", "0.6386515", "0.6373637", "0.63143545", "0.63105434", "0.63011616", "0.62995636", "0.6286364", "0.6281605", "0.62686455", "0.6266686", "0.625252...
0.8002456
0
Begin a reinitialization process, where paint_manager.initialize() is called after initialization. The visual initializer is then called again, but it is only used to update the data, not to create the visual variables and the shader, which have already been created in the first place.
def reinit(self): self.data_updating = {} self.reinitialization = True # force the bounds to be defined again self.bounds = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self._do_paint = True\n self._do_process_data = True\n #opengl data\n self._dentsvertsdata = {} # dictionary that holds vertex data for all primitive and submodel combinations\n self._multFactor = 1 # maybe not the brighest idea...
[ "0.6253552", "0.61923045", "0.6137455", "0.6123902", "0.60901594", "0.59197164", "0.59086144", "0.5901052", "0.5896446", "0.58544797", "0.5832264", "0.582158", "0.58158433", "0.57946545", "0.57931787", "0.57278377", "0.5723287", "0.5714105", "0.5687003", "0.56747293", "0.5670...
0.60517484
5
Return all variables defined in the visual.
def get_variables(self, shader_type=None): if not shader_type: return self.variables else: return [var for (_, var) in self.variables.iteritems() \ if var['shader_type'] == shader_type]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return self._.vars", "def get_all_variables(self):\n return []", "def get_all_variables(self):\n raise NotImplementedError()", "def get_variables(self):\n\t\treturn self.variables", "def get_all_variables_names(self):\n return self.project.get_variable_nam...
[ "0.7383229", "0.7318903", "0.7207668", "0.7200434", "0.7190757", "0.7169007", "0.7127215", "0.7118033", "0.7109175", "0.7073742", "0.6984955", "0.69646525", "0.6954134", "0.6950107", "0.69484794", "0.685847", "0.68505436", "0.68338364", "0.68338364", "0.68338364", "0.68284434...
0.0
-1
Return the list of variables, to be used in the output dictionary containing all the visual information.
def get_variables_list(self): variables = self.variables.values() # handle reference variables for variable in variables: name = variable['name'] if name in self.references: variable['data'] = self.references[name] return variables
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return self._.vars", "def get_variables(self):\n\t\treturn self.variables", "def variables(self):\n return {u for u in self if u.type == 'var'}", "def variable_names(self):\n \n return [x['variable'] for x in self.variable_dicts()]", "def variables(self):\...
[ "0.77178", "0.7603368", "0.7594695", "0.7565736", "0.75262374", "0.74746263", "0.7437809", "0.7432794", "0.74325436", "0.7431996", "0.7428937", "0.74271464", "0.7393821", "0.7384312", "0.7371361", "0.73705906", "0.73670965", "0.73549557", "0.7310831", "0.7273227", "0.72653764...
0.7157749
27
Return the dict representation of the visual.
def get_dic(self): dic = { 'size': self.size, 'bounds': self.bounds, 'visible': self.visible, 'is_static': self.is_static, 'options': self.options, 'primitive_type': self.primitive_type, 'constrain_ratio': self.constrain_ratio, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_visual_properties(self) -> dict:\n return self._vis_properties", "def json(self):\n return {\n \"hwnd\": self.hwnd,\n \"text\": self.text,\n \"x\": self.x,\n \"y\": self.y,\n \"width\": self.width,\n \"height\": self.height,\...
[ "0.7412972", "0.73641264", "0.73534304", "0.72406304", "0.7226668", "0.6874862", "0.68595034", "0.68361795", "0.6792762", "0.6792762", "0.6791727", "0.67876196", "0.67717373", "0.67515206", "0.6746294", "0.6745493", "0.67348254", "0.67245674", "0.6715478", "0.6707385", "0.670...
0.69946766
5
Retrieves the configuration from the Configuration Manager
def _retrieve_configuration(stream_id): global _config_from_manager global _config global _config_omf_types global _config_omf_types_from_manager _logger.debug("{0} - ".format("_retrieve_configuration")) # Configuration related to the OMF Translator try: config_category_name = _CO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self):\n return self.config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__config", "def _get_config(self):\n return self.__co...
[ "0.78008074", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", "0.7750566", ...
0.0
-1
Return the absolute path to the JS package embedded in the Python package. If ``filename`` is provided then it will returned as absolute path to the filename inside the package. If Python package doesn't have JS package embedded then ``None`` will be returned.
def package_filename(dist, *filename): static = static_filename(dist) if static is None: return if not os.path.exists(os.path.join(static, 'js', 'package.json')): return js_filename = os.path.abspath(os.path.join(static, 'js')) if filename is not None: js_filename = os.path.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n\n if self.package:\n directory = self.package.directory\n if self.package.resolve_root:\n directory = directory.joinpath(self.package.resolve_root)\n rel = None\n try:\n rel = self.filename.with_suffix('').relative_to(directory)\n except ValueError as e:\...
[ "0.6057936", "0.6030743", "0.5999259", "0.59003025", "0.5847006", "0.5828996", "0.5775768", "0.5737666", "0.5684548", "0.56829834", "0.5667502", "0.56670445", "0.5666412", "0.5664479", "0.5590559", "0.5589955", "0.55821526", "0.5574037", "0.55735415", "0.55041707", "0.5482762...
0.70025396
0
Ensures that a ValueError is raised when users try to use any other type of initial value input methods other than the `init_vals` argument of `fit_mle()`. This prevents people from expecting the use of shape parameters to work with the Cloglog model.
def test_init_shapes_error_in_fit_mle(self): # Create a variable for the arguments to the fit_mle function. # Note `None` is the argument passed when using the init_intercepts # and init_coefs keyword arguments. fit_args = [None] # Create variables for the incorrect kwargs. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_insufficient_initial_values_in_fit_mle(self):\n # Create a variable for the arguments to the fit_mle function.\n # Note `None` is the argument passed when using the init_shapes,\n # init_intercepts and init_coefs keyword arguments.\n fit_args = [None]\n\n # Create base s...
[ "0.73594844", "0.71825516", "0.6932653", "0.6723754", "0.6066163", "0.6059139", "0.6033005", "0.5970038", "0.5728688", "0.568957", "0.56296736", "0.5607289", "0.54975855", "0.54804647", "0.5465541", "0.54280096", "0.5425935", "0.5410016", "0.5360656", "0.5341214", "0.53006566...
0.7381102
0
Ensures that ValueError is raised if init_intercepts has wrong length.
def test_init_intercepts_length_error_in_fit_mle(self): # Create a variable for the arguments to the fit_mle function. # Note `None` is the argument passed when using the init_intercepts # and init_coefs keyword arguments. fit_args = [None] # Create base set of kwargs for fit_ml...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_vals_length_error_in_fit_mle(self):\n # Note there is only one beta, so we can't go lower than zero betas.\n original_intercept_ref_position = self.fake_intercept_ref_pos\n for intercept_ref_position in [None, original_intercept_ref_position]:\n self.base_clog.intercep...
[ "0.7496007", "0.69427234", "0.6279935", "0.62461525", "0.5843656", "0.5683139", "0.5582588", "0.55467546", "0.54694885", "0.5460964", "0.54477257", "0.5447452", "0.5436863", "0.5428459", "0.5407051", "0.5390119", "0.5389079", "0.5376103", "0.53671306", "0.5345392", "0.5328896...
0.7938569
0
Get the environment variable or return exception
def get_env_variable(var_name, default=None): if default is not None: return _fix_booleans(environ.get(var_name, default)) try: return _fix_booleans(environ[var_name]) except KeyError: error_msg = "Please set the %s environment variable" % var_name raise KeyError(error_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_or_exception(key):\n \n value = os.getenv(key)\n if value is None:\n raise ImproperlyConfigured(f'{key} env variable is not set')\n\n return value", "def getenv_or_raise_exception(varname) -> str:\n\n env = os.getenv(varname)\n if env is None:\n raise EnvironmentError(...
[ "0.8200246", "0.8092687", "0.79894614", "0.784626", "0.77570546", "0.7752938", "0.76418203", "0.7543517", "0.7497901", "0.7496738", "0.7489223", "0.74844366", "0.74418545", "0.74263376", "0.7405853", "0.7378395", "0.7376232", "0.73147345", "0.7307007", "0.73065275", "0.728995...
0.67631114
45
Return whether or not moving is done.
def done(self): if rospy.is_shutdown(): self.stop() return self._done
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ismoving(self):\n return not self.get_par(\"done_moving\")", "def moving(self):\n if self.done is not None:\n dval = self.done.get(use_monitor=False)\n return dval != self.done_value\n else:\n return self._moving", "def move(self) -> bool:\n pass", ...
[ "0.82001173", "0.8080654", "0.7976221", "0.7954937", "0.7910424", "0.77323073", "0.7529476", "0.7474263", "0.74340117", "0.7381468", "0.73463374", "0.732284", "0.7268703", "0.72589207", "0.72227156", "0.7159252", "0.71474695", "0.7132329", "0.7122144", "0.70770425", "0.705738...
0.0
-1
Returns the index of a column that is unassigned and has valid choices available
def get_next_unassigned_var(self): while(True): randomVal = random.randint(0, self.n - 1) if self.state[randomVal] is -1: return randomVal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_column_index(self, columns):\n for i in range(len(columns)):\n if self.match(columns[i]):\n return i\n return None", "def get_index(self, column):\r\n\r\n\t\treturn self.columns.index(column)", "def getColIdx(self, col):\n try: \n return int(co...
[ "0.6801343", "0.6671783", "0.6528251", "0.64788496", "0.6332733", "0.62817794", "0.62337846", "0.62105095", "0.62033504", "0.61972976", "0.61565584", "0.61344886", "0.61035705", "0.60866034", "0.60775477", "0.6061781", "0.6047274", "0.6040493", "0.6030969", "0.6029224", "0.60...
0.0
-1
returns choices[var], the list of available values for variable var, possibly sorted
def get_choices_for_var(self, var): return self.choices[var]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choices(self, var):\r\n return (self.curr_domains or self.domains)[var]", "def get_search_dropdown_choices(var):\n q = (\"select distinct {column} as choices \".format(column=var) + \n \"from {schema}.PersonCombined \".format(schema=app_schema) +\n \"where (MostRecentTestResult is n...
[ "0.73491347", "0.7136625", "0.6975995", "0.67458355", "0.66897374", "0.6608018", "0.62533426", "0.62533426", "0.6214962", "0.61960685", "0.61926377", "0.6069647", "0.6058466", "0.60367215", "0.5992466", "0.597073", "0.5941168", "0.5883738", "0.5860843", "0.5840433", "0.577264...
0.8222674
0
returns a string representation of the object
def __str__(self): return ''.join(str(e) + ' ' for e in self.state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return str(self.obj)", "def __str__(self):\n return str(self.serialize())", "def __str__(self):\n return str(self.__dict__)", "def __str__(self):\n return str(self.__dict__)", "def to...
[ "0.85698074", "0.84377533", "0.8193423", "0.81663173", "0.81663173", "0.8103083", "0.8064919", "0.8064919", "0.8064919", "0.8064919", "0.8064919", "0.8026625", "0.8005496", "0.8004417", "0.7977081", "0.7964056", "0.79449266", "0.79449266", "0.79449266", "0.79449266", "0.79449...
0.0
-1
Get the normalize vector of a posterior (Z) without its exp()
def _get_normalize_vec(self, feat_vec, weights=None): if weights is None: weights = self.weights return array([row[0] + row[feat_vec].sum() for row in weights])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_zmuv(x, axis=0, epsilon=1e-9):\n mean = x.mean(axis=axis)\n std = np.sqrt(x.var(axis=axis) + epsilon)\n return (x - mean[np.newaxis,:]) / std[np.newaxis,:]", "def _normalizeState(self, Z : vector) -> vector:\n return Z * self.D", "def _denormalizeState(self, Z : vector) -> vector:...
[ "0.71569633", "0.69774306", "0.6792109", "0.6737975", "0.667479", "0.66259366", "0.66078943", "0.6605986", "0.65730906", "0.6539986", "0.64977914", "0.6397373", "0.63523996", "0.6348935", "0.62916136", "0.6283562", "0.62594765", "0.6256564", "0.62113106", "0.62026215", "0.620...
0.0
-1
Group the detected and ground truth bounding boxes by image_id.
def get_per_image_gts_and_detections(gt_db_indexed, detection_res): per_image_gts = {} per_image_detections = {} # iterate through each image in the gt file, not the detection file for image_id, annotations in gt_db_indexed.image_id_to_annotations.items(): # ground truth image_obj = gt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_bounding_boxes(ground_truth_file: Path) -> List[Dict]:\n index_shifts = defaultdict(lambda: 0)\n index_shifts[\"cubicle\"] = 1108\n folder_name = ground_truth_file.parent.name\n \n annotations = []\n ground_truth_dataframe = pd.read_csv(str(ground_truth_file),\n ...
[ "0.6743901", "0.65991783", "0.6458405", "0.6428084", "0.6410259", "0.6403304", "0.63615465", "0.6330413", "0.63081384", "0.6305826", "0.6290879", "0.6271545", "0.6260094", "0.61935264", "0.61604553", "0.6153784", "0.61433375", "0.6136004", "0.613072", "0.61195004", "0.6090950...
0.0
-1
Return a deepcopy of this node.
def copy(self): copy = Node(self.ident) for k, v in self.iteritems(): copy[k] = v return copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deepcopy(self):\n return self.copy()", "def __copy__(self):\n result = Node()\n result.data = copy.copy(self.data)\n if self.left:\n result.left = copy.copy(self.left)\n if self.right:\n result.right = copy.copy(self.right)\n return result", "...
[ "0.83197933", "0.83187413", "0.83078396", "0.82133377", "0.81972146", "0.80737066", "0.80544853", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275", "0.79943275"...
0.80953455
5
Return a deepcopy of this graph.
def copy(self): copy = TemporalGraph(self._start, self._end) copy.update(self) return copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_copy_of_graph(self):\r\n return deepcopy(self)", "def clone(self):\n cloned = Graph()\n for v in self.vertices:\n cloned.vertices[v] = self.vertices[v].clone()\n return cloned", "def copy(self):\n cls = self.__class__\n new_graph = cls.__new__(cls)\n...
[ "0.9263364", "0.8568227", "0.8517514", "0.83991396", "0.8309606", "0.82482636", "0.8187165", "0.818205", "0.8151937", "0.8134871", "0.8057162", "0.7996115", "0.7985011", "0.7985011", "0.7985011", "0.7985011", "0.7985011", "0.7985011", "0.7985011", "0.7985011", "0.7985011", ...
0.78874713
36
Return all temporal neighbors of the node.
def neighbors(self, ident, time=None): if time is not None: ident = (ident, time) return map((lambda i: self._nodes[i]), self._edges[ident])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, node):\r\n return list(self.graph.neighbors(node))", "def neighbours(self):\n return [x.node for x in self.edges]", "def neighbor_nodes(self,node):\n\n neighbors = []\n if node > self.cols:\n neighbors.append(node-self.cols)\n if node <= self.co...
[ "0.75201905", "0.7377156", "0.7299956", "0.72630185", "0.72164613", "0.72079796", "0.7194858", "0.7112097", "0.7106257", "0.70883936", "0.7008176", "0.6982142", "0.6951938", "0.69513816", "0.6925804", "0.6901635", "0.6901635", "0.6901635", "0.6901635", "0.6895256", "0.6867019...
0.6887463
20
Return False if there is a temporal paradox in the graph.
def is_consistent(self, item): targets = set(ident for ident, node in self._nodes.iteritems() \ if node[item] == OCCUPIED) return self._check_consistency(item, [self.current], targets)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_t(self):\n return any(map(lambda s: s.is_temporal, self))", "def graph_has_temporal(g):\n return any(any(edge.get(p) == 'time' for p in {'argmax', 'argmin', 'type'}) or 'num' in edge for edge in g.get('edgeSet', []))", "def is_temporal(self, e):\n if e in self.temporal:\n re...
[ "0.7378828", "0.73099107", "0.7087611", "0.66003364", "0.6460493", "0.64076334", "0.63658535", "0.632196", "0.6284522", "0.6231687", "0.6169934", "0.6119965", "0.6103211", "0.6101402", "0.6045803", "0.6023686", "0.6007772", "0.59755534", "0.5963441", "0.5962085", "0.5962085",...
0.0
-1
Return all data flavors that this class supports.
def getTransferDataFlavors(self) -> List[java.awt.datatransfer.DataFlavor]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flavors(self, **kwargs):\n raise NotImplementedError", "def list_flavors(cls):\n return cls.dbdriver.list_flavors()", "def flavors(self, details=True):\n flv = _flavor.FlavorDetail if details else _flavor.Flavor\n return list(self._list(flv, paginated=True))", "def flavors(sel...
[ "0.7577019", "0.7290043", "0.7036952", "0.68689495", "0.6850949", "0.67735964", "0.64139575", "0.62119263", "0.6166835", "0.61030936", "0.6063357", "0.6038673", "0.59369475", "0.5786934", "0.5785678", "0.57843333", "0.5697084", "0.5688995", "0.565429", "0.56486255", "0.561652...
0.68944675
3
Return a list of the codepoint/width pairs in this bucket, sorted by codepoint.
def entries(self) -> "list[tuple[Codepoint, EffectiveWidth]]": result = list(self.entry_set) result.sort() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_buckets(entries, low_bit: BitPos, cap_bit: BitPos) -> \"list[Bucket]\":\n num_bits = cap_bit - low_bit\n assert num_bits > 0\n buckets = [Bucket() for _ in range(0, 2 ** num_bits)]\n mask = (1 << num_bits) - 1\n for (codepoint, width) in entries:\n buckets[(codepoint >> low_bit) & ma...
[ "0.5735562", "0.5467073", "0.54209775", "0.54097843", "0.53756267", "0.5369393", "0.5343463", "0.52992076", "0.52579176", "0.52486306", "0.5239181", "0.52251446", "0.5208217", "0.5180474", "0.515151", "0.512683", "0.5111322", "0.5061336", "0.5061244", "0.5054759", "0.5042618"...
0.6858773
0
Compute IoU between detect box and gt boxes
def IoUs(box, boxes): box_area = (box[2] - box[0]) * (box[3] - box[1]) area = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1]) xx1 = np.maximum(box[0], boxes[:, 0]) yy1 = np.maximum(box[1], boxes[:, 1]) xx2 = np.minimum(box[2], boxes[:, 2]) yy2 = np.minimum(box[3], boxes[:, 3]) # c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_iou(prediction_box, gt_box):\n if is_overlapping(prediction_box, gt_box):\n overlap_box = get_overlap_box(prediction_box, gt_box)\n\n intersection = calculate_box_area(overlap_box)\n pred_box_area = calculate_box_area(prediction_box)\n gt_box_area = calculate_box_area(g...
[ "0.7889271", "0.7658224", "0.74288875", "0.74163836", "0.74065274", "0.7305846", "0.730318", "0.72965515", "0.72965515", "0.72965515", "0.7293232", "0.72609204", "0.7257961", "0.7257961", "0.7246226", "0.72179633", "0.7205666", "0.71986187", "0.71777195", "0.70791966", "0.707...
0.7457907
2
Checks if the nucleotide from instance of TranslateTranscript & self.base_orig are the same
def check_orig_base_isoform( self, isoform_id ): #create transcript isoform based on isoform_id obj_tt = self.create_transcript_instances( isoform_id ) #double check to see if the original nucleotide reported (self.base_orig) & nucleotide in hg19.fa i_genome_pos = obj_tt.arr_genome_pos....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: 'OriginInput') -> bool:\n return not self == other", "def is_original(self):\n return is_original(self.subdomain, self.record_id)", "def __ne__(self, other: 'Origin') -> bool:\n return not self == other", "def test_is_canonical_by_transcript(self):\n assert...
[ "0.5924275", "0.58929324", "0.58720934", "0.5810714", "0.58014524", "0.57087475", "0.564655", "0.55557513", "0.55216247", "0.55081815", "0.5494623", "0.5455015", "0.54465646", "0.54455614", "0.5415674", "0.5386486", "0.53719604", "0.5350403", "0.53401005", "0.5320491", "0.531...
0.7386989
0
Initialize model and loss funtions.
def _init_model_and_losses(self): cnn = copy.deepcopy(self.model) # normalization module normalization = Normalization( self.normalization_mean, self.normalization_std).to(device) content_losses = [] style_losses = [] # assuming that cnn is a nn.Sequential,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss()\n self.initialised = True", "def init(self):\n inputs = self.inputs()\n outputs = self.outputs(inputs)\n ...
[ "0.76369923", "0.7589704", "0.70774245", "0.7041178", "0.69475263", "0.69104654", "0.68511724", "0.6847927", "0.6827751", "0.6809345", "0.67449063", "0.67208284", "0.6686025", "0.66664773", "0.66578376", "0.6633632", "0.6631292", "0.6603125", "0.6602919", "0.6578608", "0.6554...
0.64286804
40
Create layers of vgg model.
def make_layers(cfg, batch_norm=False): layers = [] in_channels = 3 for v in cfg: if v == 'M': layers += [nn.MaxPool2d(kernel_size=2, stride=2)] else: conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1) if batch_norm: layers += [co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vgg():\n input_shape = (256, 256, 3)\n\n vgg = keras.applications.VGG19(include_top = False , input_shape = input_shape , weights=\"imagenet\")\n features = vgg.get_layer(index = 9).output\n\n model = keras.Model(inputs=[vgg.inputs], outputs=[features])\n return model", "def build_vgg(s...
[ "0.7676829", "0.7374913", "0.73588485", "0.7241171", "0.7098424", "0.70820373", "0.7060778", "0.70510143", "0.699266", "0.67753017", "0.672316", "0.6597901", "0.65691596", "0.65595144", "0.6539147", "0.65072536", "0.650632", "0.6502837", "0.6487303", "0.6465075", "0.6410713",...
0.5824693
67
VGG 19layer model (configuration "E").
def vgg19(pretrained=False, **kwargs): if pretrained: kwargs['init_weights'] = False model = VGG(make_layers(cfg['E']), **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['vgg19'], model_dir='../')) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vgg():\n input_shape = (256, 256, 3)\n\n vgg = keras.applications.VGG19(include_top = False , input_shape = input_shape , weights=\"imagenet\")\n features = vgg.get_layer(index = 9).output\n\n model = keras.Model(inputs=[vgg.inputs], outputs=[features])\n return model", "def build_vgg(s...
[ "0.78685546", "0.73130226", "0.7255297", "0.72495025", "0.7243427", "0.72324556", "0.7218377", "0.7074391", "0.7070553", "0.7031298", "0.70105857", "0.6990864", "0.69836867", "0.6966712", "0.6938336", "0.69239324", "0.68904227", "0.68365544", "0.6834573", "0.68208146", "0.679...
0.74153507
1
calculates distance(km) using two sets of latitude and longitude
def get_distance(restuarant, user): lat1 = math.radians(restuarant[1]) lon1 = math.radians(restuarant[0]) lat2 = math.radians(user[1]) lon2 = math.radians(user[0]) dlon = lon1 - lon2 dlat = lat1 - lat2 a = math.sin(dlat / 2) ** 2 + math.cos(lat1) * \ math.cos(lat2) * math.sin(dlon / ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist_between(lon1, lat1, lon2, lat2):\n # convert decimal degrees to radians \n lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2])\n # haversine formula \n dlon = lon2 - lon1 \n dlat = lat2 - lat1 \n a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2\n ...
[ "0.7556667", "0.74937904", "0.74597543", "0.74450517", "0.7404256", "0.7394613", "0.7379719", "0.73304975", "0.72718066", "0.7271267", "0.7259073", "0.7250699", "0.7249427", "0.722803", "0.7216061", "0.72037333", "0.716201", "0.71544397", "0.71358657", "0.71312493", "0.712919...
0.0
-1
Compute the number of connected components in the graph G and its algebraic connectivity, given the adjacency matrix A of G.
def connectivity(A, tol=1e-8): #calculate L and eigenvalues of L L = laplacian(A) eigs, eigvec = la.eig(L) num_cc = 0 #check zeros for i in eigs: if i < tol: num_cc += 1 #fins the algebraic connectivity of G sec_small = sorted(eigs)[1] return num_cc, sec_small
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_strongly_connected_components(G):\n return len(strongly_connected_components(G))", "def _num_conn_comp(graph):\n\n return nx.number_connected_components(graph)", "def number_weakly_connected_components(G):\n return sum(1 for wcc in weakly_connected_components(G))", "def number_of_stro...
[ "0.7572298", "0.7356721", "0.7247077", "0.70837003", "0.69085026", "0.6907127", "0.68705857", "0.6526354", "0.64469016", "0.64300025", "0.63931274", "0.6355983", "0.63340557", "0.6295991", "0.62632036", "0.6240827", "0.62114227", "0.6199364", "0.6143058", "0.6134779", "0.6102...
0.6473118
8
Save the new user settings to the configuration manager.
def saveSettings(self): self.userFiles.applyData() self.userPersonal.applyData()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_settings(self):\n with open(self.settings_path, \"w\") as f:\n json.dump(self.settings, f, indent=4)", "def save_setting(self):\n if self.is_checked.get():\n if \"Email\" not in s.alert:\n s.updateAlert(\"Email\")\n s.updateEmail(self.email_a...
[ "0.7022737", "0.70158464", "0.6955093", "0.6936306", "0.69278556", "0.6864282", "0.6829706", "0.68042445", "0.68004596", "0.677778", "0.67072356", "0.67052203", "0.66609657", "0.66572374", "0.66507125", "0.66454697", "0.65697336", "0.65342516", "0.6527507", "0.6490011", "0.64...
0.7899377
0
Move the selected color down.
def _onMoveDown(self, event): index = self.colorlist.GetSelection() self.graphColors.insert(index + 1, self.graphColors.pop(index)) self._tupleListToStrings() self.colorlist.SetSelection(index + 1) self._updateButtons(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onMoveUp(self, event):\n index = self.colorlist.GetSelection()\n self.graphColors.insert(index - 1, self.graphColors.pop(index))\n self._tupleListToStrings()\n self.colorlist.SetSelection(index - 1)\n self._updateButtons(None)", "def up(self):\n if self.selected_off...
[ "0.74437934", "0.6879542", "0.6774776", "0.65950745", "0.64506364", "0.6443568", "0.636923", "0.6367831", "0.6310845", "0.6296764", "0.6294402", "0.6259675", "0.62519485", "0.6176525", "0.61513764", "0.61435866", "0.61115336", "0.610217", "0.6060286", "0.60481197", "0.6024589...
0.77009374
0
split path by '/' and remove empty strs
def split_path(self, path: str) -> List[str]: dirs = path.split('/') return list(filter(lambda x: x!='', dirs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _path_parts(path):\n # clean it up. this removes duplicate '/' characters and any that may\n # exist at the front or end of the path.\n return [pp for pp in path.split(\"/\") if pp]", "def split_path(path):\n\n if type(path) != str:\n return []\n\n # replace multiple occurre...
[ "0.795074", "0.7651821", "0.76488495", "0.7537164", "0.747039", "0.7297731", "0.7251287", "0.71949697", "0.7159903", "0.7081001", "0.70713836", "0.7018653", "0.69929385", "0.69625735", "0.68487626", "0.6839464", "0.67570794", "0.6754752", "0.67375726", "0.6720416", "0.6695329...
0.7547453
3
Returns the handle indices (i.e. indices into ``self.all_handles``) corresponding to the handles in ``handles_key``. An entry in the returned tuple is ``None`` if the handle is invalid.
def _get_handle_indices( self, handles_key: _HandlesKey, ) -> Tuple[Optional[int], ...]: indices: List[int] = [] for handle in handles_key: if handle not in self.handle_to_handle_index: indices.append(None) else: indices.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_names_from_handles(\n self,\n handles_key: _HandlesKey,\n ) -> List[List[str]]:\n prefixed_param_names: List[List[str]] = []\n for handle in handles_key:\n flat_param = handle.flat_param\n if flat_param not in self.flat_param_to_prefixed_param_names:\n ...
[ "0.6095189", "0.5447306", "0.5432923", "0.54099256", "0.5408392", "0.53903985", "0.5365637", "0.5353805", "0.5341128", "0.5286059", "0.52609557", "0.5254295", "0.5187032", "0.5151512", "0.51353514", "0.5112926", "0.5105425", "0.50880986", "0.5086101", "0.507979", "0.50673383"...
0.8981582
0
Determines and returns this FSDP instance's compute device. If the module is already on a nonCPU device, then the compute device is that nonCPU device. If the module is on CPU, then the compute device is the current device. Since this method should be called after materializing the module, any nonCPU device should not ...
def _get_compute_device( self, module: nn.Module, ignored_params: Set[nn.Parameter], device_from_device_id: Optional[torch.device], ) -> torch.device: # If the module is on GPU already, then that GPU device has priority # over the current device param = next(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device(self) -> torch.device:\n for param in self.parameters():\n return param.device\n return get_device(\"cpu\")", "def get_device():\n import torch\n\n if torch.cuda.is_available():\n return torch.device('cuda')\n return torch.device('cpu')", "def...
[ "0.73570067", "0.7328095", "0.71778244", "0.71314156", "0.70642984", "0.6855592", "0.6718017", "0.6664229", "0.6633882", "0.6629954", "0.66140187", "0.66052157", "0.66052157", "0.66052157", "0.66052157", "0.65965533", "0.6539867", "0.6538872", "0.6526315", "0.6523687", "0.650...
0.8263755
0
Whether user explicitly enabled mixed precision for gradient reduction or not.
def _mixed_precision_enabled_for_reduce(self) -> bool: return self.mixed_precision.reduce_dtype is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mixed_precision_enabled_for_params(self) -> bool:\n return self.mixed_precision.param_dtype is not None", "def _mixed_precision_enabled_for_buffers(self) -> bool:\n return self.mixed_precision.buffer_dtype is not None", "def _low_precision_hook_enabled(self) -> bool:\n return (\n ...
[ "0.7358453", "0.6768625", "0.6469172", "0.63078666", "0.62485284", "0.5923022", "0.585929", "0.55501693", "0.55363053", "0.5496913", "0.547387", "0.5393136", "0.53747034", "0.53603995", "0.5357265", "0.535076", "0.5345505", "0.53369504", "0.53323114", "0.53223324", "0.5309427...
0.77600414
0
This hook create a ShardedTensor from the local flat_param and replace the state_dict[f"{prefix}{FLAT_PARAM}] with the ShardedTensor. No copy will happen. The underlying storage is the same.
def _local_post_state_dict_hook( self, state_dict: Dict[str, Any], prefix: str, ) -> Dict[str, Any]: _replace_by_prefix(state_dict, f"{prefix}{FSDP_WRAPPED_MODULE}.", prefix) if not self._fsdp_wrapped_module.has_params: return state_dict # state_dict[f"{p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _local_pre_load_state_dict_hook(\n self,\n state_dict: Dict[str, Any],\n prefix: str,\n ) -> None:\n _replace_by_prefix(state_dict, prefix, f\"{prefix}{FSDP_WRAPPED_MODULE}.\")\n fqn = f\"{prefix}{FSDP_WRAPPED_MODULE}.{FLAT_PARAM}\"\n if fqn not in state_dict:\n ...
[ "0.6494341", "0.6222213", "0.59791857", "0.5918826", "0.57699895", "0.55042934", "0.5317502", "0.52841425", "0.5241555", "0.5199148", "0.51922446", "0.51106495", "0.5094428", "0.50473845", "0.4970771", "0.4966289", "0.49586606", "0.49532518", "0.49464664", "0.4939521", "0.493...
0.6695388
0
Registers prebackward hooks on the tensors that require gradients in the forward pass outputs ``outputs``, which were computed using the ``FlatParameter`` s of ``handles``.
def _register_pre_backward_hooks( self, outputs: Any, handles: List[FlatParamHandle], ) -> Any: # If there is no gradient computation, then there is no need for # pre-backward logic if not torch.is_grad_enabled(): return outputs if self._is_root: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_pre_backward_hooks(\n state: _State,\n outputs: Any,\n handles: List[FlatParamHandle],\n) -> None:\n # If there is no gradient computation, then there is no need for\n # pre-backward logic\n if not torch.is_grad_enabled():\n return outputs\n if state._is_root:\n sta...
[ "0.88707286", "0.7840999", "0.7673528", "0.71470493", "0.7030799", "0.6852213", "0.6841884", "0.6817858", "0.6755273", "0.6604978", "0.65488726", "0.6529459", "0.6058749", "0.6035606", "0.59875256", "0.59783334", "0.5967693", "0.58277446", "0.5797821", "0.5757762", "0.5718252...
0.8263291
1
Registers postbackward hooks on the ``FlatParameter`` s' ``AccumulateGrad`` objects to reshard and to reducescatter gradients. The ``AccumulateGrad`` object represents the last function that finalizes the ``FlatParameter`` 's gradient, so it only runs after its entire gradient computation has finished. We register the ...
def _register_post_backward_hooks( self, handles: List[FlatParamHandle], ) -> None: # If there is no gradient computation, then there is no need for # post-backward logic if not torch.is_grad_enabled(): return for handle in handles: flat_param ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_post_backward_hooks(self) -> None:\n if not torch.is_grad_enabled():\n return # don't register grad hooks if grad isn't enabled\n for p in self.full_params:\n if p.requires_grad:\n if hasattr(p, \"_shard_bwd_hook\"):\n continue\n # Register a hook on the first ...
[ "0.8141295", "0.75680685", "0.75465757", "0.7477698", "0.7440965", "0.68835145", "0.6811986", "0.67125815", "0.6655907", "0.6627588", "0.66123796", "0.64132965", "0.63767225", "0.6300233", "0.6297085", "0.62681705", "0.6242154", "0.61414814", "0.59206873", "0.5866735", "0.584...
0.7550414
2
Clip all gradients at this point in time. The norm is computed over all gradients together, as if they were concatenated into a single vector. Gradients are modified inplace.
def clip_grad_norm_( self, max_norm: Union[float, int], norm_type: Union[float, int] = 2.0 ) -> None: self._lazy_init() self._wait_for_previous_optim_step() assert self._is_root, "clip_grad_norm should only be called on the root (parent) instance" self._assert_state(TrainingS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_grads(self): # Clipping gradients for stability\n parameters = list(filter(lambda p: p.grad is not None, self.machine.parameters()))\n for p in parameters:\n p.grad.data.clamp_(-10, 10)", "def clip_gradient(model, clip_norm):\n totalnorm = 0\n for p in model.paramete...
[ "0.7232433", "0.70915717", "0.7085697", "0.7041226", "0.69929767", "0.6981707", "0.6917934", "0.6897601", "0.686517", "0.6674762", "0.6615811", "0.6608631", "0.6588324", "0.6581928", "0.65666217", "0.65502334", "0.64403516", "0.6381444", "0.6330048", "0.62852716", "0.62742585...
0.6310692
19
Shards the full optimizer state dict ``full_optim_state_dict`` by remapping the state to flattened parameters instead of unflattened parameters and restricting to only this rank's part of the optimizer state. The first argument should be the return value of
def shard_full_optim_state_dict( full_optim_state_dict: Dict[str, Any], model: torch.nn.Module, optim_input: Optional[ Union[ List[Dict[str, Any]], Iterable[torch.nn.Parameter], ] ] = None, optim: Optional[torch.optim.Optimizer] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_full_optim_state_dict(\n full_optim_state_dict: Optional[Dict[str, Any]],\n model: torch.nn.Module,\n optim_input: Optional[Union[\n List[Dict[str, Any]], Iterable[torch.nn.Parameter],\n ]] = None,\n optim: Optional[torch.optim.Optimizer] = None,\n g...
[ "0.6944979", "0.68178874", "0.6444117", "0.63703686", "0.63167906", "0.61628145", "0.58055925", "0.57762736", "0.5727741", "0.55649847", "0.5484436", "0.540303", "0.5395655", "0.5395655", "0.53783184", "0.53605807", "0.5267841", "0.5228583", "0.5212387", "0.5195796", "0.51767...
0.7350118
0
Rekeys the optimizer state dict ``optim_state_dict`` to use the key type ``optim_state_key_type``. This can be used to achieve compatibility between optimizer state dicts from models with FSDP instances and ones without. To rekey an FSDP full optimizer state dict (i.e. from
def rekey_optim_state_dict( optim_state_dict: Dict[str, Any], optim_state_key_type: OptimStateKeyType, model: torch.nn.Module, optim_input: Optional[Union[ List[Dict[str, Any]], Iterable[torch.nn.Parameter], ]] = None, optim: Optional[torch.optim.Optimizer] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shard_full_optim_state_dict(\n full_optim_state_dict: Dict[str, Any],\n model: torch.nn.Module,\n optim_input: Optional[\n Union[\n List[Dict[str, Any]], Iterable[torch.nn.Parameter],\n ]\n ] = None,\n optim: Optional[torch.optim.Optimizer...
[ "0.6113661", "0.5847519", "0.5763434", "0.5603948", "0.5577986", "0.5577986", "0.5510404", "0.54268175", "0.53947103", "0.53441316", "0.5326797", "0.5278401", "0.5247392", "0.52401334", "0.52328724", "0.5199052", "0.5199052", "0.5194841", "0.5194841", "0.51872456", "0.5180641...
0.78244007
0
Transform numpy [] message to Point array.
def to_pose_2d(np_trajectory): arr = [] for i in range(len(np_trajectory[0])): pose = msgs.Pose2D(np_trajectory[0,i], np_trajectory[1,i], 0.) arr.append(pose) return arr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dlib_point_to_np_array(point: dlib.point):\n return np.array([point.x, point.y])", "def convert_point_type(point):\n if isinstance(point, (PathPoint, TrajectoryPoint)):\n np_point = np.array([point.point.x, point.point.y, point.point.z])\n elif isinstance(point, (list, np.ndarray)):\n ...
[ "0.6614464", "0.65068626", "0.6348085", "0.6297034", "0.6289222", "0.6212789", "0.61096835", "0.6082394", "0.60222596", "0.60159755", "0.5966171", "0.5962204", "0.5959896", "0.59516007", "0.59077126", "0.58266157", "0.5692217", "0.569119", "0.565894", "0.56272566", "0.5615694...
0.56738096
18
Relationship type URI for this relationship. Corresponds roughly to the part type of the target part.
def _reltype(self): return self.__reltype
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self) -> URIType:\n if self.study_instance_uid is None:\n return URIType.SERVICE\n elif self.series_instance_uid is None:\n return URIType.STUDY\n elif self.sop_instance_uid is None:\n return URIType.SERIES\n elif self.frames is None:\n ...
[ "0.64929456", "0.6288943", "0.6271802", "0.604241", "0.5980953", "0.59466803", "0.5935114", "0.5909031", "0.5881879", "0.58263505", "0.5728455", "0.5696708", "0.56683457", "0.5647053", "0.5630891", "0.5630452", "0.5627703", "0.56219023", "0.56169474", "0.56116503", "0.5596201...
0.6622305
0
The numeric portion of the rId of this |_Relationship|, expressed as
def _num(self): try: num = int(self.__rId[3:]) except ValueError: num = 9999 return num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rId(self):\n return self.__rId", "def get_rid(self):\n return str(self.rid).zfill(3) #pad the beggining with zeros", "def num_id(self) -> str:\n return pulumi.get(self, \"num_id\")", "def get_id_number(self) -> str:\n return self.id_number", "def _next_rId(self):\n t...
[ "0.7324146", "0.71260905", "0.695657", "0.6857698", "0.6850707", "0.67950034", "0.6756177", "0.6585846", "0.6542781", "0.64950037", "0.64950037", "0.6483775", "0.64411414", "0.6345757", "0.63129467", "0.6291346", "0.62793684", "0.6277455", "0.62768024", "0.62503844", "0.62407...
0.72371083
1
Assign partnames like ``/ppt/slides/slide9.xml`` to all slides in the collection. The name portion is always ``slide``. The number part forms a continuous sequence starting at 1 (e.g. 1, 2, 3, ...). The extension is always ``.xml``.
def __rename_slides(self): for idx, slide in enumerate(self._values): slide.partname = '/ppt/slides/slide%d.xml' % (idx+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_slides(self):\n for idx, slide in enumerate(self):\n partname_str = '/ppt/slides/slide%d.xml' % (idx+1)\n slide.partname = PackURI(partname_str)", "def _next_partname(self):\n partname_str = '/ppt/slides/slide%d.xml' % (len(self)+1)\n return PackURI(partname_...
[ "0.82876116", "0.6684473", "0.6216492", "0.5730008", "0.55637604", "0.5017737", "0.49635524", "0.49546188", "0.48890015", "0.48777503", "0.4779336", "0.4697163", "0.46544096", "0.46416223", "0.46158323", "0.4611897", "0.45991755", "0.4492745", "0.4471792", "0.44643617", "0.44...
0.8185721
1
Internal name of this slidelike object.
def name(self): cSld = self._element.cSld return cSld.get('name', default='')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name ( self ) :\n return self.__name if self.__name else ''", "def name(self):\n return self.__name", "def name(self):\n return self.__name", "def name(self):\n return self.__name", "def name(self):\n return self.__name", "def name(self):\n return self.__name...
[ "0.82432485", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.81589764", "0.8091746", "0.8087424", "0.8087424", "0.8087424", "0.8087424", "0.8087424", "0.8087424", "0.8087424", "0.80578554", "0.8...
0.0
-1
Id of this shape. Note that ids are constrained to positive integers.
def id(self): return int(self.__nvXxPr.cNvPr.get('id'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape_id(self):\n return self._shape_id", "def id(self) -> int:\n\t\t# pylint: disable=invalid-name\n\t\treturn self._oid", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n...
[ "0.78237844", "0.7177491", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.71595037", "0.70268595", "0.6946847", "0.6928756", "0.68821317", ...
0.0
-1
Name of this shape.
def name(self): return self.__nvXxPr.cNvPr.get('name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n raise NotImplementedError", "def name(self):\n raise NotImplementedError", "def name(self):\n raise NotImplementedError", "def name(self):\n raise NotImplementedError", "def name(self):\n raise NotImplementedError", "def name(self):\n raise NotI...
[ "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7603144", "0.7593328", "0.75805855", "0.7565821", "0.75547403", "0.75547403", "0.75547403", "0.75547403", "0.75547403", "0.75547403", "0.75547403", "0.75547...
0.0
-1
True if this shape is a title placeholder.
def _is_title(self): ph = _child(self.__nvXxPr.nvPr, 'p:ph') if ph is None: return False # idx defaults to 0 when idx attr is absent ph_idx = ph.get('idx', '0') # title placeholder is identified by idx of 0 return ph_idx == '0'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def istitle(self) -> bool:\n pass", "def is_placeholder(self):\n return _child(self.__nvXxPr.nvPr, 'p:ph') is not None", "def title(self):\n for shape in self.__shapes:\n if shape._is_title:\n return shape\n return None", "def is_title_displayed(self):\n ...
[ "0.71491075", "0.6736903", "0.65215355", "0.63916105", "0.63101065", "0.618546", "0.60266703", "0.5997301", "0.5967585", "0.5958487", "0.59437084", "0.5799381", "0.5790523", "0.57570267", "0.57558787", "0.57269293", "0.5721711", "0.5667919", "0.56625545", "0.56603426", "0.565...
0.8128091
0
Next unique placeholder name for placeholder shape of type ph_type, with id number id and orientation orient. Usually will be standard placeholder root name suffixed with id1, e.g. __next_ph_name(PH_TYPE_TBL, 4, 'horz') ==> 'Table Placeholder 3'. The number is incremented as necessary to make the name unique within the...
def __next_ph_name(self, ph_type, id, orient): basename = slide_ph_basenames[ph_type] # prefix rootname with 'Vertical ' if orient is 'vert' if orient == PH_ORIENT_VERT: basename = 'Vertical %s' % basename # increment numpart as necessary to make name unique numpart =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self, op_type):\n\n def _gen(t):\n t = t.lower()\n if t not in self.local_op_namespace:\n self.local_op_namespace[t] = START_IDX\n suffix = \"\"\n else:\n self.local_op_namespace[t] += 1\n suffix = f\"{...
[ "0.54161257", "0.5398205", "0.5371809", "0.5354095", "0.5317093", "0.52624184", "0.52248466", "0.52189016", "0.52168626", "0.5207562", "0.52042496", "0.52023256", "0.51877433", "0.51438105", "0.5137035", "0.50739664", "0.50596994", "0.5055646", "0.49881598", "0.49698746", "0....
0.8377544
0
if z_pos is not None, the sign of the normal is flipped to make the dot product with z_pos (+).
def fit_plane(xyz,z_pos=None): mean = np.mean(xyz,axis=0) xyz_c = xyz - mean[None,:] l,v = np.linalg.eig(xyz_c.T.dot(xyz_c)) abc = v[:,np.argmin(l)] d = -np.sum(abc*mean) # unit-norm the plane-normal: abcd = np.r_[abc,d]/np.linalg.norm(abc) # flip the normal direction: if z_pos is n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal(self,points):\n ez=np.array([[0,0,1]])\n v=((points-self.pos()*ez)*self.C-ez)\n return (v/np.linalg.norm(v,axis=1)[:,np.newaxis])#*np.sign(self.C)", "def normal(self, position):\n return self._normal", "def getZCoord(self, x, y):\n n = self.normal()\n z = (-n.x ...
[ "0.6222574", "0.6199523", "0.6092675", "0.5985981", "0.59790933", "0.5968544", "0.5939464", "0.59270144", "0.5923378", "0.59091663", "0.58837295", "0.5861264", "0.5833076", "0.57544696", "0.5741688", "0.57369506", "0.5735805", "0.572182", "0.5692303", "0.5626209", "0.5625428"...
0.52914935
67
Modifies the AST to use input from stdin. How we do this depends on which magic variables are used.
def build_input(self) -> None: possible_vars = {typ: names & self.undefined for typ, names in MAGIC_VARS.items()} if (possible_vars["loop"] or possible_vars["index"]) and possible_vars["input"]: loop_names = ", ".join(possible_vars["loop"] or possible_vars["index"]) input_names ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_stdin(self, text):\n orig = sys.stdin\n sys.stdin = StringIO(text)\n yield\n sys.stdin = orig", "def stdin(self):\n pass", "def main(self):\n cmd = \"self.%s(sys.stdin)\" % sys.argv[1]\n exec(cmd)", "def main():\n dt = DropToken()\n play = True\n ...
[ "0.6705657", "0.6704471", "0.64573187", "0.6328495", "0.62795436", "0.6265963", "0.6226644", "0.62104684", "0.6087675", "0.60646635", "0.60543716", "0.60365903", "0.6011187", "0.5999355", "0.5964213", "0.5897256", "0.5825975", "0.58212435", "0.5802393", "0.5794592", "0.575385...
0.5794813
19
Create new node and add it at the end. The tail will be changed since we put the given element to the end. (tail will be the given end node) But the head will not be changed. This is the difference between inserting before header and inserting at the end. This method is based on the concept which is regarding the tail ...
def insertAtEnd(self, e): # self.insertBeforeHeader(e) # this is not true since the head will be changed if self.is_empty(): # if this is the first insert method call, print("As you do not have any start node yet, the given element will be a start node.") self._first_insert(e) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_end(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n while temp.next is not None:\n temp = temp.next\n temp.next = ListNode(data)", "def add_last(self, elem):\n if self.is_em...
[ "0.6935565", "0.6841123", "0.6707307", "0.66848713", "0.6683242", "0.6679439", "0.6629882", "0.6593673", "0.6533931", "0.65219325", "0.65192384", "0.64948636", "0.64925146", "0.64818", "0.647346", "0.64600116", "0.64486015", "0.643798", "0.6431406", "0.6431406", "0.6403852", ...
0.71170765
0
Combines a tuple of `Deferred`s into a single `Deferred`. Wraps `defer.gatherResults` to provide type annotations that support heterogenous lists of `Deferred`s.
def gather_results( # type: ignore[misc] deferredList: Tuple["defer.Deferred[T1]", ...], consumeErrors: bool = False, ) -> "defer.Deferred[Tuple[T1, ...]]": # The `type: ignore[misc]` above suppresses # "Overloaded function implementation cannot produce return type of signature 1/2/3" deferred = de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def gather(*async_fns_and_args: AsyncFnsAndArgsType) -> Tuple[Any, ...]:\n indices_and_results = []\n\n async def get_result(index: int) -> None:\n async_fn_and_args = async_fns_and_args[index]\n if isinstance(async_fn_and_args, Iterable):\n async_fn, *args = async_fn_and_args\...
[ "0.63822705", "0.5803502", "0.56743723", "0.5600087", "0.542104", "0.5315591", "0.529028", "0.52661186", "0.52396595", "0.51308644", "0.51091784", "0.5084493", "0.5082203", "0.5062277", "0.5052214", "0.50514805", "0.50122136", "0.4968304", "0.49475044", "0.49425486", "0.49057...
0.7823377
0
Convert a value to an awaitable if not already an awaitable.
def maybe_awaitable(value: Union[Awaitable[R], R]) -> Awaitable[R]: if inspect.isawaitable(value): assert isinstance(value, Awaitable) return value return DoneAwaitable(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cast(obj):\n if isinstance(obj, Future):\n return obj\n else:\n return NonFuture(obj)", "def from_awaitable(a: Awaitable[_A]) -> Deferred[_A]:\n\n async def adapt() -> _A:\n return await a\n\n return Deferred.fromCoroutine(adapt())", "async def resolved(value: T) -> T:\n ...
[ "0.6118696", "0.6023675", "0.5986309", "0.5633857", "0.5607051", "0.56017905", "0.5462076", "0.5328957", "0.5244753", "0.52420205", "0.5230873", "0.5177839", "0.5035285", "0.49636406", "0.49578407", "0.49215913", "0.49169078", "0.49141058", "0.491255", "0.48895687", "0.487668...
0.7688143
0
Delay cancellation of a coroutine or `Deferred` awaitable until it resolves. Has the same effect as `stop_cancellation`, but the returned `Deferred` will not resolve with a `CancelledError` until the original awaitable resolves.
def delay_cancellation(awaitable: Awaitable[T]) -> Awaitable[T]: # First, convert the awaitable into a `Deferred`. if isinstance(awaitable, defer.Deferred): deferred = awaitable elif asyncio.iscoroutine(awaitable): # Ideally we'd use `Deferred.fromCoroutine()` here, to save on redundant ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_cancellation(deferred: \"defer.Deferred[T]\") -> \"defer.Deferred[T]\":\n new_deferred: \"defer.Deferred[T]\" = defer.Deferred()\n deferred.chainDeferred(new_deferred)\n return new_deferred", "def cancelok(foo):\n @functools.wraps(foo)\n async def wrapper(*args, **kwargs):\n try:\n...
[ "0.62751657", "0.56090444", "0.54755807", "0.5473325", "0.53437775", "0.5308978", "0.5262036", "0.51987636", "0.51098776", "0.50475824", "0.5026727", "0.49845898", "0.49829578", "0.49383378", "0.49376595", "0.4912936", "0.48809806", "0.4863629", "0.48287147", "0.48124617", "0...
0.7921553
0
Gets the standard argument parser. This is public because it will be useful for unit testing the command parser.
def get_argument_parser(self): parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest='command') fetch_parser = subparsers.add_parser('fetch', help='fetches and displays a release from discogs') fetch_parser.add_argument('discogs_id', help='the ID of the release') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n\n parser = parser.ArgumentParser()\n return parser", "def parser(self):\n return self.arg_parser", "def get_parser():\n p = argparse.ArgumentParser(description='such a good program')\n p.add_argument('infile')\n p.add_argument('outfile')\n return p", "def ...
[ "0.8222445", "0.7729526", "0.75496703", "0.75003445", "0.7377841", "0.7313574", "0.7263669", "0.7203009", "0.7190347", "0.7178007", "0.7178007", "0.7167722", "0.71561337", "0.7030261", "0.7026612", "0.7024276", "0.7014115", "0.6995926", "0.69738346", "0.697242", "0.6957372", ...
0.0
-1
return current time str in chinese style.
def get_time_str(): return time.strftime(time_fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_str(self):\n return datetime.now().strftime('%c')", "def _get_current_time() -> str:\n return datetime.now().strftime(\"%FT%H:%M:%S\")", "def str_current_time():\n return strftime(\"%Y_%m_%d_%H_%M_%S_%Z\", gmtime())", "def getCurServerTimeStr(self):\n curDateTime = self.getCurSer...
[ "0.7659189", "0.7273833", "0.7129349", "0.6967521", "0.69227314", "0.69227314", "0.69172496", "0.69046247", "0.6773907", "0.6723575", "0.6709003", "0.6658716", "0.6642164", "0.6631812", "0.661618", "0.65976596", "0.6593756", "0.65785205", "0.6555872", "0.6541923", "0.6517741"...
0.6187658
38
Do not return anything, modify head inplace instead.
def reorderList(self, head: ListNode) -> None: nodes = [] curNode = head while curNode: nodes.append(curNode) curNode = curNode.next if len(nodes) <= 2: return head startIdx, endIdx = 0, len(nodes)-1 while startIdx < endIdx: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(self, head):\n\n self._head = head", "def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)", "def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no...
[ "0.7218526", "0.6802109", "0.6732775", "0.6622557", "0.65217346", "0.6466963", "0.64551795", "0.63585746", "0.63523316", "0.63093", "0.62923217", "0.6231313", "0.622523", "0.62005043", "0.62005043", "0.62005043", "0.62005043", "0.6198878", "0.6193791", "0.61740905", "0.614918...
0.5881337
52
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.70900273
53
Make sure the page responds with '200 OK'
def test_success_response(self): self.login() res = self.client.get(url_for('create_user')) assert res.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertHttpOK(self, response):\r\n self.assertEqual(response.status_code, 200)", "def test_status_home(self):\n self.assertEqual(200, self.response.status_code)", "def test_status_is_ok(self):\n why_page = self.client.get(\"/why/\")\n self.assertEqual(why_page.status_code, 200)",...
[ "0.78314334", "0.77721316", "0.76916367", "0.7688923", "0.7483567", "0.7479874", "0.7434767", "0.7416266", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "0.73651594", "...
0.0
-1
Is this (UTC) date/time value in the future or not?
def is_in_the_future(dt): if dt > datetime.now(pytz.utc): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future", "def date_in_past(date: dt.datetime) -> bool:\n return date < dt.datetime.now()", "def is_timestamp_in_future(timestamp: int) -> bool:\n timestamp_datetime = timestamp_to_datetime(timestamp)\n now...
[ "0.801099", "0.7258797", "0.7240597", "0.69621223", "0.6854131", "0.6849611", "0.6759239", "0.6727527", "0.6724698", "0.6639817", "0.6573272", "0.6480884", "0.6458598", "0.6432331", "0.64142686", "0.63649243", "0.63029534", "0.6243647", "0.6229727", "0.6208399", "0.6183426", ...
0.76990587
1
find the first value higher than a limit (in absolute value). return 1 if no value higher in the array
def findFirstValueHigher( data, limit ): # NB: argmax could return 0 if all remaining sample are equal to zero (the index of equal value are the one of the first element) # min( np.argmax( self.data>nLimit ), np.argmax( self.data<-nLimit ) ); => pb if no neg or no positive value => 0 => min => 0 and so we think...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findFirstElementGreaterThan(self, array, index):\n l, r = 0, len(array) - 1\n ans = -1;\n while (l <= r):\n mid = l + (r - l) // 2;\n # Move to right side if target is greater\n if (array[mid] <= index):\n l = mid + 1;\n # Move lef...
[ "0.7240428", "0.6800983", "0.6769293", "0.67252284", "0.67075545", "0.6676649", "0.6657705", "0.6645488", "0.6643053", "0.66173166", "0.660287", "0.6590954", "0.65894246", "0.6588459", "0.65852785", "0.6569574", "0.65655637", "0.6514823", "0.6513581", "0.650469", "0.65004", ...
0.8161571
0
Duration of an astropy.time.Time object
def duration(t, unit=None): delta = np.max(t) - np.min(t) # TimeDelta object if unit is None: return delta elif unit == 'yr': return delta.jd / (365.25) elif unit == 'd': return delta.jd elif unit == 's': return delta.sec else: raise Exception('invalid uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n\n return self.endtime - self.starttime", "def duration(self):\r\n return (self.end_time or time.time()) - self.start_time", "def duration(self):\n return self.end_time - self.start_time", "def duration(self):\n return float('{0:.2f}'.format(self.end_time - se...
[ "0.72779226", "0.72774124", "0.724079", "0.710687", "0.7073806", "0.70384616", "0.69707495", "0.6904485", "0.6852148", "0.6847567", "0.68281305", "0.68281305", "0.6807464", "0.67664856", "0.67664856", "0.67586255", "0.6757389", "0.6744827", "0.67108375", "0.67099327", "0.6705...
0.66017264
26
Returns duration (tstart, tend) for which t1 and t2 overlap, or (None, None) if no overlap.
def overlap(t1, t2): t1 = dict(min=np.min(t1), max=np.max(t1)) t2 = dict(min=np.min(t2), max=np.max(t2)) for t in (t1, t2): t['dur'] = t['max'] - t['min'] # Ensure t1 min < t2 min if t2['min'] < t1['min']: print('t2 starts earlier') t1, t2 = t2, t1 # var names wrt t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_overlap_time(begin_at_infected, end_at_infected, begin_at_contact, end_at_contact):\n\n\tbegin_at_infected = begin_at_infected\n\tbegin_at_contact = begin_at_contact\n\tend_at_infected = end_at_infected\n\tend_at_contact = end_at_contact\n\treturn (min(end_at_infected, end_at_contact) - max(begin_at_infect...
[ "0.6338955", "0.6296979", "0.6277353", "0.621116", "0.61824316", "0.61628884", "0.61547625", "0.5876438", "0.5856604", "0.58332545", "0.5762551", "0.57228905", "0.5641493", "0.5588288", "0.55184114", "0.5488445", "0.5469588", "0.54370666", "0.5434602", "0.53684616", "0.534047...
0.7407402
0
Given a time axis, return the edges between observing seasons.
def season_edges(t): offset = season_offset(t) yr_min = t.datetime.min().year left_frac = t.jyear.min() % yr_min if left_frac < offset: ex_left = 1 else: ex_left = 0 edges = np.arange(yr_min - ex_left + offset, t.jyear.max() + 1, 1.0) return astropy.time.Time(edges, format='j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seasonal_series(t, y, edges=None, hard=False):\n t = ensure_tarray(t)\n if len(t) == 1:\n return [t], [y]\n season_ixs = season_indices(t, edges=edges, hard=hard)\n ts = []\n ys = []\n for season in season_ixs:\n ts.append(astropy.time.Time(t.jyear[season], format='jyear', scale...
[ "0.6264593", "0.6041903", "0.5983948", "0.5604998", "0.5260374", "0.51272166", "0.4970148", "0.496554", "0.49563706", "0.49385422", "0.4921073", "0.49153122", "0.49153122", "0.4914542", "0.4914542", "0.4914542", "0.48978612", "0.48828164", "0.48757395", "0.48689747", "0.48142...
0.71575934
0
Rescale data to units of its standard deviation
def sigmanorm(y): y = y.copy() y -= y.mean() # set to zero mean y /= y.std() # rescale to units of sigma return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standardize(data):\r\n mean = data.mean(axis=0)\r\n std = data.std(axis=0)\r\n return (data - mean)/std", "def normalize_standard_deviation(dataset):\n return dataset*(1/np.std(dataset))", "def scale_data(self, data):\n return (data - self.mean)/self.std", "def standardize_data(data):...
[ "0.76923937", "0.7684651", "0.7636073", "0.76004046", "0.74780715", "0.7419116", "0.7400311", "0.7360044", "0.7262866", "0.7205112", "0.7205112", "0.72000957", "0.719625", "0.71653205", "0.70953", "0.7094482", "0.701", "0.7005674", "0.69588876", "0.6956328", "0.69544846", "...
0.0
-1
Uncertainty estimate for peak period P found in time series.
def peak_uncertainty(t, S, P): t = t.jyear N = S.size T = t.max() - t.min() amp, phase, offset = find_sine_params(t, S - S.mean(), P) sine = sinefunc(t, P, amp, phase, offset) residual = (S - S.mean()) - sine sigma = residual.std() #print "P=%0.3f N=%i T=%0.1f amp=%0.3g sigma=%0.3g" % (P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizedpeakerror():\r\n peak_simulation = max(hydrograph)\r\n peak_observation = max(obs_data)\r\n peak_error = abs(peak_simulation - peak_observation)/(peak_observation + peak_simulation)\r\n return peak_error", "def peak_PSF(self):\n return self.compute_PSF(np.zeros(self.N_zern))", ...
[ "0.7116659", "0.68431157", "0.65652937", "0.6473256", "0.62878627", "0.607678", "0.5885763", "0.5878891", "0.58172584", "0.5784122", "0.57744104", "0.57669085", "0.57651746", "0.574893", "0.5735275", "0.5730572", "0.5688967", "0.5679805", "0.5676243", "0.5664906", "0.5660895"...
0.746349
0
validate an ip address
def is_valid_ip(address): return is_valid_ipv4_address(address) or is_valid_ipv6_address(address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ip(ip):\n ...", "def validate_ip_address(ip_addr):\n try:\n ip_object = ipaddress.ip_address(ip_addr)\n return True\n except ValueError:\n return False", "def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n ...
[ "0.839468", "0.8242345", "0.80687463", "0.80186135", "0.79904044", "0.7960519", "0.7950642", "0.7932457", "0.790907", "0.78222567", "0.7812952", "0.77832973", "0.7754813", "0.7735581", "0.7713535", "0.7654278", "0.76354665", "0.76313627", "0.76280427", "0.7621482", "0.7560285...
0.7662796
15
Return the email address to satisfy FlaskLogin's requirements.
def get_id(self): return self.username
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self,...
[ "0.74636996", "0.74636996", "0.74636996", "0.74636996", "0.744493", "0.744493", "0.744493", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7421634", "0.72910833", "0.7233626", "0.7228416", "0.72064245", "0.7176058", "0.71472573",...
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.8739372", "0.87086535", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.8613915", "0.8609252", "0.8578436", "0.83723366", "0.83587176", "0.8258534", "0.82273275", "0.8209421", "0.8200795", "0.8174884", "0.81280386", "0.8...
0.8580474
18
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.85624325", "0.83800477", "0.82456774", "0.7815806", "0.7576082", "0.72904116", "0.72619915", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72338396", "0.715833", "0.7106215", "0.70944613", "0.70567185", "0.70209265", "...
0.8360155
13
This function clears the TF session from the model. This is needed as TF/Keras models are not automatically cleared, and the memory will be overloaded
def get_rid_of_the_models(model=None): K.clear_session() if model is not None: del model gc.collect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n tf.keras.backend.clear_session()\n tf.reset_default_graph()", "def clear(self, using=None):\n backend = self.get_backend(using)\n\n if backend is not None:\n backend.clear(models=[self.get_model()])", "def reset(self):\n self.close()\n sel...
[ "0.7770355", "0.72716427", "0.7258732", "0.7068438", "0.7068438", "0.6989312", "0.6749733", "0.66091216", "0.65931886", "0.6591342", "0.6574395", "0.65372044", "0.65049005", "0.6474335", "0.6474335", "0.6474335", "0.64520293", "0.6422632", "0.64199966", "0.62927586", "0.62634...
0.0
-1
Assigns a digit label to each cluster. Cluster is a list of clusters containing labelled datapoints.
def assign_labels_to_centroids(self): labelled_centroids = [] for i in range(len(self.final_clusters)): labels = map(lambda x: x[0], self.final_clusters[i]) # pick the most common label most_common = Counter(labels).most_common(1)[0][0] c = np.round(len([i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignLabels(self):\n clusters = np.arange(0, len(self.V))[self.V < self.V1] #indexes self.V, volumes_sorted, and oldOrder\n self.clusterV = self.volumes_sorted[clusters]\n clusters = self.oldOrder[clusters] #indexes volumes\n self.clusters = self.nonBI[clusters] #indexes self.vor a...
[ "0.73355687", "0.6715509", "0.6681344", "0.6504924", "0.644804", "0.6412088", "0.6258633", "0.6171677", "0.61029404", "0.60809934", "0.60141236", "0.5989538", "0.5921908", "0.59215057", "0.5883092", "0.58693475", "0.58496875", "0.5843253", "0.5824531", "0.58191615", "0.581585...
0.7103997
1
Returns a description of an ECS stack, or `None` if the stack cannot be found.
def describe_stack(cfn, stack_name): try: stacks = cfn.describe_stacks(StackName=stack_name)["Stacks"] return stacks[0] except ClientError as e: if "does not exist" not in e.response["Error"]["Message"]: raise e return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stack_info():\n\n response = cloudformation.describe_stacks(\n StackName=config.CLOUDFORMATION_STACK_NAME\n )\n return response['Stacks'][0]", "def get_stack(stack_name, region, cfn_client=None):\n if not cfn_client:\n cfn_client = boto3.client(\"cloudformation\", region_name=re...
[ "0.71426237", "0.67980194", "0.6593632", "0.65162265", "0.6512927", "0.6359841", "0.63255066", "0.62793475", "0.6213488", "0.6182999", "0.61405706", "0.60518956", "0.5963513", "0.59158134", "0.5908508", "0.58904874", "0.5873001", "0.58022666", "0.56977457", "0.5618392", "0.56...
0.8019377
0
Creates and returns KWS3 detector
def get_kws3_detector(): u0 = 45.7 # in mm v0 = 48.5 # in mm detector = ba.RectangularDetector(256, 90.0, 256, 90.0) detector.setPerpendicularToDirectBeam(9300.0, u0, v0) return detector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterID3ID3D.__New_orig__()\n ...
[ "0.56625897", "0.5442037", "0.5415502", "0.53608644", "0.5266712", "0.52529067", "0.52522945", "0.5248425", "0.5227549", "0.5212138", "0.5197367", "0.51934683", "0.51918095", "0.5191634", "0.51812774", "0.5177026", "0.5156936", "0.5156664", "0.5147989", "0.51278967", "0.51234...
0.79184186
0
Sets the email of this ReportageAccountInfoSchema.
def email(self, email): self._email = email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEmail(self, email):\n self.email = email\n return self", "def email(self, email: str):\n\n self._email = email", "def email(self, email):\n if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501\n raise ValueError(\"Invalid value f...
[ "0.7451031", "0.7114627", "0.7020715", "0.69835865", "0.6842732", "0.68287545", "0.6607159", "0.6607159", "0.64885306", "0.63143647", "0.63100094", "0.63100094", "0.63100094", "0.6227725", "0.60987073", "0.60676616", "0.60247356", "0.6003748", "0.5952748", "0.589552", "0.5833...
0.7193084
6
Sets the first_name of this ReportageAccountInfoSchema.
def first_name(self, first_name): self._first_name = first_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_first_name(self, first_name):\n self.first_name = first_name", "def first_name(self, name):\n self._first_name = name", "def firstname(self, firstname):\n\n self._firstname = firstname", "def firstname(self, firstname):\n\n self._firstname = firstname", "def first_name(s...
[ "0.82309395", "0.803652", "0.77821386", "0.77821386", "0.7778777", "0.7696988", "0.7671563", "0.73437184", "0.665903", "0.6635446", "0.6621724", "0.6621724", "0.6520536", "0.64352447", "0.64120394", "0.64120394", "0.64120394", "0.6291533", "0.62396973", "0.6232101", "0.623210...
0.80871856
8
Sets the last_name of this ReportageAccountInfoSchema.
def last_name(self, last_name): self._last_name = last_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_last_name(self, last_name):\n self.last_name = last_name", "def setLastname(self, lastname):\n self.lastname = lastname\n return self", "def lastname(self, lastname):\n\n self._lastname = lastname", "def last_name(self, name):\n self._last_name = name", "def payee...
[ "0.79750794", "0.7654325", "0.76160765", "0.75748485", "0.7311623", "0.7140535", "0.6774352", "0.6774352", "0.6644617", "0.65936667", "0.65402675", "0.62761134", "0.61761266", "0.61761266", "0.61761266", "0.61761266", "0.6167837", "0.60775125", "0.6070639", "0.60223293", "0.6...
0.7702641
8
Sets the company of this ReportageAccountInfoSchema.
def company(self, company): self._company = company
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company(self, company):\n self._company = company", "def design_company(self, design_company):\n\n self._design_company = design_company", "def company_name(self, company_name):\n\n self._company_name = company_name", "def company(self):\n return self._company", "def company...
[ "0.76402146", "0.69123185", "0.63198507", "0.61138505", "0.61138505", "0.5979825", "0.59324163", "0.5626073", "0.5615436", "0.5418429", "0.5388618", "0.53861254", "0.5371049", "0.5206027", "0.5164829", "0.50789785", "0.5071474", "0.5065174", "0.5063801", "0.5060384", "0.50557...
0.76043856
2
Sets the account_type of this ReportageAccountInfoSchema.
def account_type(self, account_type): self._account_type = account_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_type(self, account_type):\n allowed_values = [\"USER_ACCOUNT\", \"SERVICE_ACCOUNT\", \"INACTIVE_SERVICE_ACCOUNT\"] # noqa: E501\n if account_type not in allowed_values:\n raise ValueError(\n \"Invalid value for `account_type` ({0}), must be one of {1}\" # noqa:...
[ "0.7919431", "0.6840975", "0.64223593", "0.6331896", "0.6239336", "0.6239336", "0.6239336", "0.6239336", "0.6214023", "0.61945486", "0.60293734", "0.59803647", "0.59311604", "0.5795917", "0.57938075", "0.57938075", "0.5782841", "0.576508", "0.57599056", "0.57599056", "0.57599...
0.8479824
2
Sets the reg_limit of this ReportageAccountInfoSchema.
def reg_limit(self, reg_limit): self._reg_limit = reg_limit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_record_limit(self, limit):\n self.max_record_limit = limit", "def limit(self, custom_limit):\n # NOTE(gibi): this operation needs escalated privileges (e.g. admin)\n # as the owner of the app cannot set its own app's limits. But\n # authorization is out of scope.\n ...
[ "0.58739394", "0.5750573", "0.55862874", "0.55862874", "0.55862874", "0.55506235", "0.5539945", "0.55366194", "0.55135393", "0.55019504", "0.53868306", "0.5377366", "0.5363322", "0.53475696", "0.53444076", "0.53420645", "0.5334232", "0.5300806", "0.52975386", "0.52961874", "0...
0.82123107
0
Sets the strict_limit of this ReportageAccountInfoSchema.
def strict_limit(self, strict_limit): self._strict_limit = strict_limit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_limit(self, limit):\n self.limit = limit\n self._prune()", "def set_max_record_limit(self, limit):\n self.max_record_limit = limit", "def limit(self, limit):\n self._limit = limit", "def limit(self, limit):\n\n self._limit = limit", "def limit(self, limit):\n\n ...
[ "0.6055698", "0.5870747", "0.58315957", "0.5816366", "0.5816366", "0.5816366", "0.5750616", "0.56445605", "0.5634302", "0.5633472", "0.5568411", "0.54787827", "0.5474091", "0.54339397", "0.540389", "0.53834105", "0.5281766", "0.52672595", "0.52644604", "0.5186301", "0.5068851...
0.7688316
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ReportageAccountInfoSchema): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457167", "0.8393036", "0.81455255", "0.8139734", "0.81333447", "0.8094964", "0.8093362", "0.8093362", "0.8093362", "0.80863476", "0.80863476", "0.8077286", "0.8077286", "0.806682" ]
0.0
-1
Collate training batch from normalized text and melspec
def __call__(self, batch): # Right zero-pad all one-hot text sequences to max input length input_lengths, ids_sorted_decreasing = torch.sort( torch.LongTensor([len(x[0]) for x in batch]), dim=0, descending=True) max_input_len = input_lengths[0] text_padded = torc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieval_pretrain_collate(data):\n # separate source and target sequences\n t2i_batch, i2t_batch = list(zip(*data))\n\n # t2i\n def generate_inputs_t2i(_batch):\n sent, att_feats, img_masks, box_feats, obj_labels, lm_label, itm_label, img_ids, ori_feats, masked_types = zip(\n *_b...
[ "0.66708034", "0.66386783", "0.6449236", "0.6420128", "0.62829566", "0.625657", "0.6206815", "0.62043476", "0.6169876", "0.6161933", "0.6150317", "0.610892", "0.610611", "0.6084843", "0.60705036", "0.6070052", "0.60617954", "0.6032133", "0.60234106", "0.60113484", "0.5993857"...
0.59515345
24
__init__ the class for time series data manipulation
def __init__(self,data,timeSeriesCol,mainCategoryCol=None): super().__init__() if isinstance(data,(Time_Series_Data,Time_Series_Data_Collection)): self.time_series_data = data else: self.time_series_data = self._setup_time_series_data(data,timeSeriesCol,mainCategoryCol) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data, ts):\n self.data = data\n self.ts = ts", "def __init__(self, timeseries, freq, ch_name, units, start_time, filename=\"\"):\n self.timeseries = deepcopy(is_valid(timeseries, np.ndarray))\n self.freq = deepcopy(is_valid(freq, (int, float)))\n self.ch_name...
[ "0.7277648", "0.71354955", "0.7089336", "0.6932718", "0.68922764", "0.68417186", "0.68330073", "0.6802152", "0.67596364", "0.67243195", "0.6662689", "0.6660439", "0.6651891", "0.66388434", "0.6618463", "0.660302", "0.65856916", "0.65767086", "0.65723526", "0.6553221", "0.6512...
0.7019628
3
make_lag_sequence making lag sequence data this function could be useful for deep learning.
def make_lag_sequence(self,inputLabels,windowSize,lagNum,suffix=None,fillMissing=np.nan,verbose=0,n_jobs=1): self._transform_wrapper( inputLabels, None, make_lag_sequnece, suffix, windowSize, False, n_jobs, verbose, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lagged_subsequences_inference(\n sequence: torch.Tensor,\n subsequences_length: int,\n lags_seq: List[int]) -> torch.Tensor:\n sequence_length = sequence.shape[1]\n batch_size = sequence.shape[0]\n lagged_values = []\n for lag_index in lags_seq:\n begin_index = -lag_...
[ "0.6780452", "0.65861255", "0.633228", "0.62776464", "0.61215776", "0.6016169", "0.5951904", "0.59302276", "0.5774577", "0.5774577", "0.575435", "0.57258743", "0.5724455", "0.5714448", "0.56743956", "0.56592613", "0.56575626", "0.561674", "0.56027216", "0.5567354", "0.5533387...
0.72850966
0
make_lead_sequence making lead sequence data this function could be useful for deep learning.
def make_lead_sequence(self,inputLabels,windowSize,leadNum,suffix=None,fillMissing=np.nan,verbose=0,n_jobs=1): self._transform_wrapper( inputLabels, None, lead_sequence, suffix, windowSize, False, n_jobs, verbose, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sequences(dataset, SEQ_LEN, feature_to_predict, scaler):\n\n feature_to_predict_scaler = scaler\n\n # We need to iterate over the values, store all the features, NOT THE LABEL, then append it to list when we\n # reach the SEQ_LEN\n for col_name in dataset.columns:\n dataset.dropna(inp...
[ "0.62702423", "0.61392224", "0.6103371", "0.5913357", "0.5905143", "0.58209825", "0.57568145", "0.5721552", "0.56919587", "0.5673925", "0.56738484", "0.557398", "0.55678034", "0.55224836", "0.5521345", "0.54412985", "0.54324526", "0.5415035", "0.53999704", "0.5389031", "0.538...
0.68980205
0
Returns the hash of `password` with salt `salt`
def hash_pass(password, salt): return hashlib.pbkdf2_hmac('sha512', password.encode(), salt, 100000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(password, salt):\n password = str(password).encode('utf-8')\n salt = str(salt).encode('utf-8')\n return hashlib.sha512(password + salt).hexdigest()", "def hashedPassword(password, salt):\n\tif not hasattr(password, 'decode'):\n\t\tpassword = password.encode('utf-8')\n\tkey = makeKey(pa...
[ "0.77716386", "0.75169814", "0.7461958", "0.7396252", "0.7192787", "0.7139065", "0.71113193", "0.698886", "0.69419914", "0.690565", "0.6888083", "0.6873638", "0.6859591", "0.68562776", "0.6768737", "0.6761073", "0.6719422", "0.670408", "0.66990423", "0.66767114", "0.66757816"...
0.75204575
1