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
The time at which the channel will be automatically deleted. If null, the channel will not be automatically deleted. This field is present in the output whether it's set directly or via the `ttl` field.
def expire_time(self) -> pulumi.Output[str]: return pulumi.get(self, "expire_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_time(self) -> str:\n return pulumi.get(self, \"delete_time\")", "def delete_time(self) -> str:\n return pulumi.get(self, \"delete_time\")", "def destroy_time(self) -> str:\n return pulumi.get(self, \"destroy_time\")", "def deleted_time(self) -> str:\n return pulumi.get(...
[ "0.65620995", "0.65620995", "0.6496035", "0.63865167", "0.6154583", "0.5818128", "0.5650564", "0.55895376", "0.55895376", "0.55895376", "0.55701953", "0.55701953", "0.55133456", "0.540363", "0.5368135", "0.5362047", "0.5350833", "0.532063", "0.532063", "0.5315186", "0.5281532...
0.5512819
13
The current release for the channel, if any.
def release(self) -> pulumi.Output['outputs.ReleaseResponse']: return pulumi.get(self, "release")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_release():\n return _CURRENT_RELEASE", "def channel(self) -> Optional[pulumi.Input['ReleaseChannelChannel']]:\n return pulumi.get(self, \"channel\")", "def getChannel(self):\r\n return self.channel", "def current_version(self):\n try:\n return self.release_s...
[ "0.7833908", "0.76867086", "0.66333395", "0.65862054", "0.6526233", "0.6526233", "0.65008926", "0.6354863", "0.61796784", "0.61345464", "0.60916597", "0.6090326", "0.6061989", "0.6052359", "0.60454893", "0.60154897", "0.598631", "0.5985626", "0.59100944", "0.590049", "0.58657...
0.62462527
8
Input only. A timetolive for this channel. Sets `expire_time` to the provided duration past the time of the request.
def ttl(self) -> pulumi.Output[str]: return pulumi.get(self, "ttl")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_time(self, expire_time):\n\n self._expire_time = expire_time", "def expire_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expire_time\")", "def expire_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expire_time\")", "def expire(se...
[ "0.667296", "0.62861294", "0.62861294", "0.611906", "0.61017776", "0.6057683", "0.60013646", "0.60013646", "0.60013646", "0.5972136", "0.5926626", "0.58693695", "0.58693695", "0.5779569", "0.5711244", "0.56618905", "0.5651764", "0.56288284", "0.56017745", "0.5537348", "0.5525...
0.0
-1
The time at which the channel was last updated.
def update_time(self) -> pulumi.Output[str]: return pulumi.get(self, "update_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_update_time(self):\n return self._last_update_time", "def get_last_update_time(self):\n return self.last_update_time", "def last_updated_time(self) -> str:\n return pulumi.get(self, \"last_updated_time\")", "def last_updated_time(self) -> datetime.datetime:\n return self....
[ "0.8278886", "0.8145214", "0.79247606", "0.7894875", "0.7894875", "0.78785396", "0.7825468", "0.7738329", "0.77317995", "0.77317995", "0.77317995", "0.77317995", "0.77317995", "0.77317995", "0.77317995", "0.77317995", "0.7682402", "0.75359315", "0.75359315", "0.75045043", "0....
0.7285828
37
create a mac address based on the VM name for DHCP predictability
def macaddr(index): hname = name.encode("utf-8") if not isinstance(name, bytes) else name mac_ext = hashlib.md5(hname).hexdigest() # pylint: disable=E1101 return "52:54:00:{0}:{1}:{2:02x}".format(mac_ext[0:2], mac_ext[2:4], int(mac_ext[4:6], 16) ^ index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac_from_vm(vm: libvirt.virDomain = None) -> str:\n doc = minidom.parseString(vm.XMLDesc())\n interfaces = doc.getElementsByTagName('mac')\n return interfaces[0].getAttribute('address')", "def generate_mac_addr(self):\n\t\tcall_sdk_function('PrlVmDevNet_GenerateMacAddr', self.handle)", "def genera...
[ "0.75262207", "0.73823893", "0.6578665", "0.6578665", "0.6449386", "0.6445896", "0.63863933", "0.6363393", "0.6361569", "0.63372844", "0.62672144", "0.6247294", "0.6238205", "0.6230993", "0.6204163", "0.6158098", "0.6156114", "0.61514807", "0.61339635", "0.6125399", "0.611123...
0.6573335
4
Checks if two nodes are equal by comparing their respective states; Returns A boolean value representing if self.state is equal to other_node.state;
def __eq__(self, other_node): return self.state == other_node.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, another_node):\n return Node.state_as_string(self.state) == Node.state_as_string(another_node.state)", "def __eq__(self, other):\n if self is other:\n return True\n elif type(self) != type(other):\n return False\n else:\n # A node is c...
[ "0.8590962", "0.83055395", "0.811803", "0.8094991", "0.801822", "0.7886486", "0.7791241", "0.77382374", "0.7701742", "0.76733387", "0.7664609", "0.7664609", "0.7664609", "0.7664609", "0.7664609", "0.76293504", "0.7574248", "0.75007915", "0.7488543", "0.74745286", "0.744228", ...
0.87373334
0
Return the correct connection object to the filer. You do not have to care if the filer is a clustermode or a sevenmode filer.
def get_netapp(url, username, password, verify=False): # prepend https if not specified if not url.startswith("https://"): url = "https://" + url nidhogg = SevenMode(url, username, password, 1, 15, verify) if nidhogg.clustered: return ClusterMode(url, username, password, 1, 21, verify) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connector(self):\n if '_connector' not in self.__dict__:\n from meerschaum.connectors.parse import parse_instance_keys\n conn = parse_instance_keys(self.connector_keys)\n if conn:\n self._connector = conn\n else:\n return None\n ...
[ "0.5946494", "0.5860204", "0.5808", "0.57799244", "0.5746762", "0.5746762", "0.5710213", "0.5710213", "0.5592292", "0.55903393", "0.5582405", "0.55682755", "0.5530835", "0.55181193", "0.5513085", "0.55127984", "0.5468103", "0.5453946", "0.54094833", "0.54094833", "0.53855276"...
0.0
-1
Get a list of the playlists owned or followed by the current user. Requires the playlistreadprivate scope to return private playlists. Requires the playlistreadcollaborative scope to return collaborative playlists.
def current_user_playlists(self, limit: int = 20, offset: int = 0): return self._get('me/playlists', limit=limit, offset=offset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_playlists(self, user=None):\n if user:\n playlists = self.sp.user_playlists(user)['items']\n else:\n playlists = self.sp.user_playlists(self.user)['items']\n pl_names = [pl['name'] for pl in playlists]\n pl_id = [pl['id'] for pl in playlists]\n pl_o...
[ "0.7492218", "0.7143421", "0.6862756", "0.6862455", "0.6585548", "0.64993894", "0.64930576", "0.6435999", "0.6435254", "0.6424102", "0.61687917", "0.6120953", "0.60795325", "0.60677594", "0.6035163", "0.60217875", "0.59644806", "0.59210736", "0.58597386", "0.5761129", "0.5754...
0.71924233
1
Get a list of the playlists owned or followed by a user. Requires the playlistreadprivate scope to return private playlists. Requires the playlistreadcollaborative scope to return collaborative playlists. Collaborative playlists are only returned for current user.
def playlists(self, user_id: str, limit: int = 20, offset: int = 0): return self._get(f'users/{user_id}/playlists', limit=limit, offset=offset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_playlists(self, user=None):\n if user:\n playlists = self.sp.user_playlists(user)['items']\n else:\n playlists = self.sp.user_playlists(self.user)['items']\n pl_names = [pl['name'] for pl in playlists]\n pl_id = [pl['id'] for pl in playlists]\n pl_o...
[ "0.7621095", "0.73885006", "0.7037331", "0.69751096", "0.6639359", "0.65922856", "0.6514494", "0.6337983", "0.6323602", "0.62688357", "0.6192288", "0.6177221", "0.61089236", "0.6084685", "0.6005763", "0.59335417", "0.5891134", "0.5866407", "0.5775839", "0.5689571", "0.5650369...
0.71526355
2
verify block, cell is in state. verify block, cell has color
def verify_blocks_details(app, styles): error = [] for column in range(2): for row in range(2): if app.board.blocks[column][row].get_style() != styles[column][row]: error.append(f'block[{column}][{row}] invalid style: expected {styles[column][row]}, actual: {app.board.blocks[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_cell_details(app, style, color, cell):\n error = ''\n found_cell = find_cell(app, cell)\n if found_cell is None:\n return 'Cell not found. may be invalid column and row in block or cell'\n # verify state: raised or normal\n if found_cell.get_style() != style:\n return f'Cell...
[ "0.64290416", "0.6307064", "0.6270811", "0.6237739", "0.6086158", "0.6080615", "0.60435754", "0.60433894", "0.59696114", "0.595856", "0.59477264", "0.59313935", "0.5902469", "0.5863283", "0.5850375", "0.58438134", "0.58394146", "0.58354014", "0.5831893", "0.5820386", "0.58200...
0.5992124
8
verify block, cell is in state. verify block, cell has color
def verify_cell_details(app, style, color, cell): error = '' found_cell = find_cell(app, cell) if found_cell is None: return 'Cell not found. may be invalid column and row in block or cell' # verify state: raised or normal if found_cell.get_style() != style: return f'Cell invalid sty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_block(self, block):\n pass", "def _check_cells(self):\n for row_number in range(self.number_cells_y):\n for col_number in range(self.number_cells_x):\n alive_neighbours = self._get_neighbours(row_number,col_number)\n \n self.to_be_up...
[ "0.63094264", "0.62694573", "0.623781", "0.60859853", "0.60789436", "0.6044077", "0.6044067", "0.59927624", "0.5969526", "0.5957471", "0.5946785", "0.5930182", "0.59025955", "0.58651", "0.5848911", "0.58436", "0.58378613", "0.583588", "0.58302295", "0.582096", "0.5819941", ...
0.64296144
0
Calculates Mean Absolute Deviation
def mad(self): observations_raw = input("Observations: ").split() observations = [int(elem) for elem in observations_raw] n = len(observations) mean = sum(observations)/n deviations = [xi - mean for xi in observations] abs_deviations = [abs(xi) for xi in deviations] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_deviation(self):\r\n\t\t_mean = sum(self.sample)/len(self.sample)\r\n\t\treturn sum(map(lambda x: abs(x - _mean), self.sample))/len(self.sample)", "def mean_stddev(self):\n if len(self.vs) == 0:\n raise StdDevFilterException\n\n mx = self.mean()\n # compute variance\n ...
[ "0.7624987", "0.72484756", "0.71904784", "0.7181966", "0.7124336", "0.7068963", "0.70612484", "0.7046267", "0.7017091", "0.69929713", "0.6970996", "0.69685525", "0.69674873", "0.69624853", "0.6942552", "0.69211733", "0.6875774", "0.6875409", "0.6776536", "0.6738162", "0.67176...
0.7734906
0
Returns the atomic mass for a given atomic symbol.
def get_mass(atomic_symbol: str) -> float: if atomic_symbol in _masses.keys(): return _masses[atomic_symbol] else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_molecular_mass(symbols):\n\n mass = 0\n for atom in symbols:\n mass += atom_weigths[atom]\n\n return mass", "def mass(self):\n self.check_symbols()\n return self._tree_mass(self._tokentree())", "def getMolecularMass(self):\n dataDict = self.__dict__\n # get for...
[ "0.7345212", "0.72763354", "0.7144618", "0.70410585", "0.6991745", "0.65770125", "0.6542567", "0.65212345", "0.65208113", "0.6463491", "0.64285445", "0.6422744", "0.6374614", "0.6372728", "0.6372728", "0.6354212", "0.6195308", "0.6175607", "0.6109826", "0.6107706", "0.6084342...
0.86470944
0
Returns the longitudinal component (z) of the electric field
def osirisEzSlice(dump, theta=0., e0=1.0, modes=[0, 1, 2], path='./', x0=1.0, use2r=False): return __osirisLoadECylSlice(dump, '1', theta=theta, e0=e0, modes=modes, path=path, x0=x0, use2r=use2r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMagneticField(self, z):\n return float(self.solenoid.B_interp(z))", "def electric_field(self, xyz):\n dxyz = self.vector_distance(xyz)\n r = spatial.repeat_scalar(self.distance(xyz))\n kr = self.wavenumber*r\n ikr = 1j * kr\n\n front_term = (\n (1j * se...
[ "0.73889357", "0.68877256", "0.66581905", "0.6618951", "0.66184294", "0.66020435", "0.65795654", "0.6562936", "0.6562561", "0.65474516", "0.65279484", "0.65089005", "0.64862615", "0.6387878", "0.63754326", "0.63133025", "0.63085747", "0.6268714", "0.62677044", "0.62552255", "...
0.0
-1
Returns the Euclidean distance between the center of mass of this blob and the center of mass of other blob.
def distanceTo(self, other): result = (other._x - self._x) * (other._x - self._x) \ + (other._y - self._y) * (other._y - self._y) return result ** 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distance(self, other):\n return math.sqrt((self.center[0] - other.center[0]) ** 2 + (self.center[1] - other.center[1]) ** 2)", "def dist(self, other):\n return math.sqrt((self.x - other.x)**2 +\n (self.y - other.y)**2 +\n (self.z - other...
[ "0.7807972", "0.71320444", "0.70759076", "0.70759076", "0.6976365", "0.6960868", "0.69451004", "0.6942792", "0.6837552", "0.68210226", "0.6818428", "0.6787365", "0.67690986", "0.6752434", "0.6745343", "0.67136675", "0.6705356", "0.66564894", "0.66521347", "0.6651926", "0.6627...
0.644547
36
Returns a string representation of this blob.
def __str__(self): return '%d (%.4f, %.4f)' % (self._P, self._x, self._y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return bytes_to_string(self._bytes)", "def __str__(self):\n return bytes_to_str(bytes(self))", "def dumps(self) -> str:\n bits = dill.dumps(self)\n return base64.b64encode(bits).decode(\"ascii\")", "def as_string(self):\n return self.__repr__()", "def...
[ "0.7542156", "0.72625804", "0.71247613", "0.706831", "0.7036793", "0.70294684", "0.7009664", "0.70091146", "0.6973576", "0.69688904", "0.69646376", "0.6956953", "0.6956953", "0.6889316", "0.6883112", "0.68823504", "0.68807703", "0.68448913", "0.68268436", "0.6819091", "0.6809...
0.0
-1
Calculate the max of each of an activation's channels.
def activation_channels_max(activation): if activation.ndim == 4: featuremap_max_mat = activation.max(axis=(2, 3)) elif activation.ndim == 2: featuremap_max_mat = activation.max(axis=1) # batch x 1 else: raise ValueError("activation_channels_means: Unsupported shape: ".format(activa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_channelwise_max(grid_):\n return np.max(np.max(np.max(grid_, axis=0), axis=0), axis=0)", "def hopMax(channels, offset=0) :\n\tabschannels = abs(channels)\n\treturn (\n\t\tabschannels.max(axis=0),\n\t\tabschannels.argmax(axis=0)+offset,\n\t\t)", "def state_max(self) -> float:\n raise NotImple...
[ "0.73631144", "0.69676226", "0.6520885", "0.6394797", "0.63915086", "0.63900274", "0.6373252", "0.6362524", "0.63344884", "0.6332408", "0.63202804", "0.63201195", "0.6292718", "0.62659997", "0.6261992", "0.62268317", "0.6202593", "0.6202593", "0.6202593", "0.6202593", "0.6193...
0.76785797
0
Init the ship and set it's position
def __init__(self, ai_game): self.screen = ai_game.screen self.screen_rect = ai_game.screen.get_rect() self.settings = ai_game.settings # Load the ship image and get its rect self.image = pygame.transform.scale(pygame.image.load('images/astronaut_cat.bmp'), (100, 100)) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,ai_settings, screen):\n\t\tsuper(Ship,self).__init__()\n\t\tself.screen = screen\n\t\tself.ai_settings = ai_settings\n\t\t\n\t\t# Load ship and get its rect\n\t\tself.image = pygame.image.load('images/spaceship.bmp')\n\t\tself.image = pygame.transform.scale(self.image, (50,50))\n\t\tself.rect = s...
[ "0.75611776", "0.74861884", "0.7485746", "0.7485746", "0.74799126", "0.7402444", "0.7381929", "0.7374617", "0.7363442", "0.734303", "0.73323244", "0.7313293", "0.7295501", "0.72894585", "0.72684705", "0.7223836", "0.7179852", "0.7140805", "0.711099", "0.7065391", "0.70351166"...
0.6598252
37
Compute the prediction accuracy assuming perfect classification based on the gameboard labels (i.e. before the mislabeling of pixels), and assuming that abstentions are applied to mislabeled pixels only.
def perfect_acc(abst_setpoint, gameboard): correct_fraction = (gameboard.ncell - gameboard.pr_mislabel * gameboard.nnoisy) / gameboard.ncell predicted_fraction = 1.0 - abst_setpoint return np.minimum(1.0, correct_fraction/predicted_fraction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(pred, labels):\n pred = torch.sigmoid(pred)\n predicted = (pred > 0.5).int()\n correct = (predicted == labels).sum().item()\n return correct / labels.shape[0]", "def accuracy(predictions, labels):\n return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1)) / prediction...
[ "0.7687375", "0.7635693", "0.7551568", "0.753965", "0.75117606", "0.7478109", "0.74595076", "0.7420505", "0.74117285", "0.7406197", "0.738621", "0.73854035", "0.7368826", "0.7353392", "0.7348373", "0.73383814", "0.73097533", "0.72814095", "0.72730577", "0.7238431", "0.7236725...
0.0
-1
Compute the categorical accuracy for the predictions above the percentile threshold.
def compute_dnn_accuracy(y_true, y_pred, perc, tranquil=np.nan): max_logits = np.max(y_pred, axis=-1) i = np.where(max_logits >= np.percentile(max_logits, 100 - perc))[0] met = tf.keras.metrics.CategoricalAccuracy() met.update_state(y_true[i, :], y_pred[i, :]) return met.result().numpy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categorical_accuracy(preds, y):\n top_pred = preds.argmax(1, keepdim = True)\n correct = top_pred.eq(y.view_as(top_pred)).sum()\n acc = correct.float() / y.shape[0]\n return acc", "def accuracy(gt, pred):\n \n return np.mean(gt == pred)", "def accuracy_score(y_true, y_pred_proba, threshol...
[ "0.76287097", "0.73547596", "0.7288933", "0.7230265", "0.7222886", "0.7219989", "0.7210751", "0.71834266", "0.7173349", "0.71286565", "0.7127876", "0.711811", "0.70795226", "0.70609546", "0.70400226", "0.70259583", "0.70177567", "0.7009177", "0.6976436", "0.6969441", "0.69617...
0.7009869
17
Creates an app container based sandbox.
def CreateSandbox() -> Sandbox: global _sandbox_name if _sandbox_name is None: return NullSandbox() else: return AppContainerSandbox(_sandbox_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sandbox(name='healthybox'):\n sandbox = tempfile.mkdtemp(prefix=name)\n if not os.path.isdir(sandbox):\n os.mkdir(sandbox)\n\n return sandbox", "def sandbox(verbose, app, archive):\n return _deploy_in_mode(\n mode=\"sandbox\", verbose=verbose, log=log, app=app, archive=archiv...
[ "0.6834057", "0.68246406", "0.62970877", "0.62127465", "0.61584556", "0.6113662", "0.6098139", "0.6097987", "0.60902345", "0.6084158", "0.6069124", "0.6027871", "0.60230565", "0.6017236", "0.6003866", "0.5986684", "0.593042", "0.5829477", "0.5819514", "0.58125246", "0.5787239...
0.81505257
0
Return the data models header dictionary based on open data `dataset_model`. Returns a flat parameter dictionary used for CRDS bestrefs matching.
def _get_data_dict(dataset_model): header = dataset_model.to_flat_dict(include_arrays=False) return _clean_flat_dict(header)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_header(model_file, model_data):\n header = list()\n # GeoCSV header\n header.append('# dataset: {}\\n'.format(GEOCSV_VERSION))\n header.append('# created: {} UTC ({})\\n'.format(datetime.utcnow().strftime(\"%Y-%m-%d %H:%M:%S\"), SCRIPT))\n header.append('# netCDF_file: {}\\n'.format(os...
[ "0.71013683", "0.61621237", "0.5699891", "0.55552864", "0.5534038", "0.55332524", "0.5516341", "0.5508695", "0.55008596", "0.54910856", "0.5466097", "0.5416038", "0.53242475", "0.53180164", "0.53053784", "0.53044087", "0.53002405", "0.52946234", "0.5231523", "0.52279586", "0....
0.7111056
0
Gets a reference file from CRDS as a readable filelike object. The actual file may be optionally overridden.
def get_reference_file(dataset, reference_file_type, observatory=None, asn_exptypes=None): if isinstance(dataset, str): from jwst import datamodels with datamodels.open(dataset, asn_exptypes=asn_exptypes) as model: return get_multiple_reference_paths( model, [reference_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self, c_path):\n raise NotImplementedError", "def open(self):\n return File(open(self.get_path()), \"rb\")", "def fileobj(path_or_file, mode='r'):\n if isinstance(path_or_file, basestring):\n try:\n return open(path_or_file, mode)\n except:\n re...
[ "0.6609357", "0.6523083", "0.6196477", "0.6160547", "0.61535853", "0.61356753", "0.60982907", "0.6065362", "0.5979971", "0.5976008", "0.59754443", "0.59747726", "0.59595215", "0.59119624", "0.59050435", "0.5900054", "0.5881914", "0.5879565", "0.5876402", "0.58717316", "0.5855...
0.59991264
8
Returns the name of the override configuration parameter for the given reference file type.
def get_override_name(reference_file_type): if not re.match('^[_A-Za-z][_A-Za-z0-9]*$', reference_file_type): raise ValueError( "{0!r} is not a valid reference file type name. " "It must be an identifier".format(reference_file_type)) return "override_{0}".format(reference_file_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def override(self, default: Optional[str] = None) -> Optional[str]:\n return self.type_override if self.type_override else default", "def name(self):\n return f'{self._config[CONF_NAME]} {self._typeconf[\"name\"]}'", "def get_config_file_name(self):\n argv = sys.argv\n config_type =...
[ "0.60906863", "0.59806335", "0.59454674", "0.5642469", "0.5581362", "0.553366", "0.5434157", "0.54198843", "0.5416948", "0.5400928", "0.5391175", "0.53861606", "0.53712225", "0.53092176", "0.5271537", "0.52607954", "0.52570695", "0.5250729", "0.52208304", "0.52146745", "0.520...
0.7696321
0
Update alpha so that L2 regularization term/residual term ~ target_ratio
def update_alpha(self, squared_error, target_ratio=1e-8): x_tensors = self.x_tensors() reg = numpy.sum([squared_L2_norm(t) for t in x_tensors]) self.alpha = target_ratio * squared_error/reg return self.alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_alpha(model):\n a = model.params.alpha_prior[0]\n b = model.params.alpha_prior[1]\n\n alpha_old = model.params.alpha\n\n log_p_old = model.feat_alloc_dist.log_p(model.params)\n\n alpha_new = scipy.stats.gamma.rvs(a, scale=(1 / b))\n\n model.params.alpha = alpha_new\n\n log_p_new = m...
[ "0.6767738", "0.6254935", "0.60736775", "0.6016342", "0.60003495", "0.5965032", "0.5914822", "0.5914822", "0.59013945", "0.587536", "0.58424854", "0.58217764", "0.57871395", "0.57871395", "0.5786818", "0.576329", "0.5754882", "0.57457924", "0.5714368", "0.5704283", "0.5692983...
0.7240049
0
Check if the IP address is valid.
def valid_ip(ip_address, strict=True): import socket try: socket.inet_aton(ip_address) return True except socket.error: if strict: raise ValueError("Invalid IP address") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_ip(self, address):\r\n try:\r\n # Is this an valid ip address?\r\n ipaddr.IPNetwork(address)\r\n except ValueError:\r\n return False\r\n return True", "def checkIPValid(self, ipAddr):\n try:\n socket.inet_aton(ipAddr)\n ...
[ "0.87264526", "0.8612985", "0.8518473", "0.85039467", "0.8434054", "0.8332337", "0.8292483", "0.8265874", "0.8221214", "0.8147088", "0.80209625", "0.79717857", "0.7961593", "0.79388773", "0.7871126", "0.785514", "0.78422004", "0.78421474", "0.78331405", "0.7758562", "0.774117...
0.82987946
6
Set the log level.
def set_log_level(self, level): if level == 'info': level = logging.INFO if level == 'debug': level = logging.DEBUG if level == 'error': level = logging.ERROR self._log.setLevel(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setlevel(self, lvl):\n self.logger.setLevel(lvl)", "def level(self, log_level):\n self.logger.setLevel(log_level)", "def set_log_level(level):\n __log__.setLevel(level)", "def set_level(self, level: str):\n self._logger.setLevel(getattr(logging, level))", "def setLogLevel(se...
[ "0.8278434", "0.827287", "0.81975234", "0.81849635", "0.8056591", "0.8051466", "0.79607683", "0.7897868", "0.7891762", "0.7839134", "0.7819281", "0.77514726", "0.7748947", "0.7717125", "0.7659597", "0.759137", "0.75582075", "0.753076", "0.7409961", "0.73917747", "0.73696697",...
0.8300165
0
Liberally convert from hex string to binary string.
def _dehex(s): import re import binascii # Remove all non-hexadecimal digits s = re.sub(br'[^a-fA-F\d]', b'', s) # binscii.unhexlify works in Python 2 and Python 3 (unlike # thing.decode('hex')). return binascii.unhexlify(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __convertToBinaryStr(self, hex_str): \n final_bi_str = ''\n for c in hex_str:\n bi_str = bin(int(c, 16))[2:]\n if len(bi_str) != 4:\n bi_str = (4 - len(bi_str)%4)*'0' + bi_str\n final_bi_str += bi_str\n \n # sanity check\n i...
[ "0.80344826", "0.76596546", "0.74354875", "0.72615784", "0.71950406", "0.716125", "0.7134897", "0.7123435", "0.70408094", "0.6950405", "0.6944907", "0.68975365", "0.6881606", "0.6844457", "0.6832426", "0.68265486", "0.6801364", "0.67949456", "0.6715222", "0.6690651", "0.66871...
0.6428212
32
Return a request object of a GET request.
def _req_get(self, url: str): self._get_cookies() if not self._cookies: return r = reqtry.get(url, cookies=self._cookies, allow_redirects=False, timeout=(3, 3), tries=3, delay=1, backoff=1.5, jitter=(1, 1.5)) assert r.status_code == 200, f"Get request: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_request(url, params):\n request = requests.get(url, params=params)\n\n return request", "def _get(self, *args, **kwargs):\n return self._request('get', *args, **kwargs)", "def get(self, **kwargs):\r\n params = base.get_params(None, kwargs, serialize_param=serialize_param)\r\n ...
[ "0.7567471", "0.7374113", "0.7359712", "0.7359712", "0.7359712", "0.7359712", "0.7359712", "0.7359712", "0.7348352", "0.732073", "0.7297971", "0.72735435", "0.7224922", "0.71508145", "0.7147858", "0.707113", "0.70682496", "0.7047867", "0.704501", "0.7042746", "0.69991916", ...
0.0
-1
Return a dictionary of a Client Parent Control configuration.
def get_parent_control(self, mac: str) -> dict: return self._get_json(self._URLS['GetParentControl'] + mac)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parent_dic(self):\n d = {}\n for tier_ID in self.tier_hierarchy:\n for child in self.tier_hierarchy[tier_ID]:\n\n d[child[\"id\"]] = tier_ID\n self.child_parent_dic = d", "def _parents(self, prefix):\n if self.inherit:\n suffix = self.in...
[ "0.6136709", "0.60296476", "0.5993973", "0.59720546", "0.5955928", "0.5893259", "0.5870978", "0.58109003", "0.57764155", "0.5756731", "0.5750311", "0.5750311", "0.5738799", "0.57220966", "0.5654894", "0.5648989", "0.5626981", "0.56109995", "0.558254", "0.558254", "0.5575817",...
0.67865616
0
Renders the index page of the app.
def index(self): return render_template("{0}/index.html".format(self.__APP_DIR__))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\r\n return render_template('index.html')", "def index(self):\n\t\treturn render_template('ind...
[ "0.85512924", "0.85512924", "0.854952", "0.8543514", "0.8509415", "0.8454395", "0.8436509", "0.8392836", "0.8385963", "0.8385963", "0.8322365", "0.8300954", "0.8300954", "0.8300954", "0.8298317", "0.82829285", "0.82674044", "0.82574975", "0.82573366", "0.82566714", "0.8252403...
0.8138399
70
Renders the view requests page for the app. The function takes a parameter, index, which specifies the current index for the list of requests that is used in paginating requests. The template gets passed all uploads that are relevant for the current user, and pagination details.
def view_requests(self, index=0): all_uploads = self.get_uploads() num_to_display = 10 return render_template("{0}/view_requests.html".format(self.__APP_DIR__), uploads=all_uploads[index: num_to_display + index], pagination=paginate_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template(\"upload.html\")", "def main():\n page = get_page_arg()\n\n items = load_data(page)\n total_pages = get_total_pages()\n context = {\"current_page\": page,\n \"total_pages\": total_pages,\n \"items\": items}\n\n return render_temp...
[ "0.6345573", "0.62325263", "0.6194013", "0.61901236", "0.60309875", "0.60229963", "0.59468734", "0.5937259", "0.59302646", "0.59263796", "0.5924922", "0.592334", "0.59194577", "0.5915744", "0.59095603", "0.5893848", "0.58843654", "0.58830965", "0.58764756", "0.58764756", "0.5...
0.8639572
0
Returns a specific file from a request.
def download_file(self, net_id, request_id, file_name): current_user_roles = get_user_roles() if current_user_roles["STFADM"] or net_id == current_user.net_id: try: return send_from_directory("{0}/user_uploads/{1}/{2}/".format(self.__APP_PATH__, net_id, request_id), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file():\n fname = get_var(request, \"fname\")\n return open(fname).read()", "def get_file(self, path):\n file = self.get('data_request?id=file&parameters=%s' % path)\n return file", "def getfilefromPost(self, request, campo=None):\n return utilsForAll.getfilefromPost(request,...
[ "0.7514999", "0.7313401", "0.7282628", "0.67823", "0.67098606", "0.66515064", "0.66313905", "0.66006345", "0.6584379", "0.6538951", "0.65178645", "0.64948076", "0.64648235", "0.6436359", "0.6420393", "0.6388293", "0.6379102", "0.6377837", "0.63777274", "0.6369078", "0.6363115...
0.0
-1
This helper method filters requests based on the statuses that were selected. If a request matches any of the statuses specified then this method returns true.
def filter_by_status(x, _filter_status_list=None): if _filter_status_list: for filter_status in _filter_status_list: if x.get(filter_status, False): return True return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _matchStatus(self, status: int):\n return (status in self._allowedStatus['List']\n or (self._allowedStatus['Range']\n and (self._allowedStatus['Range'][0] <= status\n and status <= self._allowedStatus['Range'][1])))", "def filter_flag_present(self, req, qs)...
[ "0.6255176", "0.6241925", "0.6206748", "0.6094299", "0.6042681", "0.60302085", "0.60296047", "0.591354", "0.5886389", "0.56861544", "0.56077474", "0.5495946", "0.5474114", "0.547179", "0.547179", "0.5449511", "0.539938", "0.5370203", "0.53564334", "0.5354915", "0.52818507", ...
0.716965
0
Sorts requests by submission date. Datetime dates are used for sorting.
def sort_by_submission_date(x): return datetime.strptime("{0}-{1}-{2}".format(x["request_date"]["year"], x["request_date"]["month"], x["request_date"]["day"]), '%Y-%m-%d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_by_latest_activity(x):\n if len(x[\"history\"]) > 0:\n return datetime.strptime(x[\"history\"][-1][\"date\"], '%Y-%m-%d')\n return datetime.strptime(\"{0}-{1}-{2}\".format(x[\"request_date\"][\"year\"], x[\"request_date\"][\"month\"], x[\"request_date\"][\"day\"]), '%Y...
[ "0.63215494", "0.5893584", "0.5812213", "0.57752", "0.57317525", "0.5709708", "0.56736785", "0.5651528", "0.5606232", "0.55392724", "0.55151016", "0.55150914", "0.5504915", "0.5432235", "0.54043037", "0.54032487", "0.53835464", "0.5340727", "0.5326773", "0.5320368", "0.530209...
0.83892596
0
Get an item from an index and apply the transformations dinamically.
def __getitem__(self, index): if self.data is None: raise IndexError() if self.cache and index in self.cached_data: return self.cached_data[index] ex = self.data[index] if len(self.transform_hooks) > 0: ret = [] for field, cols in self.tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index: int) -> Any:\n img_id, image = super().__getitem__(index)\n image[\"imageId\"] = img_id\n if self._transform is not None:\n return self._transform(image)\n return image", "def get_item(self, index: int) -> _T:\n return self.index_to_item[...
[ "0.6827163", "0.66277707", "0.6503464", "0.6427489", "0.64050037", "0.6404129", "0.63919723", "0.634302", "0.6327069", "0.63200605", "0.62679607", "0.6261322", "0.62565386", "0.62260455", "0.6215842", "0.62011874", "0.61477196", "0.61337334", "0.6128532", "0.6128468", "0.6125...
0.66164964
2
Return the length of the dataview, ie the amount of examples it contains.
def __len__(self) -> int: if self.data is None: return 0 return len(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return self.data.num_samples", "def data_count(self):\n return(len(self.data))", "def size(self) -> int:\r\n return self.da.length()", "def __len__(self): \r\n length = len(self.data) - 2* self.skip_window\r\n #print ('length', length)\r\n ...
[ "0.7743075", "0.75641006", "0.7520403", "0.7514192", "0.7466716", "0.7466716", "0.7466716", "0.7466716", "0.7463347", "0.7440647", "0.7425814", "0.74085325", "0.7406429", "0.7395495", "0.73912305", "0.73912305", "0.7384987", "0.73788613", "0.7355602", "0.734469", "0.73404115"...
0.7076415
69
Returns the amount of columns in the tabular dataset
def cols(self) -> int: return self.train.cols()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getColumnCount(self) -> int:\n ...", "def get_table_total_cols(table_name):\n return table_spec[table_name]['number_of_columns']", "def ncolumns(self):\n return len(self.__column_list)", "def columns_count(self):\n if self.value.count != 0:\n return len(self.value[0])\n...
[ "0.8216218", "0.8103026", "0.8051882", "0.80486625", "0.80285573", "0.8014754", "0.7907233", "0.789774", "0.78885615", "0.7878697", "0.78611887", "0.785653", "0.7705796", "0.767059", "0.7635865", "0.76154965", "0.7601832", "0.7601247", "0.75836945", "0.7574417", "0.7533597", ...
0.7146662
33
Get the length of the dataset.
def __len__(self): return len(self.train) + len(self.val) + len(self.test)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self) -> int:\n return len(self.data)", "def __len__(self):\n return self._dataset.size(dirs=self._dirs)", "def getLen(self):\n return len(self.data)", "def length(self):\n return len(self.data)", "def length(self):\n return len(self.data)", "def length(self)...
[ "0.81695807", "0.8132053", "0.8120344", "0.8113011", "0.8113011", "0.8113011", "0.8095", "0.8090324", "0.8017467", "0.79916984", "0.79916984", "0.79916984", "0.79916984", "0.7965216", "0.7940359", "0.7929157", "0.79088104", "0.78975385", "0.78951997", "0.7878114", "0.78751826...
0.0
-1
Get the item at the given index.
def __getitem__(self, index): ceiling = len(self.train) if index < ceiling: return self.train[index] offset = ceiling ceiling += len(self.val) if index < ceiling: return self.val[index - offset] offset = ceiling ceiling += len(self.test) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, index: int) -> _T:\n return self.index_to_item[index]", "def get_by_index(self, index):\n if index > self.length - 1:\n return None\n else:\n return self.items[index]", "def get(self, index):\n self.__validate_index(index)\n return sel...
[ "0.90585554", "0.87073386", "0.853018", "0.84568286", "0.8370591", "0.8339085", "0.8307339", "0.8192717", "0.81261545", "0.80475384", "0.7978322", "0.79514426", "0.79514426", "0.79153425", "0.7893272", "0.7840749", "0.7825966", "0.77981144", "0.7770664", "0.7743545", "0.77419...
0.0
-1
Thrower Email Changes the email for the current signed in user
def throwerEmail_update(self, data, sesh): # Verify fields try: DictHelper.eval(data, ['email', 'email_passwd']) except ValueError as e: return Services.Effect(error=(1001, [(f, "missing") for f in e.args])) # Find the thrower oThrower = Thrower.get(sesh['thrower']['_id']) if not oThrower: return Servi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self, instance):\r\n return instance.user.email", "def log_useremail(self):\n return self.user.email", "def change_email(user):\n if 'research' in user.get_domains():\n domain = 'research'\n else: domain = 'academic'\n subject = \"ECE/CIS Account - Login Changed\"\n h...
[ "0.68527675", "0.6852403", "0.68267244", "0.6634271", "0.6606221", "0.65317", "0.65047735", "0.648546", "0.64123243", "0.64018655", "0.64018655", "0.64018655", "0.64018655", "0.64018655", "0.64018655", "0.64018655", "0.64018655", "0.639586", "0.6385675", "0.6381925", "0.63709...
0.66180664
4
return unit ar max
def getUmidadeArMax(self): return str(self.getWeather('umid-max')[:2]) + '%'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alturamax(gravedad, veli):\r\n #se realiza varias operacione para encontrar la altura maxima \r\n maxima=(veli/2)*(veli/gravedad)\r\n #se regresa el valor de maxima\r\n return maxima", "def get_unit(self, data, max=1.0):\n self.unitval = max\n for item in data:\n if isi...
[ "0.6865692", "0.6772808", "0.66283023", "0.6581159", "0.6445515", "0.64160794", "0.6322067", "0.6281881", "0.6280624", "0.6276812", "0.626841", "0.62449783", "0.6224158", "0.62036914", "0.6186334", "0.6157375", "0.6157375", "0.6157375", "0.6157375", "0.6157375", "0.6157375", ...
0.68784714
0
constructor que inicaliza las listas, puerto, ip
def __init__(self, PORT): self.server.bind(('0.0.0.0', PORT)) self.server.listen(10000) self.clients = [] self.rooms = [] self.aceptarClientes = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n list_1_ip_object_index=None,\n list_2_ip_object_index=None,\n list_3_ip_object_index=None,\n list_4_ip_object_index=None,\n list_5_ip_object_index=None,\n list_6_ip_object_index=None,\n list_7_ip_object_index=None,\n list_8_ip_o...
[ "0.6874955", "0.6768027", "0.6600252", "0.6220922", "0.6157869", "0.615488", "0.6140539", "0.6101861", "0.60906696", "0.60267425", "0.6021862", "0.5995524", "0.59304684", "0.5927725", "0.59174126", "0.5907317", "0.5905402", "0.5847415", "0.58428574", "0.58097047", "0.5792431"...
0.0
-1
Get words from text(symbols are excluded)
def get_words(text): only_words_text = re.compile(r'[^0-9^a-z^A-Z\s]').sub('', text) return only_words_text.split(' ')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(text):\n return re.compile('\\w+').findall(text)", "def words(self, text):\n return re.findall(r'\\w+', text)", "def _get_word_list(text):\n return re.findall('\\w+', text)", "def getWords(self, text):\n\t\ttextWithoutPunctuation = self.removePunctuation(text)\n\t\treturn [word for...
[ "0.865168", "0.84254634", "0.8312741", "0.8102591", "0.7809829", "0.77771413", "0.7759123", "0.7714965", "0.7625076", "0.75899994", "0.7588026", "0.7579311", "0.75580215", "0.7536277", "0.7527415", "0.74806255", "0.74806255", "0.74411994", "0.7416101", "0.74037486", "0.740229...
0.8566885
1
Returns the mean squared error between y_pred and y_true
def mean_squared_error(y_true, y_pred): mse = np.mean((y_true - y_pred)**2) return mse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(y_true, y_pred):\n\tmse = np.mean(np.power(y_true, y_pred, 2))\n\treturn mse", "def mean_squared_error(y_true, y_pred):\n mse = np.mean(np.power(y_true - y_pred, 2))\n return mse", "def error(self, y_true, y_pred):\n\n return mean_squared_error(y_true, y_pred)", "def mean_...
[ "0.88475394", "0.8828964", "0.8661993", "0.8530196", "0.84918606", "0.8467822", "0.84481364", "0.84110373", "0.83996624", "0.83951354", "0.8373771", "0.8237241", "0.8231998", "0.8216124", "0.80921715", "0.8037975", "0.80369306", "0.80289817", "0.8012308", "0.79710084", "0.795...
0.8856849
0
Calculates the l2 distance between two Numpy arrays
def euclidean_distance(x1, x2): return np.sqrt(np.sum(np.power(x1 - x2, 2)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_distance(v1, v2):\n\treturn np.linalg.norm(np.array(v1) - np.array(v2))", "def l2_distance(a, b):\n\n if a.shape[0] != b.shape[0]:\n raise ValueError(\"A and B should be of same dimensionality\")\n\n aa = np.sum(a**2, axis=0)\n bb = np.sum(b**2, axis=0)\n ab = np.dot(a.T, b)\n\n retu...
[ "0.7969215", "0.7692503", "0.76819515", "0.7631207", "0.7591296", "0.75474477", "0.7523988", "0.74907583", "0.73284787", "0.7286253", "0.7282458", "0.7277085", "0.7247283", "0.724618", "0.7226127", "0.721428", "0.7211818", "0.71856403", "0.7162269", "0.713763", "0.71372443", ...
0.6688125
91
Function is checking if input include any special character return boolean True or False
def is_special_char(user_input): # Expected special character list symbols = {'~', ':', "'", '+', '[', '\\', '@', '^', '{', '%', '(', '-', '"', '*', '|', ',', '&', '<', '`', '}', '.', '_', '=', ']', '!', '>', ';', '?', '#', '$', ')', '/'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_special_characters(string):\n check = [\"[\", \"@\", \"_\", \"!\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\", \"(\", \")\", \"<\", \">\",\n \"?\", \"/\", \"\\\\\", \"|\", \"}\", \"{\", \"~\", \":\", \"]\", \"'\"]\n\n return any(ext in string for ext in check)", "def check_input(input_s...
[ "0.7256763", "0.7221142", "0.7119753", "0.6960734", "0.6958965", "0.68960744", "0.6857785", "0.6816924", "0.6813341", "0.67343754", "0.6717701", "0.67074734", "0.6691673", "0.66795266", "0.66766864", "0.6674488", "0.66716987", "0.6662083", "0.66159546", "0.6615358", "0.658103...
0.74729747
0
If the queue is empty then we want to initialize the queue
def test_empty_queue(self): max_hour_count = (None, None, None) result = feature_5(self.deque, self.heap, self.expected_dict, self.top_n, max_hour_count, self.time_rollo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialization_with_empty_list_first_node_check():\n queue = Queue([])\n assert queue._queue.first_node is None", "def __init__(self) -> None:\n self._queue = []", "def make_empty_queue():\n return Queue(0, None, None)", "def __init__(self):\n self.queue = []\n self.que...
[ "0.753165", "0.7527498", "0.7438747", "0.74081594", "0.73568296", "0.73568296", "0.73568296", "0.73568296", "0.73568296", "0.734886", "0.7343002", "0.73271775", "0.73271775", "0.73267806", "0.73267806", "0.73103887", "0.72198254", "0.7211724", "0.7204803", "0.71970546", "0.71...
0.64182496
76
This is a helper method for creating a grid of the kernel's inputs. Use this helper rather than maually creating a meshgrid. The grid dimensions depend on the kernel's evaluation mode.
def _create_input_grid(self, x1, x2): return x1.unsqueeze(-2), x2.unsqueeze(-3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_grid(self, nx, ny):\n nx_vec = np.arange(nx)\n ny_vec = np.arange(ny)\n yv, xv = np.meshgrid(ny_vec, nx_vec)\n grid = np.stack((yv, xv), axis=2)\n grid = grid.reshape(1, 1, ny, nx, 2)\n return grid", "def gen_grids(self):\n self.dx = self.grid_width / sel...
[ "0.7042662", "0.67295456", "0.66665596", "0.65888655", "0.6579004", "0.6433366", "0.64206505", "0.6366932", "0.635032", "0.6329233", "0.6327623", "0.63242453", "0.62931854", "0.6286689", "0.6280161", "0.6262229", "0.6255247", "0.62317663", "0.6227382", "0.6216915", "0.6195333...
0.64822084
5
Bottleneck residual unit variant with BN before convolutions. This is the full preactivation residual unit variant proposed in [2]. See Fig. 1(b) of [2] for its definition. Note that we use here the bottleneck variant which has an extra bottleneck layer. When putting together two consecutive ResNet blocks that use this...
def bottleneck_v1(inputs, depth, depth_bottleneck, stride, rate=1, name=None, **kwargs): is_training = kwargs.get('is_training') reuse = kwargs.get('reuse') with tf.variable_scope(name, 'bottleneck_v2', [inputs]): depth_in = util.last_dimension(inputs.get_shape(), min_rank=4) preact = batch_norm( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bottleneck_residual(self,\n x,\n in_filter,\n out_filter,\n stride,\n activate_before_residual=False):\n if activate_before_residual:\n with tf.variable_scope('common_bn_re...
[ "0.7332736", "0.7066272", "0.7044891", "0.67779213", "0.6699005", "0.6681205", "0.6638205", "0.64586157", "0.6414224", "0.6383163", "0.63176984", "0.6307312", "0.6259222", "0.62562406", "0.6249689", "0.6249598", "0.62478936", "0.62389684", "0.6228316", "0.61868954", "0.616125...
0.55421114
80
Bottleneck residual unit variant with BN before convolutions. This is the full preactivation residual unit variant proposed in [2]. See Fig. 1(b) of [2] for its definition. Note that we use here the bottleneck variant which has an extra bottleneck layer. When putting together two consecutive ResNet blocks that use this...
def bottleneck_v2(inputs, depth, depth_bottleneck, stride, rate=1, name=None, **kwargs): is_training = kwargs.get('is_training') reuse = kwargs.get('reuse') with tf.variable_scope(name, 'bottleneck_v2', [inputs]): depth_in = util.last_dimension(inputs.get_shape(), min_rank=4) preact = batch_norm( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bottleneck_residual(self,\n x,\n in_filter,\n out_filter,\n stride,\n activate_before_residual=False):\n if activate_before_residual:\n with tf.variable_scope('common_bn_re...
[ "0.7333815", "0.70671225", "0.70450723", "0.6777166", "0.66987926", "0.66815686", "0.6637738", "0.6458818", "0.6414843", "0.63821983", "0.6317906", "0.63066065", "0.6259691", "0.6256471", "0.6249884", "0.62496805", "0.6248292", "0.62388355", "0.62286425", "0.6188617", "0.6162...
0.5479004
88
Adds a PVA block layer. convolution followed by crelu and scaling.
def pva_block_v1(x, num_units, name='pva_block_v1', **kwargs): trainable = kwargs.get('trainable') regularizer = kwargs.get('w_regularizer') activation = kwargs.get('activation') kwargs.update({'activation': None}) with tf.variable_scope(name): output = conv2d(x, num_units, **kwargs) output = crelu(ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)", "def pva_block_v2(x, num_units, name='pva_block_v2', **kwargs):\n trainable = kwargs.get('trainable')\n reuse = kwargs.get('reuse')\n is_training = kwargs.get('is_training')...
[ "0.6129614", "0.6090554", "0.60833335", "0.60111904", "0.59266555", "0.5752631", "0.5666569", "0.56405514", "0.5621983", "0.5577849", "0.554003", "0.54940945", "0.5484048", "0.54724604", "0.5467948", "0.5458898", "0.54493576", "0.5426051", "0.5426051", "0.5425548", "0.5422706...
0.6284178
0
Adds a PVA block v2 layer. first batch normalization followed by crelu and scaling, convolution is applied after scalling.
def pva_block_v2(x, num_units, name='pva_block_v2', **kwargs): trainable = kwargs.get('trainable') reuse = kwargs.get('reuse') is_training = kwargs.get('is_training') regularizer = kwargs.get('w_regularizer') activation = kwargs.get('activation') kwargs.update({'activation': None}) kwargs.update({'batch_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vgg_block(input_vec, filters=32, l2_weight_regulaizer=0.0002, weight_initializer=\"he_uniform\", kernel=(3, 3)):\n\n with tf.keras.backend.name_scope(\"VGG_Block\"):\n conv3x3_1 = Conv2D(filters, kernel, padding='same', activation='relu', kernel_initializer=weight_initializer,\n ...
[ "0.62135154", "0.60568565", "0.5972858", "0.5923678", "0.5879215", "0.5852078", "0.58150256", "0.5692932", "0.56884766", "0.5643621", "0.5642492", "0.56332994", "0.5625387", "0.5617882", "0.5606574", "0.5606574", "0.5597172", "0.55697113", "0.5552557", "0.5550725", "0.5546037...
0.6632591
0
Layer to calculate radial basis function 'embeddings' for a continuous input variable. The width and location of each bin can be optionally trained. Essentially equivalent to a 1hot embedding for a continuous variable.
def __init__( self, dimension=128, init_gap=10, init_max_distance=7, trainable=False ): super(RBFExpansion, self).__init__() self.init_gap = init_gap self.init_max_distance = init_max_distance self.dimension = dimension self.trainable = trainable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_embedding(self):\n #with tf.variable_scope(\"RNN\", reuse = tf.AUTO_REUSE):\n embeddings = tf.get_variable(\"embeddings\", initializer = self.pretrained_embeddings,trainable=True)\n inputs = self.input_placeholder\n inputs = tf.reshape(inputs, [self.config.batch_size, -1 , self....
[ "0.604187", "0.5929914", "0.58310133", "0.58093643", "0.56199175", "0.54835474", "0.5472895", "0.5469543", "0.5397126", "0.5361042", "0.53346705", "0.5329709", "0.5304453", "0.5294443", "0.52933306", "0.52910703", "0.52627254", "0.52215666", "0.52139795", "0.51656425", "0.516...
0.0
-1
Sets up device environment.
def SetupEnvironment(self): self._adb.RunShellCommand('chmod 777 /data/local/tmp') self._adb.RunShellCommand('setenforce 0') for prop in self._wrap_properties: self._adb.RunShellCommand('setprop %s "logwrapper %s"' % ( prop, self.GetTestWrapper())) SetChromeTimeoutScale(self._adb, self.G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpEnv(self):\n \n robot = Robot('atrv')\n\n pose = Sensor('pose')\n robot.append(pose)\n pose.configure_mw('yarp')\n\n motion = Actuator('v_omega')\n robot.append(motion)\n motion.configure_mw('yarp')\n \n env = Environment('indoors-1/ind...
[ "0.71320033", "0.6922998", "0.68095523", "0.68054736", "0.67522305", "0.6696203", "0.6587383", "0.65828747", "0.6556088", "0.6541673", "0.6539371", "0.64924264", "0.6492055", "0.64569205", "0.6446064", "0.6430825", "0.637347", "0.63644195", "0.63602984", "0.62851787", "0.6248...
0.65250343
11
State vectors as 1D array of size 3N
def position_sv(self): return self._state_vectors.reshape((self.n * 3,), order='F')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vector(self): \n #print(self.state)\n '''\n print(\"\"\"\n Price {}\n Last Price {}\n Last Period Transaction {}\n Last Transaction {}\n Las Value {}\n Last day {}\n Last hour {}\n Last minute {}\n...
[ "0.70832676", "0.7023592", "0.66366434", "0.65568405", "0.64776367", "0.64745796", "0.6422134", "0.6352563", "0.63280845", "0.6286224", "0.6264996", "0.6198908", "0.6181501", "0.61255336", "0.60811406", "0.60719967", "0.60489947", "0.6041368", "0.6022412", "0.6015587", "0.598...
0.6931684
2
Initialize the general sar orbit object using the provided input parameters
def __init__(self, time_axis: Union[np.ndarray, are_ax.Axis], state_vectors: np.ndarray): if isinstance(time_axis, np.ndarray): if time_axis.dtype == PreciseDateTime: time_axis_start = time_axis[0] relative_time_axis = (time_axis - time_axis_start).astype(float) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._read_calibration_data()\n self.configure_sensor(\n TemperatureOversamplings.x08,\n PressureOversamplings.x16,\n HumidityOversamplings.x08,\n IIRFilterCoefficients.FC_003,\n 250,\n 250)", "def __init__(self...
[ "0.6631818", "0.66140443", "0.6551585", "0.65013504", "0.6431743", "0.6402836", "0.63995343", "0.632741", "0.6297609", "0.6293944", "0.62937844", "0.62876314", "0.6277481", "0.62693286", "0.6240606", "0.6214705", "0.6206849", "0.62025726", "0.619734", "0.6187052", "0.6159754"...
0.0
-1
Loads the item of the given index.
def __getitem__(self, idx): # Get the information from the init function return self.edges_s[idx], self.labels[idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\n item = self.data[index]\n return item", "def get_item(self, index: int) -> _T:\n return self.index_to_item[index]", "def __getitem__ (self, idx):\n return self.loaded_data[idx]", "def get_item(self, index):\n if index == 0:\n raise...
[ "0.70526403", "0.6870253", "0.6836088", "0.67920536", "0.6739406", "0.67367566", "0.6562299", "0.65513265", "0.654924", "0.653213", "0.6515712", "0.6488234", "0.64740115", "0.64732313", "0.64641315", "0.64410526", "0.6433581", "0.6362544", "0.63617224", "0.6350748", "0.631895...
0.0
-1
Test `OpenGridBaseWorkChain.handle_output_stdout_incomplete` for restarting from OOM.
def test_handle_output_stdout_incomplete( generate_workchain_open_grid_base, generate_inputs_open_grid_base, npool_key, npool_value, ): from aiida import orm inputs = {"open_grid": generate_inputs_open_grid_base()} # E.g. when number of MPI procs = 4, the next trial is 2 inputs["open_gr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_none(self):\n output, _err = self.executor.prepare('do-stuff', 'special', verbose=None).batch()\n self.assertEqual(output, 'doing stuff slightly more verbosely')", "def test_console_output_size_flush(self):\n self.render_config_template(\n console={\n \"pre...
[ "0.59802115", "0.5895854", "0.5809445", "0.5809445", "0.5809445", "0.5809445", "0.57505584", "0.5676154", "0.5675046", "0.56318027", "0.5609052", "0.55714715", "0.55437577", "0.55437577", "0.5532312", "0.5527179", "0.5515466", "0.5497685", "0.54740006", "0.5465634", "0.545270...
0.8128536
0
Simple function to take a date in the format %m/%d/%Y and convert it to a format that is used on Southwest's calendar picker. For example, given date 05/23/2019 return may23 This is required to make sure that we pick the correct date on the date picker for departure and return date.
def format_my_date(mydate): date = mydate date = date.split('/') day = date[1] monthDict = {1:'january', 2:'february', 3:'march', 4:'april', 5:'may', 6:'june', 7:'july', 8:'august', 9:'september', 10:'october', 11:'november', 12:'december'} month = monthDict[int(date[0])] retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_date(date):\n if type(date) == str:\n return date\n\n formatted_string = date.strftime(\"%d/%m/%Y\")\n\n return formatted_string", "def str2date(date):\n return datetime.datetime.strptime(date, \"%m/%d/%Y\").date()", "def format_date(date):\n try:\n start_date = datet...
[ "0.71254903", "0.69735783", "0.69528776", "0.6937843", "0.6928612", "0.6851561", "0.68089473", "0.67904204", "0.6775161", "0.67411494", "0.6691409", "0.66814643", "0.66386306", "0.65105385", "0.64742213", "0.6467827", "0.6434688", "0.6421535", "0.64129543", "0.6396277", "0.63...
0.5753126
56
Simple function to take a date in the format %m/%d/%Y and return a shortened version with the last 2 digits of the year along with the day of the week. For example, given departure 05/23/2019 return 5/23/19 Thursday This is used to validate any date printed on Southwest's page in the format like 5/23/19 Thursday.
def date_with_day_of_week_appended(mydate): import datetime month, day, year = (int(x) for x in mydate.split('/')) shortened_year = abs(year) % 100 day_of_week = datetime.date(year, month, day).strftime("%A") return "%s/%s/%s %s" % (month,day,shortened_year, day_of_week)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_date(year: str, week: str):\n date = datetime.fromisocalendar(int(year), int(week), 1)\n return date.strftime(\"%m/%d/%YZ\")", "def fixstartdate(startdate):\n if not startdate: return \"01/01/2017\"\n s = str(startdate)\n d,m,y = [max(dt,1) for dt in [int(s[6:8]),int(s[4:6]),int(s[:4])...
[ "0.6604607", "0.63272864", "0.6287838", "0.6253973", "0.6251153", "0.61900246", "0.6173367", "0.61500144", "0.6138438", "0.61004615", "0.608483", "0.6074327", "0.6002055", "0.5981537", "0.59683365", "0.59673285", "0.59627604", "0.5959348", "0.5958266", "0.595051", "0.5922161"...
0.7113302
0
Get a copy of this bucket's entries in sorted order
def getSorted(self): return sorted(self.contacts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(self):\n return sorted(self.__entries.keys())", "def entries(self):\n return [self._entries[key] for key in self._order]", "def get_all_sorted(self):\n self.sort_and_reduce()\n return self.data", "def order_entries(self):\n for key in self.entries.keys():\n ...
[ "0.67303246", "0.6650146", "0.65499985", "0.62093717", "0.6196583", "0.6162412", "0.6102883", "0.5898533", "0.5895788", "0.5884735", "0.58505136", "0.5769235", "0.57305574", "0.57190645", "0.5718595", "0.56690973", "0.5632218", "0.56280565", "0.56238544", "0.5607272", "0.5584...
0.53684974
47
Only allow members to see the detail page if it is for themselves, or they are staffers
def test_func(self): member_to_view = self.get_object() is_self = self.request.user.rfid == member_to_view.rfid view_others = self.request.user.has_permission("core.view_member") return view_others or is_self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_staff(self):\r\n return self.is_admin", "def is_staff(self):\n\t\treturn self.is_admin", "def is_staff(self):\n return self.is_admin", "def is_staff(self):\n return self.is_admin", "def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)", "def get_q...
[ "0.6990299", "0.6787267", "0.67341506", "0.67341506", "0.6634007", "0.660387", "0.6562672", "0.65576696", "0.6530729", "0.65304166", "0.6450031", "0.64279974", "0.63973415", "0.6379234", "0.635985", "0.6337809", "0.6333959", "0.6323154", "0.63076735", "0.6295644", "0.62949944...
0.67779857
2
Only allow members to see the detail page if it is for themselves, or they are staffers
def test_func(self): return self.request.user.has_permission("core.view_staffer")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_staff(self):\r\n return self.is_admin", "def is_staff(self):\n\t\treturn self.is_admin", "def test_func(self):\n member_to_view = self.get_object()\n is_self = self.request.user.rfid == member_to_view.rfid\n view_others = self.request.user.has_permission(\"core.view_member\")\n...
[ "0.69912416", "0.6788225", "0.6778714", "0.67351466", "0.67351466", "0.663505", "0.6604346", "0.656369", "0.65579987", "0.65307796", "0.6530384", "0.6450154", "0.6427798", "0.6397484", "0.6380303", "0.6359379", "0.63378483", "0.6334355", "0.63233006", "0.6307134", "0.6295686"...
0.0
-1
Initializes a new MinHeap
def __init__(self, start_heap=None): self.heap = DynamicArray() # populate MinHeap with initial values if start_heap: for node in start_heap: self.add(node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n # Initialize a new binary min heap to store the items\n self.heap = MinHeap()", "def __init__(self):\n self.min_heap = []\n self.max_heap = []\n self.size_max, self.size_min = 0, 0", "def __init__(self):\n self.maxHeap = []\n self.minHead =...
[ "0.8138042", "0.7661201", "0.76074666", "0.75257117", "0.74794716", "0.7433302", "0.741263", "0.7393429", "0.73932743", "0.736134", "0.73327655", "0.72667897", "0.7227931", "0.72025937", "0.71662766", "0.7151976", "0.71483403", "0.7008933", "0.699537", "0.69641817", "0.696418...
0.8022516
1
Return True if no elements in the heap, False otherwise
def is_empty(self) -> bool: return self.heap.length() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(heap):\n return size(heap) == 0", "def empty(self):\n return 0 >= len(self._heap)", "def is_empty(self):\n return len(self.__heap) == 0", "def is_empty(self):\n return self.heap_size <= 0", "def is_empty(self):\n return not bool(self._heap)", "def is_empty(self):\...
[ "0.85082734", "0.8071228", "0.79873717", "0.79226214", "0.7916409", "0.75379765", "0.7280966", "0.7248566", "0.7239333", "0.72100246", "0.7026123", "0.68884176", "0.6807475", "0.6800937", "0.6788051", "0.67764753", "0.673138", "0.6705951", "0.6688786", "0.66759294", "0.666420...
0.7921232
4
Builds a proper MinHeap from Dynamic Array
def build_heap(self, da: DynamicArray) -> None: # clear current content for _ in range(self.heap.length()): self.heap.pop() # create copy array for i in range(da.length()): self.heap.append(da.get_at_index(i)) # arr = copy array arr = self.heap ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_heap(self, da: DynamicArray) -> None:\n da2=DynamicArray()\n #We want da to not change so we need to create a hard copy of da, not tied to the same memory address\n #this operation is n\n for x in range(0,da.length()):\n da_int=da.get_at_index(x)\n da2.ap...
[ "0.68904716", "0.6887649", "0.6870457", "0.6868342", "0.6828333", "0.67776215", "0.6771721", "0.67297566", "0.6692977", "0.65436363", "0.6437471", "0.6431975", "0.6364772", "0.63125503", "0.63092345", "0.6195023", "0.61876774", "0.615912", "0.61181957", "0.61160433", "0.61145...
0.6238917
15
The constructor class for the Block group
def __init__(self, total_length:int, initial_y:int, screen, number:int, debug:bool = False): #Call the superclass super().__init__() #Create the group of blocks based on x and y and add them to the group for k in range(number): for i in range(-1,2): for j in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, lvl, block_dimensions=DEFAULT_BLOCK_SIZE, group_name=DEFAULT_GROUP_NAME):\n self.lvl = lvl\n self.block_dimensions = block_dimensions\n self.group_name = group_name", "def __init__(self, in_channels, out_channels, group=1):\n super(Block, self).__init__()\n i...
[ "0.7417771", "0.7272517", "0.7146111", "0.70074266", "0.69225055", "0.69084555", "0.68989694", "0.66611356", "0.6651061", "0.6649609", "0.6649314", "0.6636868", "0.6586277", "0.65811247", "0.6557748", "0.6536704", "0.6520757", "0.65130234", "0.65042573", "0.6477216", "0.64749...
0.7031582
3
Initialize the colormap "jet" from matplotlib, Return function that takes risk and returns RGB color for use with scatter() in matplotlib
def create_riskmap(colormap): # Note that this code is tricky - remember to return a lambda expression risk_norm = mpl.colors.Normalize(vmin = MIN_LOG_RISK, vmax = MAX_LOG_RISK) color_mapper = mpl.cm.ScalarMappable(norm = risk_norm, cmap = colormap) return lambda risk : color_mapper.to_rgba(math.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)", "def applyJET(img):\n\treturn applyColorMap(img, \"jet\")", "def cmap(num,cmap = plt.cm.gist_earth_r):\n return cmap(np.linspace(0, 1, num))", "def uniqueish_color():\n return plt.cm.gist_ncar(np.random.random())", "def uniqueish_col...
[ "0.68552744", "0.66484815", "0.6433616", "0.6294446", "0.62684035", "0.6191598", "0.61673045", "0.6081824", "0.6069737", "0.60398173", "0.6025857", "0.6025857", "0.59889996", "0.59721375", "0.59721375", "0.59721375", "0.59221244", "0.5890712", "0.58846146", "0.5834934", "0.58...
0.6389171
3
Get the path of a file for MPIESM standard output file names and directory.
def get_path( dir_base_experiment: str = "/work/bm1124/m300086/CMIP6/experiments", member: int = 1, init: int = 1960, model: str = "hamocc", output_stream: str = "monitoring_ym", timestr: str = "*1231", ending: str = "nc", ) -> str: # get experiment_id dirs = _os.listdir(dir_base_exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_path():\n return os.getcwd() + \"/output/\"", "def getOutputFile(fname):\n return os.path.join(Configurations.getOutputDir(), fname)", "def output_path(self):\r\n return '%s/%s' % (os.path.abspath(os.path.dirname(__file__) + 'outputs'),\r\n self.identifi...
[ "0.7153517", "0.6796124", "0.6741091", "0.6618549", "0.6589147", "0.6576297", "0.6544177", "0.6541542", "0.64804375", "0.6470711", "0.6420478", "0.6407216", "0.6289064", "0.6287215", "0.6283947", "0.6279727", "0.6215009", "0.6195875", "0.61781067", "0.6169501", "0.61617553", ...
0.0
-1
Returns the ELO expected value of the match against an other player (0 means a guaranteed loss, 1 means a guaranteed win)
def expected_result(self, other): return float(1) / (1 + math.pow(10, float(other.elo - self.elo) / DIVIDER))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlayerCMP(player_x, player_y):\n\n if player_x.GetElo() > player_y.GetElo():\n return -1\n elif player_y.GetElo() > player_x.GetElo():\n return 1\n else:\n return 0", "def get_elo_from_player(player):\r\n return player.elo.lower()", "def other(player):\n return 1 - playe...
[ "0.6709805", "0.6676525", "0.66024834", "0.66024834", "0.66024834", "0.65381855", "0.648289", "0.6462447", "0.6462263", "0.64591944", "0.64536715", "0.64520943", "0.6422514", "0.6360007", "0.6336324", "0.6313029", "0.62814945", "0.62100196", "0.6180012", "0.61767596", "0.6156...
0.646275
7
Higherorder function, returning a policy loading function.
def _load_stable_baselines( cls: Type[on_policy_algorithm.OnPolicyAlgorithm], policy_attr: str ) -> PolicyLoaderFn: def f(path: str, venv: vec_env.VecEnv) -> policies.BasePolicy: """Loads a policy saved to path, for environment env.""" logging.info(f"Loading Stable Baselines policy for '{cls}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loading_function(function):\n def call_with_loaded_data(hash, loader):\n data = loader.load(hash)\n return function(data)\n call_with_loaded_data.__name__ = function.__name__\n call_with_loaded_data.__qualname__ = function.__qualname__\n return call_with_loaded_data", "def create_gr...
[ "0.60893035", "0.58315593", "0.5740895", "0.5461275", "0.5454066", "0.5421325", "0.5421325", "0.5421325", "0.53855544", "0.5261313", "0.5248539", "0.52041316", "0.51650625", "0.5108163", "0.50889724", "0.508234", "0.5076596", "0.50548494", "0.5052046", "0.5050324", "0.5050324...
0.5692406
3
Loads a policy saved to path, for environment env.
def f(path: str, venv: vec_env.VecEnv) -> policies.BasePolicy: logging.info(f"Loading Stable Baselines policy for '{cls}' from '{path}'") model_path = os.path.join(path, "model.pkl") model = cls.load(model_path, env=venv) policy = getattr(model, policy_attr) normalize_path = os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_policy(self, policy_path, tracker):\r\n if not os.path.exists(policy_path):\r\n return {}\r\n try:\r\n with open(policy_path) as f:\r\n return json.load(f)\r\n except (IOError, ValueError) as err:\r\n msg = \"ERROR: loading course policy...
[ "0.7414811", "0.65774673", "0.6406888", "0.6401563", "0.6382867", "0.6327698", "0.6076653", "0.5990476", "0.5976755", "0.5975665", "0.5800865", "0.5797894", "0.56849444", "0.564223", "0.56010044", "0.5599212", "0.55744946", "0.5493853", "0.5479864", "0.5478152", "0.5458101", ...
0.6978996
1
Set value on message.
def __set__(self, message_instance, value): # Reaches in to message instance directly to assign to private tags. if value is None: if self.repeated: raise ValidationError( 'May not assign None to repeated field %s' % self.name) else: message_instance._Message__tags.pop(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_message(self, value):\n self.__message = value", "def value(self, value):\n self.set_data(value)", "def set_value(self, value):\n self.value = str(value)", "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n self.value = value", "...
[ "0.7928963", "0.734428", "0.7116324", "0.7107831", "0.7107831", "0.7107831", "0.71054506", "0.7034611", "0.70327044", "0.6990884", "0.6974681", "0.6974681", "0.6974681", "0.6974681", "0.6974681", "0.6974681", "0.6969228", "0.6961439", "0.6943658", "0.6897801", "0.6848779", ...
0.6532119
58
Validate value as assigned to field default field. Some fields may allow for delayed resolution of default types necessary in the case of circular definition references. In this case, the default value might be a place holder that is resolved when needed after all the message classes are defined.
def validate_default_element(self, value): return self.validate_element(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_default_value(self):\n if self.has_default_value:\n if not self.is_valid_value(self.default):\n raise AttributeSchemaError(\n \"Default value '%s' is not compliant with the schema\"\n )", "def validate_default(self, value):\n retu...
[ "0.6998876", "0.69897896", "0.6927871", "0.6890851", "0.6636045", "0.6613414", "0.6554747", "0.64965594", "0.64884216", "0.64879835", "0.6462795", "0.6447667", "0.6435045", "0.63757527", "0.6283974", "0.6259122", "0.6259122", "0.6224417", "0.6217464", "0.62049997", "0.6201891...
0.5989992
33
Validate default value assigned to field.
def validate_default(self, value): return self.__validate(value, self.validate_default_element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_default_value(self):\n if self.has_default_value:\n if not self.is_valid_value(self.default):\n raise AttributeSchemaError(\n \"Default value '%s' is not compliant with the schema\"\n )", "def validate_default(self, value):\n ...
[ "0.81868947", "0.78467256", "0.7230786", "0.7230786", "0.7109969", "0.69292593", "0.69249916", "0.68446213", "0.67579883", "0.6724588", "0.6722898", "0.672073", "0.6611115", "0.6544696", "0.6541936", "0.65011966", "0.6474088", "0.6422759", "0.6381658", "0.63445455", "0.631911...
0.79932135
1
Get Message definition that contains this Field definition.
def message_definition(self): try: return self._message_definition() except AttributeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_definition(self):\n try:\n return self._message_definition()\n except AttributeError:\n return None", "def message_definition(cls):\n try:\n return cls._message_definition()\n except AttributeError:\n return None", "def custom_...
[ "0.8126758", "0.8051696", "0.66247123", "0.6446697", "0.640234", "0.63325983", "0.6328311", "0.6266838", "0.6247716", "0.62363875", "0.62211967", "0.6215417", "0.6215417", "0.61748254", "0.6121513", "0.61171836", "0.61171836", "0.60863113", "0.6049366", "0.60237", "0.5932186"...
0.7940663
2
Updates the model using backpropagation with given input and target tensors.
def update( self, batch: ModelInput, optimizer: torch.optim.Optimizer, target: Optional[torch.Tensor] = None, idx=None, next_obs=None, ) -> float: optimizer = cast(torch.optim.Optimizer, optimizer) self.train() optimizer.zero_grad() los...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backPropagate(self, targets):\n if len(targets) != self.output:\n raise ValueError('NOT MATCH ERROR -- output number!')\n\n # calculate error terms for output\n # the delta tell you which direction to change the weights\n output_deltas = [0.0] * self.output\n for k...
[ "0.72327346", "0.70811176", "0.70322686", "0.68825775", "0.6858759", "0.6743159", "0.67131233", "0.6700937", "0.66958886", "0.6686108", "0.6683161", "0.66648644", "0.66299844", "0.6618377", "0.6610922", "0.65944546", "0.6590553", "0.6571502", "0.6537369", "0.6534574", "0.6531...
0.0
-1
Initializes any internal dependent state when using the model for simulation. Initializes model indices for "fixed_model" propagation method a bootstrapped ensemble with TSinf propagation).
def reset( # type: ignore self, x: torch.Tensor, rng: Optional[torch.Generator] = None ) -> torch.Tensor: assert rng is not None self._propagation_indices = self._sample_propagation_indices(x.shape[0], rng) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_model(rngs):\n init_model_state, init_params = model_def.init(\n rngs, *dummy_input, train=False, debug=False).pop('params')\n # Set bias in the head to low value, such that loss is small initially.\n if config.get('init_head_bias', None) is not None:\n init_params = flax.core....
[ "0.652693", "0.6328387", "0.6324066", "0.62681586", "0.61783516", "0.61739904", "0.6083125", "0.6029062", "0.60235035", "0.6021824", "0.6011901", "0.5978822", "0.5972138", "0.5965246", "0.5923111", "0.5903539", "0.5882372", "0.58694667", "0.58479404", "0.5846906", "0.58439827...
0.0
-1
The function is used to design anchor boxes by ourselves as long as you provide the scale and aspect of anchor boxes.
def generate_anchor(input_size, stride, anchor_scale, anchor_aspect): assert len(anchor_scale) == len(anchor_aspect) h, w = input_size hs, ws = h // stride, w // stride S_fmap = hs * ws total_anchor_size = [] for ab_scale, aspect_ratio in zip(anchor_scale, anchor_aspect): for a in aspect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_anchor_boxes(image_size, feature_map_size, sizes, scales):\n image_height, image_width = image_size\n fm_height, fm_width = feature_map_size\n height_stride = int(image_height / fm_height)\n width_stride = int(image_width / fm_width)\n\n # Compose horizontal and vertical positions into ...
[ "0.7178802", "0.6959812", "0.6761317", "0.6718242", "0.66397655", "0.6631975", "0.66304106", "0.6594992", "0.6571936", "0.6553685", "0.6518313", "0.65107256", "0.64655656", "0.64655656", "0.6464569", "0.6410156", "0.6396587", "0.6389344", "0.6389344", "0.636538", "0.63456744"...
0.6253233
21
Return an estimation of the amount of times `x` has ocurred. The returned value always overestimates the real value.
def query(self, x): return min(table[i] for table, i in zip(self.tables, count_min_sketch_hash(x, self.m, self.d)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fluence(self, range_x):\n time_step = np.diff(range_x)\n val_square = np.square(np.abs(self(range_x)))\n res = np.sum(np.array(val_square[:-1] * time_step))\n res = res/(range_x[-1] - range_x[0])\n return res", "def improvement(x):\n Y = 20*(1-np.exp(-x/5.0))\n return...
[ "0.63271266", "0.62677306", "0.6266995", "0.6266995", "0.6099454", "0.60895723", "0.6057306", "0.604135", "0.6037878", "0.59514254", "0.59514254", "0.5948263", "0.5913063", "0.5862836", "0.58481437", "0.5821307", "0.5819277", "0.5790484", "0.5775076", "0.57712895", "0.5763688...
0.0
-1
Restore the training state from the backed up checkpoint file.
def restore(self): # For multi-worker training, it should not restore a model in certain # worker setting (e.g. non-chief worker in ParameterServerStrategy). # pylint: disable=protected-access if self._model._in_multi_worker_mode() and not multi_worker_util.should_load_checkpoint(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n\n self.brain.restore_checkpoint()", "def restore(self, checkpoint):\n raise NotImplementedError", "def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)", "def restore(self, check...
[ "0.81459254", "0.80328304", "0.79776925", "0.79737246", "0.7689481", "0.764013", "0.76380104", "0.7564498", "0.74885815", "0.7462417", "0.7371668", "0.73160183", "0.7171658", "0.71643835", "0.70352954", "0.70146847", "0.70008296", "0.6966463", "0.69652146", "0.6946277", "0.68...
0.78073424
4
Maybe load initial epoch from ckpt considering possible worker recovery. When `_ckpt_saved_epoch` attribute exists and is not `CKPT_SAVED_EPOCH_UNUSED_VALUE`, this is under multiworker training setting and indicates the worker is recovering from previous failure. In this case, infer `initial_epoch` from `self._ckpt_sav...
def maybe_load_initial_epoch_from_ckpt(self, initial_epoch, mode): epoch = K.eval(self._ckpt_saved_epoch) if mode == mode_keys.ModeKeys.TRAIN and epoch >= 0: # The most recently saved epoch is one epoch prior to the epoch it # failed at, so return the value of 'self._ckpt_saved_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume(self) -> int:\n last_epoch = -1\n latest_file_path = self._fetch_latest_checkpt()\n if latest_file_path and os.path.exists(latest_file_path):\n self.load_params(latest_file_path)\n _, self.checkpt_dir, filename = latest_file_path.rsplit(os.path.sep, 2)\n ...
[ "0.67070216", "0.65064484", "0.64661425", "0.6440556", "0.6380047", "0.61433697", "0.6118619", "0.61170554", "0.6101058", "0.60428995", "0.599978", "0.5933003", "0.5883685", "0.58721304", "0.5870887", "0.5861558", "0.5828003", "0.5817125", "0.58149254", "0.57925147", "0.57770...
0.85100347
0
Constructor for the Account1 class
def __init__(self, id=None, number=None, name=None, balance=None, mtype=None, status=None, customer_id=None, institution_id=None, balance_date=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, account_name, user_name, password):\n self.account_name = account_name\n self.user_name = user_name\n self.password = password", "def __init__(self, first_name, second_name, gender, account_type):\n self.first_name = first_name\n self.second_name = second_nam...
[ "0.71518856", "0.70505494", "0.7036426", "0.70320386", "0.7010023", "0.69485015", "0.6911477", "0.6875856", "0.685711", "0.6793664", "0.67865777", "0.67849344", "0.67669225", "0.67423975", "0.66477245", "0.664424", "0.6535182", "0.6474709", "0.6468848", "0.64155126", "0.63194...
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') number = dictionary.get('number') name = dictionary.get('name') balance = dictionary.ge...
{ "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.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.7882321
11
Convert an angle in radians into a quaternion _message_.
def angle_to_quaternion(angle): return Quaternion(*tf.transformations.quaternion_from_euler(0, 0, angle))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_to_quaternion(angle):\n return Quaternion(*tf.transformations.quaternion_from_euler(0, 0, angle))", "def quaternion_about_axis(angle, axis):\r\n q = numpy.array([0.0, axis[0], axis[1], axis[2]])\r\n qlen = vector_norm(q)\r\n if qlen > _EPS:\r\n q *= math.sin(angle/2.0) / qlen\r\n ...
[ "0.70787954", "0.6589153", "0.6581337", "0.65063107", "0.6459875", "0.6399914", "0.63855743", "0.63081235", "0.62961113", "0.62541527", "0.6238344", "0.62374145", "0.6094688", "0.60905355", "0.60882777", "0.60818195", "0.6078863", "0.6071422", "0.6067874", "0.6063613", "0.606...
0.7187201
0
to_tuple(1, length=1) > (1,) to_tuple(1, length=3) > (1, 1, 1) If value is an iterable, n is ignored and tuple(value) is returned to_tuple((1,), length=1) > (1,) to_tuple((1, 2), length=1) > (1, 2) to_tuple([1, 2], length=3) > (1, 2)
def to_tuple( value: Union[TypeNumber, Iterable[TypeNumber]], length: int = 1, ) -> Union[TypeTripletFloat, Tuple[TypeNumber, ...]]: try: iter(value) value = tuple(value) except TypeError: value = length * (value,) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_tuple(values: Union[int, Iterable[int]]) -> Tuple[int, ...]:\n try:\n return tuple(values)\n except TypeError:\n return (values,)", "def make_tuple(tuple_like):\n tuple_like = (\n tuple_like\n if isinstance(tuple_like, (list, tuple))\n else (tuple_like, tuple_l...
[ "0.7617386", "0.70297694", "0.69395643", "0.69215775", "0.6744515", "0.66831195", "0.6623964", "0.6575028", "0.65276414", "0.65128773", "0.6510971", "0.64154077", "0.64154077", "0.63467413", "0.62925184", "0.6284415", "0.62273985", "0.6224793", "0.62143725", "0.6208716", "0.6...
0.77677083
0
Save JSON file. A function that converts character dictionary into JSON file and saves it , for the user to continue the game.
def save_character(): global character filename = 'character.json' with open(filename, 'w') as file_object: json.dump(character, file_object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, characters, filepath):\n\n\t\twith open(filepath, 'w') as out:\n\t\t\tjson.dump(characters, out, sort_keys=True, indent=4)", "def save(self) -> None:\n with open(dict_path, 'w', encoding='utf-8') as dictionary_file:\n json.dump(self.data, dictionary_file, indent=2, separators=(',', ':'), e...
[ "0.7917112", "0.74882144", "0.73599017", "0.73386115", "0.73013073", "0.7255119", "0.7195541", "0.71916014", "0.71857935", "0.71553844", "0.7115402", "0.7094933", "0.70800865", "0.70729023", "0.7061524", "0.7049637", "0.70365995", "0.70292914", "0.70156014", "0.7009513", "0.6...
0.8087497
0
Find Conv2d + batchnorm + relu parititions
def _annotate_conv2d_bn_relu( gm: torch.fx.GraphModule, quantization_config: Optional[QuantizationConfig], filter_fn: Optional[Callable[[Node], bool]] = None, ) -> Optional[List[List[Node]]]: fused_partitions = find_sequential_partitions( gm, [torch.nn.Conv2d, torch.nn.BatchNorm2d, torch.nn.ReLU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, input_nc, ndf=64, n_layers=3, norm_layer=nn.BatchNorm2d):\n super(LLConvDiscriminator, self).__init__()\n if type(norm_layer) == functools.partial: # no need to use bias as BatchNorm2d has affine parameters\n use_bias = norm_layer.func == nn.InstanceNorm2d\n else...
[ "0.6789076", "0.67128366", "0.6629552", "0.6612338", "0.66093284", "0.66045517", "0.6587353", "0.65827715", "0.6580956", "0.658003", "0.6549978", "0.6538741", "0.65354425", "0.65274066", "0.6525427", "0.64804256", "0.64586866", "0.64546055", "0.64101607", "0.6390778", "0.6389...
0.0
-1
Return an event message.
def event_message(iden: int, event: Any) -> dict[str, Any]: return {"id": iden, "type": "event", "event": event}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_message(self):\n return self._event_message", "def formatEventMessage(self, message):\r\n\t\treturn format.formatEventMessage(message)", "def getMessage():\n return message", "def get_message(self):\n return self.msg", "def event(self) -> pulumi.Output[str]:\n return pulum...
[ "0.81838685", "0.7272154", "0.7050331", "0.6930456", "0.6901453", "0.6868145", "0.6868145", "0.6868145", "0.6868145", "0.6868145", "0.6838678", "0.6838678", "0.67856187", "0.67830306", "0.6760071", "0.67483413", "0.6723417", "0.66868687", "0.66868687", "0.6681384", "0.6673948...
0.68846697
5
Serialize a websocket message to json.
def message_to_json(message: dict[str, Any]) -> str: try: return JSON_DUMP(message) except (ValueError, TypeError): _LOGGER.error( "Unable to serialize to JSON. Bad data found at %s", format_unserializable_data( find_paths_unserializable_data(message, dump...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(msg) -> str:\n try:\n return json.dumps(msg, separators=(',', ':'))\n except json.JSONDecodeError as err:\n return err.msg", "def _GenericMessageToJsonObject(self, message):\n # Duration, Timestamp and FieldMask have ToJsonString method to do the\n # conver...
[ "0.6820873", "0.681848", "0.66347516", "0.65812755", "0.65176684", "0.6515389", "0.64818776", "0.64081544", "0.6404834", "0.62408286", "0.61993045", "0.6175989", "0.614852", "0.6062147", "0.60503614", "0.6013799", "0.6002955", "0.5999532", "0.599799", "0.59765184", "0.5957033...
0.6555942
4
decrease the learning rate
def get_adjusted_lr(args, optimizer, epoch): lr = args.lr if epoch <= int(args.epochs * 0.5): lr = args.lr elif epoch <= int(args.epochs * 0.9): lr = args.lr * 0.1 else: lr = args.lr * 0.01 for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dec_learning_rate(step, opt, dec_rate=0.05):\r\n prev_lrs = [ ]\r\n curr_lrs = [ ]\r\n for param_group in opt.param_groups:\r\n prev_lrs.append(param_group['lr'])\r\n param_group['lr'] *= (1 - dec_rate)\r\n curr_lrs.append(param_group['lr'])\r\n print('Step {}: learning rate de...
[ "0.73365825", "0.6999569", "0.69734424", "0.6962472", "0.6850783", "0.6850783", "0.6736016", "0.67287916", "0.6726578", "0.67016196", "0.6700515", "0.6699682", "0.66969526", "0.66909665", "0.66878617", "0.6660984", "0.6660523", "0.66366637", "0.661834", "0.66054904", "0.65952...
0.0
-1
Learning Rate Schedule Learning rate is scheduled to be reduced after 10, 15, 20, 22 epochs. Called automatically every epoch as part of callbacks during training. Arguments
def lr_schedule(epoch, current_lr): lr = current_lr if epoch == 23: lr *= 0.5 elif epoch == 21: lr *= 1e-1 elif epoch == 16: lr *= 1e-1 elif epoch == 11: lr *= 1e-1 return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #...
[ "0.76963335", "0.75957423", "0.757989", "0.7454135", "0.74389756", "0.74269027", "0.74262613", "0.7407213", "0.7407213", "0.7407213", "0.7407213", "0.7368826", "0.73521197", "0.73338693", "0.73307705", "0.7281589", "0.7279649", "0.7268736", "0.7246171", "0.7224259", "0.720613...
0.7310802
15
Searches through the tags of the attribute for the values of tag_name. If a tag does not exist then it will return False. This is to allow tags to be defined with the true value and not require a false as well.
def get_tag(self, tag_name): tag_values = [] for tag in self.tags: if tag.tag_name == tag_name: tag_values.append(tag.tag_value) if len(tag_values) == 1: if tag_values[0].lower() == 'true': return True elif tag_values[0].lower(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, name, tags):\n name, tags = self.get_compiled(name, tags)\n \n def index_of_letter(l):\n return ord(l) - ord('a')\n \n true_val, false_val = name\n \n if true_val:\n return index_of_letter(true_val) in tags\n else:\n ...
[ "0.72157556", "0.70540005", "0.6984095", "0.68996596", "0.6667193", "0.65863645", "0.6582158", "0.65259117", "0.6384985", "0.6384985", "0.63142395", "0.6217207", "0.615323", "0.6150417", "0.61483", "0.6083684", "0.60783803", "0.6004714", "0.5996803", "0.598308", "0.59759676",...
0.7295158
0
Searches through the tags of the attribute for the values of tag_name. If a tag does not exist then it will return False. This is to allow tags to be defined with the true value and not require a false as well.
def get_tag(self, tag_name): tag_values = [] for tag in self.tags: if tag.tag_name == tag_name: tag_values.append(tag.tag_value) if len(tag_values) == 1: if tag_values[0].lower() == 'true': return True elif tag_values[0].lower(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, name, tags):\n name, tags = self.get_compiled(name, tags)\n \n def index_of_letter(l):\n return ord(l) - ord('a')\n \n true_val, false_val = name\n \n if true_val:\n return index_of_letter(true_val) in tags\n else:\n ...
[ "0.7216588", "0.7053974", "0.6985282", "0.69008327", "0.66665995", "0.6585554", "0.65834", "0.6525388", "0.6385108", "0.6385108", "0.6314395", "0.62177813", "0.61534345", "0.6151914", "0.61488175", "0.6083692", "0.60782623", "0.6005103", "0.59984833", "0.5983477", "0.5977449"...
0.7295367
1
returning at most the first K elements of the list
def max_K(list,K): l = len(list) res = list #np.copy(list) if l > K: res = list[:K] #np.copy(list[:K]) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kthSmallest(A, k):\n if k >= len(A):\n return None\n return select(A, 0, len(A) - 1, k)", "def fn(arr, k):\n ans = []\n for i, x in enumerate(arr): \n while ans and ans[-1] < x and len(ans) + len(arr) - i > k: ans.pop()\n if len(ans) < k: ans.a...
[ "0.71640044", "0.69768006", "0.67069376", "0.6702543", "0.66610503", "0.665663", "0.66533095", "0.65993977", "0.65819657", "0.65692824", "0.65524167", "0.6502652", "0.64619654", "0.6453512", "0.64518434", "0.6450477", "0.64242214", "0.6362775", "0.6350139", "0.62365144", "0.6...
0.73436
0
Computes the number of days in the specified month
def days_in_month(year, month): num_days = monthrange(year, month)[1] return num_days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_days_in_month(year=2019, month=1):\n return monthrange(year, month)[1]", "def days_in_month(month):\r\n if month==\"February\":\r\n return 28\r\n elif month==\"September\" or month==\"April\" or month==\"June\" or month==\"November\":\r\n return 30\r\n elif month==\"Januar...
[ "0.8361109", "0.8289317", "0.82335204", "0.8151239", "0.8147704", "0.8097949", "0.8090779", "0.80077416", "0.79491955", "0.789739", "0.789739", "0.789739", "0.78689307", "0.7850419", "0.78422385", "0.78358084", "0.7782018", "0.77579194", "0.77316403", "0.7565574", "0.7551957"...
0.85287994
0
Returns string with month name
def get_month_name(month): datetime_object = datetime.datetime.strptime(str(month), "%m") month_name = str(datetime_object.strftime("%b")) return month_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthname(self):\n return self.strftime(\"%B\")", "def month_name(month_number):\n return calendar.month_name[month_number]", "def get_month_name(month_of_year):\n return VALID_MONTHS[month_of_year - 1].title()", "def get_month_name(self, month):\n return self.month_names[month.month ...
[ "0.83646864", "0.8364236", "0.8295143", "0.8032498", "0.78931165", "0.7813376", "0.7770287", "0.7749387", "0.7730849", "0.7676878", "0.7664987", "0.76262563", "0.7501103", "0.7373502", "0.7330029", "0.7261517", "0.70710295", "0.70482576", "0.702831", "0.70116156", "0.70099753...
0.8293219
3
Tries to case to a list (with json friendly elements) >>> cast_to_list('3') [3] >>> cast_to_list("[3]") [3] >>> cast_to_list("[4,2]") [4, 2]
def cast_to_list(value): if isinstance(value, str): value = cast_to_jdict(value) assert isinstance(value, list) return value elif hasattr(value, 'tolist'): # meant for numpy arrays # what other potential attributes to check for? return value.tolist() else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_list(value):\n if hasattr(value, '__iter__') and not isinstance(value, str):\n return list(value)\n return [value]", "def to_list(x):\n import collections\n if not isinstance(x, collections.Iterable) or isinstance(x, str):\n x = [x]\n return x", "def tolist(x):\n retu...
[ "0.77082795", "0.7688037", "0.755851", "0.7469468", "0.7456465", "0.73932564", "0.736333", "0.73093605", "0.7263392", "0.711045", "0.7095432", "0.7091047", "0.70866376", "0.7082461", "0.7023577", "0.70084584", "0.694446", "0.69114697", "0.68999016", "0.6899557", "0.6789194", ...
0.81984067
0
Gradient of the loss and output activation.
def gradient_loss_and_output(self, a_o, y): if self.regression: return 2*(a_o - y) else: return -y / (1 + np.exp(y * a_o))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, inputs):\n raise NotImplementedError", "def calculate_gradient(y, tx, w): \n return tx.T@(sigmoid(tx@w)-y)", "def calculate_gradient(y, tx, w):\n return tx.T.dot(sigmoid(tx.dot(w))-np.reshape(y,(len(y),1)))", "def backward(self, gradient: Tensor) -> Tensor:\n self.b_gr...
[ "0.7414604", "0.73901314", "0.7341867", "0.7287168", "0.72121716", "0.71953434", "0.7191971", "0.7191971", "0.7183483", "0.71819216", "0.71658117", "0.7155459", "0.71540374", "0.71402144", "0.7121345", "0.7113772", "0.71135205", "0.70899636", "0.7080998", "0.70774406", "0.707...
0.0
-1