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
Gets the specified accumulator from this counter object.
def get(self, count_name): return getattr(self, 'count_' + count_name, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_accumulator(self):\n return self.ACCUMULATOR", "def extract_output(self, accumulator: int) -> int:\n return accumulator", "def create_accumulator(self):\n raise NotImplementedError", "def create_accumulator(self) -> WrapperAccumulator:\n return {}", "def make_accumulator():\n pass #...
[ "0.72960806", "0.66314626", "0.628824", "0.5919295", "0.5787861", "0.56600875", "0.54951143", "0.54827005", "0.5428628", "0.5382291", "0.5373962", "0.51670355", "0.513239", "0.51320636", "0.51240146", "0.5068", "0.5049705", "0.50312996", "0.50075924", "0.49847364", "0.4969608...
0.0
-1
Gets an integer ID that is guaranteed to be different from any ID previously returned by this static method.
def create_id(): unique_id = UniqueId() unique_id.put() return unique_id.key().id()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integer_id(self):\n id = self.id()\n if not isinstance(id, (int, long)):\n id = None\n return id", "def id(self) -> int:\n\t\t# pylint: disable=invalid-name\n\t\treturn self._oid", "def GetId(self):\n return int(self.id)", "def get_id(self) -> int:\n return self.id", "def ge...
[ "0.82013637", "0.78027546", "0.7674348", "0.7614026", "0.7614026", "0.7568451", "0.75040185", "0.73927766", "0.73816633", "0.73816633", "0.73816633", "0.73816633", "0.73816633", "0.73816633", "0.7357538", "0.7356729", "0.73359656", "0.7333701", "0.73305786", "0.73305786", "0....
0.0
-1
Initialize restaurant name and cuisine type attributes
def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, restaurant_name, cuisine_type):\r\n\t\tself.restaurant_name = restaurant_name\r\n\t\tself.cuisine_type = cuisine_type", "def __init__(self, restaurant_name, cuisine_type):\n\t\tself.name = restaurant_name\n\t\tself.type = cuisine_type", "def __init__(self, restaurant_name, cuisine_type):\n\t...
[ "0.8867893", "0.88307756", "0.8777077", "0.86650914", "0.8590518", "0.854975", "0.854975", "0.8524922", "0.85144866", "0.84030193", "0.84030193", "0.8368049", "0.83221966", "0.83221966", "0.8252662", "0.8079612", "0.7813271", "0.78129244", "0.78112715", "0.7777169", "0.736069...
0.87326837
5
Go through all empty positions and initialize their possible values, according to the constraints. Called once when the board is first created.
def init_constraints(self): for (row, col), curr_value in np.ndenumerate(self.final_values): self.possible_values[row][col] = [] # Initialize empty list if curr_value == 0: # If the final value is 0 then the position is vacant for value in range(1, 10): # Iterate throu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, final_values):\n self.final_values = final_values # Holds the final values on the board\n self.possible_values = np.empty(shape=(9, 9), dtype=list) # Holds the possible values each empty slot can take", "def initialize_board(self):\n self.board = np.zeros(shape=(BOARD_SI...
[ "0.69556713", "0.69445854", "0.6928109", "0.6829788", "0.68030906", "0.67487305", "0.66930026", "0.6672037", "0.66359526", "0.6585402", "0.652841", "0.65129584", "0.650719", "0.6502183", "0.64733964", "0.64556843", "0.6449356", "0.6448072", "0.6445054", "0.642698", "0.637587"...
0.76460886
0
Checks if the board is solvable, i.e. each empty position has at least one possible value.
def is_solvable(self): for row, col in np.ndindex(9, 9): if len(self.possible_values[row][col]) < 1 and self.final_values[row][col] == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_solved(self):\n for cell in self.board.values():\n if not cell.value:\n return False\n return True", "def is_solved(self):\n # Asserting board is valid.\n if not self.is_legal():\n return False\n\n # Asserting board is filled.\n...
[ "0.8226037", "0.7956708", "0.77154416", "0.7613739", "0.76123434", "0.75807106", "0.7487948", "0.7479519", "0.73125523", "0.72673947", "0.72199494", "0.71548647", "0.71472603", "0.7147121", "0.7127494", "0.70912015", "0.7089305", "0.7081779", "0.7027587", "0.701583", "0.70122...
0.83548516
0
Checks if the board has been solved, i.e. there are no empty positions (signified by zeroes).
def is_goal(self): if 0 in self.final_values: # Check if any zeroes are in the final states return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(board):\n find = find_blank(board)\n \n if not find:\n return True\n #will loop through untill the blanks are filled\n\n\n\n else:\n row, col = find\n\n for i in range(1, 10):\n if valid(board, i, (row, col)):\n board[row][col] = i\n\n if solve...
[ "0.8065399", "0.79596627", "0.79174244", "0.77993", "0.7604317", "0.7598087", "0.7514709", "0.7465813", "0.7465206", "0.74407125", "0.74258065", "0.74165255", "0.7411672", "0.7367736", "0.7352679", "0.7340678", "0.732091", "0.73000395", "0.7285851", "0.728125", "0.72783285", ...
0.0
-1
Generates a list with the coordinates of all the empty slots that have only 1 possible value (singletons). Called after assignment (generate of new board).
def get_singletons(self): singleton_list = [] # List holding singleton positions (row, col) for row in range(9): for col in range(9): if len(self.possible_values[row][col]) == 1 and self.final_values[row][col] == 0: singleton_list.append((row, col)) # If...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_spots(self):\n\t\tret = []\n\t\tfor i in range(0, self.size):\n\t\t\tfor j in range(0, self.size):\n\t\t\t\tif(self.grid[i][j] == self.terminal):\n\t\t\t\t\tret.append((i,j))\n\t\treturn ret", "def get_empty_squares(self):\n empty = []\n for row in range(self._dim):\n for col i...
[ "0.73838145", "0.71295583", "0.7018735", "0.6972191", "0.6946488", "0.6906955", "0.6903224", "0.6879551", "0.68740577", "0.68387556", "0.6811779", "0.674936", "0.6731642", "0.672649", "0.67142946", "0.67014825", "0.66878414", "0.66877687", "0.6650112", "0.6625762", "0.6603511...
0.7582303
0
Deprecated status setup end_date.
def test_set_deprecated_status(self): control = factories.ControlFactory() self.assertIsNone(control.end_date) self.api.put(control, control.id, { "status": all_models.Control.DEPRECATED, }) control = db.session.query(all_models.Control).get(control.id) self.assertIsNotNone(control.end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_end_date(self, date):\n pass", "def change_end_date(self, new_end_date):\n self.end_date = new_end_date", "def end_date(self, end_date):\n self._end_date = end_date", "def end_date(self, end_date):\n if end_date is None:\n end_date = datetime.utcnow()\n\n ...
[ "0.7037978", "0.65168864", "0.64707625", "0.64283144", "0.6330095", "0.62186366", "0.62186366", "0.62186366", "0.62186366", "0.62186366", "0.62186366", "0.62186366", "0.62186366", "0.61597675", "0.6109338", "0.6109338", "0.60571206", "0.6051189", "0.6051189", "0.59943473", "0...
0.59660435
24
Test order of ExternalComments returned by /query.
def test_external_comments_order(self, order_by_attr): with factories.single_commit(): control = factories.ControlFactory() for _ in range(5): comment = factories.ExternalCommentFactory( description=factories.random_str() ) factories.RelationshipFactory(source=control...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_query_external_comment(self):\n with factories.single_commit():\n control = factories.ControlFactory()\n comment = factories.ExternalCommentFactory(description=\"test comment\")\n factories.RelationshipFactory(source=control, destination=comment)\n request_data = [{\n \"filters...
[ "0.7089441", "0.6435584", "0.62819415", "0.62208265", "0.6208567", "0.60752714", "0.60502255", "0.6033374", "0.5925397", "0.5853359", "0.58321196", "0.5813381", "0.5785427", "0.5702853", "0.56935304", "0.5685173", "0.5685115", "0.56263196", "0.55783224", "0.5520285", "0.54655...
0.77446896
0
Returns the next action the agent will take
def getAction(self, state): "*** YOUR CODE HERE ***" x, y = state.getPacmanPosition(self.index) numPacmen = state.getNumPacmanAgents() if not MyAgent.customFood: MyAgent.customFood = state.getFood() MyAgent.foodLeft = len(MyAgent.customFood.asList()) #if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action(self):\n next_action = self.strategy.get_next_move(self)\n return next_action", "def get_next_action(self):\n\n u = self.plan.pop(0)\n return u", "def get_next_action(self):\n chosen_action = None\n while chosen_action is None:\n choice = input('A...
[ "0.8337207", "0.79425484", "0.79240257", "0.75870395", "0.7547049", "0.73340666", "0.73014915", "0.7267236", "0.7194915", "0.71547794", "0.71327364", "0.7079289", "0.70439297", "0.69918877", "0.6959046", "0.6955211", "0.69239324", "0.69239324", "0.6898673", "0.6885382", "0.68...
0.0
-1
Create instance of LightningDataModule class which can be used for creating DataLoader for particular dataset.
def create_data_module(config: Config) -> LightningDataModule: paths = { 'train': config.TRAIN_DATA_DIR, 'test': config.TEST_DATA_DIR, 'val': config.VALID_DATA_DIR } return DogsDataModule(paths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_DataLoader(self, **kwargs):\r\n return DataLoader(self, **kwargs)", "def train_dataloader(self) -> DataLoader:\n return DataLoader(\n self.train_dataset,\n batch_size=self.hparams.batch_size,\n shuffle=True,\n num_workers=multiprocessing.cpu_count(...
[ "0.735904", "0.735311", "0.7320936", "0.73052824", "0.7230452", "0.71447974", "0.7044497", "0.6889275", "0.68658566", "0.6865417", "0.6857626", "0.6827875", "0.6810419", "0.67897904", "0.665286", "0.6627414", "0.66264206", "0.6625209", "0.6599837", "0.6570209", "0.6516974", ...
0.71475625
5
Return a ROS message from a serialized string
def _from_cpp(self, str_msg, cls): msg = cls() result = msg.deserialize(str_msg) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, str):\n codecs.lookup_error(\"rosmsg\").msg_type = self._type\n try:\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.type is None:\n self.type = std_msgs.msg.String()\n if self.parent_name is None:\n self.parent_name = std_ms...
[ "0.72504485", "0.7245892", "0.7094195", "0.69345707", "0.6886136", "0.6874164", "0.6864935", "0.6849131", "0.68235683", "0.6793045", "0.67202127", "0.6682759", "0.66647387", "0.66523033", "0.6595845", "0.6576521", "0.6566095", "0.6548959", "0.64836025", "0.64610857", "0.64535...
0.64915717
18
This function creates the buttons to be pressed/clicked during the game.
def create_buttons(frame): button0 = Button(frame, height=2, width=2, text=" ", command=lambda: on_click(button0)) button0.pack(side=LEFT) button1 = Button(frame, height=2, width=2, text=" ", command=lambda: on_click(button1)) button1.pack(side=LEFT) button2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_buttons(self):\r\n # The buttons are created in the center of the screen then offset in the x/y directions by a number of button\r\n # widths. E.g. The \"-1, 0\" for the easy button means to shift the button one button width left of center.\r\n self.easy_button = Button(self.ai_game...
[ "0.8152329", "0.7905322", "0.77345216", "0.76290643", "0.7562581", "0.7429676", "0.7409013", "0.7391837", "0.73436", "0.7276186", "0.7248884", "0.72447884", "0.72356814", "0.72100484", "0.7117757", "0.7070466", "0.70612425", "0.7014205", "0.6998184", "0.6946568", "0.6931892",...
0.76530534
3
Sets the seed for this env's random number generator(s). Returns Returns the list of seeds used in this env's random number generators
def seed(self, seed=None): self.np_random, seed = gym.utils.seeding.np_random(seed) return [seed]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed (self, seed=None):\n self.np_random, seed = seeding.np_random(seed)\n return [seed]", "def seed(self, seed=None):\n self.np_random, seed = seeding.np_random(seed)\n return [seed]", "def seed(self, seed=None):\n self.np_random, seed = seeding.np_random(seed)\n ...
[ "0.84853697", "0.8463831", "0.8463831", "0.8447249", "0.8351227", "0.8250413", "0.80403525", "0.796306", "0.7315629", "0.72712773", "0.7259946", "0.7238558", "0.7234487", "0.7211908", "0.7199528", "0.7169771", "0.714234", "0.71165854", "0.71165854", "0.70867884", "0.69960344"...
0.8513289
0
This function generates a random string using the given length and character set.
def make_secret(size=6, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for _ in range(size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_chars(char_set, length):\n s = \"\"\n sz = len(char_set)-1\n r = random.SystemRandom()\n for i in range(0, length+1):\n n = r.randint(0, sz)\n s = s + char_set[n]\n return s", "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\...
[ "0.83858544", "0.8240503", "0.81806076", "0.81035495", "0.80651194", "0.8061078", "0.7977482", "0.79770094", "0.7972302", "0.7967095", "0.7918699", "0.7916532", "0.79160416", "0.7904953", "0.78926355", "0.7887011", "0.78824776", "0.7862049", "0.7859437", "0.78591144", "0.7845...
0.0
-1
label(a) == label(b) && a != b
def get_positive_mask(labels): batch_shape = tf.shape(labels)[0] mask_1 = tf.logical_not(get_negative_mask(labels)) mask_2 = tf.logical_not(tf.eye(batch_shape, dtype=tf.bool)) return tf.logical_and(mask_1, mask_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n return tf.math.not_equal(self._ordinals, other.ordinal())", "def pairwise(a,b):\n return a != b", "def __eq__(self, other):\r\n return self.label == other.label and self.positive_state == other.positive_state", "def different_values_constraint(A, a, B, b):\r\n retur...
[ "0.71798927", "0.7076246", "0.70062286", "0.68969136", "0.6873993", "0.6742048", "0.66909033", "0.65883094", "0.6566443", "0.6555804", "0.6532703", "0.65173995", "0.6475816", "0.6444344", "0.6441343", "0.64171046", "0.64070123", "0.63709736", "0.6359963", "0.6357309", "0.6338...
0.0
-1
Initialises a `Spectrum1D` object from an `astropy.table.Table` instance.
def from_table(cls, table, dispersion_column, flux_column, error_column=None, continuum_column=None, unit=None, dispersion_unit=None): dispersion = Quantity(table[dispersion_column]) flux = Quantity(table[flux_column]) if error_column is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_table(cls, table):\n offset_edges = _make_bin_edges_array(table['THETA_LO'].squeeze(), table['THETA_HI'].squeeze())\n offset_edges = Angle(offset_edges, table['THETA_LO'].unit)\n energy_edges = _make_bin_edges_array(table['ENERG_LO'].squeeze(), table['ENERG_HI'].squeeze())\n en...
[ "0.58847636", "0.5752756", "0.57239497", "0.5702236", "0.5557037", "0.54563797", "0.5385332", "0.53390545", "0.5298843", "0.52871335", "0.5243626", "0.52360696", "0.5224612", "0.5213403", "0.51625204", "0.5160665", "0.5160665", "0.51571715", "0.51257694", "0.51250327", "0.510...
0.5642316
4
returns True if number is prime, False otherwise
def is_prime(number): #for i in range(2, ceil(sqrt(number))): for i in range(2, number): if number % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\telif number % 2 == 0: return False\n\telse:\n\t\tfor x in range(2, number):\n\t\t\tif number % x == 0:\n\t\t\t\treturn False\n\t\telse:\n\t\t\treturn True", "def is_prime_number(number_):\n flag = 0\n for values in...
[ "0.8485697", "0.8467493", "0.84140295", "0.8360368", "0.83536255", "0.8352131", "0.8317346", "0.82874715", "0.8270817", "0.82524806", "0.82370245", "0.82214177", "0.8217482", "0.82134634", "0.8209622", "0.8198739", "0.81563526", "0.81278956", "0.80930114", "0.8090869", "0.808...
0.81863403
16
The table name with the details we want will either be the new table (only possible after made of course) or if an existing table, the original name.
def make_changes(self): dd = mg.DATADETS_OBJ if not self.read_only: ## NB must run Validate on the panel because the objects are ## contained by that and not the dialog itself. ## http://www.nabble.com/validator-not-in-a-dialog-td23112169.html if not self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_name(self):\n return self._new_table.name", "def table_name() -> str:\n pass", "def new_table_name(self):\n if len(self._old_table.name) < constant.MAX_TABLE_LENGTH - 10:\n return constant.NEW_TABLE_PREFIX + self.table_name\n elif (\n len(self._old_ta...
[ "0.82664675", "0.7914891", "0.7804374", "0.7452047", "0.7402411", "0.7402411", "0.7402411", "0.73365813", "0.732864", "0.7300404", "0.7268513", "0.7258091", "0.7197089", "0.71480244", "0.71113324", "0.7037499", "0.70236194", "0.7012551", "0.70000315", "0.69864565", "0.6977005...
0.0
-1
convert an image to tensor
def convert_image_to_tensor(image_path: str, output_path: str) -> None: image = np.asarray(Image.open(image_path).resize( (224, 224))) / 255.0 if (image.shape == (224, 224, 4)): image = image[:, :, 0] * 0.21 + image[:, :, 1] * 0.72 + image[:, :, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_image_to_tensor(image):\n # image = image.astype(np.float32)\n return transform(image)\n # return transform(image)", "def pil_to_tensor(img):\n img = ToTensor()(img)\n return img", "def tensor_to_image(img):\n t = transforms.ToPILImage()\n return t(img)", "def image_to_tensor...
[ "0.8577761", "0.8157437", "0.8129766", "0.8020487", "0.7826417", "0.7674793", "0.76635075", "0.7605076", "0.74680465", "0.7453381", "0.7411015", "0.7337452", "0.7310343", "0.7255455", "0.72391504", "0.72352755", "0.72217673", "0.7181541", "0.7170399", "0.7105143", "0.70998234...
0.7480528
8
Closes the SSEClient instance.
def close(self): self.should_connect = False self.retry = 0 self.resp.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.client:\n self.client.connection.close()\n self.client = None", "async def close(self) -> None:\n\n if self._client:\n await self._client.__aexit__()", "def close(self):\n self._client.close()\n self._transport.close()", ...
[ "0.70056486", "0.69517237", "0.6944841", "0.68412125", "0.68307555", "0.6823133", "0.6763972", "0.67183405", "0.66115445", "0.6608905", "0.65187925", "0.64577305", "0.6432181", "0.64266264", "0.6422844", "0.63979894", "0.63341075", "0.6315731", "0.62710834", "0.6245288", "0.6...
0.0
-1
Take a function that accepts input arrays. This is a temporary thing until we have a proper decorator system for these array functions.
def multichannel(fcn): return lambda args: (fcn(*args), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_input(f):\n @wraps(f)\n def wrapped(self, t):\n t = np.atleast_1d(t)\n r = f(self, t)\n return r\n return wrapped", "def __array_function__(self, func, types, args, kwargs):\n try:\n if not func.__module__.startswith(\"numpy\"):\n return No...
[ "0.78472435", "0.7292039", "0.71375084", "0.6872393", "0.6783825", "0.65298057", "0.6491657", "0.6351075", "0.6334589", "0.6271168", "0.6224946", "0.6210089", "0.6186544", "0.615926", "0.6145688", "0.6110263", "0.6102116", "0.6027178", "0.602611", "0.60202897", "0.6020025", ...
0.52309525
78
[This function checks for similarity between understat and fpl names, and returns a dataframe with all the unique understat names with the most similarly matching FPL name.]
def get_matching_names(understat_names, fpl_names): understat_names, fpl_names = understat_names['player_name'].unique(), fpl_names['player_name'].unique() seq = difflib.SequenceMatcher() understat_similar = [] fpl_similar = [] ratio = [] for i in range(len(understat_names)): for j i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_matched_names(fpl, understat, exact_merge): \n fpl_not_matched = fpl[~fpl['player_name'].isin(exact_merge['player_name'].unique())] \n understat_not_matched = understat[~understat['player_name'].isin(exact_merge['player_name'].unique())] \n return fpl_not_matched, understat_not_matched", "...
[ "0.67464316", "0.6070741", "0.587723", "0.5818824", "0.5750044", "0.5457883", "0.54351366", "0.5387454", "0.5255924", "0.51499546", "0.5148366", "0.51164156", "0.5079236", "0.50657415", "0.5030209", "0.502642", "0.49840075", "0.49655002", "0.4962999", "0.49557227", "0.4934124...
0.8124159
0
Operator converter for brelu.
def convert_brelu(g, op, block): x = g.get_node(op.input("X")[0]) t_max = op.attr("t_max") t_min = op.attr("t_min") out = _op.tensor.clip(x, t_min, t_max) g.add_node(op.output("Out")[0], out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_relu(node, **kwargs):\n return create_basic_op_node('Relu', node, kwargs)", "def _bn_relu(input):\n\tnorm = BatchNormalization(axis=3)(input)\n\treturn Activation(\"relu\")(norm)", "def _bn_relu(input):\n norm = BatchNormalization()(input)\n return Activation(\"relu\")(norm)", "def _bn_r...
[ "0.6997577", "0.67862815", "0.6746368", "0.6746368", "0.6721262", "0.6600945", "0.6600945", "0.65476614", "0.65432006", "0.64540356", "0.6344826", "0.6294202", "0.62071335", "0.6112909", "0.5998305", "0.58736885", "0.5863295", "0.58511233", "0.580061", "0.57899237", "0.577433...
0.5725523
26
Operator converter for conv2d.
def convert_conv2d(g, op, block): dilations = op.attr("dilations") groups = op.attr("groups") paddings = op.attr("paddings") padding_algorithm = op.attr("padding_algorithm") strides = op.attr("strides") kernel = g.get_node(op.input("Filter")[0]) input_x = g.get_node(op.input("Input")[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_depthwise_conv2d(self, op):\n return self.convert_conv(op, \"depthwise\")", "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUL2IUL2_cast(*args)", "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPy...
[ "0.77124536", "0.6659152", "0.66298926", "0.66006505", "0.6547993", "0.6544018", "0.65421", "0.6529408", "0.64761746", "0.64688337", "0.6439539", "0.64111936", "0.6385079", "0.6316574", "0.628645", "0.6282204", "0.62778354", "0.62658465", "0.62658465", "0.62357426", "0.623200...
0.67047113
1
Operator converter for conv3d.
def convert_conv3d(g, op, block): dilations = op.attr("dilations") groups = op.attr("groups") paddings = op.attr("paddings") padding_algorithm = op.attr("padding_algorithm") strides = op.attr("strides") kernel = g.get_node(op.input("Filter")[0]) input_x = g.get_node(op.input("Input")[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itkScalarConnectedComponentImageFilterIUL3IUL3_cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUL3IUL3_cast(*args)", "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUL3IUL3_cast(...
[ "0.6859782", "0.6835417", "0.68006456", "0.67527854", "0.6750266", "0.6737496", "0.66440094", "0.6570769", "0.6542995", "0.65286976", "0.6474901", "0.64694494", "0.646473", "0.6462924", "0.64120245", "0.6361748", "0.6354526", "0.63530177", "0.63488555", "0.6339379", "0.631805...
0.7081379
0
Operator converter for dist.
def convert_dist(g, op, block): x = g.get_node(op.input("X")[0]) y = g.get_node(op.input("Y")[0]) z = _op.abs(_op.subtract(x, y)) dtype = infer_type(x).checked_type.dtype p = op.attr("p") if p == np.inf: out = _op.reduce.max(z) elif p == np.NINF: out = _op.reduce.min(z) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_op(self):\n raise NotImplementedError", "def distmod2dist(distmod):\n return 10.**(distmod/5.-2.)", "def to_operator(operator):\n if isinstance(operator, str):\n return ValueConstraintOperators.STRING_OPERATOR_MAP[operator]\n else:\n return operator", "def...
[ "0.6339641", "0.58407134", "0.5719981", "0.55249023", "0.55137885", "0.5484184", "0.5455077", "0.5454385", "0.5448707", "0.54449403", "0.5438097", "0.5403102", "0.5321066", "0.53005666", "0.52721924", "0.5269971", "0.5256855", "0.52475345", "0.5199331", "0.5192369", "0.517775...
0.6126183
1
Operator converter for dot.
def convert_dot(g, op, block): # x, y should be 1D or 2D tensor # when it's 2D tensor, the first dimension means batch dimension x = g.get_node(op.input("X")[0]) y = g.get_node(op.input("Y")[0]) out = _op.sum(_op.multiply(x, y), axis=[-1], keepdims=True) g.add_node(op.output("Out")[0], out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(self, x):\n pass", "def dot(self, other):\n from divisi2 import operators\n return operators.dot(self, other)", "def dot(a, b):\n raise NotImplementedError", "def dot(self):\n return self.__dot", "def _print_dot(_self, expr):\r\n return r'{((%s) \\cdot (%s))}' ...
[ "0.7000113", "0.69225705", "0.6734694", "0.66602993", "0.6594274", "0.6549932", "0.6436715", "0.6356107", "0.63459045", "0.6322401", "0.6261979", "0.6168339", "0.6146374", "0.60558003", "0.6028431", "0.6012952", "0.59742177", "0.5954042", "0.5941271", "0.58944374", "0.5888765...
0.55892116
51
Operator converter for fill_constant.
def convert_fill_constant(g, op, block): value = op.attr("value") shape = block.var(op.output("Out")[0]).shape dtype = op.attr("dtype") dtype = _convert_dtype_value(dtype) value = _expr.const(value).astype(dtype) if "ValueTensor" in op.input_names and op.input("ValueTensor"): shape = g....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_identity(node, **kwargs):\n return create_basic_op_node('ConstantFill', node, kwargs)", "def on_constant(self, node):\n if node.is_constant(Primitive):\n return self.convert_func(\n get_prim_graph({}, node.value, node.abstract))\n return self.make_const(node...
[ "0.70990324", "0.6030638", "0.5743218", "0.5708666", "0.56673795", "0.5635013", "0.5507181", "0.55013335", "0.5461051", "0.54267126", "0.53893894", "0.53808427", "0.5360184", "0.53533846", "0.5340008", "0.5330984", "0.5328292", "0.5297096", "0.52946055", "0.52735186", "0.5270...
0.70311314
1
Operator converter for grid_sampler.
def convert_grid_sampler(g, op, block): x = g.get_node(op.input("X")[0]) data_shape = infer_shape(x) grid = g.get_node(op.input("Grid")[0]) mode = op.attr("mode") padding_mode = op.attr("padding_mode") align_corners = op.attr("align_corners") if len(data_shape) == 4: layout = "NCHW...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_op(self):\n raise NotImplementedError", "def to_operator(operator):\n if isinstance(operator, str):\n return ValueConstraintOperators.STRING_OPERATOR_MAP[operator]\n else:\n return operator", "def to_operator(self) -> Operator:\n return Operator(self.to_...
[ "0.59936064", "0.54852706", "0.53029156", "0.52232623", "0.5098335", "0.49979678", "0.49866682", "0.49159187", "0.4880294", "0.48530972", "0.48529428", "0.4848007", "0.48410067", "0.4820684", "0.48026562", "0.47862282", "0.47634876", "0.4757607", "0.47517854", "0.47374362", "...
0.54407173
2
Operator converter for hard_sigmoid.
def convert_hard_sigmoid(g, op, block): slope = op.attr("slope") offset = op.attr("offset") x = g.get_node(op.input("X")[0]) out = x * _expr.const(slope) + _expr.const(offset) out = _op.clip(out, 0, 1) g.add_node(op.output("Out")[0], out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_sigmoid(node, **kwargs):\n return create_basic_op_node('Sigmoid', node, kwargs)", "def _tanh_to_sigmoid(x):\n return x * 0.5 + 0.5", "def hardsigmoid(input, inplace=False):\n return FunctionLib.apply(\n 'HardSigmoid', input.device, [input],\n outputs=[input if inplace else No...
[ "0.79609686", "0.7310558", "0.72265494", "0.71526724", "0.7123541", "0.6998369", "0.6943257", "0.69178456", "0.68699634", "0.6850029", "0.6830203", "0.68278205", "0.68142104", "0.6812073", "0.6808258", "0.6808258", "0.6802319", "0.6753503", "0.6730246", "0.6716248", "0.671316...
0.72889036
2
Operator converter for leaky_relu.
def convert_leaky_relu(g, op, block): alpha = op.attr("alpha") x = g.get_node(op.input("X")[0]) out = _op.nn.leaky_relu(x, alpha=alpha) g.add_node(op.output("Out")[0], out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_leaky_relu_action(graph: Graph, matches: dict):\n mul_op = matches['mul_op']\n mul_value_data = matches['const_data']\n mul_data = matches['mul_data']\n input_data = matches['data']\n max_op = matches['max_op']\n max_data = max_op.out_node()\n\n # Check that all nodes satisfies...
[ "0.7370343", "0.73001176", "0.66221714", "0.65967107", "0.6582359", "0.6566005", "0.65279996", "0.6521039", "0.64799136", "0.64645904", "0.6457674", "0.64572585", "0.6341657", "0.6341657", "0.6295495", "0.6295495", "0.62341285", "0.6212536", "0.62066454", "0.6202043", "0.6190...
0.7227731
2
Operator converter for logsigmoid.
def convert_logsigmoid(g, op, block): x = g.get_node(op.input("X")[0]) out = _op.log(_op.tensor.sigmoid(x)) g.add_node(op.output("Out")[0], out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_sigmoid(node, **kwargs):\n return create_basic_op_node('Sigmoid', node, kwargs)", "def get_sigmoid(arg):\n\n if arg >= 0:\n z = np.exp(-arg)\n return 1. / (1. + z)\n else:\n z = np.exp(arg)\n return z / (1 + z)", "def _tanh_to_sigmoid(x):\n return x * 0.5 + 0...
[ "0.76032346", "0.70990795", "0.6969098", "0.69575626", "0.68987423", "0.68571717", "0.6832141", "0.6832141", "0.68300146", "0.68188673", "0.68188673", "0.6813658", "0.6809938", "0.6804544", "0.6792052", "0.6792052", "0.67841154", "0.67658395", "0.67627764", "0.67627764", "0.6...
0.7840095
0
Operator converter for pool2d.
def convert_pool2d(g, op, block): adaptive = op.attr("adaptive") ceil_mode = op.attr("ceil_mode") global_pooling = op.attr("global_pooling") ksize = op.attr("ksize") paddings = op.attr("paddings") padding_algorithm = op.attr("padding_algorithm") pooling_type = op.attr("pooling_type") da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_op(self):\n raise NotImplementedError", "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUS2IUS2_cast(*args)", "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilt...
[ "0.67155707", "0.63085103", "0.6243801", "0.624234", "0.6140723", "0.61363566", "0.6072542", "0.60115415", "0.5975536", "0.59201026", "0.5870939", "0.582125", "0.57917345", "0.57905704", "0.57591844", "0.57531637", "0.57522684", "0.57241905", "0.57233334", "0.5720315", "0.570...
0.627663
2
Operator converter for pool3d.
def convert_pool3d(g, op, block): adaptive = op.attr("adaptive") ceil_mode = op.attr("ceil_mode") global_pooling = op.attr("global_pooling") ksize = op.attr("ksize") paddings = op.attr("paddings") padding_algorithm = op.attr("padding_algorithm") pooling_type = op.attr("pooling_type") da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUS3IUS3_cast(*args)", "def itkScalarConnectedComponentImageFilterIUS3IUS3_cast(*args):\n return _itkScalarConnectedComponentImageFilterPython.itkScalarConnectedComponentImageFilterIUS3IUS3_cast(...
[ "0.64802796", "0.634125", "0.6329923", "0.62835914", "0.6072355", "0.600861", "0.5975352", "0.5970682", "0.5958929", "0.5951508", "0.59156597", "0.5907593", "0.5903646", "0.59001213", "0.5845868", "0.5841345", "0.5837835", "0.583599", "0.5832108", "0.58082217", "0.58035505", ...
0.63981235
1
Operator converter for set_value.
def convert_set_value(g, op, block): x = g.get_node(op.input("Input")[0]) if op.input("StartsTensorList"): starts = g.get_node(op.input("StartsTensorList")[0]) else: starts = op.attr("starts")[0] if op.input("EndsTensorList"): ends = g.get_node(op.input("EndsTensorList")[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_operator(operator):\n if isinstance(operator, str):\n return ValueConstraintOperators.STRING_OPERATOR_MAP[operator]\n else:\n return operator", "def convert(self, value):\r\n return value", "def convert(self, value):\n return value", "def match_value(s...
[ "0.63077563", "0.6290146", "0.62251383", "0.6105594", "0.6038026", "0.5998612", "0.5933695", "0.59143376", "0.5882397", "0.5819177", "0.5806699", "0.57977116", "0.5791342", "0.57765645", "0.5772728", "0.5739569", "0.5734919", "0.57314175", "0.5720462", "0.56565744", "0.565098...
0.58093953
10
Operator converter for softmax.
def convert_softmax(g, op, block): axis = op.attr("axis") input_shape = block.var(op.input("X")[0]).shape if axis < 0: axis = len(input_shape) + axis x = g.get_node(op.input("X")[0]) m = _op.max(x, axis, keepdims=True) e = _op.exp(x - m) out = e / _op.sum(e, axis, keepdims=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_softmax(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axis', op.axis),\n ])\n return node", "def _create_softmax(cls, onnx_node, inputs, opset_version):\n factor = onnx_node.g...
[ "0.64913285", "0.64781654", "0.6419903", "0.6419903", "0.63959384", "0.6354198", "0.6307182", "0.629241", "0.62803423", "0.6260943", "0.6226556", "0.62239", "0.6220813", "0.6220813", "0.6134256", "0.6113583", "0.60977525", "0.60738033", "0.60657024", "0.60635906", "0.6058736"...
0.66949296
0
Operator converter for softmax_with_cross_entropy.
def convert_softmax_with_cross_entropy(g, op, block): logits = g.get_node(op.input("Logits")[0]) labels = g.get_node(op.input("Label")[0]) ignore_index = op.attr("ignore_index") axis = op.attr("axis") if axis < 0: axis = len(infer_shape(logits)) + axis softmax = _op.nn.softmax(logits, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_cross_entropy(inputs, axis=1, reduction='mean', **kwargs):\n args = ArgHelper.parse(locals())\n args['reduction'] = reduction.upper()\n op_lib = loss_ops_lib.SoftmaxCrossEntropy\n if context.executing_eagerly():\n return op_lib \\\n .instantiate(\n axis=axis...
[ "0.64137816", "0.6352757", "0.63304996", "0.6288456", "0.6251121", "0.62245667", "0.61739784", "0.6161671", "0.6141829", "0.61134845", "0.6104285", "0.6102624", "0.60936904", "0.60571945", "0.5995504", "0.5986937", "0.5984326", "0.59788394", "0.59710175", "0.5968684", "0.5946...
0.6448857
0
return a dictionary with ngram counts
def count_ngrams(word_list,n): ngram_dict = dict() for i in xrange(len(word_list)-n+1): ngram = tuple(word_list[i:i+n]) if ngram in ngram_dict: # ngram already exists in dictionary # increment the count by 1 ngram_dict[ngram] += 1 else: # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_ngrams(self, n):\n\n output = {}\n\n for i in range(len(self.text)-n+1):\n s = ' '.join(self.text[i:i+n])\n # if s is not already in dictionary, set value to 0\n output.setdefault(s, 0)\n output[s] += 1\n return output", "def count_n_grams...
[ "0.7743292", "0.77199584", "0.7716969", "0.76105267", "0.75992095", "0.74991006", "0.7440763", "0.7403988", "0.7346905", "0.7243749", "0.72091806", "0.71726334", "0.71435004", "0.7117929", "0.7001526", "0.6987259", "0.6980143", "0.6945595", "0.6943904", "0.6909837", "0.689564...
0.76826704
3
Return time formatted for Ploneboard
def toPloneboardTime(context, request, time_=None): ploneboard_time = None ts = getToolByName(context, 'translation_service') format = '%Y;%m;%d;%w;%H;%M;%S' # fallback formats, english young_format_en = '%A %H:%M' old_format_en = '%B %d. %Y' if not time_: return 'Unknown date' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\n now = datetime.datetime.now()\n hour = 12 if now.hour % 12 == 0 else now.hour % 12\n meridiem = \"AM\" if now.hour < 12 else \"PM\"\n return \"%d:%02d %s\" % (hour, now.minute, meridiem)", "def friendly_time(time=None):\n if time is None:\n time = pass_...
[ "0.78443176", "0.78165925", "0.7803336", "0.77409714", "0.77112925", "0.7694536", "0.7676821", "0.7670104", "0.7653917", "0.76407", "0.7574116", "0.7524239", "0.7480668", "0.7449746", "0.74482924", "0.7436809", "0.73982805", "0.7323254", "0.73225206", "0.7317877", "0.729542",...
0.7136611
31
Returns the number of conversations in this forum.
def getNumberOfConversations(node, catalog=None): if catalog is None: catalog = getToolByName(node, 'portal_catalog') return len(catalog( object_provides=IConversation.__identifier__, path='/'.join(node.getPhysicalPath())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_count(self):\n return len(self.messages)", "def message_count(self):\n return self._message_count", "def count_chat_with(self, actor_label):\n query = read_query('trust/count_chat_with') % actor_label\n response = self._submit_query(query)\n\n return response[0]['...
[ "0.7046309", "0.67483366", "0.6559145", "0.647817", "0.6411175", "0.6347197", "0.6342727", "0.63276786", "0.6303933", "0.6276361", "0.6274735", "0.62053746", "0.6204217", "0.619952", "0.6168952", "0.6164415", "0.6070203", "0.60651463", "0.60547584", "0.59845173", "0.597897", ...
0.72814435
0
Returns a string concatenated with '!!!'.
def inner(word): return word + '!!!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shout():\n # Concatenate the strings: shout_word\n shout_word = 'congratulations'+'!!!'\n\n # Print shout_word\n print(shout_word)", "def repeat(s,exclaim):\n result = s+s+s\n if exclaim:\n result = result + '!!!'\n return result", "def shout():\n # Concatenate the strings: shout_word\...
[ "0.6222425", "0.62033045", "0.61873996", "0.59948725", "0.59948725", "0.59463835", "0.59098756", "0.5884046", "0.57748294", "0.5744767", "0.57358265", "0.57358265", "0.57358265", "0.5682084", "0.5681596", "0.5601378", "0.5575337", "0.5566258", "0.5560172", "0.5552537", "0.554...
0.6519947
0
Define the name of the instance of RNNModel using its arguments.
def __name__(self): return '_'.join([function.__name__ for function in self.functions])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setName(self, *args):\n return _libsbml.ModelCreator_setName(self, *args)", "def generate_model_name(self):\n now = datetime.datetime.now()\n name = '%s_%s_%s_%s_%s_%s' % (now.day, now.month, 'rnn', self._controller_type, self._num_layers, self._layer_size)\n if self._dropout > 0:...
[ "0.6435514", "0.63512707", "0.6342804", "0.6240059", "0.6175415", "0.61512685", "0.5970166", "0.59167725", "0.58603233", "0.5857045", "0.58183295", "0.5817024", "0.5815913", "0.57817906", "0.5767783", "0.5733591", "0.57298726", "0.57222044", "0.5717912", "0.5713784", "0.56984...
0.0
-1
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city_abbreviations = ['chi', 'ny', 'w'] while True: city = input('Kindly specify a city by typing chicago o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.6671029", "0.65359104", "0.6458688", "0.63752216", "0.6348333", "0.6310136", "0.6286666", "0.6259401", "0.6232757", "0.6214305", "0.6204918", "0.6181069", "0.61726975", "0.6168352", "0.61584324", "0.61581767", "0.61533356", "0.6144159", "0.6131992", "0.61047643", "0.610251...
0.6008372
27
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): #loading data of the city chosen by user into dataframe df = pd.read_csv(CITY_DATA[city]) #converting the start time clomn from object (string) to datetime object so as we can use datetime Attributes and methonds to extract month coulmn and day to filter with them df['S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.813227", "0.8108956", "0.8046483", "0.8042587", "0.8009157", "0.80073005", "0.7999508", "0.79889566", "0.7979226", "0.7973997", "0.7961329", "0.79560906", "0.7947187", "0.794649", "0.7908341", "0.79083204", "0.7904475", "0.79011774", "0.78934294", "0.7889157", "0.78827393"...
0.7998818
7
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating statistics of The Most Frequent Times of Travel...\n') start_time = time.time() # TO DO: display the most common month most_common_month = df['month'].mode()[0] print('Most common Month is: ', most_common_month ) # TO DO: display the most common da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.75023395
28
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station popular_start_station = df['Start Station'].mode()[0] print('Most popular Start station is: ', popular_start_station) # TO DO: displa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7816157", "0.7662524", "0.7554042", "0.7492024", "0.7475423", "0.74471235", "0.7430301", "0.74246186", "0.741813", "0.7387859", "0.73857087", "0.7365416", "0.73599696", "0.73571277", "0.73555714", "0.73525584", "0.7351796", "0.735084", "0.7342505", "0.734093", "0.7337747",...
0.7400704
9
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time total_travel_time = df['Trip Duration'].sum() print('Total travel time in seconds is : ', total_travel_time) # TO DO: display mean travel time mean_travel_time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.8142488", "0.802504", "0.8003995", "0.7949535", "0.7937111", "0.793114", "0.7926624", "0.79147255", "0.7913882", "0.7907699", "0.79052943", "0.7900545", "0.78914416", "0.7889074", "0.7886493", "0.7884836", "0.7884105", "0.78822976", "0.78735834", "0.7868467", "0.7866015", ...
0.7855678
26
return a string containing file name (the calling routine will need to open the file)
def AskSaveasFilename(self, title='Save File', filetypes=None, initialfile=''): if filetypes==None: filetypes = [ ('CSV File','*.csv'), ('Any File','*.*')] fileName = FileDialog.asksaveasfilename(parent=self.tk_root, filetypes=filetypes, initialfile=initialfil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_name(self):\n return str(self.get_file())", "def get_file_name(self):\n return self.file_name", "def get_file_name(self):\n return self.__file_name", "def get_file_name(self):\n return self.path.name[6:]", "def file_name(self):\n return self.lib.file_name", ...
[ "0.85806555", "0.78965586", "0.7884057", "0.7878058", "0.7865611", "0.77958035", "0.7770247", "0.7767001", "0.77409166", "0.77409166", "0.77409166", "0.77409166", "0.77409166", "0.7704209", "0.7672761", "0.76636815", "0.7619641", "0.7506628", "0.74642754", "0.7448468", "0.743...
0.0
-1
Compute the padding necessary to ensure that convolving 'X' with a 2D kernel of shape 'kernel_shape' and stride 'stride' produces outputs with dimension 'out_dim'
def calc_pad_dims_2D(X_shape, out_dim, kernel_shape, stride, dilation=0): if not isinstance(X_shape, tuple): raise ValueError("X_shape must be of type tuple") if not isinstance(out_dim, tuple): raise ValueError("out_dim must be of type tuple") if not isinstance(kernel_shape, tuple): raise ValueError("kernel_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_pad_dims_2D(X_shape, out_dim, kernel_shape, stride, dilation=0):\n if not isinstance(X_shape, tuple):\n raise ValueError(\"`X_shape` must be of type tuple\")\n\n if not isinstance(out_dim, tuple):\n raise ValueError(\"`out_dim` must be of type tuple\")\n\n if not isinstance(kernel_s...
[ "0.8247134", "0.7567151", "0.7563502", "0.75364166", "0.7374004", "0.7361205", "0.7306342", "0.729063", "0.7279653", "0.7209143", "0.7207988", "0.7174449", "0.7173881", "0.71691567", "0.71236885", "0.71168876", "0.7110765", "0.709979", "0.7019291", "0.6944721", "0.6938874", ...
0.8221825
1
Compute the padding necessary to ensure that convolving 'X' with a 1D kernel of shape 'kernel_shape' and stride 'stride' produces outputs with length 'l_out'
def calc_pad_dims_1D(X_shape, l_out, kernel_width, stride, dilation=0, causal=False): if not isinstance(X_shape, tuple): raise ValueError("X_shape must be type tuple") if not isinstance(l_out, int): raise ValueError("l_out must be type int") if not isinstance(kernel_width, int): raise ValueError("kernel_widt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l_out(l_in: int, padding: int, dilation: int, kernel: int, stride: int) -> int:\n return (l_in + 2 * padding - dilation * (kernel - 1) - 1) // stride + 1", "def l_out_pool(l_in, kernel_size, stride=None, padding=0, dilation=1):\n if stride == None:\n stride = kernel_size\n l_out = int(\n ...
[ "0.7611012", "0.733894", "0.72302073", "0.7213094", "0.71773523", "0.7081073", "0.6933778", "0.68309605", "0.67562455", "0.668144", "0.6660785", "0.66606504", "0.6654768", "0.6646968", "0.66388535", "0.66267", "0.6568458", "0.6564548", "0.6563976", "0.65409815", "0.65240794",...
0.79546314
0
Perform a "deconvolution" (more accurately, a transposed convolution) of an input volume `X` with a weight kernel `W`, incorporating stride, pad, and dilation. Notes Rather than using the transpose of the convolution matrix, this approach uses a direct convolution with zero padding, which, while conceptually straightfo...
def deconv2D_naive(X, W, stride, pad, dilation=0): if stride > 1: X = dilate(X, stride-1) stride = 1 # pad the input X_pad, p = pad2D(X, pad, W.shape[:2], stride=stride, dilation=dilation) n_ex, in_rows, in_cols, n_in = X.shape fr, fc, n_in, n_out = W.shape s, d = stride, dilation pr1, pr2, pc1, pc2 = p ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2D(X, W, stride, pad, dilation=0):\n\ts, d = stride, dilation\n\t_, p = pad2D(X, pad, W.shape[:2], s, dilation=dilation)\n\n\tpr1, pr2, pc1, pc2 = p\n\tfr, fc, in_ch, out_ch = W.shape\n\tn_ex, in_rows, in_cols, in_ch = X.shape\n\n\t# update effective filter shape based on dilation factor\n\t_fr, _fc = fr *...
[ "0.7789402", "0.7657116", "0.73724806", "0.7076886", "0.70751727", "0.7072442", "0.6950653", "0.6888651", "0.68331355", "0.6727414", "0.66853243", "0.6679687", "0.66354847", "0.6598508", "0.6594285", "0.6574297", "0.6558899", "0.6554841", "0.6531102", "0.6515422", "0.65014327...
0.84939915
0
input a twocharacter string xy and return a base2500 value
def index(xy): if len(xy) != 2: return 'Not a valid string' with open('ch.txt', encoding="utf-8") as file: chars = file.read() print(chars) for i in range(len(chars)): if chars.contains(xy[0]): return 'Yeah'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcbin(x, y=8):\n if x >= (2**(y - 1)) or x < -(2**(y - 1) or y < 1):\n raise Exception(\"Argument outside of range.\")\n if x >= 0:\n binstr = bin(x)\n # pad with leading zeros\n while len(binstr) < y + 2:\n binstr = \"0b0\" + binstr[2:]\n return binstr\n ...
[ "0.58406514", "0.5641362", "0.55234545", "0.5480494", "0.5448977", "0.5391766", "0.5346254", "0.5310514", "0.52967805", "0.52910286", "0.5280652", "0.52701575", "0.52520615", "0.52370185", "0.5218431", "0.5205449", "0.52035004", "0.52021116", "0.5200173", "0.51575506", "0.515...
0.0
-1
Test for failing to get auth token for invalid user credentials
def test_failing_auth_token_for_invalid_user(self): response = self.client.post( "/auth/login", data=dict(username='random_test_user', password='random_test_password') ) self.assertEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fail_token(client, request):\n res = client.get('/token?uid=1')\n\n assert res.status_code == 400\n assert 'User does not exist' in res.data.decode('utf-8')", "def test_get_token_failure(self):\n url = '/api-token-auth/'\n data = {'username': 'adam', 'password': '321'}\n\n ...
[ "0.8102997", "0.7945774", "0.7934029", "0.7864483", "0.78641933", "0.7798869", "0.77983093", "0.7778654", "0.77361274", "0.7645643", "0.764208", "0.7635275", "0.76208466", "0.7603388", "0.7593273", "0.75691026", "0.7556424", "0.753166", "0.7528433", "0.74639946", "0.7459939",...
0.83376944
0
Test for creating and getting bucketlist and constituent items
def test_creating_and_getting_a_bucketlist_for_authenticated_user(self): # test all bucketlists response = self.client.post( "/bucketlists/", data=dict(name='test_bucketlist'), headers={'Authorization': self.user_token} ) bucketlist = json.loads(respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_bucketlist_items(self):\n resp = self.client.post('/bucketlists',\n data=json.dumps(self.bucketlist),\n content_type=\"application/json\", headers={\n \"Authorization\": self.token\n ...
[ "0.7643662", "0.73914295", "0.7356936", "0.73352313", "0.72897893", "0.72300017", "0.7208685", "0.71998215", "0.7146859", "0.71368647", "0.7119349", "0.7117094", "0.7090583", "0.7025843", "0.7002102", "0.69745415", "0.6969966", "0.6968271", "0.69138056", "0.68787915", "0.6868...
0.74604183
1
Test that data is published to expected topics
def test_listen(sysmon_tester_agent): listen(sysmon_tester_agent, _test_config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stream_publish(self):\n pass", "def test_topic_check(self):\n # Create bus\n bus = pubsub.PubSubBus()\n\n # Try to publish with non-existent topic\n self.assertRaises(ValueError, bus.publish, 'foo', 'data')\n\n foo_sub = SingleSubscriber(\n self, bus,...
[ "0.7107211", "0.7087697", "0.707206", "0.69657946", "0.6940049", "0.6910118", "0.68783116", "0.68650997", "0.6853177", "0.6827456", "0.677853", "0.675708", "0.6741788", "0.6727343", "0.67225796", "0.6717456", "0.67075086", "0.6682258", "0.66819495", "0.66674376", "0.6660347",...
0.0
-1
returns True if ad_url is in filter list, meaning it is not an ad and should be filtered
def filter_obvious_non_ads(ad_url): filter = [ 'http:pagead2.googlesyndication.compageadimagesgoogle-logo.png', 'http:pagead2.googlesyndication.compageadimagesgreen-check.png', 'http:pagead2.googlesyndication.compageadimagesnessie_icon_thin_chevron_white.png', 'http:pagead2.googlesyndication.compageadima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_audience(self, request, audience):\n if not self.audiences:\n return audience == request.host_url\n for audience_pattern in self._audience_patterns:\n if audience_pattern.match(audience):\n return True\n return False", "def contains_ads(self):\...
[ "0.63571125", "0.60815376", "0.59847295", "0.596617", "0.57923347", "0.5784023", "0.5747687", "0.56860244", "0.56672096", "0.56461245", "0.56422883", "0.5639728", "0.55854344", "0.5545889", "0.5516618", "0.55105555", "0.5492124", "0.54894924", "0.54785776", "0.5471862", "0.54...
0.79558086
0
Reads a float array from Example proto to np array.
def read_input_float_feature(feature_map, key, shape): if shape is None: (dim_z, dim_y, dim_x) = feature_map.feature[key + '/dim'].int64_list.value else: (dim_z, dim_y, dim_x) = shape tensor = np.array(feature_map.feature[key].float_list.value[:]).reshape( dim_z, dim_y, dim_x) return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_float(filename):\n\tf = open(filename, \"r\")\n\tarr = np.fromfile(f, dtype='>f4')\n\treturn arr", "def load_data(self):\n return numpy.fromfile(self.data_fname, dtype=numpy.float32)", "def convert_stream(self, stream):\n return np.fromstring(stream, \"Float32\")", "def load_file(file_...
[ "0.69671804", "0.6889737", "0.6788302", "0.6292833", "0.6253976", "0.6239448", "0.6226115", "0.61455786", "0.60687584", "0.6067613", "0.6035139", "0.60305834", "0.6010634", "0.59828347", "0.5940118", "0.59288985", "0.59206367", "0.5876959", "0.5862205", "0.58601415", "0.58596...
0.55965406
55
Returns the maximum allowable outgoing flow for a given stream. If the allowable flow is zero, then waits on the network until WindowUpdated frames have increased the flow rate.
async def _wait_for_outgoing_flow(self, request: Request, stream_id: int) -> int: local_flow: int = self._h2_state.local_flow_control_window(stream_id) max_frame_size: int = self._h2_state.max_outbound_frame_size flow = min(local_flow, max_frame_size) while flow == 0: await s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_flow(self, source, sink):\n\n max_flow = 0\n\n for i in range(self.V):\n for j in range(self.V):\n self.flow[i, j] = 0\n\n while self.bfs(source, sink):\n increment = maxint\n\n u = sink\n\n while self.pred[u] != -1:\n ...
[ "0.6194889", "0.6043823", "0.5908881", "0.55964226", "0.5325499", "0.53132993", "0.51967525", "0.5127323", "0.4998654", "0.49965987", "0.4975326", "0.49690938", "0.49684918", "0.48983842", "0.48562852", "0.48515046", "0.48479512", "0.48470542", "0.48407075", "0.48086783", "0....
0.7008591
0
Parse start date and time.
def _parse_start(self, item, start_time): date_str = item.css("*::text").extract_first() if not date_str: return date_match = re.search(r"\w{3,9} \d{1,2}, \d{4}", date_str) if date_match: parsed_date = datetime.strptime(date_match.group(), "%B %d, %Y") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_start(self, date_str):\n # TODO: Find start time\n return datetime.strptime(date_str.title(), \"%B %d, %Y\")", "def _parse_start(self, response):\n date_str = response.css(\".date time::attr(datetime)\").extract_first()\n time_str = \"\".join(response.css(\"article.time::te...
[ "0.8012607", "0.7956383", "0.775254", "0.7745357", "0.7708766", "0.7648467", "0.7642984", "0.754136", "0.74821883", "0.7459805", "0.7399587", "0.7093819", "0.697785", "0.69141096", "0.6728942", "0.65998924", "0.6470897", "0.6462791", "0.6380753", "0.634331", "0.6262659", "0...
0.79541355
2
This is the constructor of the Line class
def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, vertices, **kwargs):\n super(Line, self).__init__(vertices, **kwargs)\n self._geotype = \"Line\"\n return", "def __init__(self, c, p1=Point(), p2 = Point()):\n Line.__init__(self, p1, p2)\n self.cnv = c", "def __init__(self, line):\n self.start = Lin...
[ "0.8268392", "0.8146298", "0.7959601", "0.79078287", "0.7490877", "0.7410803", "0.7288737", "0.7281866", "0.7220005", "0.72124076", "0.7203657", "0.71134865", "0.7107252", "0.7057454", "0.70520735", "0.6942884", "0.6937187", "0.689195", "0.6846719", "0.6831642", "0.6812054", ...
0.0
-1
xaxis label and units. Axis labels know about units. We need to do this so that we can detect when axes are not commesurate. Currently this is ignored other than for formatting purposes.
def xaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.xbox.set_text(r"$%s$" % (label)) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_xlabel(label)\n pass", "def set_xunits(self, units, include_brackets):\n if include_brackets:\n plt.xlabel(\n \"x (\" + self.xunits_from_units(units=uni...
[ "0.77864", "0.68611026", "0.6854408", "0.65931517", "0.6455449", "0.64169616", "0.63975906", "0.6340904", "0.6327228", "0.62637603", "0.62549233", "0.62412125", "0.6206764", "0.61634564", "0.6145363", "0.61047965", "0.6085972", "0.60728234", "0.6061254", "0.6040449", "0.60404...
0.7472149
1
yaxis label and units.
def yaxis(self,label,units): if units != "": label = label + " (" + units + ")" self.ybox.set_text(r"$%s$" % (label)) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_ylabel(label)\n pass", "def ylabel(ylabel):\n impl.ylabel(**locals())", "def labels_y(y_unit, latex = True, verbose = 0): \n\n if verbose > 1:\n print(\"Spectra...
[ "0.8391478", "0.7328002", "0.7229695", "0.72150916", "0.7116793", "0.70888394", "0.70200956", "0.7003589", "0.6940507", "0.6940507", "0.6785098", "0.67295647", "0.67104685", "0.66930753", "0.6681132", "0.66706085", "0.6655517", "0.6536776", "0.65352345", "0.65045035", "0.6448...
0.83645123
1
Get the initial conditions (a PDF) withsupport `x`. This function must be redefined in subclasses. `x` is a length N ndarray representing the support of the initial condition PDF, i.e. the xdomain. This returns a length N ndarray describing the distribution.
def get_IC(self, x, dx, **kwargs): raise NotImplementedError("IC model %s invalid: must define the get_IC function" % self.__class__.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conditional(self, x):\n # self._mu = np.random.rand(self._n_components, self._n_dims)\n # self._mu = x[np.random.choice(x.shape[0], self._n_components, False), :]\n\n # response = np.zeros((x.shape[0], self._n_components))\n response = []\n # compute conditional probabili...
[ "0.63827074", "0.5953372", "0.5933818", "0.5843133", "0.58424085", "0.58012825", "0.5771625", "0.5761548", "0.5727641", "0.569203", "0.569203", "0.56865376", "0.5683423", "0.5653233", "0.5639571", "0.56326306", "0.5591509", "0.5555189", "0.55493927", "0.55066127", "0.55061513...
0.0
-1
Setup flask test app
def app(): test_db = 'sqlite:///ratemovies_test.db' settings = { 'DEBUG': False, 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': test_db } _app = create_app(test_config=settings) ctx = _app.app_context() ctx.push() yield _app ctx.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.app = Flask(__name__)\n self.app_context = self.app.app_context()\n self.app_context.push()\n self.client = self.app.test_client()", "def app():\n os.environ[\"FLASK_ENV\"] = \"test\"\n return create_app()", "def create_app(test_config=\"test_config.py\...
[ "0.80199814", "0.80170506", "0.7855729", "0.7794914", "0.7754035", "0.76583874", "0.765709", "0.7655299", "0.7642242", "0.76025945", "0.7588315", "0.75806785", "0.7536184", "0.7536184", "0.7519244", "0.75121415", "0.7507728", "0.74758744", "0.7475763", "0.7467466", "0.7467227...
0.0
-1
Return the number of nodes in this search trie.
def __len__(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_count(self):\n return self._root.count()", "def count(self):\n return self.__tree.node_count", "def numNodes(self):\n res = 0\n for n in self.iternodes():\n res += 1\n return res", "def node_count(self):\n return self._node_count", "def number_o...
[ "0.82841825", "0.8099688", "0.8029568", "0.80173093", "0.79952693", "0.79530835", "0.7946479", "0.7946479", "0.7913318", "0.7880282", "0.7842051", "0.7803598", "0.7797644", "0.7692612", "0.7683431", "0.7664927", "0.7659269", "0.76226175", "0.75838107", "0.75726026", "0.749792...
0.0
-1
Recursively construct nodes in a trie for the given term and metadata element, adding the element to every intermediate node along the way.
def _add(self, node, term, i, element): if i > 0: # If this isn't the root node add the element to the # node since it will be considered a match for the # current prefix node.add_element(element) if i == len(term): return char = term[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_trie(self, root, *words):\n _end = '_end_'\n for word in words:\n current_dict = root\n for letter in word:\n current_dict = current_dict.setdefault(letter, {})\n current_dict[_end] = word\n\n return root", "def addWord(self, word)...
[ "0.6279866", "0.62746936", "0.61444885", "0.60815966", "0.5994504", "0.5903968", "0.5847147", "0.58295196", "0.5803181", "0.5780361", "0.57369155", "0.57229745", "0.57040226", "0.5597469", "0.5591795", "0.5583159", "0.5581413", "0.5521476", "0.55119896", "0.5501063", "0.54988...
0.6254299
2
Counts the maximum number of references any given production in the grammar can have on the final tree.
def countRecursiveReferences(self) -> Tuple[Dict[str, List[str]], Dict[str, Dict[str, int]]]: countReferences = {} isReferencedBy = {} for nt in self.non_terminals: # for each non-terminal in the grammar for production in self.grammar[nt]: # for each possible production on that non t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_reference(gram_list, references):\r\n gram_sub_str = ' '.join(gram_list)\r\n gram_count = []\r\n for item in references:\r\n # calculate the count of the sub string\r\n gram_count.append(len(re.findall(gram_sub_str, item)))\r\n return gram_count", "def calculate_reference(...
[ "0.6344946", "0.6331416", "0.61905414", "0.59246284", "0.57841647", "0.5763673", "0.5751604", "0.57489383", "0.57478607", "0.57450664", "0.57291263", "0.57115686", "0.56965035", "0.56922156", "0.56860703", "0.56548613", "0.56532294", "0.56429106", "0.5602189", "0.5600686", "0...
0.7292844
0
Gets the maximum number of references a non terminal production has.
def findReferences(self, nt: str, isReferencedBy: Dict[str, List[str]], countReferencesByProd: Dict[str, Dict[str, int]] ) -> Dict[str, int]: results = [] if nt == "<expr_0>": # if its the root term, the maximum number of references i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_num_links(self):\n return self._max_num_links", "def n_refs(self):\n return self._n_refs", "def get_ref_length(self, ref):\n tbl = self._get_references_node()\n return get_ref_length(tbl, ref)", "def num_global_external_references(self):\n if self.global_external_re...
[ "0.68808335", "0.6746698", "0.67138547", "0.6631458", "0.65965766", "0.65712804", "0.6564011", "0.6546533", "0.6501295", "0.63953185", "0.6383301", "0.6367133", "0.63469726", "0.629366", "0.62000734", "0.6180161", "0.6173758", "0.61720425", "0.6171267", "0.6166574", "0.614614...
0.60324514
36
Returns the estimated probability of the query using rejection method. Ignore any samples that result in any invalid evidence variables.
def rejection_sample(self, trial_count): count = 0 valid_trial_count = 1 for i in xrange(trial_count): values = {} valid_sample = True for letter in self.letters: prob = self.variables[letter].get_prob(values) values[letter] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirmProbability(self, totalDice, bidCount):\n result = self.choose(totalDice, bidCount) * P**bidCount * (1 - P)**(totalDice-bidCount)\n return result", "def rejection_sampling(data, weights):\n weights = np.asarray(weights)\n idx = weights > np.random.uniform(0, np.max(weights), len(we...
[ "0.6198907", "0.5918354", "0.5898204", "0.5746092", "0.5730764", "0.5658549", "0.56502354", "0.5639987", "0.5632724", "0.5616158", "0.56135935", "0.56078446", "0.5594434", "0.55477095", "0.5545576", "0.55351746", "0.5517408", "0.5516377", "0.5474847", "0.5454276", "0.54473037...
0.7291372
0
Electron density per m^3
def electron_density_per_m3(self): return self.electron_density * 1e6
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def electron_density(self):\n return N_avo * self.num_electrons * self.density / self.molar_mass", "def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3", "def number_density(self) -> u.m**-3:\n return self._number_density", "def...
[ "0.75250614", "0.7471538", "0.6671602", "0.6617881", "0.6527502", "0.65202945", "0.6465667", "0.64480203", "0.641283", "0.6402636", "0.6392911", "0.6370481", "0.62934023", "0.62076735", "0.6181983", "0.6180715", "0.61612326", "0.6125147", "0.60930717", "0.6088828", "0.6076462...
0.8596014
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues) plt.title('Confusion Matrix', fontsize=20) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81922984", "0.80933887", "0.80272716", "0.8016492", "0.79913706", "0.79885876", "0.79777396", "0.79729784", "0.7958926", "0.7954523", "0.79347897", "0.7931899", "0.7931772", "0.7928666", "0.7923684", "0.7921764", "0.79213995", "0.7920191", "0.792016", "0.7919876", "0.79153...
0.0
-1
Calculate the DamerauLevenshtein distance between sequences.
def dameraulevenshtein(self, seq1, seq2): # codesnippet:D0DE4716-B6E6-4161-9219-2903BF8F547F # Conceptually, this is based on a len(seq1) + 1 * len(seq2) + 1 matrix. # However, only the current and two previous rows are needed at once, # so we only store those. oneago = None thisrow ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pairwise_dist(self,seq1,seq2):\n \n return jf.damerau_levenshtein_distance(str(seq1), str(seq2))", "def damerau_levenshtein_distance(s1, s2):\n\n utils.check_for_none(s1, s2)\n utils.check_for_type(str, s1, s2)\n\n # s1 = utils.unicode_normalize(s1)\n # s2 = utils.unicode_normalize(s2)...
[ "0.7851929", "0.75725025", "0.74737394", "0.7240839", "0.7121927", "0.7057333", "0.70353204", "0.7017338", "0.70074964", "0.68133575", "0.6793625", "0.6783736", "0.6783736", "0.675899", "0.67561644", "0.6752951", "0.67469144", "0.67329764", "0.66845506", "0.6648064", "0.65433...
0.7028208
7
Applies network layers and ops on input image(s) x.
def forward(self, x): device = x.device x, sources = self._get_sources(x) # apply multibox head to source layers conf = [] loc = [] for i, (loc_fn, conf_fn) in enumerate(zip(self.loc, self.conf)): l = loc_fn(sources[i]).permute(0, 2, 3, 1).contiguous() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_network(inputs):\n return apply_layer(tf.sigmoid(apply_layer(inputs, 64)), 1)", "def forward(self, x):\n for task_module_name in self.task_module_name_path[self.task_idx]:\n for layer in self.task_modules[task_module_name]:\n x = layer(x)\n #x = self.task_...
[ "0.65635645", "0.6369926", "0.6366342", "0.6353145", "0.6308525", "0.63080144", "0.6259044", "0.6207936", "0.61983746", "0.6192247", "0.6176785", "0.6163958", "0.61539495", "0.61442596", "0.61295325", "0.61276245", "0.6121304", "0.6115892", "0.61109567", "0.60991436", "0.6084...
0.0
-1
make conv2d layer with parameters
def conv(input, inch, outch, filter_h, filter_w, stride_h, stride_w, padding='SAME', name='conv_layer'): with tf.name_scope(name) as scope: layer = tf.layers.conv2d(input, outch, filter_h, strides=(stride_h, stride_w), padding="same", activation=tf.nn.relu) return la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_conv_type2(model, depth):\n model.add(Convolution2D(depth, 3, 3, subsample=(1, 1)))", "def _conv2d_layer(self, inputs, filters_num, kernel_size, name, use_bias=False, strides=1):\n if strides > 1: # modified 0327\n inputs = tf.pad(inputs, paddings=[[0, 0], [1, 0], [1, 0], [0, 0]], m...
[ "0.7279625", "0.7188575", "0.70890415", "0.7070724", "0.70557415", "0.699893", "0.69928545", "0.69468975", "0.69453466", "0.69453466", "0.69366103", "0.6928607", "0.6926231", "0.69182336", "0.6902095", "0.68858635", "0.6836865", "0.68286", "0.68230224", "0.6821344", "0.681808...
0.71879214
2
add L2 pooling layer to input L2norm pooling selects average of squared rectangular neighborhood & apply square root.
def l2pool(input, filter_h, filter_w, stride_h, stride_w, padding, name): with tf.name_scope(name): squared = tf.square(input) subsample = tf.nn.avg_pool(squared, ksize=[1, filter_h, filter_w, 1], strides=[1, stride_h, stride_w, 1], padding=padding) subsamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_average_pooling_2d(x, use_cudnn=True):\n\n return F.average_pooling_2d(x, ksize=(x.shape[2], x.shape[3]), use_cudnn=use_cudnn)", "def l2(weights):\n\treturn np.sqrt(np.sum(weights * weights))", "def convert_pool2d(g, op, block):\n\n adaptive = op.attr(\"adaptive\")\n ceil_mode = op.attr(\"c...
[ "0.5871164", "0.5676643", "0.5663675", "0.5580594", "0.55603546", "0.5511111", "0.5453032", "0.5402045", "0.5380037", "0.534318", "0.53420675", "0.53215724", "0.5320973", "0.53174394", "0.53137684", "0.5274193", "0.52677375", "0.52624005", "0.52130866", "0.5212137", "0.520823...
0.6388516
0
Generate a random United States Employer Identification Number (EIN). An United States An Employer Identification Number (EIN) is also known as a Federal Tax Identification Number, and is used to identify a business entity. EINs follow a format of a
def ein(self) -> str: # Only certain EIN Prefix values are assigned: # # https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes ein_prefix_choices: List[str] = [ "01", "02", "03", "04", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itin(self) -> str:\n\n area = self.random_int(min=900, max=999)\n serial = self.random_int(min=0, max=9999)\n\n # The group number must be between 70 and 99 inclusively but not 89 or 93\n group: int = self.random_element([x for x in range(70, 100) if x not in [89, 93]])\n\n i...
[ "0.60033274", "0.58758867", "0.5875787", "0.5840039", "0.57153285", "0.5701205", "0.5681064", "0.56764835", "0.56096095", "0.5591005", "0.5551279", "0.55171835", "0.5484305", "0.5462546", "0.54304606", "0.5371505", "0.5335441", "0.5277129", "0.52713925", "0.5239948", "0.52139...
0.6028611
0
Get default cell size value.
def get_default_cell_size(cls, db, x, y, z, cell): ret_val, cell.value = gxapi_cy.WrapBIGRID._get_default_cell_size(GXContext._get_tls_geo(), db, x.encode(), y.encode(), z.encode(), cell.value) return ret_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Size(self, default=None):\n return self.data.get('size', default)", "def get_default_page_size(self):\n return self.default_page_size", "def _get_default_size(self):\n default_width = default_height = ''\n if self.selector_declarations:\n default_width = self.sele...
[ "0.7406437", "0.71481436", "0.70099425", "0.68779343", "0.6874531", "0.67571783", "0.6701486", "0.6659154", "0.6642595", "0.65857077", "0.6541842", "0.6533074", "0.6533074", "0.6533074", "0.6525733", "0.6525733", "0.6494386", "0.64833504", "0.64423037", "0.64131445", "0.63781...
0.8013108
0
Add a new experience to memory.
def add(self, states, all_state, action, all_actions, reward, next_state, all_next_state, done): e = self.experience(states, all_state, action, all_actions, reward, next_state, all_next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "...
0.6427997
33
Return the current size of internal memory.
def __len__(self): return len(self.memory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573752", "0.82169205", "0.8200361", "0.8087402", "0.8021614", "0.7890747", "0.78219426", "0.78017354", "0.77905464", "0.7758844", "0.77559924", "0.77559924", "0.775519", "0.77544576", "0.7733221", "0.7732168", "0.7720068", "0.77145016", "0.77092093", "0.77077913", "0.7697...
0.75127405
53
Set the parameters threshold.
def set_threshold(self, threshold): self._threshold = check_value_positive('threshold', threshold)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._s...
[ "0.75904775", "0.6962668", "0.6962668", "0.6962668", "0.6962668", "0.6962668", "0.66798", "0.6573095", "0.6557857", "0.65344787", "0.647978", "0.6470806", "0.6400144", "0.63341093", "0.6318119", "0.63161755", "0.6308599", "0.6299662", "0.6247986", "0.62410915", "0.62218195", ...
0.69708884
1
Compute mean and standard deviation for historical daily counts in given window.
def _compute_mean_std(self, history, window=28): history = np.array(history[-window - 1: -1]) decay_weights = [self.decay ** a for a in range(len(history), 0, -1)] weighted = history * decay_weights mean = weighted.mean() std = weighted.std() return mean, std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rolling_std(self, window=20, normalize=False):\n values = self.daily['Adj Close']\n if normalize: values = self.normalize(values)\n return values.rolling(window).std()", "def get_rolling_std(values, window):\r\n return pd.rolling_std(values, window=window)", "def get_rolling_std(val...
[ "0.7156707", "0.69563454", "0.68889934", "0.68031394", "0.65568167", "0.64584196", "0.6405226", "0.62985945", "0.6296525", "0.6267641", "0.617713", "0.6114039", "0.6094793", "0.6086178", "0.6078605", "0.60264426", "0.5976451", "0.59609866", "0.59573233", "0.59519356", "0.5931...
0.6974525
1
Return true if the priority queue does not contain any node
def isEmpty(self): return len(self._pool) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.priority_queue) == 0", "def any(self) -> bool:\n return len(self.queue) > 0", "def is_empty(self):\n return self.queue == []", "def empty(self):\r\n return self.queue == []", "def empty_queue(queue):\n return queue.front is None", "def isEm...
[ "0.78619343", "0.724722", "0.72285265", "0.7219937", "0.7177337", "0.7157373", "0.7142936", "0.7136744", "0.7136744", "0.7133738", "0.71158105", "0.7115304", "0.7108593", "0.7107909", "0.7100756", "0.70957786", "0.7091771", "0.70899045", "0.7075348", "0.7073441", "0.7071565",...
0.0
-1
Get variables that participate in an expression The exact variables returned depends on the method used to determine incidence. For example, ``method=IncidenceMethod.identify_variables`` will return all variables participating in the expression, while ``method=IncidenceMethod.standard_repn`` will return only the variab...
def get_incident_variables(expr, **kwds): config = IncidenceConfig(kwds) method = config.method include_fixed = config.include_fixed linear_only = config.linear_only if linear_only and method is IncidenceMethod.identify_variables: raise RuntimeError( "linear_only=True is not supp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self, *args, **kwargs):\n return self._optimizer.variables(*args, **kwargs)", "def variables(self) -> pulumi.Input[Sequence[pulumi.Input['AssetModelExpressionVariableArgs']]]:\n return pulumi.get(self, \"variables\")", "def variables(self) -> pulumi.Input[Sequence[pulumi.Input['...
[ "0.54273486", "0.519651", "0.519651", "0.5124917", "0.511992", "0.5001495", "0.4977053", "0.4906163", "0.4903531", "0.48541722", "0.48529178", "0.4833822", "0.48131612", "0.47701487", "0.47678682", "0.47662506", "0.47530222", "0.4728819", "0.4672121", "0.4639792", "0.46338844...
0.6816663
0
Convert data columns to datetimes. Check if object columns in a dataframe can be parsed as dates. If yes, rewrite column with values parsed as dates.
def recognize_dates(dframe): for i, dtype in enumerate(dframe.dtypes): if dtype.type == np.object_: column = dframe.columns[i] new_column = _convert_column_to_date(dframe, column) if not new_column is None: dframe[column] = new_column return dframe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert(frame):\n frame = frame.convert_objects(convert_numeric=True)\n for column in frame:\n if column in c.dates:\n frame[column] = frame[column].astype('datetime64')\n return frame", "def _preprocess_temporal_columns(df: DataFrame) -> DataFrame:\n for col in df.select_dtype...
[ "0.75098544", "0.7087017", "0.7058885", "0.69461", "0.69408333", "0.69273263", "0.6719332", "0.65359586", "0.65048695", "0.6471247", "0.63772154", "0.63733363", "0.636413", "0.63515455", "0.6293363", "0.6286831", "0.622281", "0.61918646", "0.613217", "0.60787344", "0.6051648"...
0.7748912
0
Get a list of Products
def test_get_product_list(self): self._create_products(5) resp = self.app.get("/products") self.assertEqual(resp.status_code, status.HTTP_200_OK) data = resp.get_json() self.assertEqual(len(data), 5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_products(self):\n return self._make_get_request(self._urls['products'])", "def get_all_products(self):\n\t\tpass", "def get(self):\n return Products().get_all_products()", "def products(self):\n return list(Product.select())", "def list_products(self):\n url = self.base...
[ "0.8526346", "0.8258815", "0.81158453", "0.80976355", "0.8046384", "0.7997196", "0.7990647", "0.7961487", "0.7903322", "0.78983736", "0.78821486", "0.786502", "0.7746972", "0.77126104", "0.7627231", "0.7615329", "0.7557139", "0.7552181", "0.7544176", "0.75401574", "0.7512356"...
0.6995828
44
Get a Product thats not found
def test_get_product_not_found(self): resp = self.app.get("/products/0") self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_product_that_doesnot_exist_in_inventory(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n ...
[ "0.64637876", "0.6316111", "0.62717265", "0.62078625", "0.6204175", "0.6191436", "0.6137049", "0.6117989", "0.60395724", "0.6025381", "0.5980918", "0.5956974", "0.5952704", "0.59502584", "0.59479815", "0.5933025", "0.59325606", "0.59083056", "0.5860325", "0.58585984", "0.5841...
0.7146867
0
Query Products by Price
def test_query_product_list_by_price(self): products = self._create_products(10) test_price_low = 30 test_price_high = 100 price_products = [product for product in products if product.price >= test_price_low and product.price <= test_price_high] resp = self.app.get( "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_price(cls, price: float):\n cls.logger.info(\"Processing price query for %s ...\", price)\n return cls.query.filter(cls.price == price).order_by(cls.id).all()", "def get_price():\n \n #Teacher's code. Could not get it working.\n #price = db(db.product.name == productName).selec...
[ "0.77169204", "0.70002115", "0.69464356", "0.6510316", "0.65097415", "0.62784094", "0.60495", "0.5991454", "0.591836", "0.59093183", "0.59022754", "0.58641595", "0.5856563", "0.58137536", "0.58039916", "0.5785772", "0.57851064", "0.5779367", "0.57670563", "0.57445174", "0.571...
0.7231043
1
Create a Product with missing data
def test_create_product_no_data(self): resp = self.app.post( "/products", json={}, content_type="application/json" ) self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_nullables(self):\n self.assertIsNone(self.product3.main_image)\n self.assertIsNone(self.product3.protein)\n self.assertIsNone(self.product3.fat)\n self.assertIsNone(self.product3.carbs)\n self.assertIsNone(self.product3.calories)", "def test_object_is_not_creat...
[ "0.65588826", "0.65119845", "0.64869165", "0.64614993", "0.64162344", "0.6397853", "0.63894874", "0.63328326", "0.63087726", "0.63005304", "0.62383354", "0.61990327", "0.6116126", "0.6066462", "0.60569936", "0.6048549", "0.6039679", "0.6032216", "0.60268784", "0.6024345", "0....
0.6918995
0
Return the active track.
def _get_active_track(t_idx, program, channel): key = (program, channel) if key in tracks[t_idx]: return tracks[t_idx][key] tracks[t_idx][key] = Track(program, _is_drum(channel)) return tracks[t_idx][key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track(self):\n return self._track", "def track(self):\r\n\t\treturn self._track", "def get_active(self):\n return self._active", "def current_track():\n track = sonos.get_current_track_info()\n track[\"title\"] = track[\"title\"][:30]\n track[\"artist\"] = track[\"artist\"][:30]\n ...
[ "0.7342291", "0.7312559", "0.6865959", "0.6812659", "0.6757633", "0.6757633", "0.6757633", "0.6757633", "0.6561503", "0.64777946", "0.64161944", "0.6393138", "0.6377567", "0.6377567", "0.63317627", "0.6324405", "0.62764555", "0.6223306", "0.62065953", "0.6198751", "0.6164824"...
0.7382982
0
Return pretty_midi Note object as a MusPy Note object.
def parse_pretty_midi_note(note: PrettyMIDINote) -> Note: return Note(note.start, note.duration, note.pitch, note.velocity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretty_midi(midi: PrettyMIDI) -> Music:\n key_signatures = parse_pretty_midi_key_signatures(midi)\n time_signatures = parse_pretty_midi_time_signatures(midi)\n lyrics = parse_pretty_midi_lyrics(midi)\n tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks]\n return Music(\n...
[ "0.7293404", "0.69942254", "0.6827884", "0.6659135", "0.66532123", "0.65662116", "0.63545966", "0.6179956", "0.61643726", "0.60831136", "0.6072116", "0.60466844", "0.6038118", "0.6034175", "0.5991713", "0.5982047", "0.59645224", "0.592573", "0.5920061", "0.5893302", "0.588902...
0.8291737
0
Return a pretty_midi Instrument object as a Track object.
def parse_pretty_midi_instrument(instrument: Instrument) -> Track: notes = [parse_pretty_midi_note(note) for note in instrument.notes] return Track( instrument.program, instrument.is_drum, instrument.name, notes )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretty_midi(midi: PrettyMIDI) -> Music:\n key_signatures = parse_pretty_midi_key_signatures(midi)\n time_signatures = parse_pretty_midi_time_signatures(midi)\n lyrics = parse_pretty_midi_lyrics(midi)\n tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks]\n return Music(\n...
[ "0.70979977", "0.67129993", "0.6334844", "0.59775984", "0.5868439", "0.58336437", "0.57237566", "0.57043034", "0.5686008", "0.5639041", "0.56086385", "0.5597634", "0.55318654", "0.5401908", "0.5341095", "0.52723014", "0.5243355", "0.5189497", "0.5172072", "0.51548624", "0.512...
0.82236636
0
Used for comparing tokens' chronological orders. If t1.key() < t2.key() then t1 appears before t2.
def key(self): return self.sentence_idx * (10 ** 6) + self.get_id()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, other):\n return self._key < other._key", "def __lt__(self, other):\n return other > self._cmpkey()", "def __gt__(self, other):\n return self._key > other._key", "def ascendingTimeOrder(t1, t2):\n return cmp(t1['total_seconds'], t2['total_seconds'])", "d...
[ "0.7047981", "0.6762525", "0.6563232", "0.6541728", "0.65251356", "0.64715487", "0.642599", "0.6399123", "0.6358407", "0.6275156", "0.6262451", "0.62558246", "0.62328625", "0.6192279", "0.61878246", "0.6184352", "0.6175027", "0.61494285", "0.6135046", "0.60539305", "0.6048277...
0.0
-1
Distance in tokens between the two given tokens.
def token_distance_between_tokens(t1, t2): assert t1.document.id == t2.document.id # If t1 comes after t2, flip variables if t1.key() > t2.key(): temp = t1 t1 = t2 t2 = temp assert t1.sentence_idx <= t2.sentence_idx,\ "wrong order for tokens, t1 should appear before ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTokenDistance(self,n1,n2):\n txt = self.getText()\n if( n1 < n2 ):\n start = n1.getSpan()[1]+1\n end = n2.getSpan()[0]\n direction = 1\n else:\n start = n2.getSpan()[1]+1\n end = n1.getSpan()[0]\n direction = -1\n\n ...
[ "0.8172838", "0.8170361", "0.797784", "0.703881", "0.6943071", "0.6893108", "0.68514365", "0.6758776", "0.6743447", "0.6735663", "0.6735647", "0.6726448", "0.66758597", "0.66699535", "0.6649276", "0.6644578", "0.6642823", "0.6636252", "0.6635442", "0.66315943", "0.6617269", ...
0.84209156
0
Converts Users to JSON and returns it
def json(self): return { 'id': self.id, 'id_bank_data': self.id_bank_data, 'national_id_document': self.national_id_document, 'country': self.country, 'name': self.name, 'surname': self.surname, 'mail': self.mail, 'g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userJSON():\n user = session.query(User).all()\n result = []\n\n for i in user:\n result += [i.serialize]\n\n return jsonify(Users=result)", "def json(self):\n result = {}\n for user in self.users:\n result[user.user_id] = user.json\n return result", "def ...
[ "0.81121004", "0.8069787", "0.7850647", "0.78057593", "0.7632436", "0.7553775", "0.7504452", "0.7455339", "0.74321014", "0.74134016", "0.7411823", "0.73564863", "0.7353144", "0.7344763", "0.7330775", "0.7289913", "0.7217889", "0.7205674", "0.7182952", "0.71791804", "0.7173752...
0.0
-1
Get the Gateway URL.
async def get_gw(test_cli) -> str: gw_resp = await test_cli.get('/api/v6/gateway') gw_json = await gw_resp.json return gw_json['url']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"gateway_url\")", "def gateway_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"gateway_url\")", "def get_gateway_url(self, request):\n raise NotImplementedError('Must be implemented in PaymentProc...
[ "0.8808191", "0.8464898", "0.7873342", "0.7534917", "0.73695016", "0.73621035", "0.73621035", "0.7348563", "0.7348563", "0.7249318", "0.72031534", "0.71239895", "0.7105501", "0.7040983", "0.70385796", "0.70027286", "0.69962215", "0.6957233", "0.6953203", "0.69384307", "0.6931...
0.706232
13
'licenses' value will be changed when it installed licenses is below to sql, license _id is no license select from osf_nodelicense;
def create_preprints_patch(self, preprints_id, p_year_month, po, abstract, doi): data = {} attributes = {} attributes['description'] = abstract attributes['doi'] = doi attributes['original_publication_date'] = p_year_month license_record = {} license_record['copyr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qs_license():\r\n paragraph = document.add_paragraph('')\r\n document.add_heading('License', level=1)\r\n lic_metric = ['lef', 'serial', 'name', 'organization', 'product', 'numberOfCores', 'isExpired', 'expiredReason', 'isBlacklisted', 'isInvalid']\r\n qs_lic = get_qlik_sense.get_license()\r\n n...
[ "0.64473814", "0.61319053", "0.598101", "0.5975616", "0.57881576", "0.5660515", "0.5626086", "0.5614522", "0.55855227", "0.55624175", "0.5561593", "0.5558785", "0.55549985", "0.55407196", "0.5540423", "0.5510674", "0.547765", "0.5455072", "0.54527754", "0.54357624", "0.543523...
0.0
-1
Transform x, y, z values into RGB colors.
def _rgb(x, y, z): rgb = np.array([x, y, z]).T rgb -= rgb.min(0) rgb /= np.maximum(rgb.max(0), 1e-16) # avoid div by zero return rgb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int2color_tuple(x):\n red_val = int(1000 * x % 255)\n green_val = int(10000 * x % 255)\n blue_val = int(100000 * x % 255)\n return red_val, green_val, blue_val", "def int2color(x):\n # r = int(1000 * x % 255)\n # g = int(10000 * x % 255)\n # b = int(100000 * x % 255)\n x = 0 if x == 0...
[ "0.67375964", "0.66734827", "0.6468065", "0.6397281", "0.63308555", "0.6318717", "0.62222016", "0.6016022", "0.6011604", "0.601133", "0.5971275", "0.59469557", "0.59302026", "0.58573526", "0.5854485", "0.5842732", "0.5829991", "0.5825446", "0.58073014", "0.5768837", "0.576405...
0.7237567
0
Create a colormap with value below a threshold being greyed out and transparent. Params
def colormap_masked(ncolors=256, knee_index=None, cmap='inferno', alpha=0.3): cm = plt.cm.get_cmap(cmap)(np.linspace(0, 1, ncolors)) if knee_index is None: # Then map to pvals, as -log(p) between 0 and 3.5, and threshold at 0.05 knee_index = np.argmin(abs(np.linspace(0., 3.5, ncolors)+np.log10(0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solarize(img, threshold):\n \n for x, y, col in img:\n\n # Invert the values of all RGB components less than 128,\n # leaving components with higher values unchanged.\n\n red, green, blue = col\n\n if red < threshold:\n red = 255 - red\n\n if green < threshol...
[ "0.65614676", "0.6512516", "0.64896274", "0.64896274", "0.64896274", "0.6484343", "0.6243192", "0.62310296", "0.6212723", "0.61078703", "0.60917246", "0.60615873", "0.59070307", "0.5900779", "0.58830136", "0.58513767", "0.5808906", "0.579982", "0.57951266", "0.57929254", "0.5...
0.5943468
12
Annotate barplot with pvalues.
def barplot_annotate_brackets(num1, num2, data, center, height, color='k', yerr=None, dh=.05, barh=.05, fs=None, maxasterix=None): if type(data) is str: text = data else: # * is p < 0.05 # ** is p < 0.005 # *** is p < 0.0005 # etc. text = '' p = .05 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_value_labels(ax, spacing=5):\n\n # For each bar: Place a label\n for rect in ax.patches:\n # Get X and Y placement of label from rect.\n y_value = rect.get_height()\n x_value = rect.get_x() + rect.get_width() / 2\n\n # Number of points between bar and label. Change to your...
[ "0.722161", "0.6651087", "0.6488847", "0.64184594", "0.6393515", "0.6376214", "0.6118446", "0.6086852", "0.5960943", "0.59527975", "0.5939206", "0.5854869", "0.57599854", "0.574859", "0.56947863", "0.56895536", "0.56891966", "0.56863445", "0.5686152", "0.5646012", "0.56211436...
0.5666118
19