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
Representation of the object
def __repr__(self, prefixes=[]): return super(kNN, self).__repr__( ["k=%d" % self.__k, "dfx=%s" % self.__dfx, "voting=%s" % repr(self.__voting)] + prefixes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return repr(self.__dict__['_obj'])", "def __repr__(self):\n pass", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):...
[ "0.79716", "0.75059515", "0.74530923", "0.74530923", "0.74530923", "0.74530923", "0.74530923", "0.74310106", "0.7386631", "0.7373184", "0.7365455", "0.7365455", "0.7365455", "0.736231", "0.73588294", "0.73249376", "0.7257963", "0.7234122", "0.7234122", "0.7234122", "0.7234122...
0.0
-1
Inicialize the Home page, finding all element in the page
def __init__(self, driver, log, allure): super().__init__(driver, log, allure) self.__product_sort = BaseSelect(driver, HomeLocator.product_sort, log) self.__products = self.get_elements( driver, HomeLocator.product_list, log) self.__products_add_cart = self.get_elements( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home_content(self):\n bs = self.get_soup(baseUrl)\n self.assertOneExists(bs, \"#page_discover\")", "def init_page_elements(self):\n pass", "def init_home_page(self):\n rps = self.session.get(home_url, headers = BROWSER_HEADERS)\n # with open('first_get.html', 'w') as...
[ "0.6697018", "0.66735005", "0.62571937", "0.6104209", "0.6093641", "0.6069654", "0.6035942", "0.59371936", "0.59287256", "0.58757013", "0.58507854", "0.5847302", "0.5774559", "0.5760556", "0.57433057", "0.5735142", "0.5715942", "0.5707272", "0.56972754", "0.56852984", "0.5669...
0.0
-1
Destroy blank temp database after each test
def tearDown(self): db.drop_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\n app....
[ "0.7994026", "0.7994026", "0.7994026", "0.7994026", "0.7994026", "0.7994026", "0.79939485", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.79194725", "0.790249", "0.78965896", "0.7878383", "0.785482", "0.7806...
0.7822717
21
Destroy blank temp database before each test
def tearDown(self): self.logout() BaseDatabase.tearDown(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\n app....
[ "0.8047722", "0.8047722", "0.8047722", "0.8047722", "0.8047722", "0.8047722", "0.7994777", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.7969804", "0.79655796", "0.7890185", "0.7890185", "0.7883602", "0.78631985", ...
0.0
-1
checks if every number in the rotated list is prime
def isCircular(alist): global primes for j in alist: if j not in primes: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(a):\n return all(a % i for i in xrange(2, a))", "def toate_elementele_prime(lst):\n for x in lst:\n if nr_prim(x) is False:\n return False\n return True", "def is_prime(number: int):\n\n for index in range(2, (number//2) + 1):\n if number%index == 0:\n ...
[ "0.7136787", "0.70996404", "0.7029823", "0.69317424", "0.6901951", "0.68883836", "0.6878041", "0.68713266", "0.68181604", "0.678866", "0.6785131", "0.67831355", "0.67827743", "0.67805016", "0.67244774", "0.6714764", "0.6691928", "0.6672485", "0.66646934", "0.66509926", "0.664...
0.6649542
20
Compute the Projection kernel entry for a tuple of points on the Grassmann manifold.
def element_wise_operation(self, xi_j: Tuple) -> float: xi, xj = xi_j r = np.dot(xi.T, xj) n = np.linalg.norm(r, "fro") return n * n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_impl(K, Rt, points):\n height, width, _ = points.shape\n projections = np.zeros((height, width, 2))\n projection_matrix = K.dot(Rt)\n\n for h in range(height):\n for w in range(width):\n p = np.append(points[h, w], 1)\n p = projection_matrix.dot(p)\n ...
[ "0.5989121", "0.5947493", "0.59352136", "0.58828646", "0.58586144", "0.5847349", "0.58240473", "0.5755863", "0.5741005", "0.5702317", "0.5677599", "0.56108564", "0.5577968", "0.55509806", "0.5483102", "0.5472181", "0.5411593", "0.5405778", "0.5374564", "0.52818304", "0.527557...
0.0
-1
Add an edge to graph.
def add_edge(self, s, e): self.graph[s].append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n if(self.has_edge(edge) == 0):\n self.__graph_dict[edge[0]].append(edge[1])", "def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_...
[ "0.8422972", "0.84143287", "0.83437884", "0.8320354", "0.83120257", "0.82301676", "0.82103896", "0.8130567", "0.81110483", "0.8101498", "0.8035332", "0.8014023", "0.79848194", "0.7974444", "0.79484487", "0.79014236", "0.78658754", "0.78506446", "0.7726932", "0.77191895", "0.7...
0.771675
20
Performs linear operation. Uses ortho init defined earlier.
def super_linear(x, output_size, scope=None, reuse=False, init_w='gaussian', weight_start=0.001, use_bias=True, bias_start=0.0, input_size=None): shape = x.get_shape().as_list() wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _linear2view(X):\n if X.shape[1] == 1:\n X = -X\n else:\n np.random.seed(2)\n X = X @ ortho_group.rvs(X.shape[1])\n return X", "def ortho(self):\r\n\r\n m11,m12,m13,m14,m21,m22,m23,m24,m31,m32,m33,m34,m41,m42,m43,m44 = self.mlist\r\n\r\n x = _vec3(m11, m21, m31)\r\...
[ "0.62840676", "0.60858226", "0.59118223", "0.5900982", "0.5850878", "0.5816448", "0.57267535", "0.5716768", "0.5703888", "0.5648536", "0.5641427", "0.5621985", "0.5519963", "0.55011886", "0.5492256", "0.5490068", "0.54772633", "0.5467471", "0.5465767", "0.5430795", "0.5398287...
0.51393986
43
Retrieves the part name as a string. This extracts out the actual class name of the subclassed parts.
def get_name(cls): return '' if cls is SAM3X else cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partname(self):\n assert self.__partname, \"BasePart.partname referenced before assigned\"\n return self.__partname", "def get_xml_part_name(xml_score_part):\n part_name_node = xml_score_part.find(\"part-name\")\n if part_name_node is not None:\n if part_name_node.get(\...
[ "0.7131589", "0.6476631", "0.6407188", "0.63222814", "0.6201953", "0.61973566", "0.6118482", "0.6115656", "0.6095947", "0.6074777", "0.6066645", "0.6066378", "0.60211796", "0.6016106", "0.60045654", "0.59925234", "0.5983483", "0.59754395", "0.5960481", "0.59549135", "0.595402...
0.0
-1
Number of days left.
def ssl_valid_time_remaining(domainname): expires = ssl_expiry_date(domainname) return expires - datetime.datetime.utcnow().date()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_days(self):\r\n return 1", "def elapsed_days(self) -> int:\n return (datetime.today() - self.release_datetime).days", "def remaining_days_in_current_period(self):\n try:\n return self.count_days_from_now(self.current_period_ends_at)\n except AttributeError:...
[ "0.7505091", "0.7279096", "0.7158447", "0.71100044", "0.7087657", "0.70665115", "0.7026382", "0.7017739", "0.6946899", "0.69389665", "0.6917387", "0.6910316", "0.6885656", "0.68470883", "0.6816302", "0.6804258", "0.6734145", "0.670508", "0.6679895", "0.6673183", "0.66385496",...
0.0
-1
In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.
def forward(ctx, input, hard=False, tau=1): y_soft = F.gumbel_softmax(input, hard=hard, tau=tau) ctx.save_for_backward(y_soft) if hard: _, k = y_soft.max(-1) # this bit is based on # https://discuss.pytorch.org/t/stop-gradients-for-st-gumbel-softmax/530/5 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(ctx, grad_output):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n # Retrieve saved tensors and constants\n gamma, ivar, mean, input = ctx.saved_tensors\n eps = ctx.saved_tensors\n\n # Check which inputs need gradients\n input_needs_grad, gamm...
[ "0.69556504", "0.69066066", "0.6810715", "0.67043793", "0.66899854", "0.6684465", "0.6660817", "0.65307224", "0.6530573", "0.6509171", "0.6470912", "0.64638025", "0.64638025", "0.6454478", "0.64297265", "0.6386702", "0.6381238", "0.63718504", "0.6353076", "0.63463473", "0.632...
0.6345806
20
In the backward pass we receive a Tensor containing the gradient of the loss with respect to the output, and we need to compute the gradient of the loss with respect to the input.
def backward(ctx, grad_output): input, = ctx.saved_tensors grad_input = grad_output.clone() grad_input[input < 0] = 0 return grad_input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(ctx, grad_output):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n # Retrieve saved tensors and constants\n gamma, ivar, mean, input = ctx.saved_tensors\n eps = ctx.saved_tensors\n\n # Check which inputs need gradients\n input_needs_grad, gamm...
[ "0.8170905", "0.81486243", "0.79394436", "0.7930217", "0.79058665", "0.79021686", "0.789242", "0.786225", "0.78447706", "0.7824903", "0.780594", "0.77870184", "0.77862805", "0.7772275", "0.7772275", "0.7753113", "0.7695107", "0.769183", "0.7674699", "0.7674699", "0.7646278", ...
0.75304437
24
Function to set a generic state vector for an agricultural site and the given temporal schedule. Following values are applied uniformily at all time points. These values are internally stored in lists 'self.generic_prior', 'self.generic_prior_unc', the
def _setprior_generic_agriculture(self): #-- number of time-points npts = self.get_npts() #-- LAI,Canopy-Height,Soil-Moisture self.prstate = np.empty((3,npts), dtype=np.float64) #-- LAI self.prstate[0,:] = self.generic_prior[0] #-- canopy-height ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_prior_priorunc_synthetic(self):\n\n lai_coeff_absunc = None\n statevec_absunc = None\n\n #-- \n if self.prior_inifile!=None:\n lai_coeff_absunc, statevec_absunc = self._setprior_from_inifile()\n elif self.use_generic_prior:\n self._setprior_generic_...
[ "0.5813575", "0.5620336", "0.54812396", "0.5368272", "0.5233314", "0.5173843", "0.51605034", "0.51191336", "0.51130575", "0.50942117", "0.5091906", "0.50888133", "0.5086407", "0.50613683", "0.5054067", "0.5034559", "0.50307506", "0.4995448", "0.49933112", "0.49864486", "0.498...
0.6586572
0
Use this method to load the weights from a pretrained BERT checkpoint into a bert layer.
def load_pooler(pooler: tf.keras.layers.Dense, ckpt_path): ckpt_reader = tf.train.load_checkpoint(ckpt_path) loaded_weights = set() re_bert = re.compile(r'(.*)/(pooler)/(.+):0') match = re_bert.match(pooler.weights[0].name) assert match, "Unexpected bert layer: {} weight:{}".format(pooler, pooler.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model from: {self.pretrained}')\n load_checkpoint(self, self.pretrained, strict=False, logger=logger)\n elif self.pretrained is None:\n pass\n ...
[ "0.7444649", "0.7164474", "0.7139277", "0.7118373", "0.7118373", "0.7068311", "0.70365864", "0.7004185", "0.6978368", "0.69456017", "0.6905531", "0.6851603", "0.6828723", "0.68099254", "0.67591745", "0.6751652", "0.670792", "0.6690212", "0.66624564", "0.66270065", "0.66268235...
0.0
-1
Given the dataset type, target language and whether or not to use augmented data, loads and returns numpy array representations of the source text, translation text and scores.
def load_data(data_type=DatasetType.TRAIN, target_language=Language.GERMAN, augmented=False): if target_language == Language.ENGLISH: raise ValueError("Target language cannot be english") base_path = DATASETS_BASE_PATH if target_language == Language.GERMAN: language_folder = "en-de" if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_and_labels():\n # Load data from files\n positive_examples = list(\n open(\"./data/rt-polarity.pos\", \"r\", encoding='latin-1').readlines())\n positive_examples = [s.strip() for s in positive_examples]\n negative_examples = list(\n open(\"./data/rt-polarity.neg\", \"r\", en...
[ "0.62523055", "0.6046321", "0.60108787", "0.5998523", "0.5959485", "0.5901574", "0.5884368", "0.58632356", "0.5829691", "0.58163095", "0.5732789", "0.57060385", "0.5692011", "0.56848377", "0.56594086", "0.5616305", "0.5579834", "0.5576734", "0.5559516", "0.55583185", "0.55228...
0.7841989
0
Given some data (word_embeddings or other), of shape (x, variable, dimensionality) returns the data padded in the 2nd dimension to size length i.e. (x, length, dimensionality)
def pad_to_length(word_embeddings, length, padding): for sentence in word_embeddings: num_to_append = length - len(sentence) assert num_to_append >= 0 for _ in range(num_to_append): sentence.append(padding)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_data(data, max_length):\n ret = []\n\n # Use this zero vector when padding sequences.\n zero_vector = [0] * Config.n_features\n zero_label = 0\n\n for sentence, labels, attr in data:\n ### YOUR CODE HERE (~4-6 lines)\n labels_copy = labels[:]\n sentence_copy = sentence[:...
[ "0.69606996", "0.6676879", "0.66666895", "0.6657077", "0.64124817", "0.6351787", "0.63387066", "0.6336817", "0.6294361", "0.6288716", "0.62751466", "0.6253283", "0.62522787", "0.62497723", "0.6223753", "0.61585337", "0.6148455", "0.61200553", "0.60852736", "0.60821986", "0.60...
0.6371053
5
Called when the user specifies an intent for this skill
def on_intent(intent_request, session): print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId']) intent = intent_request['intent'] intent_name = intent_request['intent']['name'] # Dispatch to your skill's intent handlers if intent_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ...
[ "0.7143966", "0.6956116", "0.6949057", "0.6905333", "0.68928874", "0.67641324", "0.6754843", "0.6722764", "0.6720773", "0.67161995", "0.6699252", "0.6691263", "0.6670276", "0.6645522", "0.6642719", "0.6638686", "0.6607724", "0.6594981", "0.6575682", "0.6570076", "0.65620786",...
0.6483012
32
Convenience method to store a password in the OS keyring using `keyring` lib. It is equivalent to `ODSClient(...).store_apikey_in_keyring(apikey)`
def store_apikey_in_keyring(platform_id='public', # type: str base_url=None, # type: str keyring_entries_username=KR_DEFAULT_USERNAME, # type: str apikey=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_password_in_keyring(username, password):\n return keyring.set_password(KEYRING_SYSTEM, username, password,)", "def test__save_password_in_keyring(create_class):\n # Late import\n import keyring\n\n cloud._save_password_in_keyring(\n \"salt.cloud.provider.test_case_provider\",\n ...
[ "0.76529884", "0.644169", "0.6083549", "0.5919272", "0.5844136", "0.57820386", "0.56884843", "0.5641347", "0.563579", "0.5603136", "0.5586879", "0.55301625", "0.5526738", "0.55232507", "0.55232507", "0.54684925", "0.53964293", "0.53880364", "0.53459287", "0.5335912", "0.53333...
0.74452686
1
Query the Accounts collection to get an account by its name One user may have access to multiple Google Analytics accounts. This method returns an account object that corresponds to the desired account based on the account name.
def get_account_by_name(self, account_name): accounts = self.service_old.management().accounts().list().execute() account = None if accounts.get('items'): account = next(acnt for acnt in accounts.get('items') if acnt["name"] == account_name) if account is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account(self, name):\n return self._accounts[name]", "def get_account_by_name(self, name):\n return next((account for account in self.accounts\n if account.name.lower() == name.lower()), None)", "def get_account_by_name(self, name):\n return next((account for ac...
[ "0.82401174", "0.7593005", "0.7454623", "0.7142398", "0.69273245", "0.6810475", "0.67763954", "0.66882944", "0.6613426", "0.655244", "0.6541101", "0.6520345", "0.64827585", "0.64827585", "0.63991284", "0.63316983", "0.62688005", "0.6233087", "0.61885405", "0.6112431", "0.6086...
0.7724099
1
Calculate massweighted cloud fraction.
def _get_weighted_cloud_fractions(cl_cube, zg_cube, level_limits, n_jobs=1): level_width_coord = _get_level_width_coord(cl_cube, zg_cube, n_jobs=n_jobs) cl_cube.add_aux_coord(level_width_coord, np.arange(cl_cube.ndim)) # Mask data appropriately levs = cl_cube.coord('air_pressure') cloud_fractions =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mass(self):\n\t\treturn self.volume*self.density", "def _reduced_mass(structure) -> float:\n reduced_comp = structure.composition.reduced_composition\n num_elems = len(reduced_comp.elements)\n elem_dict = reduced_comp.get_el_amt_dict()\n\n denominator = (num_elems - 1) * reduced_c...
[ "0.64634335", "0.63038385", "0.62398696", "0.6238555", "0.6099755", "0.60895747", "0.6054101", "0.60429215", "0.6031469", "0.60293615", "0.59668475", "0.59626186", "0.59592646", "0.5957317", "0.5957317", "0.59062994", "0.5887171", "0.58794415", "0.58742815", "0.58735025", "0....
0.58538055
20
Similarity metric using Pearson correlatin coefficient.
def _pearson_correlation_coeff(x_data, y_data): reg = linregress(x_data, y_data) return reg.rvalue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_similarity(self, ):\r\n customer_cos_similarity = cosine_similarity(self.rating_matrix, self.rating_matrix)\r\n customer_cos_similarity = pd.DataFrame(customer_cos_similarity,\r\n index=self.customer_vendor_matrix.index,\r\n ...
[ "0.71205443", "0.681783", "0.67118037", "0.66502756", "0.6642287", "0.6542144", "0.6512295", "0.6512295", "0.6512295", "0.6512295", "0.6500488", "0.6494058", "0.6494058", "0.6494058", "0.648428", "0.64834064", "0.6482181", "0.64727235", "0.6457254", "0.6436918", "0.6282316", ...
0.63309145
20
Get default configuration settings.
def get_default_settings(cfg): cfg = deepcopy(cfg) cfg.setdefault('metric', 'regression_slope') cfg.setdefault('n_jobs', 1) cfg.setdefault('savefig_kwargs', { 'bbox_inches': 'tight', 'dpi': 600, 'orientation': 'landscape', }) logger.info("Using at most %i processes", cfg[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDefaultSettings():\n return {}", "def loadConfig(self):\n return self._defaults", "def defaults(self):\n return self._config_parser.defaults()", "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def defaults(self):\n ...
[ "0.82081205", "0.80987155", "0.80368286", "0.7921888", "0.7851286", "0.7840802", "0.77894753", "0.7750592", "0.77450675", "0.7685755", "0.76519674", "0.75427884", "0.7527601", "0.74951", "0.7460322", "0.7412091", "0.7374259", "0.7373014", "0.7340594", "0.73059815", "0.7295828...
0.6798135
47
Validate valid python version.
def validate_python_version(cls, values: Dict) -> Dict: if sys.version_info < (3, 9): raise ValueError( "This tool relies on Python 3.9 or higher " "(as it uses new functionality in the `ast` module, " f"you have Python version: {sys.version}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_python_version():\n version = sys.version.split()[0]\n if version < \"2.6\" or version >= \"3\":\n raise CuckooStartupError(\"You are running an incompatible version of Python, please use 2.6 or 2.7\")", "def _check_python_version(self):\n python_exe = tools.which(\"python\")\n ...
[ "0.77807486", "0.76029795", "0.75831395", "0.75310683", "0.75310683", "0.75310683", "0.72753096", "0.724242", "0.71019304", "0.70628154", "0.6997715", "0.697339", "0.69500786", "0.69321376", "0.6927702", "0.6902898", "0.68952495", "0.6840301", "0.68330806", "0.6768792", "0.66...
0.7437353
6
Create a dict of optimizer parameters.
def params_from_optimizer( optimizer: torch.optim.Optimizer, param_names: Iterable[str] = ['optim']) -> Dict[str, Any]: param_groups = optimizer.state_dict()['param_groups'] if len(param_groups) != len(param_names): raise ValueError('The number of parameter groups in ``optimizer`` ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimizer_config(self):\r\n return {\r\n \"lr\": self.args.lr[0],\r\n \"momentum\": self.args.momentum,\r\n \"weight_decay\": self.args.weight_decay,\r\n }", "def gen_params(self) -> Dict:\n param_dict: Dict = {}\n\n gX_name: List[str] = ['g_leak',...
[ "0.72385114", "0.69783306", "0.6964503", "0.6911176", "0.6843733", "0.67937267", "0.6792942", "0.6786122", "0.67746353", "0.6741739", "0.66908497", "0.66908497", "0.66908497", "0.6674964", "0.66521084", "0.661157", "0.6611476", "0.65916234", "0.657634", "0.654863", "0.6532321...
0.6660357
14
Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view.
def paginate_queryset(self, queryset, request, view=None): page_size = self.get_page_size(request) if not page_size: return None paginator = self.django_paginator_class(queryset, page_size) page_number = self.page_query_param if page_number in self.last_page_strings:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate_queryset(self, queryset, request, view=None):\n # page_size = self.get_page_size(request)\n page_size = request.GET.get(\"page_size\")\n if not page_size:\n return None\n\n paginator = self.django_paginator_class(queryset, page_size)\n page_number = reques...
[ "0.802451", "0.80088323", "0.80088323", "0.7760657", "0.7672235", "0.7434823", "0.7382449", "0.7245751", "0.7225355", "0.7143413", "0.70101964", "0.6943953", "0.68669254", "0.64697224", "0.64116096", "0.64089006", "0.63194555", "0.6310484", "0.6271545", "0.6238474", "0.621370...
0.8202232
1
Converts sentence to list of words. Gets rid of non alphanumeric characters
def sentence2word(sentence): return list(filter(lambda word: word != "", [re.sub('[^A-Za-z0-9]+', '', word).lower() for word in sentence.replace("' ", "'").split(' ')]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence_to_words(sentence: str) -> List[str]:\n return list(map(clean_word, sentence.split(\" \")))", "def sent_to_words(sent: str) -> List[str]:\n return [word for word in sent.split() if word not in string.punctuation]", "def token_to_words(sentence):\n\n regex_of_word = re.findall(SENTENCE_TO_...
[ "0.85336757", "0.8362783", "0.8027865", "0.7856944", "0.78478515", "0.76956433", "0.76570415", "0.7593957", "0.7554642", "0.7469246", "0.7464422", "0.7406909", "0.735986", "0.7341267", "0.7340095", "0.7340095", "0.7337841", "0.730512", "0.7290949", "0.72855604", "0.727572", ...
0.8240545
2
Convenience method to get the single ServiceConfig instance.
def Get(): return ServiceConfig() # Singleton decorator ensures there's only one
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance", "def get_config() -> Optional[Config]:\n return CurrentConfig.get()", "def get_config() -> Config:\n return get_or_set('config', build_configuration)", ...
[ "0.6943933", "0.6745661", "0.67014253", "0.6694083", "0.66413873", "0.6599076", "0.6578767", "0.65283936", "0.64251965", "0.63892514", "0.63338834", "0.63241243", "0.6323865", "0.63193214", "0.62747204", "0.62361825", "0.62361825", "0.62361825", "0.62361825", "0.62361825", "0...
0.743418
0
create onehot representations for the categorical features pad the representations to a desired length
def encode(self, df, categorical_columns, max_length): padded_categorical_data = [] for c in categorical_columns: ohe = [[self.name_to_num[c][i]] for i in df[c]] padded_categorical_data.append( pad_sequences(ohe, maxlen=max_length, padding="post") ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_onehot(x,num_labels=7):\n enc = OneHotEncoder(n_values=num_labels)\n return enc.fit_transform(np.array(x).reshape(-1, 1)).toarray()", "def __encode_one_hot_util(self):\n for col in self.cat_cols:\n if (\n col in self.train_df\n and col + str(\"Encode...
[ "0.75773233", "0.7402805", "0.7354181", "0.73366404", "0.7316448", "0.72809476", "0.7280105", "0.7268368", "0.7257575", "0.72524047", "0.72516143", "0.72323954", "0.72224694", "0.72210765", "0.72142446", "0.7211858", "0.7210938", "0.7193842", "0.71873", "0.71873", "0.71873", ...
0.0
-1
Converts a list of numbers to the corresponding categorical variable names. Returns the list of names
def retrieve_names(self, categorical_column, num_list): return [self.num_to_name[categorical_column][i] for i in num_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categorical_feature_names(\n pipeline: Pipeline, transformer_name: str, feature_names: List[str]\n) -> List[str]:\n full_feature_names = feature_names + [\n f\"{feature_names[idx]}_missing\"\n for idx in pipeline[\"preprocess\"]\n .named_transformers_[transformer_name][\"impute\"...
[ "0.65199685", "0.61879873", "0.6121893", "0.6006947", "0.5973956", "0.5926613", "0.57295877", "0.5704969", "0.5704969", "0.57017463", "0.56798106", "0.5671474", "0.5653411", "0.5653411", "0.56417495", "0.5622783", "0.56143886", "0.5577268", "0.55672175", "0.5560988", "0.55430...
0.67168105
0
Save the embeddings in an output directory, return a dictionary with the embeddings information
def save_embeddings( _output_path, _trained_model, _categorical_columns, _categorical_encoder ): embs = {} for c in _categorical_columns: embs[c] = _trained_model.extract_weights(c.replace(" ", "_") + "_embedding") column_names = _categorical_encoder.retrieve_names( c, range(0, e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_embeddings(self):\n save_path = self.config.path_embeddings / self.model.model_name\n save_path.mkdir(parents=True, exist_ok=True)\n \n idx2ent = self.model.config.knowledge_graph.read_cache_data('idx2entity')\n idx2rel = self.model.config.knowledge_graph.read_cache_da...
[ "0.7066615", "0.7063558", "0.6892149", "0.67970455", "0.64997715", "0.64932716", "0.6325217", "0.6312836", "0.6249985", "0.62133414", "0.6206542", "0.6203132", "0.61268353", "0.6110195", "0.6105065", "0.60575145", "0.60389006", "0.6030839", "0.6028754", "0.6005243", "0.599163...
0.6625312
4
Ensure that get_full_name method works properly
def test_full_name(self): user = CustomUser.objects.get(email="test@test.test") self.assertEqual(user.get_full_name(), "TestName TestSecondName")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n full_name = '%s %s' % (self.first_name, self.last_name)\n return full_name.strip()", "def _get_full_name(self):\n if self.middle_name:\n return u'%s %s %s' % (self.first_name, self.middle_name,\n self.last_name)\n else:\n return ...
[ "0.8004604", "0.7935145", "0.77175975", "0.7646127", "0.7646127", "0.7645311", "0.7637316", "0.7615078", "0.7602463", "0.7586801", "0.75739616", "0.7571767", "0.755733", "0.7540053", "0.7540053", "0.7540053", "0.7540053", "0.7540053", "0.7540053", "0.7540053", "0.7540053", ...
0.0
-1
A tiny little helper function to create the basis for the predictions parameter in the submit_forecast function. You pass an IFP from the questions API into this function and receive a list of 'answer_id' and 'value' dictionaries that are needed to submit a forecast.
def _forecast_template(self,ifp): output = [{'answer_id':a['id'],'value':a['probability']} for a in ifp['answers']] return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_forecast(self,question_id,method_name,predictions):\n \n url = self.external_prediction_sets_url\n \n params={'external_prediction_set':{'question_id':question_id,\n 'external_predictor_attributes':\n ...
[ "0.63360405", "0.61785835", "0.5961585", "0.57127106", "0.56618065", "0.55746925", "0.55559796", "0.5479239", "0.54554874", "0.5409359", "0.53902596", "0.5368174", "0.5350171", "0.53045076", "0.53019005", "0.5295385", "0.5280624", "0.52626216", "0.5249886", "0.52299315", "0.5...
0.669773
0
Extended equal procedure fore self and other entities.
def extended_equal(self, other): comparison = Representation.compare_entities(self, other) self.diff_info = comparison["self_diff"] other.diff_info = comparison["other_diff"] return comparison["is_equal"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, other): # -> bool:\n ...", "def __eq__(self, other):\n return equal(self, other)", "def equivalent(self, other):\n return id(self) == id(other)", "def isEqual (self, other) :\n return self.id == other.getIdent ()", "def __eq__(self, other):\n raise NotIm...
[ "0.69346255", "0.6825996", "0.6752676", "0.67184854", "0.6714158", "0.6714158", "0.6714158", "0.67133766", "0.66982013", "0.6688542", "0.66864824", "0.66741943", "0.66741943", "0.66508985", "0.66482925", "0.6637339", "0.6637339", "0.6633079", "0.6633079", "0.6633079", "0.6633...
0.7059251
0
Explicitly return list of all entities' classes.
def all_entities_classes(): return [ PersonEntity, CustomAttributeEntity, ProgramEntity, ControlEntity, AuditEntity, AssessmentEntity, AssessmentTemplateEntity, IssueEntity, CommentEntity]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_entity_classes():\n persistent_classes = Entity._decl_class_registry.values()\n # with sqlalchemy 0.8 _decl_class_registry holds object that are not classes\n return [ cls for cls in persistent_classes\n if isclass(cls) and issubclass(cls, Entity) ]", "def list_all_classes(self):\n cl...
[ "0.82343", "0.73591477", "0.732288", "0.7090031", "0.70738024", "0.7059396", "0.6987407", "0.69329345", "0.6873289", "0.67893845", "0.67853063", "0.6754753", "0.6750397", "0.6736268", "0.6701195", "0.6689434", "0.6689434", "0.6689434", "0.6689434", "0.6689434", "0.6689434", ...
0.8093427
1
The set of annotations guaranteed to be provided when we are done.
def provides(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotations(self, annotations):\n self._annotations = annotations", "def markAsNeedsAnnotationsDictionary(self):\n self.needs_annotations_dict = True", "def annotations(self):\n return self._annotations", "def needsAnnotationsDictionary(self):\n return self.needs_annotations_d...
[ "0.7077331", "0.67481226", "0.6719404", "0.6718761", "0.66960335", "0.6573956", "0.65451825", "0.64201224", "0.63767236", "0.63706946", "0.6365993", "0.6365993", "0.6291518", "0.6272305", "0.6200193", "0.6190159", "0.61348283", "0.6043598", "0.6043598", "0.6032766", "0.597254...
0.0
-1
Creates a protobuf .pb file from the frozen graph of a keras model stored in a .h5 file format. The output file is stored in the same location as input.
def _main(): # setup paths json_model_path = osp.join(FLAGS.input_dir, FLAGS.json_model_fname) weights_path = osp.join(FLAGS.input_dir, FLAGS.weights_fname) save_path = osp.splitext(json_model_path)[0][:-6] + "graph_w" + str(weights_path.split("_")[-1][:-3]) + ".pb" print("Loading Model: " + json_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h5_to_pb(h5_model, output_dir, model_name, out_prefix=\"output_\", log_tensorboard=True): \n if osp.exists(output_dir) == False:\n os.mkdir(output_dir)\n \n out_nodes = list()\n \n ## get all tensor node.\n for i in range(len(h5_model.outputs)):\n out_nodes.append(out_prefix+...
[ "0.7638469", "0.71506625", "0.7001762", "0.68717015", "0.68486005", "0.67391104", "0.657081", "0.6468009", "0.64114964", "0.6406961", "0.63215756", "0.62240565", "0.62180364", "0.6177826", "0.6170048", "0.61514425", "0.61447823", "0.61435026", "0.6143453", "0.61322534", "0.60...
0.67930347
5
Prepare the dict of values to create the new invoice line for a sales order line. This method may be overridden to implement custom invoice generation (making sure to call super() to establish a clean extension chain).
def _prepare_invoice_line(self, inv_id): res = {} account_id = self.product_id.property_account_income_id.id or self.product_id.categ_id.property_account_income_categ_id.id if not account_id: raise UserError(_('Please define income account for this product: "%s" (id:%d).') % \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_invoice(self, cr, uid, order, lines, context=None):\n invoice_vals = super(my_sale_order, self)._prepare_invoice(cr, uid, order,\n lines, context)\n\n invoice_vals.update({\n 'partner_shipping_id': order.partner_sh...
[ "0.78784865", "0.75810105", "0.73986036", "0.73717624", "0.73172545", "0.71517307", "0.71019447", "0.70597476", "0.70097494", "0.7009054", "0.69369483", "0.6776965", "0.65319914", "0.6512631", "0.6510116", "0.6502725", "0.64527595", "0.6390906", "0.63380307", "0.63025445", "0...
0.71242726
6
Test if the name of cli.args long option valid
def test_arg_option_long_only(self): optional_long = [ arg for arg in cli_args.values() if len(arg.flags) == 1 and arg.flags[0].startswith("-") ] for arg in optional_long: assert ILLEGAL_LONG_OPTION_PATTERN.match(arg.flags[0]) is None, f"{arg.flags[0]} is not match"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_args() -> bool:\n if len(argv) == 1 or \\\n '--help' in argv:\n print(usage)\n return False\n return True", "def test_arg_option_mix_short_long(self):\n optional_mix = [\n arg for arg in cli_args.values() if len(arg.flags) == 2 and arg.flags[0].startswith(...
[ "0.70487946", "0.6918986", "0.65828025", "0.6523338", "0.6483785", "0.64769727", "0.64443225", "0.64287376", "0.6407862", "0.6404428", "0.63955575", "0.6387425", "0.6326687", "0.63120097", "0.6293055", "0.6290903", "0.628635", "0.62862563", "0.62781674", "0.6260102", "0.62550...
0.76031315
0
Test if the name of cli.args mix option (s, long) valid
def test_arg_option_mix_short_long(self): optional_mix = [ arg for arg in cli_args.values() if len(arg.flags) == 2 and arg.flags[0].startswith("-") ] for arg in optional_mix: assert LEGAL_SHORT_OPTION_PATTERN.match(arg.flags[0]) is not None, f"{arg.flags[0]} is not match"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arg_option_long_only(self):\n optional_long = [\n arg for arg in cli_args.values() if len(arg.flags) == 1 and arg.flags[0].startswith(\"-\")\n ]\n for arg in optional_long:\n assert ILLEGAL_LONG_OPTION_PATTERN.match(arg.flags[0]) is None, f\"{arg.flags[0]} is not...
[ "0.72207177", "0.6647978", "0.6436925", "0.6318208", "0.62797594", "0.6185453", "0.6156047", "0.6134145", "0.60912627", "0.60906214", "0.60894126", "0.6083184", "0.60704386", "0.6065211", "0.6061725", "0.6061026", "0.6060489", "0.6047591", "0.60256904", "0.6011794", "0.597587...
0.76159865
0
Test if each of cli._COMMANDS.arg flags without conflict
def test_subcommand_arg_flag_conflict(self): subcommand = { key: val for key, val in cli_parser.__dict__.items() if key.isupper() and key.startswith("COMMANDS") } for group, command in subcommand.items(): for com in command: positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkallflags(flags_with_values,flags_withoutvalues,cldic):\r\n if len(set(flags_with_values).intersection(set(flags_without_values))) > 0:\r\n print ( \"error some flags appear in two lists of flags, with and without required values:\",set(flags_with_values).intersection(set(flags_without_v...
[ "0.6978081", "0.6943144", "0.69152963", "0.6863492", "0.68248564", "0.67891896", "0.66566175", "0.6592277", "0.6573175", "0.6534608", "0.65314615", "0.6497277", "0.6440176", "0.64200884", "0.63851255", "0.6239222", "0.6234022", "0.61467624", "0.6136724", "0.6131858", "0.61279...
0.74612933
0
Test that invalid choice raises for exportformat in db exportcleaned command.
def test_invalid_choice_raises_for_export_format_in_db_export_archived_command( self, mock_isdir, export_format ): with contextlib.redirect_stderr(io.StringIO()) as stderr: with pytest.raises(SystemExit): parser = cli_parser.get_parser() parser.parse_args(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isc_optviewserver_stmt_transfer_format_failing(self):\n test_string = [\n 'transfer-format no-answer;',\n 'transfer-format !one-answer;',\n 'transfer-format many-answer;',\n ]\n result = optviewserver_stmt_transfer_format.runTests(test_string, failureT...
[ "0.6524202", "0.6345172", "0.61557037", "0.6053377", "0.60256803", "0.601475", "0.59988064", "0.59711176", "0.57923037", "0.578008", "0.57769775", "0.5774371", "0.576682", "0.576327", "0.57609767", "0.57180697", "0.57043785", "0.5695613", "0.5687859", "0.5651353", "0.5648456"...
0.7939143
0
Get the unique items in iterables while preserving order. Note that this mutates the seen set provided only when the returned generator is used.
def unique(seen, *iterables): _add = seen.add # return a generator of the unique items and the set of the seen items # the seen set will mutate when the generator is iterated over return (i for i in chain(*iterables) if i not in seen and not _add(i))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(iterable):\n seen_items = set()\n for item in iterable:\n if item not in seen_items:\n yield item\n seen_items.add(item)", "def unique(self):\n return self.element_wise(lambda seqs: list(set(seqs)))", "def chain_unique(*iterables):\n seen = set()\n for...
[ "0.74047774", "0.7234851", "0.70630944", "0.69512564", "0.6903696", "0.6863216", "0.6783394", "0.6723641", "0.6719547", "0.66293585", "0.6628292", "0.6572777", "0.65655386", "0.6559209", "0.6538916", "0.6449778", "0.6445427", "0.6426239", "0.6385657", "0.6366434", "0.63497436...
0.8025429
0
Abstracts returning the appropriate path separator for the given path string. This implementation always returns ``os.sep`` Abstracted to make test mocking easier.
def _getPathSep(path): return os.sep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_sep(self) -> str:\n return self._path_sep", "def fix_dir_separator(slash_delim_path):\n return slash_delim_path.replace('/', os.path.sep)", "def _posix_seps(path: str) -> str:\n\n if not path:\n return None\n elif os.sep != posixpath.sep:\n return path.replace(os....
[ "0.75904137", "0.73666114", "0.68218964", "0.64080817", "0.6314331", "0.61740553", "0.6152027", "0.6105847", "0.60140324", "0.5990186", "0.5971919", "0.59635407", "0.59512156", "0.5944136", "0.5921321", "0.58842045", "0.58823323", "0.5798806", "0.56834227", "0.56743294", "0.5...
0.83338016
0
Calculate sum of normalzied discounted cumulative gain for the predictions The correct prediction will have a relevance of 1, incorrect predictions will have a relevance of 0. Weight the relevance values such that it is reduced logarithmically proportional to it its position
def ndcg(preds, labels): #find positions where the prediction matches the label relv_pos = np.where(np.equal(preds, labels))[1] #weight func: log2(i+1), add one more to adjust for 0-based indexing total_ndcg = np.sum(1./np.log2(relv_pos+2)) return total_ndcg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discounted_cumulative_gain(ranked_list):\n total_ndcg = 0\n for query in ranked_list:\n relevances = [doc[0] for doc in query[1]]\n dcg = 0\n for i, rel in enumerate(relevances, 1):\n dcg += rel / (math.log(i + 1, 2))\n\n idcg = 0\n for i, rel in enumerate(so...
[ "0.74499345", "0.69735", "0.6779795", "0.6764704", "0.6729282", "0.66514224", "0.66035104", "0.6570051", "0.65157557", "0.65036315", "0.64907336", "0.6484084", "0.647415", "0.6419924", "0.64034486", "0.63766825", "0.63745046", "0.6372564", "0.6336742", "0.63309205", "0.632455...
0.6312037
21
find top k predictions from probability matrix and call ndcg to find accuracy of predictions
def eval_all(cls_prob, dtrain): #determine the top k predictions labels = dtrain.get_label() top_k = cls_prob.argsort(axis = 1)[:,::-1][:,:5] # top_k = cls_prob.argsort(axis = 1)[:,:k:-1] #convert true values and compared with predictions to check for equality labels = labels[:, None] return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k_accuracy(y_true : np.ndarray, probs: np.ndarray, k: int) -> float:\r\n \r\n # Top k sorted preds\r\n sorted_probs = probs.argsort()[:,-k:]\r\n\r\n # Does the truth intersect with any of the top k predictions?\r\n matches = np.max(sorted_probs == y_true.reshape(-1, 1), axis=1)\r\n return...
[ "0.7248039", "0.71244645", "0.70865405", "0.69146085", "0.68664426", "0.6852818", "0.6850756", "0.68490434", "0.6848725", "0.6846973", "0.6845912", "0.68352395", "0.6822426", "0.6819039", "0.6816156", "0.6816156", "0.6811358", "0.68099844", "0.6801106", "0.6792978", "0.678651...
0.73447526
0
Calculate NDCG for users who chose US or NDF, NDF is encoded as 7 and US is encoded as 10.
def eval_ndfUs(cls_prob, dtrain): labels = dtrain.get_label() pred = cls_prob.argsort(axis = 1)[:,::-1][:,:5] #only retain the labels for users who chose US or NDF users_idx = np.logical_or(labels == 7, labels == 10) labels = labels[users_idx] pred = pred[users_idx,:] labels = labels[:, Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nDCG(self, p, users=None, test=None, ranks=None, excluded_items=None):\n\n # returns a sorted array\n if users is None:\n users = np.unique(self.edge_idx_d[:,0])\n if test is None:\n test = self.edge_idx_d\n if ranks is None:\n ranks = self.recommend...
[ "0.6374063", "0.61929274", "0.61216813", "0.599862", "0.5938341", "0.5889138", "0.5863265", "0.5796126", "0.5702564", "0.56214136", "0.560524", "0.55582345", "0.54458314", "0.54176307", "0.5393563", "0.536228", "0.5340128", "0.5337987", "0.53153545", "0.53123546", "0.530981",...
0.68104607
0
determines if an integer is prime
def is_prime(n): if n < 2: return False if n == 2 or n == 3: return True elif n % 2 == 0: return False else: x = 0 for i in range(3, n, 2): if n % i == 0: x = 1 return x == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def is_prime(n):\n return mr_prime(n)", "def is_prime(a):\n return all(a % i for i in xrange(2, a))", "def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values ...
[ "0.8185056", "0.8142938", "0.8030971", "0.79956126", "0.79694474", "0.7964449", "0.7923807", "0.79162204", "0.79139185", "0.7847631", "0.7838183", "0.78058064", "0.7803274", "0.77988964", "0.77880716", "0.7782016", "0.77706134", "0.776488", "0.776313", "0.77542764", "0.775187...
0.76925707
28
(Animal) > int Returns age of the animal.
def getAge(self): return self.age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age(self) -> int:\n return self.age", "def get_age(self):\n today = datetime.now()\n return today.year \\\n - self.date_of_birth.year \\\n - ((today.month, self.date_of_birth.day) \\\n < (self.date_of_birth.month, self.date_of_birth.day))", "def get...
[ "0.7051849", "0.67881364", "0.6729541", "0.6669159", "0.6616464", "0.6616464", "0.6616464", "0.6581302", "0.652346", "0.6514881", "0.6449324", "0.64486474", "0.6385499", "0.63503283", "0.6349098", "0.63053936", "0.6255605", "0.62038404", "0.61942184", "0.6182354", "0.6159466"...
0.6557319
8
Return a list of RGB hex colors
def hex_colors(cls): return ['#{:02x}{:02x}{:02x}'.format(*cls._COLORS[s]) for s in cls._STATES]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colors(self):\n\t\treturn [(0, 30, 255),(0, 30, 120)]", "def getColors():\n return ['#8c99fc', '#cacefd', '#fff1d7', '#feda98', '#fda85a', '#fc6647']", "def get_color_map_in_hex(rgb_colors):\n list_of_hex_colors = []\n # Iterating through the list of colors given\n for i in range(len(rgb_colors...
[ "0.78017205", "0.77264136", "0.7716189", "0.76912445", "0.7516858", "0.7501724", "0.7350642", "0.73296577", "0.72455823", "0.722948", "0.7195119", "0.71948755", "0.7185311", "0.7165035", "0.7163713", "0.7135043", "0.7131917", "0.70695525", "0.7038964", "0.6997226", "0.6985322...
0.7692371
3
Get the prejob entry the prejob entry
def getPreJob(self): return self.getDagNode('A')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job(self):\n return self.batch[self.job_id]", "def getPostJob(self):\n return self.getDagNode('B')", "def getFirstWorker(self):\n return self.entries[0]", "def entry(self) -> Optional[str]:\n return pulumi.get(self, \"entry\")", "def entry(self) -> Optional[pulumi.Input[str]...
[ "0.6210873", "0.613403", "0.6073351", "0.6036146", "0.59708685", "0.5865204", "0.58616924", "0.58538574", "0.5853126", "0.5843087", "0.5803405", "0.57641816", "0.57561696", "0.56714994", "0.5656283", "0.5649353", "0.5643404", "0.5635437", "0.5634933", "0.56343967", "0.5583054...
0.7597189
0
Get full AABB of a robot including all of its constituent links.
def debug_get_full_aabb(sim_id: int, robot_id: int): num_joints = pb.getNumJoints(robot_id, physicsClientId=sim_id) aabb = np.asarray(pb.getAABB( robot_id, -1, physicsClientId=sim_id), dtype=np.float32) for i in range(num_joints): link_aabb = pb.getAABB(robot_id, i, physicsClientId=sim_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_aabb(self):\n c, s = np.cos(self.eangles), np.sin(self.eangles)\n r = np.array([[c, s], [s, c]])\n return rect(self.get_com(), np.abs(np.dot(r, self.halfexts)), 0)", "def calc_bounding_box(self):\n self.BB = self.geos.abs_el(0).BB\n for geo in self.geos.abs_iter():\n ...
[ "0.6518899", "0.53489625", "0.5252934", "0.52497023", "0.5244017", "0.5213568", "0.52010304", "0.51806635", "0.5148503", "0.5114957", "0.50895464", "0.50618726", "0.50212526", "0.49962375", "0.4957139", "0.4954778", "0.49483874", "0.49288315", "0.4927399", "0.4905914", "0.489...
0.72287107
0
Converts original node to a supported mean in standard format
def transform(self, mean_node, light_graph): self.check_original_node(mean_node, graph_type=self.GRAPH_TYPE) # Get axes axes = self._get_array_from_input_indx(mean_node, light_graph, 1).flatten() tf_attr = self._get_tf_attr(mean_node) keep_dims = tf_attr["keep_dims"].b ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_mean(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n mx_axis = attrs.get(\"axis\", None)\n axes = convert_string_to_list(str(mx_axis)) if mx_axis is not None else None\n\n keepdims = get_boolean_attribute_value(attrs, \"keepdims\")\n\n if axes is not None:\n ...
[ "0.6887938", "0.6722752", "0.6722752", "0.6722752", "0.6722752", "0.6722752", "0.6652827", "0.631472", "0.63068414", "0.62871385", "0.6136223", "0.61268616", "0.6105754", "0.60690373", "0.603044", "0.5990987", "0.5987904", "0.59780973", "0.5974779", "0.5974779", "0.5971508", ...
0.6003082
15
Get a dict from genome name to the portion of the given genome that is not N in the given HAL, clamped to 1.
def get_halstats_basecomps(hal_filename, genomes): print("Getting N counts") def get_basecomp_for_genome(genome): # First we need to write the args. args = ["halStats", hal_filename, "--baseComp", "{},1".format(genome)] # Open the process process = subprocess.Popen(arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nmer_dictionary(self,n,dic={}):\n if self.sequence == \"\":\n self.fetchSequence()\n self.sequence = self.sequence.upper()\n for i in range(0,len(self.sequence)-n):\n subseq = self.sequence[i:][:n]\n dic[subseq]=1+dic.get(subseq,0)\n del subseq\n...
[ "0.57511705", "0.55012983", "0.53374684", "0.5161188", "0.5050414", "0.50026673", "0.49359605", "0.49297646", "0.49011675", "0.48885104", "0.48684856", "0.48600802", "0.4762523", "0.47580677", "0.4727564", "0.47163197", "0.4650112", "0.46268028", "0.46193525", "0.4599772", "0...
0.0
-1
Make a square gaussian kernel. size is the length of a side of the square fwhm is fullwidthhalfmaximum, which can be thought of as an effective radius.
def makeGaussian(size, fwhm, center=None): x = sp.arange(0, size, 1, float) y = x[:,sp.newaxis] if center is None: x0 = y0 = size // 2 else: x0 = center[0] y0 = center[1] return sp.exp(-4*sp.log(2) * ((x-x0)**2 + (y-y0)**2) / fwhm**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss_kernel(size, size_y=None):\n size = int(size)\n if not size_y:\n size_y = size\n else:\n size_y = int(size_y)\n\n x, y = mgrid[-size: size + 1, -size_y: size_y + 1]\n\n g = exp(-(x ** 2 / float(size) + y ** 2 / float(size_y)))\n return g / g.sum()", "def gaussian_kernel(...
[ "0.7614286", "0.743839", "0.7424667", "0.7346859", "0.73442197", "0.7202767", "0.7045155", "0.6979886", "0.6977487", "0.69571656", "0.69122183", "0.6891391", "0.68551385", "0.6829858", "0.6829858", "0.6826354", "0.68087506", "0.67269003", "0.6707125", "0.66836387", "0.6665604...
0.68075943
17
Closes the database connection at the end of the request
def close_db(error): if hasattr(g, "sql_db"): g.sql_db.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_request():\n db.close()", "def close_db_connection(cls):\n db.close()", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._con...
[ "0.834472", "0.8134503", "0.7940359", "0.78554434", "0.7845815", "0.7792569", "0.7687412", "0.76865757", "0.7674482", "0.76627046", "0.7659166", "0.7653159", "0.7652093", "0.7645819", "0.7633246", "0.7599752", "0.7599752", "0.7599752", "0.7599752", "0.7599752", "0.7599752", ...
0.0
-1
Test to make sure the username provided could be a valid RIT username
def validate_username(test_string: str) -> bool: if USERNAME_REGEX.match(test_string) is not None: return True session["last_error"] = "That's not a valid username." return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateUsername(username):\n\n if not(username):\n return \"You must specify your archive.org username.\"", "def _check_username(self, username):\n if self.username_regex.search(username) is not None:\n print(\"Correct username\")\n return True\n else: \n ...
[ "0.78789365", "0.77336276", "0.7622192", "0.76004624", "0.755972", "0.753597", "0.74149907", "0.74023473", "0.7397648", "0.72887707", "0.7288002", "0.72054714", "0.719427", "0.71611166", "0.71464074", "0.71354204", "0.7135151", "0.709273", "0.70865047", "0.708289", "0.708074"...
0.7312459
9
Returns True if the user is an administrator, False if they are not ( or if they don't exist, since nonexistent users cannot be administrators.
def is_admin(username: str) -> bool: db = get_db() return int(db.get_user_by_name(username)["is_admin"]) == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False", "def user_is_admin(user):\n return user in admins", "def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return ...
[ "0.8255431", "0.82282704", "0.82228655", "0.8150719", "0.8073879", "0.79476106", "0.790607", "0.7839168", "0.78317195", "0.7809062", "0.77876943", "0.77876943", "0.77611953", "0.7758643", "0.7706952", "0.7660713", "0.76585585", "0.76406413", "0.7602822", "0.7597656", "0.75902...
0.7733793
14
Returns True if the user is in the database, False if they are not.
def is_user(username: str) -> bool: db = get_db() if username is None: return False return not db.get_user_by_name(username) is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_in_db(self) -> bool:\n query = \"\"\"SELECT * \n FROM Users \n WHERE Username=?;\"\"\"\n return len(self.db.fetchall(query, values=(self.username,))) > 0", "def check_user_exists(self):\n is_exists = False\n if auth.UserInfo.objects.filte...
[ "0.7963935", "0.72297883", "0.7207318", "0.71753895", "0.7087796", "0.705574", "0.7015935", "0.69771445", "0.6972047", "0.69649184", "0.69422454", "0.6928089", "0.69182426", "0.69182426", "0.69173586", "0.69110435", "0.68909276", "0.6862055", "0.68538314", "0.6829451", "0.679...
0.66294426
31
Returns True if the user is enabled, False if they are not.
def is_enabled(username: str) -> bool: db = get_db() if username is None: return False return db.get_user_by_name(username)[3] == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_enabled(self, user):\n\t\tfrom webnotes.utils import cint\n\t\tif user=='Administrator': return\n\t\tif not cint(webnotes.conn.get_value('Profile', user, 'enabled')):\n\t\t\tself.fail('User disabled or missing')", "def is_enabled(self):\n return self.enabled", "def is_enabled(self) -> bool:...
[ "0.7977749", "0.76793694", "0.75934845", "0.75929815", "0.75929815", "0.75929815", "0.75929815", "0.75929815", "0.75929815", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215", "0.75795215",...
0.7859502
1
Respond to requests for the /index page.
def index(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('index.html'), 200", "def index():\n\n return render_template(\"index.html\"), 200", "def index():\n resp = make_response(render_template(\"index.html\", title='Home'))\n return resp", "def get_index(self):\n self.client.get('/')", "def index():\n\n\...
[ "0.8013304", "0.79146504", "0.7891352", "0.7824804", "0.76392025", "0.7636938", "0.7636938", "0.7631324", "0.7631067", "0.76206243", "0.75650007", "0.75650007", "0.7528473", "0.7528473", "0.7528473", "0.7528473", "0.7528473", "0.7528473", "0.7528473", "0.7528473", "0.7528473"...
0.7539462
27
Respond to requests for the /main page.
def show_main(): db = get_db() now = datetime.datetime.now() rooms = app.config["HC_CONFIG"].values() rooms.sort(key=config_lexer.Room.sortkey) # Get the three newest counts from the database, sorted by the # user-provided time newest_counts = db.get_newest_counts(3, hc_db.NewestSort.ENTERED...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root():\n if request.headers['Accept'] == 'application/json':\n return \"Welcome\\n\\n\", 200\n else:\n return redirect(url_for('index'))", "def main_page():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"main_page.html\")", "def root(self):\n ...
[ "0.7142308", "0.70636314", "0.6903149", "0.68820095", "0.67918116", "0.6785164", "0.6775684", "0.6775684", "0.6724704", "0.6717272", "0.6634704", "0.66281825", "0.6619429", "0.6619429", "0.66075295", "0.6605944", "0.6587914", "0.6587914", "0.65544164", "0.65462655", "0.651314...
0.0
-1
The set of arguments for constructing a OpenIdConnectProvider resource.
def __init__(__self__, *, client_id: pulumi.Input[str], display_name: pulumi.Input[str], metadata_endpoint: pulumi.Input[str], resource_group_name: pulumi.Input[str], service_name: pulumi.Input[str], client_secret: Opt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: OpenIdConnectProviderArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__,\n resource_name: str,\n args: ConsumerOauth2Args,\n ...
[ "0.755379", "0.64180404", "0.6012785", "0.5714407", "0.5685427", "0.56413275", "0.56387186", "0.56061673", "0.55925465", "0.55485886", "0.55302787", "0.549922", "0.54649246", "0.54310805", "0.54239976", "0.5415862", "0.54022753", "0.5384019", "0.53765005", "0.53718", "0.53645...
0.5083163
60
The name of the resource group. The name is case insensitive.
def resource_group_name(self) -> pulumi.Input[str]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")", "def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")", "def resource_gr...
[ "0.8591517", "0.83646333", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.82033736", "0.8175502", "0.8084937", "0.8084937", "0.8084937", "0.8084937", "0.8084937", "0....
0.8087981
49
The name of the API Management service.
def service_name(self) -> pulumi.Input[str]: return pulumi.get(self, "service_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def service_name(self):\n return self._service_name", "def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self...
[ "0.7601886", "0.7601886", "0.7245596", "0.71570414", "0.71570414", "0.71570414", "0.7035657", "0.70280814", "0.6857412", "0.6830366", "0.6798942", "0.67852134", "0.6732609", "0.6732609", "0.6732609", "0.6711877", "0.6648105", "0.66418576", "0.65912753", "0.6554579", "0.634530...
0.6982778
10
If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided.
def use_in_api_documentation(self) -> Optional[pulumi.Input[bool]]: return pulumi.get(self, "use_in_api_documentation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openid(self) -> Optional[pulumi.Input['OpenSearchOpensearchUserConfigOpenidArgs']]:\n return pulumi.get(self, \"openid\")", "def open_access_enabled(self) -> pulumi.Input[bool]:\n return pulumi.get(self, \"open_access_enabled\")", "def use_in_api_documentation(self) -> pulumi.Output[Optional[...
[ "0.5820401", "0.57344157", "0.5719072", "0.5496937", "0.5439381", "0.53700346", "0.5334672", "0.5334672", "0.5313755", "0.53108734", "0.51705146", "0.51009053", "0.5100864", "0.5046569", "0.5046569", "0.49825174", "0.4981729", "0.49672022", "0.49327353", "0.49327353", "0.4923...
0.5913999
0
If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided.
def use_in_test_console(self) -> Optional[pulumi.Input[bool]]: return pulumi.get(self, "use_in_test_console")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_open_id_setup(self):\r\n self.attempt_login(200)", "def provider(provider):\n if provider in (\"alditalk\", \"netzclub\", \"congstar\"):\n return True\n else:\n return False", "def use_in_test_console(self) -> pulumi.Output[Optional[bool]]:\n return pu...
[ "0.6032821", "0.5824308", "0.55178535", "0.5453098", "0.53928345", "0.53456354", "0.5332073", "0.5317057", "0.52994496", "0.5226725", "0.5226725", "0.52034736", "0.5201415", "0.51880836", "0.51880836", "0.51832134", "0.51577765", "0.5144394", "0.5124156", "0.51016015", "0.509...
0.57748115
2
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
def type(self) -> pulumi.Output[str]: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7918516", "0.7918516", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7708053", "0.75534964", "0.7282099", "0.70591027", "0.6979169", "0.69202054", "0.6868452", "0.67303157", "0.67049116", "0.6654272", "0.6646357", "0.66396123", "0.66396123", "0.663961...
0.0
-1
If true, the Open ID Connect provider will be used in the API documentation in the developer portal. False by default if no value is provided.
def use_in_api_documentation(self) -> pulumi.Output[Optional[bool]]: return pulumi.get(self, "use_in_api_documentation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_in_api_documentation(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"use_in_api_documentation\")", "def openid(self) -> Optional[pulumi.Input['OpenSearchOpensearchUserConfigOpenidArgs']]:\n return pulumi.get(self, \"openid\")", "def open_access_enabled(self) -> pulumi.I...
[ "0.59132946", "0.5819817", "0.57342637", "0.54987097", "0.54397446", "0.53713304", "0.53374505", "0.53374505", "0.5316145", "0.5308196", "0.5173217", "0.5100801", "0.50997686", "0.5049572", "0.5049572", "0.49861863", "0.49842972", "0.49659583", "0.49350378", "0.49350378", "0....
0.5717998
3
If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided.
def use_in_test_console(self) -> pulumi.Output[Optional[bool]]: return pulumi.get(self, "use_in_test_console")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_open_id_setup(self):\r\n self.attempt_login(200)", "def provider(provider):\n if provider in (\"alditalk\", \"netzclub\", \"congstar\"):\n return True\n else:\n return False", "def use_in_test_console(self) -> Optional[pulumi.Input[bool]]:\n return pul...
[ "0.60335296", "0.5824544", "0.57736", "0.54545283", "0.53939056", "0.5346869", "0.5330024", "0.53161216", "0.5298322", "0.52281344", "0.52281344", "0.5203175", "0.5200465", "0.51872015", "0.51872015", "0.5182298", "0.515659", "0.51430994", "0.5124126", "0.5101889", "0.5097933...
0.551661
3
If cache has not been modified for a certain period of time > Call cache_expiration
def check_expiration(self, cur_time): time_limit = 1000 time_elapsed = cur_time - self.time_created # Erase cache after an arbitrary amount of time if time_elapsed > time_limit: self.cache_expiration()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testExpirationTime(self):\n\n bye = \"Good bye!\"\n memcache.add('bye', bye, 1)\n assert memcache.get('bye') == bye\n time.sleep(2)\n assert memcache.get('bye') == None", "def cache_expiration(self):\n\n\t\t# Iterate through servers\n\t\tfor serv in self.servers:\n\t\t\tser...
[ "0.7299", "0.7113362", "0.7045958", "0.70365405", "0.69072556", "0.6836212", "0.6830515", "0.6820161", "0.66594964", "0.6586818", "0.658607", "0.65856355", "0.656018", "0.6550977", "0.6532097", "0.6492891", "0.6387115", "0.63761497", "0.63723713", "0.63621426", "0.63465744", ...
0.7367351
0
Returns true if two grids are identical.
def _are_equal(grid: List[List[str]], other: List[List[str]]) -> bool: for row in range(len(grid)): for col in range(len(grid[row])): if grid[row][col] != other[row][col]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n return False", "def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n else:\r\n return False", "def grid_equal (grid1, grid2):\r\n for i in range (4):\r\n for j in range (4):...
[ "0.8874632", "0.8846738", "0.8679359", "0.8580424", "0.8521882", "0.84081334", "0.81844366", "0.8146913", "0.79227364", "0.7629054", "0.7594243", "0.7594243", "0.7581608", "0.75567365", "0.75564873", "0.75505114", "0.7498745", "0.7435768", "0.7334657", "0.73153305", "0.725373...
0.7902166
9
return list of tokens in the chunk
def getTokens(self): list = [] for i in range(self.startIdx, self.endIdx + 1): token = self.sentence[i] list.append(token) return list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokens(self):\r\n return self.iter_tokens(self._blob)", "def getTokens(self):\n # NOTE: seems to be used by the evitaNominalTrainer only\n tokenList = []\n for chunkOrToken in self.dtrs:\n if chunkOrToken.isToken():\n tokenList += [chunkOrToken]\n ...
[ "0.77799284", "0.7539872", "0.7372555", "0.72691774", "0.72216874", "0.7207633", "0.7207633", "0.7207633", "0.7166675", "0.7158124", "0.70420665", "0.698481", "0.69665545", "0.6961893", "0.6822629", "0.6821286", "0.67915696", "0.6785925", "0.6766042", "0.6728448", "0.6727657"...
0.7451886
2
compare strings with spaces removed
def _equals(a: Union[str, Iterable[str]], b: Union[str, Iterable[str]]) -> bool: if isinstance(a, str) and isinstance(b, str): return a.replace(' ', '') == b.replace(' ', '') elif isinstance(a, Iterable) and isinstance(b, Iterable): return all(_equals(a_, b_) for a_, b_ in zip(a, b)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strings_are_equal(self, value1, value2):\n if value1.lower().strip().replace('_', ' ') == value2.lower().strip().replace('_', ' '):\n return 1\n return 0", "def robust_string_compare(a, b):\n return a.strip().lower() == b.strip().lower()", "def text_compare(t1, t2):\n if not...
[ "0.73184097", "0.7179956", "0.6800987", "0.6746601", "0.666357", "0.6595954", "0.6568298", "0.6344792", "0.6273209", "0.62271565", "0.6207043", "0.61632603", "0.61584306", "0.605877", "0.6014423", "0.59590864", "0.5944405", "0.593397", "0.593309", "0.5924363", "0.59123504", ...
0.0
-1
Returns the area of a square
def square_area(side): return side**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(width, height):\n return width * height", "def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area", "def findArea(self):\n\n a, b = self.sides\n area = a * b\n prin...
[ "0.8090838", "0.80154926", "0.7954106", "0.7824471", "0.7783778", "0.7700798", "0.76872426", "0.76741797", "0.7667355", "0.765625", "0.7632898", "0.7591796", "0.7591796", "0.759148", "0.7570914", "0.75693583", "0.7566862", "0.75640994", "0.75601727", "0.7549194", "0.7535171",...
0.8390034
0
Returns the area of a triangle
def triangle_area(base, height): return (base * height) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(triangle):\n return 0.5 * length_vector(normal_triangle(triangle, False))", "def triangle_area(base, height): # Compute the area of a triangle\n area = (1.0 / 2) * base * height\n return area", "def area_triangle(w, h):\n return w * h / 2", "def triangle_area(triangle...
[ "0.8696877", "0.8590872", "0.8584031", "0.8460314", "0.83471227", "0.8312218", "0.8232575", "0.808248", "0.8021095", "0.79935163", "0.7909247", "0.78900784", "0.787283", "0.77785003", "0.7767875", "0.77661365", "0.7712286", "0.7691215", "0.76842755", "0.765636", "0.76409584",...
0.8640302
1
Returns the area of a trapezoid
def trapezoid_area(base_minor, base_major, height): return ((base_major + base_minor) / 2 ) * height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trapezoid_area(lower, leg , upper):\n area = (((upper+lower)/2)*leg)\n return area", "def area(\n self):\n pi = numpy.pi\n area0 = 4.0 * pi / 8.0\n areadiv = 4.0 ** self.depth\n area = area0 / areadiv * (180.0 / pi) ** 2\n return area", "def test_trapezoi...
[ "0.78520364", "0.7460907", "0.7454638", "0.73699516", "0.73550856", "0.7342906", "0.733967", "0.7256443", "0.7245968", "0.72141457", "0.72019714", "0.71397465", "0.713728", "0.71023494", "0.7101085", "0.70923114", "0.70847434", "0.7081655", "0.70719075", "0.70652837", "0.7063...
0.7795574
1
Returns the area of a regular polygon
def regular_polygon_area(perimeter, apothem): return (perimeter * apothem) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def area_polygon(polygon):\n o = centroid_points(polygon)\n u = subtract_vectors(polygon[-1], o)\n v = subtract_vectors(polygon[0], o)\n a = 0.5 * length_vector(cross_vectors(u, v))\n for i in range(0, len(polygon) - 1)...
[ "0.83405626", "0.7997882", "0.7929972", "0.7915305", "0.77982956", "0.77653974", "0.7651996", "0.7492192", "0.7475052", "0.7420837", "0.73130727", "0.73078954", "0.7301159", "0.7279949", "0.7221524", "0.717091", "0.7111339", "0.70596975", "0.7027792", "0.70168835", "0.6991353...
0.80994475
1
Returns the data source name for IBM SQL DB.
def get_sqldb_dsn(vcap_services): parsed = json.loads(vcap_services) credentials = parsed["sqldb"][0]["credentials"] user = credentials["username"] password = credentials["password"] host = credentials["hostname"] port = credentials["port"] dbname = credentials["db"] dsn = """DATABASE={}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDatabaseName(self):\n raise NotImplementedError", "def database_name(self) -> str:\n return pulumi.get(self, \"database_name\")", "def get_name(self) -> str:\n return self.dbname", "def database_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"database_name\")"...
[ "0.67988276", "0.6757044", "0.6640127", "0.6600996", "0.656555", "0.6562899", "0.6504213", "0.6501408", "0.64891094", "0.6466255", "0.6374168", "0.62684536", "0.62597793", "0.62597793", "0.61956596", "0.6151577", "0.6122486", "0.60518956", "0.60327893", "0.60022545", "0.60017...
0.556014
65
Check minimum amount to be smaller than maximum amount
def check_gc_min_max(self): if not self.allow_open_amount: return if self.gc_min < 0 or self.gc_max < 0: self.raise_user_error("negative_amount_not_allowed") if self.gc_min > self.gc_max: self.raise_user_error("invalid_amount")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constrain(amt,low,high):\n if amt < low:\n return low\n elif amt > high:\n return high\n else:\n return amt", "def constrain(amt, low, high):\n if amt < low:\n return low\n elif amt > high:\n return high\n else:\n return amt", "def _check_amount_w...
[ "0.7257865", "0.7184651", "0.69377804", "0.678884", "0.67194104", "0.6685445", "0.66549397", "0.64801425", "0.6479099", "0.64686066", "0.64543825", "0.6451659", "0.64506114", "0.6416206", "0.63446826", "0.6343989", "0.63376147", "0.6264", "0.62631136", "0.62584764", "0.622891...
0.73816735
0
Price can not be negative
def check_price(self): if self.price < 0: self.raise_user_error("negative_amount")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_with_negative_price(self):\n good = GoodInfo(\"яйцо 1 кат.\", \"-30\", \"40\", \"2020-12-30\", \n \"14\", \"2020-12-30\")\n check_product_data = self.database.add(good)\n\n self.assertFalse(check_product_data)", "def test_negative_pricing(self):\n w...
[ "0.7177293", "0.71677935", "0.6973525", "0.67703366", "0.6730495", "0.6679441", "0.66298133", "0.6604763", "0.65583086", "0.6532081", "0.6500664", "0.64745545", "0.64646596", "0.6331761", "0.6326377", "0.6306027", "0.62740314", "0.62172383", "0.6200367", "0.61751693", "0.6172...
0.805959
0
Computes the Manhatten distance between two points
def heuristic(self, a, b): return math.fabs(a[0] - b[0]) + math.fabs(a[1] - b[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manhattenDist(position1, position2):\n dx,dy = manhattenPath(position1, position2)\n return float(abs(dx) + abs(dy))", "def minkowski_distance(point1, point2):\n md = 0\n for p1,p2 in zip(point1,point2):\n md += abs((p1-p2)**3)\n md = md**(1/3)\n return md\n ...
[ "0.7986378", "0.7387054", "0.73350203", "0.72149414", "0.7074068", "0.7063355", "0.70533884", "0.7024286", "0.7019737", "0.7007894", "0.6965768", "0.6944149", "0.69050664", "0.68953276", "0.68782187", "0.6876553", "0.68728054", "0.6864756", "0.6848846", "0.6842906", "0.683952...
0.0
-1
Returns all the bots in this application
def bots(): return get_bots("botsunlimited.settings")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def bot_list(self) -> list:\n return await self._do_request(\"get\", botlist_address, self._user_auth)", "def getBottoms(self):\n\t\treturn self.bottoms", "def get_all_bots(self):\n\t\ttry:\n\t\t\tconn \t\t\t = sqlite3.connect(self.name, detect_types=sqlite3.PARSE_DECLTYPES)\n\t\t\tconn.row_factor...
[ "0.83468235", "0.7929498", "0.7819921", "0.7557291", "0.7549412", "0.74972034", "0.7218726", "0.6947446", "0.6843511", "0.67450565", "0.64716", "0.64440453", "0.6343327", "0.62490296", "0.6220344", "0.6147376", "0.600576", "0.5970696", "0.5922339", "0.5894877", "0.5865871", ...
0.82548034
1
Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.
def merge_dicts(*dict_args): result = {} for dictionary in dict_args: result.update(dictionary) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def _merge_dicts(*args):\n return reduce(lambda d, s: d.update(s) or d, args)", "def merge_dict(lhs, rhs, override=True):\n if not isinstance(lhs, dict) or not isinstance(rhs, dict):\n if override:\n retur...
[ "0.76676226", "0.7661076", "0.74781454", "0.74528927", "0.74528927", "0.74528927", "0.73743427", "0.73391306", "0.73064536", "0.72796404", "0.7273245", "0.72545314", "0.7230961", "0.72210413", "0.7216889", "0.71992224", "0.7181106", "0.71770334", "0.71742785", "0.71636385", "...
0.7252352
17
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your access level for that URL.\n' 'You have to login with proper credentials', 401, { 'WWW-Authenticate': 'Basic realm="Login Required"' } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7843114", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.7664151
39
return how many comments are associated with this post
def get_comments_num(self): num=len(self.comments_set.all()) return num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments_count(self) -> int:\n return pulumi.get(self, \"comments_count\")", "def count_comments(self):\n return self.run_query(f\"count({self.r}/comment)\")", "def comment_count(self):\n return self.comments.filter_by(state=0).count()", "def count_comments(self):\n comments =...
[ "0.84315157", "0.817905", "0.81258833", "0.7797831", "0.7790453", "0.73247623", "0.71818984", "0.6811503", "0.67472047", "0.67033994", "0.6659185", "0.66317374", "0.656127", "0.656127", "0.65190077", "0.64942664", "0.63149625", "0.6290748", "0.6260958", "0.6250743", "0.624685...
0.829705
1
Sets the bank_connection_id of this UpdateBankConnectionParams.
def bank_connection_id(self, bank_connection_id): if bank_connection_id is None: raise ValueError("Invalid value for `bank_connection_id`, must not be `None`") # noqa: E501 self._bank_connection_id = bank_connection_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_bank_id(self, account_bank_id):\n\n self._account_bank_id = account_bank_id", "def bank_link_id(self, bank_link_id):\n\n self._bank_link_id = bank_link_id", "def bank_id(self, bank_id):\n\n self._bank_id = bank_id", "def connection_id(self, connection_id: PublicId) -> None:\n...
[ "0.69110113", "0.674954", "0.6749373", "0.5832576", "0.5393137", "0.5393137", "0.5393137", "0.5393137", "0.5393137", "0.5393137", "0.5375874", "0.5338826", "0.52705896", "0.5232349", "0.52232414", "0.50137806", "0.49649757", "0.4857446", "0.4806949", "0.4806949", "0.47635895"...
0.7731301
0
Sets the import_new_accounts of this UpdateBankConnectionParams.
def import_new_accounts(self, import_new_accounts): self._import_new_accounts = import_new_accounts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_accounts(self, accounts):\n\n\t\tif accounts is not None and not isinstance(accounts, list):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: accounts EXPECTED TYPE: list', None, None)\n\t\t\n\t\tself.__accounts = accounts\n\t\tself.__key_modified['Accounts'] = 1", "def accounts(self, accounts)...
[ "0.53422546", "0.49780527", "0.47495136", "0.4495662", "0.44653252", "0.4435442", "0.44069389", "0.440024", "0.4393641", "0.43348584", "0.43301332", "0.42868695", "0.42819005", "0.42258856", "0.4193985", "0.41832647", "0.4165837", "0.4157977", "0.41472742", "0.41438678", "0.4...
0.835969
0
Sets the skip_positions_download of this UpdateBankConnectionParams.
def skip_positions_download(self, skip_positions_download): self._skip_positions_download = skip_positions_download
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_skip(self, val):\n self.skip = val\n return self", "def skip(self, position):\n if not self._is_position_in_corpus(position):\n raise ValueError('{0} not in corpus'.format(position))\n\n self._staged_next = None\n self._has_staged = False\n self._next_...
[ "0.5405901", "0.52995765", "0.52862895", "0.48900428", "0.48506486", "0.48102078", "0.4747491", "0.4723357", "0.46888736", "0.46759465", "0.4653951", "0.45709956", "0.45615217", "0.4504345", "0.44933861", "0.4465514", "0.44415012", "0.44352877", "0.4430059", "0.4360223", "0.4...
0.80990744
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, UpdateBankConnectionParams): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Create a token by serializing and signing given data together with current timestamp.
def make_token(self, data: object) -> str: return self.serializer.dumps(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_token(self):\n ts_datetime = self.logged_at or self.created_at\n ts = int(mktime(ts_datetime.timetuple()))\n key = base64.encodestring(self.email)\n base = \"{}{}\".format(key, ts)\n salt, hsh = self.password.split('$')\n return \"{}$${}\".format(key, get_hexdig...
[ "0.7160707", "0.6740742", "0.6711519", "0.6675842", "0.6663808", "0.66362053", "0.6575271", "0.6546655", "0.6480899", "0.6459492", "0.6432737", "0.6400944", "0.6400944", "0.6400944", "0.6400944", "0.6400944", "0.6400944", "0.6386564", "0.6385563", "0.6379062", "0.63481915", ...
0.6929179
1
Simple numpy softmax implementation
def softmax(x): # (n_samples, n_classes) if len(x.shape) == 2: row_max = np.max(x, axis=1) x -= row_max.reshape((x.shape[0], 1)) x = np.exp(x) row_sum = np.sum(x, axis=1) x /= row_sum.reshape((x.shape[0], 1)) # (n_samples, n_tasks, n_classes) elif len(x.shape) == 3: row_max = np.max(x, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n return np.exp(x)/np.sum(np.exp(x),axis=0)", "def softmax(x):\n return np.exp(x)/np.su...
[ "0.8350847", "0.8336506", "0.82955825", "0.82955825", "0.82748896", "0.8273283", "0.82632035", "0.82632035", "0.82632035", "0.82632035", "0.82632035", "0.82632035", "0.82632035", "0.82632035", "0.82578284", "0.824684", "0.82419", "0.82269114", "0.82219225", "0.82126015", "0.8...
0.81334865
28
Returns a TensorflowGraph object.
def construct_graph(self, training, seed): graph = tf.Graph() # Lazily created by _get_shared_session(). shared_session = None # Cache of TensorFlow scopes, to prevent '_1' appended scope names # when subclass-overridden methods use the same scopes. name_scopes = {} # Setup graph with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_graph(self, graph_file):\n graph = tf.Graph()\n with graph.as_default():\n od_graph_def = tf.GraphDef()\n with tf.gfile.GFile(graph_file, 'rb') as fid:\n serialized_graph = fid.read()\n od_graph_def.ParseFromString(serialized_graph)\n ...
[ "0.6786658", "0.6760551", "0.66102105", "0.6589952", "0.65499103", "0.65100443", "0.6505363", "0.64967966", "0.646981", "0.6461245", "0.6397606", "0.6389917", "0.6284137", "0.62522805", "0.62101346", "0.62007177", "0.61687016", "0.6164254", "0.6134828", "0.61314774", "0.61116...
0.5648534
56
Replace logits with softmax outputs.
def add_output_ops(self, graph, output): with graph.as_default(): softmax = [] with tf.name_scope('inference'): for i, logits in enumerate(output): softmax.append(tf.nn.softmax(logits, name='softmax_%d' % i)) output = softmax return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_softmax(input, dim, inplace=False):\n return FunctionLib.apply(\n 'LogSoftmax', input.device, [input],\n outputs=[input if inplace else None], axis=dim)", "def softmax(inputs):\n return np.exp(inputs) / float(sum(np.exp(inputs)))", "def softmax(inputs):\n return np.exp(inputs) / ...
[ "0.68293893", "0.6803097", "0.6803097", "0.67738324", "0.67111564", "0.66912186", "0.6664683", "0.66296977", "0.66294324", "0.65996385", "0.65955234", "0.6581113", "0.65708923", "0.655051", "0.65459687", "0.6541081", "0.6537832", "0.6537669", "0.6519736", "0.64928603", "0.647...
0.6559051
13
Get training op for applying gradients to variables. Subclasses that need to do anything fancy with gradients should override this method.
def get_training_op(self, graph, loss): with graph.as_default(): opt = model_ops.optimizer(self.optimizer, self.learning_rate, self.momentum) return opt.minimize(loss, name='train')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_op(loss):\n gs = tf.train.get_global_step()\n is_boolq = FLAGS.dataset == \"boolq\"\n lr = tf.train.exponential_decay(\n global_step=gs,\n learning_rate=FLAGS.learning_rate,\n staircase=True,\n decay_steps=50 if is_boolq else 100,\n decay_rate=0.999)\n opt = tf.train.Adam...
[ "0.74252564", "0.71990854", "0.69060296", "0.68191344", "0.6807688", "0.68032134", "0.6785368", "0.67478657", "0.672029", "0.66496915", "0.66250527", "0.6619885", "0.6609408", "0.66065156", "0.65524507", "0.6523957", "0.65127623", "0.64581114", "0.64581114", "0.6441815", "0.6...
0.725181
1
Restores the model from the provided training checkpoint.
def restore(self): if self._restored_model: return with self.eval_graph.graph.as_default(): last_checkpoint = self._find_last_checkpoint() # TODO(rbharath): Is setting train=False right here? saver = tf.train.Saver() saver.restore(self._get_shared_session(train=False), last_checkpo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)", "def resume(self, checkpoint):\n model_dict = paddle.load(checkpoint)\n self.model.set_state_dict(model_dict)", "def restore(self, checkpoint)...
[ "0.82538426", "0.80384153", "0.79254836", "0.7802337", "0.76352406", "0.7610023", "0.75532335", "0.7520336", "0.7518003", "0.74191695", "0.73541987", "0.7301023", "0.72817785", "0.7269415", "0.72479945", "0.7179583", "0.7116844", "0.69957864", "0.6988693", "0.6985619", "0.695...
0.7829292
3
Return model output for the provided input. Restore(checkpoint) must have previously been called on this object.
def predict_on_batch(self, X): len_unpadded = len(X) if self.pad_batches: X = pad_features(self.batch_size, X) if not self._restored_model: self.restore() with self.eval_graph.graph.as_default(): # run eval data through the model n_tasks = self.n_tasks output = [] w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def get_model_output(\n model,\n batch_x\n):\n outputs = model(batch_x, training=False)\n return outputs", "def get_model_output(self):\n\n return self.model_output_file", "def pr...
[ "0.660089", "0.6289481", "0.61409634", "0.60339", "0.59906924", "0.5960017", "0.59316105", "0.58558106", "0.5833836", "0.58277667", "0.5817685", "0.58140755", "0.57970566", "0.579473", "0.5793381", "0.5766432", "0.57657963", "0.5703666", "0.5687992", "0.5678909", "0.5644757",...
0.0
-1
Return model output for the provided input. Restore(checkpoint) must have previously been called on this object.
def predict_proba_on_batch(self, X): if self.pad_batches: X = pad_features(self.batch_size, X) if not self._restored_model: self.restore() with self.eval_graph.graph.as_default(): # run eval data through the model n_tasks = self.n_tasks with self._get_shared_session(train=False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def get_model_output(\n model,\n batch_x\n):\n outputs = model(batch_x, training=False)\n return outputs", "def get_model_output(self):\n\n return self.model_output_file", "def pr...
[ "0.65964735", "0.62873185", "0.6138874", "0.60333747", "0.5988665", "0.59588784", "0.59298015", "0.58554935", "0.5834359", "0.58237016", "0.581739", "0.58144677", "0.579704", "0.5795056", "0.57887316", "0.57651836", "0.5763722", "0.57012063", "0.56890064", "0.567577", "0.5643...
0.0
-1
Return model output for the provided input. Restore(checkpoint) must have previously been called on this object.
def predict_on_batch(self, X): len_unpadded = len(X) if self.pad_batches: X = pad_features(self.batch_size, X) if not self._restored_model: self.restore() with self.eval_graph.graph.as_default(): # run eval data through the model n_tasks = self.n_tasks outputs = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def get_model_output(\n model,\n batch_x\n):\n outputs = model(batch_x, training=False)\n return outputs", "def get_model_output(self):\n\n return self.model_output_file", "def pr...
[ "0.65964735", "0.62873185", "0.6138874", "0.60333747", "0.5988665", "0.59588784", "0.59298015", "0.58554935", "0.5834359", "0.58237016", "0.581739", "0.58144677", "0.579704", "0.5795056", "0.57887316", "0.57651836", "0.5763722", "0.57012063", "0.56890064", "0.567577", "0.5643...
0.0
-1
Construct a feed dictionary from minibatch data.
def construct_feed_dict(self, X_b, y_b=None, w_b=None, ids_b=None): orig_dict = {} orig_dict["mol_features"] = X_b for task in range(self.n_tasks): if y_b is not None: orig_dict["labels_%d" % task] = y_b[:, task] else: # Dummy placeholders orig_dict["labels_%d" % task] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_feed_dict(model_variables_list, minibatch):\n\n in_vertex1, in_edge1, in_hood_indices1, in_vertex2, in_edge2, in_hood_indices2, examples, preds, labels, dropout_keep_prob = model_variables_list\n feed_dict = {\n in_vertex1: minibatch[\"l_vertex\"], in_edge1: minibatch[\"l_edge\"],\n i...
[ "0.7191104", "0.7117051", "0.69114816", "0.6788292", "0.6578762", "0.65674967", "0.6533734", "0.64429724", "0.6429636", "0.63499343", "0.62659776", "0.6224858", "0.62052417", "0.61679345", "0.6069642", "0.6044819", "0.59823453", "0.5920428", "0.5913141", "0.58957046", "0.5870...
0.6263203
11