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
Add nEllipse ellipses to the image on a random grid, at either random position angles (angle=None), or at a consistent angle. SemiX and SemiY describe the 'x' and 'y' length of the ellipse, and can here be specified as 'None', which will make these random values (between 530) as well.
def addEllipseRandom(self, nEllipse=50, angle=None, semiX=None, semiY=None, value=1.0): self.fimage = None gridx = numpy.random.uniform(low=0, high=self.nx, size=nEllipse) gridy = numpy.random.uniform(low=0, high=self.ny, size=nEllipse) if angle != None: angles = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEllipseGrid(self, gridX=50, gridY=50, angle=None, semiX=5.0, semiY=2.0, value=1.0):\n self.fimage = None\n gridx = numpy.arange(0, self.nx+gridX, gridX)\n gridy = numpy.arange(0, self.ny+gridY, gridY)\n if angle != None: \n angles = numpy.zeros(len(gridx)*le...
[ "0.7370053", "0.6481375", "0.63777584", "0.6240807", "0.59980804", "0.58613914", "0.5815756", "0.5802279", "0.5752435", "0.5714972", "0.5712941", "0.5712289", "0.5684344", "0.56788665", "0.5654828", "0.5620707", "0.5606981", "0.5604733", "0.55894834", "0.5581635", "0.5569908"...
0.8322989
0
Find the probability that the sequence of letters contains the certain letter.
def calculate_probability(letter: str, text_list: list) -> None: try: letters = text_list[1] n_list = list(range(len(letters))) number_k = int(text_list[2][0]) result = set() combination_list = list(combinations(n_list, number_k)) for index in combination_list[:]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_prob(c):\n # check to ensure that c is a single character\n assert(type(c) == str and len(c) == 1)\n\n if c == ' ': return 0.1904\n if c == 'e' or c == 'E': return 0.1017\n if c == 't' or c == 'T': return 0.0737\n if c == 'a' or c == 'A': return 0.0661\n if c == 'o' or c == 'O': ret...
[ "0.68576866", "0.6662624", "0.64441407", "0.6390727", "0.637704", "0.6324226", "0.63078654", "0.6245515", "0.6231735", "0.6223212", "0.617444", "0.6157422", "0.6136494", "0.61119956", "0.60538065", "0.59835535", "0.5963341", "0.59351045", "0.59250224", "0.59226406", "0.590974...
0.6310796
6
Instantiate this model from a dictionary. Because MaaS decides to replace the resource ids with the representation of the resource, we must reverse it for a true representation of the block device
def from_dict(cls, api_client, obj_dict): refined_dict = {k: obj_dict.get(k, None) for k in cls.fields} if 'id' in obj_dict: refined_dict['resource_id'] = obj_dict.get('id') if 'logical_volumes' in refined_dict and isinstance( refined_dict.get('logical_volumes'), lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'CardBlockRequest':\n return util.deserialize_model(dikt, cls)", "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n id = dictionary.get(...
[ "0.70695454", "0.68536645", "0.6696691", "0.6634656", "0.659024", "0.64956754", "0.64844996", "0.6483647", "0.64627737", "0.6409181", "0.6392431", "0.63688684", "0.635876", "0.6342191", "0.63009113", "0.62848777", "0.62720704", "0.6257175", "0.62520474", "0.6251527", "0.62418...
0.646658
8
checks whether or not the word that is passed in if it has 3 or more vowels return true
def does_it_have_3_vowels(word): vowel_count = 0 vowels = "aeiou" for char in word: if char in vowels: vowel_count += 1 if vowel_count > 2: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_more_vowels(word):\n\n# If the phrase is over half vowels, it should return True:\n\n # intialize a vowel count variable \n # Loop through the letters of the word:\n # if the letter is in the set of vowels, increment the vowel count\n # if vowel count is greater than length of the word divided ...
[ "0.79739213", "0.77607274", "0.7464363", "0.72823495", "0.7242711", "0.7226103", "0.70823115", "0.6897366", "0.6820241", "0.68138057", "0.6779361", "0.6773287", "0.6755819", "0.67411226", "0.66716224", "0.6671004", "0.6633296", "0.6623763", "0.6507316", "0.6461004", "0.641854...
0.85849833
0
return all attributes those matching specific patterns in the individual content
def extract(soup, keyIndex): # getting the individual content content = soup.find('div', attrs={'data-key': keyIndex}) # index pattern = r"<span class=\"indexed-biz-name\">(\d+)" index = extractAttribute(content, pattern) #print index # link pattern = r"biz-name\".*(/biz/[\w?%?+-?]+)\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractAttribute(content, pattern):\n \n return re.findall(re.compile(pattern), str(contents))", "def get_attrs(post_content):\n for attribute in post_content.find_all(\"p\", {\"class\": \"attrgroup\"}):\n for attr in attribute.find_all(\"span\"):\n attr_text = attr.text.strip()\n ...
[ "0.7939748", "0.6967809", "0.63892853", "0.6194138", "0.6141161", "0.6030222", "0.6018985", "0.59195334", "0.5882216", "0.5878144", "0.5764142", "0.56547594", "0.5644958", "0.5623186", "0.56198716", "0.5618539", "0.56019574", "0.55679744", "0.5540958", "0.55205494", "0.546997...
0.500437
62
Score=0.4F11 + 0.6F12 F11=6label_recalllabel_precision/(5label_recall+label_precision) F12=5pred_recallpred_precision/(2pred_recall+3pred_precision)
def score(label_recall, label_precision, pred_recall, pred_precision): f11 = 6*label_recall*label_precision/(5*label_recall+label_precision) f12 = 5*pred_recall*pred_precision/(2*pred_recall+3*pred_precision) return 0.4*f11 + 0.6*f12
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f1_score_per_label(y_true, y_pred, threshold, eps=1e-9):\n \n y_pred = torch.ge(y_pred.float(), threshold).float()\n\n y_true = y_true.float()\n\n tp_l = (y_pred * y_true).sum(0).float()\n\n fp_l = (y_pred * (1 - y_true)).sum(0).float()\n\n fn_l = ((1 - y_pred) * y_tru...
[ "0.747146", "0.7438117", "0.733593", "0.7300026", "0.71396464", "0.7102712", "0.70658726", "0.70629424", "0.7060278", "0.7035578", "0.70352757", "0.7003772", "0.69979626", "0.6989815", "0.69814694", "0.6956675", "0.69470483", "0.6926542", "0.6888901", "0.6866202", "0.68434274...
0.88405424
0
DropDocumentReq a model defined in Swagger
def __init__(self, notification=None, document_id=None, user_id=None, url=None, document=None, file_name=None, cloud_storage_provider=None, cloud_storage_files=None, cloud_storage_files_desc=None, tenant_id=None, subscription_id=None, trace_id=None, request_id=None, integration_setting=None, job_id=None, job_id_ext=Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def remove_doc(self, *args, **kwargs):\n pass", "def drop(self):\n\t\tdrop_model(self.name, self.cursor, print_info = False)", "def delete_document(self):\n pass", "def drop_from_couch(self):\n try:\n self.itr.couch_db.delete_doc(self.itr.iteration_id)\n except Re...
[ "0.63224095", "0.58421624", "0.5789578", "0.563027", "0.54738736", "0.54411006", "0.5426616", "0.5414058", "0.5387809", "0.5377549", "0.53311497", "0.53191555", "0.5278767", "0.5244958", "0.5218166", "0.5199344", "0.51976293", "0.51693577", "0.51693577", "0.51538324", "0.5141...
0.0
-1
Sets the url of this DropDocumentReq.
def url(self, url): self._url = url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_url(self, url):\n if url is not None:\n self.url = url", "def set_url(self, url):\n self.url = url", "def set_url(self, url):\n self.data['url'] = url", "def url(self, url: str):\n self._url = url", "def url(self, url: str):\n\n self._url = url", "def...
[ "0.696079", "0.6904225", "0.6842938", "0.67778707", "0.67017883", "0.67017883", "0.67017883", "0.65655273", "0.65464354", "0.6390549", "0.6171833", "0.61473113", "0.6106376", "0.60918236", "0.60388744", "0.60388744", "0.5949887", "0.5943737", "0.59415114", "0.5929371", "0.591...
0.67954654
5
Sets the request_id of this DropDocumentReq.
def request_id(self, request_id): self._request_id = request_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_request(self, request_id):\n doc_id = bson.objectid.ObjectId(request_id)\n coll = self._db.get_collection(COLLECTION_REQUEST)\n coll.delete_one({\n '_id': doc_id\n })", "def setRequestId(self, reqid) :\n self.request_id = reqid", "def set_DocumentId(self...
[ "0.65506566", "0.6460715", "0.64398193", "0.63804597", "0.6354084", "0.58816046", "0.58647156", "0.5281182", "0.5223908", "0.5167853", "0.5149899", "0.50741327", "0.5057502", "0.50294924", "0.49284524", "0.4894516", "0.4894516", "0.4894516", "0.4893341", "0.4865469", "0.48612...
0.711342
0
Sets the without_metadata of this DropDocumentReq.
def without_metadata(self, without_metadata): self._without_metadata = without_metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runDocumentWithoutNotif(self):\n self.runDocument(withoutNotif=True)", "def unsetRequired(self):\n return _libsbml.SBMLDocumentPlugin_unsetRequired(self)", "def reset_document(self):\n # FIXME: this state does not make sense\n self.doc_version_set = False\n self.doc_comme...
[ "0.56692725", "0.5252302", "0.52087456", "0.51713336", "0.5157268", "0.5157268", "0.5157268", "0.5157268", "0.5157268", "0.5151334", "0.51312727", "0.51065326", "0.509231", "0.48772356", "0.48729455", "0.4872436", "0.4832461", "0.48171043", "0.4748888", "0.4746877", "0.474026...
0.7339886
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, DropDocumentReq): 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
Initialises a Player object
def __init__(self): # set up the class variables self.rangeTop = 85 # MIDI number of top note self.rangeBottom = 42 # MIDI number of bottom note self.currentUrlinie = [] self.baseMotif = [] self.workingMotif = [] self.ULLength = 120 # this is the number of values in the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, player):\n\t\tself.player = player", "def __init__(self, player):\n self.player = player", "def __init__(self,player,name,playerFn):\n\t\tself.player = player\n\t\tself.name = name\n\t\tself.playerFn = playerFn", "def __init__(self, *args, **kwargs):\n super(Player, self).__i...
[ "0.78368944", "0.77861077", "0.7427864", "0.7419789", "0.73668134", "0.72367734", "0.7144261", "0.7109159", "0.7036951", "0.696091", "0.6942897", "0.6879853", "0.6871803", "0.6819917", "0.68009317", "0.6796618", "0.67868984", "0.67806566", "0.67771393", "0.6730075", "0.666703...
0.0
-1
Returns whether the stack is empty.
def empty(self): return self.num==0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def is_empty(self):\n return len(self.stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def isEmpty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "...
[ "0.9207258", "0.91276956", "0.90185934", "0.9000551", "0.89481044", "0.89481044", "0.8914844", "0.8904091", "0.8881541", "0.88791907", "0.8867761", "0.87955654", "0.8768181", "0.8748518", "0.87393755", "0.8728073", "0.8719241", "0.87090814", "0.87090814", "0.85431594", "0.850...
0.0
-1
Helper method to get array for a DataFrame column or a Series. Equivalent of df[col].values, but without going through normal getitem, which triggers tracking references / CoW (and we might be testing that this is done by some other operation).
def get_array(obj, col=None): if isinstance(obj, Series) and (col is None or obj.name == col): arr = obj._values else: assert col is not None icol = obj.columns.get_loc(col) assert isinstance(icol, int) arr = obj._get_column_array(icol) if isinstance(arr, BaseMaskedAr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column_values(self, col: str) -> ndarray:\n dtype, loc = self._get_col_dtype_loc(col) # type: str, int\n return self._data[dtype][:, loc]", "def getitem_array(self, key):\n if isinstance(key, type(self)):\n key = key.to_pandas().squeeze(axis=1)\n\n def getitem_arr...
[ "0.74315935", "0.6938931", "0.66940194", "0.6690742", "0.66502446", "0.6644839", "0.6627666", "0.6414686", "0.64113736", "0.6392321", "0.63673145", "0.6329034", "0.6239566", "0.62270355", "0.6073727", "0.59837985", "0.5936087", "0.58864146", "0.5859457", "0.5799158", "0.57904...
0.751671
0
Get the model through the name
def get_net(net_name, weight_path=None): if net_name in ['VGGFace2']: # load model from model.vggface_models.resnet import resnet50 if weight_path is None: weight_path = "./checkpoint/resnet50_scratch_weight.pkl" net = resnet50(num_classes=8631) with open(weight_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(self, name):\n bundle_name, model_name = name.split(\".\")\n bundle = self.bundles[bundle_name]\n model = bundle.models[name]\n return model", "def get_model_by_name(cls, name):\n model_name = inflection.camelize(name) # class name of the model to use\n mo...
[ "0.8348384", "0.8130318", "0.81128883", "0.77008945", "0.76834846", "0.7640482", "0.7415706", "0.74061894", "0.73548436", "0.7332768", "0.7290543", "0.7160238", "0.7137832", "0.7121672", "0.71014076", "0.70663273", "0.70474285", "0.703507", "0.70196587", "0.69834685", "0.6971...
0.0
-1
Get the last convolutional layer name
def get_last_conv_name(net): layer_name = None for name, m in net.named_modules(): if isinstance(m, nn.Conv2d): layer_name = name return layer_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_penultimate_layer(self):\n return self.model.outputs[1]", "def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")", "def test_get_last_layer(self):\n\t\t\n\t\tprint(\"test_get_last_layer\")\n\t\tlayer_iterator = ww.WeightWatcher().make_layer_iterator(self.mo...
[ "0.7112188", "0.7087207", "0.6886191", "0.67668575", "0.6643981", "0.6604615", "0.6538557", "0.6340025", "0.6239203", "0.6197239", "0.6194134", "0.6163104", "0.613668", "0.6097598", "0.6080173", "0.6065836", "0.6052205", "0.602204", "0.60216224", "0.59522194", "0.5944485", ...
0.8535074
0
Load word embedding model
def load_word2vec_model(): logging.basicConfig( format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) model_path = '/playpen/home/tongn/GoogleNews-vectors-negative300.bin' model = KeyedVectors.load_word2vec_format(fname=model_path, binary=True) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(embed_dir):\n # need to have gensim model + syn0.npy + syn1neg.npy\n model = gensim.models.Word2Vec.load(embed_dir)\n return model", "def loadEmbModel(embFile, logger):\n logger.info(\"Loading Embedding Model\")\n f = open(embFile,'r')\n model = {}\n v = []\n for line in f:...
[ "0.8189063", "0.7636831", "0.7451083", "0.73777395", "0.73767567", "0.73462766", "0.73338634", "0.7329917", "0.7314446", "0.73017794", "0.7298426", "0.71462786", "0.71240056", "0.7082644", "0.7068705", "0.7021889", "0.7015172", "0.7011214", "0.69804484", "0.6976893", "0.69744...
0.73918474
3
Create onehot encoding with zeroing out padding.
def _one_hot(self, ys): mask = ys != PADDING_VALUE one_hot_ys = [] for i, y in enumerate(ys): unpadded_one_hot = torch_functional.one_hot(y[mask[i]], self.vocab_dim) padded_one_hot = torch.cat([unpadded_one_hot, torch.zeros(((~mask...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(y, out_size):\n n = len(y)\n oh = np.zeros((n, out_size))\n oh[range(n), y] = 1\n return oh", "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",...
[ "0.79845893", "0.7847554", "0.78112334", "0.77496904", "0.7727992", "0.7719621", "0.77149004", "0.7643938", "0.76391727", "0.75881654", "0.7572232", "0.7561501", "0.75521564", "0.75267065", "0.7518501", "0.7493017", "0.74862945", "0.74837637", "0.7480711", "0.74606764", "0.74...
0.0
-1
Create onehot encoding with zeroing out padding.
def _embed(self, ys): mask = ys != PADDING_VALUE embed_ys = [] for i, y in enumerate(ys): unpadded_embed = self.word_piece_embedding(y[mask[i]]) padded_embed = torch.cat([unpadded_embed, torch.zeros(((~mask[i]).sum(), self.embedding_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(y, out_size):\n n = len(y)\n oh = np.zeros((n, out_size))\n oh[range(n), y] = 1\n return oh", "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",...
[ "0.79839766", "0.78469974", "0.78106815", "0.77493215", "0.772654", "0.77180547", "0.77134013", "0.76427984", "0.76389664", "0.75870293", "0.7571371", "0.7560147", "0.7551642", "0.752608", "0.7517935", "0.74924713", "0.7486767", "0.74829113", "0.74798393", "0.74595577", "0.74...
0.0
-1
Where the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created inmemory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic l...
def location(self) -> Optional[str]: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def realPath(self):\n \n return (self.useLink and [self.linkPath] or [self.installPath])[0]", "def get_absolute_pathname(self):\n return os.path.join(settings.PRIVATE_STORAGE_ROOT, self.get_relative_pathname())", "def asset_manifest_path(self) -> str:\n return self._values.get(\"ass...
[ "0.67128944", "0.5875679", "0.5841888", "0.5777211", "0.5776157", "0.5751546", "0.5715768", "0.57137996", "0.5647426", "0.5612189", "0.56065255", "0.5602799", "0.5602799", "0.5602799", "0.5602799", "0.5602799", "0.56021", "0.56007874", "0.55966395", "0.5592635", "0.5570345", ...
0.0
-1
The project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode.
def editable_project_location(self) -> Optional[str]: # TODO: this property is relatively costly to compute, memoize it ? direct_url = self.direct_url if direct_url: if direct_url.is_local_editable(): return url_to_path(direct_url.url) else: # Sear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_dir():\n\n return Path(settings.PROJECT_DIR)", "def _get_egg_path(self):\n try:\n _dist = get_distribution('janitoo_nut')\n return _dist.__file__\n except AttributeError:\n return 'src-nut/config'", "def project_directory(self):\n\n # try...
[ "0.67472225", "0.6738643", "0.673171", "0.6672829", "0.66075057", "0.65734035", "0.6561655", "0.65588915", "0.65526927", "0.650255", "0.6479083", "0.6454446", "0.64221394", "0.64196014", "0.64196014", "0.64196014", "0.64196014", "0.64160496", "0.64160496", "0.64124346", "0.63...
0.7274196
0
Obtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid.
def direct_url(self) -> Optional[DirectUrl]: try: content = self.read_text(DIRECT_URL_METADATA_NAME) except FileNotFoundError: return None try: return DirectUrl.from_json(content) except ( UnicodeDecodeError, json.JSONDecodeErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url_from_metadata(self, metadata):\n if metadata != None:\n url_object = metadata.lookup_value('xesam:url')\n if url_object != None:\n url = url_object.get_string()\n if url != '':\n return url\n return None", "def get_d...
[ "0.5977687", "0.5845257", "0.5369289", "0.52597606", "0.5207365", "0.5189001", "0.5185973", "0.51731944", "0.5120753", "0.51198065", "0.5092093", "0.50565475", "0.5051189", "0.5031832", "0.5031349", "0.50074315", "0.50053513", "0.49635345", "0.49521214", "0.49486515", "0.4948...
0.83933055
0
Get the lists of debuff modifiers for a specific debuff type
def getDebuff(state, debuffType) : return [ b['props'][debuffType] for b in state['enemy']['debuff'] if debuffType in b['props'] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifiers(m) -> Set[str]:\n return set(m[\"modifier_list\"])", "def modifiers(self):\n return self._modifiers", "def modifiers(self):\n return self._modifiers", "def modifiers(self):\n return self._modifiers", "def modifiers(self):\n from .modifier import Modifier\n mhandl...
[ "0.64390606", "0.6263473", "0.6263473", "0.6263473", "0.61122996", "0.5895267", "0.5693364", "0.5606226", "0.55220014", "0.5444087", "0.54167527", "0.53634447", "0.5354794", "0.5310151", "0.5303266", "0.52474755", "0.5236511", "0.5221758", "0.521922", "0.5197451", "0.5170688"...
0.7292409
0
Returns the minimax action using self.depth and self.evaluationFunction
def getAction(self, gameState): "*** YOUR CODE HERE ***" a = self.result(gameState,0)[0] return a util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o...
[ "0.7482665", "0.7383559", "0.71806973", "0.7110041", "0.70884514", "0.70694935", "0.70683014", "0.7048308", "0.70055133", "0.69651455", "0.69642085", "0.69604385", "0.6945924", "0.68998593", "0.6895832", "0.688605", "0.6826282", "0.6767276", "0.6758028", "0.6751636", "0.67054...
0.0
-1
r"""Compute the viscous stress tensor.
def viscous_stress_tensor(discr, eos, cv, grad_cv): dim = cv.dim transport = eos.transport_model() mu_b = transport.bulk_viscosity(eos, cv) mu = transport.viscosity(eos, cv) grad_v = velocity_gradient(discr, cv, grad_cv) div_v = np.trace(grad_v) return mu*(grad_v + grad_v.T) + (mu_b - 2*m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stress_tensor(self):\n s = \"::: forming the Cauchy stress tensor :::\"\n print_text(s, self.color)\n epi = self.strain_rate_tensor(self.U3)\n I = Identity(3)\n\n sigma = 2*self.eta*epi - self.p*I\n return sigma", "def deviatoric_stress_tensor(self):\n s = \"::: forming the deviato...
[ "0.73881775", "0.7255953", "0.67312026", "0.6686066", "0.6549811", "0.6449676", "0.6125403", "0.61116076", "0.59978694", "0.59875727", "0.5986582", "0.59832853", "0.5729728", "0.55730426", "0.55697197", "0.55353355", "0.5514735", "0.54686767", "0.54493994", "0.54272693", "0.5...
0.7675515
0
r"""Compute the species diffusive flux vector, ($\mathbf{J}_{\alpha}$).
def diffusive_flux(discr, eos, cv, grad_cv): transport = eos.transport_model() grad_y = species_mass_fraction_gradient(discr, cv, grad_cv) d = transport.species_diffusivity(eos, cv) return -cv.mass*d.reshape(-1, 1)*grad_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diffusive_heat_flux(discr, eos, cv, j):\n if isinstance(eos, MixtureEOS):\n h_alpha = eos.species_enthalpies(cv)\n return sum(h_alpha.reshape(-1, 1) * j)\n return 0", "def j(self, nu, a):\n result = self.rhoSFR(a)\n result /= a*self.K\n result *= self.sed(nu, a)\n chi ...
[ "0.65512097", "0.6187856", "0.6009725", "0.59900546", "0.59839356", "0.5953706", "0.59342957", "0.5912725", "0.58964026", "0.58764386", "0.5840783", "0.58128434", "0.5797953", "0.57880217", "0.57413703", "0.5726478", "0.5726478", "0.5726478", "0.5726478", "0.5706091", "0.5668...
0.55606925
26
Routine returns the the nodelocal maximum stable viscous timestep.
def get_viscous_timestep(discr, eos, cv): from grudge.dt_utils import characteristic_lengthscales from mirgecom.fluid import compute_wavespeed length_scales = characteristic_lengthscales(cv.array_context, discr) mu = 0 d_alpha_max = 0 transport = eos.transport_model() if transport: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_max_t(self):\n \"\"\"\n if hasattr(self,'k_of_t'):\n return max([ \n self.s_of_t[-1][0],\n self.i_of_t[-1][0],\n self.r_of_t[-1][0],\n self.k_of_t[-1][0],\n ...
[ "0.6423648", "0.6311524", "0.6151831", "0.6053202", "0.5999233", "0.58975804", "0.5892716", "0.58547956", "0.58336717", "0.58267725", "0.5788448", "0.5788448", "0.5788448", "0.5788448", "0.5788448", "0.5788448", "0.570894", "0.569235", "0.5678405", "0.5665171", "0.5658524", ...
0.54594916
43
Create and configure Flask app.
def create_app(env_name): app = Flask(__name__) app.config.from_object(configs[env_name]) api = Api(app) ga_client = (google.ads.google_ads.client.GoogleAdsClient .load_from_storage()) handler.defaultConversion = ga_client.get_type( 'ClickConversion', version='v2') ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app...
[ "0.86537826", "0.8589165", "0.8507377", "0.84595364", "0.8454275", "0.8438637", "0.83340675", "0.8289564", "0.8277349", "0.8247108", "0.8243593", "0.8230877", "0.81630534", "0.8147489", "0.8141104", "0.8129321", "0.81211066", "0.8120904", "0.811153", "0.8108017", "0.8101609",...
0.0
-1
Sets the id of this Attachment.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.__id = id", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):\n self.data['id'] = id", "def id(self, id):\n if id is None:\n raise ValueError(\"Invalid value for `id`, mu...
[ "0.7694661", "0.76553226", "0.76117444", "0.7431086", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", "0.74160606", ...
0.70792943
94
Sets the byte_count of this Attachment.
def byte_count(self, byte_count): self._byte_count = byte_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_size(self, num_bytes):\n self.model.data_size = num_bytes\n self.refresh_memory()", "def byte_count(self):\n if hasattr(self, '_m_byte_count'):\n return self._m_byte_count if hasattr(self, '_m_byte_count') else None\n\n self....
[ "0.59992135", "0.5872156", "0.57596266", "0.5710116", "0.55926186", "0.5570216", "0.55569273", "0.55435973", "0.5513015", "0.54854697", "0.5437278", "0.54144335", "0.5401962", "0.539577", "0.539577", "0.539577", "0.539577", "0.53779846", "0.5325413", "0.53233224", "0.5308858"...
0.804222
0
Sets the data of this Attachment.
def data(self, data): self._data = data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data(self, data):\n\n self._data = data", "def set_data(self, data):\n\n self._data = data", "def set_data(self, data):\n\n self._data = data", "def set_data(self, data):\n self.data = data", "def data(self, data):\n self.__data = data", "def data(self, data):\n...
[ "0.7894154", "0.7894154", "0.7894154", "0.78816074", "0.7862778", "0.7852827", "0.7852827", "0.78141934", "0.77848583", "0.77704185", "0.77123404", "0.7601402", "0.7601402", "0.75249165", "0.74529666", "0.74236864", "0.74236864", "0.7403571", "0.7374803", "0.7374803", "0.7349...
0.7832565
7
Sets the description of this Attachment.
def description(self, description): self._description = description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetDescription(self, description):\n self.description = str(description)", "def set_description(self, description):\n self._description = description", "def set_description(self, description):\r\n self.__description = description", "def set_description(self, description):\n se...
[ "0.81917846", "0.8155252", "0.81508654", "0.8141625", "0.8139069", "0.8059261", "0.8059261", "0.8059261", "0.8059261", "0.80377215", "0.8008669", "0.8008669", "0.8008669", "0.8008669", "0.7972938", "0.7928191", "0.78115726", "0.77464515", "0.7702279", "0.753992", "0.75082016"...
0.8059082
29
Sets the mime_type of this Attachment.
def mime_type(self, mime_type): self._mime_type = mime_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachment_mime_type(self, attachment_mime_type):\n\n self._attachment_mime_type = attachment_mime_type", "def mime_type(self, mime_type):\n if self.local_vars_configuration.client_side_validation and mime_type is None: # noqa: E501\n raise ValueError(\"Invalid value for `mime_type`...
[ "0.8075634", "0.7308988", "0.7242003", "0.7205022", "0.6456883", "0.6407363", "0.6389319", "0.6389319", "0.63693285", "0.60873747", "0.6081679", "0.5826416", "0.57282877", "0.56393325", "0.55813384", "0.5548365", "0.5546197", "0.5542018", "0.55248743", "0.54703736", "0.547037...
0.84066135
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Attachment): 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
Test whether or not two `VoxelGrid` representation are consistent.
def _test_equiv(self, v0, v1, query_points=None): def array_as_set(array2d): return set(tuple(x) for x in array2d) # all points are filled assert g.np.all(v0.is_filled(v1.points)) assert g.np.any(v1.is_filled(v0.points)) # test different number of dimensions ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareGrids(grid1, grid2):\n if axis_utils.areAxesIdentical(grid1.getLatitude(),\n grid2.getLatitude(), check_id=False)==False:\n return False\n if axis_utils.areAxesIdentical(grid1.getLongitude(),\n grid2.getLongitude(), check_i...
[ "0.7524307", "0.74551034", "0.744511", "0.731301", "0.7277893", "0.7161064", "0.71568626", "0.7027291", "0.67985994", "0.66413", "0.6629517", "0.6538587", "0.6516908", "0.64832217", "0.6480218", "0.6480218", "0.64462155", "0.642701", "0.63774323", "0.63501525", "0.6334263", ...
0.571877
84
Show time based on the defaults at .tzcli file.
def show(): check_config: Union[List, bool] = utils.check_config() if not check_config: console.print( "File is empty or No configuration file is present in your system.:x:\n", style="bold red", ) console.print( "Use `tz add` to create and add timezon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_tzname(self):\n return settings.TIME_ZONES_BY_LANG.get(self.language, settings.TIME_ZONE)", "def timezoneHelp(self):\n rf = os.path.join('docs','helpButtons','prefsTimezone.html')\n self.showHelpFile( rf )", "def timezone():\n \n pass", "def showClock(hour: int, min: int...
[ "0.65724516", "0.64186716", "0.6320022", "0.6259091", "0.6234944", "0.6056046", "0.6048938", "0.5964352", "0.5954015", "0.5910461", "0.5784123", "0.5762627", "0.57512605", "0.57395893", "0.57161844", "0.5700914", "0.56678", "0.5652399", "0.56339604", "0.5612297", "0.5559922",...
0.7207884
0
Get time based on the entered timezone.
def search(query: str): try: # Search with user query. # TODO: Handle list with multiple data. data: List = pycountry.countries.search_fuzzy(query) # extract alpha2 value _, _, alpha_2, _ = utils.extract_fuzzy_country_data(data) # Get a list of timezone names. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone():\n\n return time.timezone", "def get_timezone(time_zone=''):\n return pytz.timezone(time_zone)", "def time_zone():\n return timezone('Etc/GMT-10')", "def get_timezone():\n return dates.get_timezone(_get_tz())", "def time_zone(self) -> Optional[pulumi.Input[str]]:\n ret...
[ "0.7432172", "0.73198473", "0.7230894", "0.7073731", "0.70336425", "0.7030845", "0.69858074", "0.6948213", "0.69172585", "0.6867727", "0.6812991", "0.6782578", "0.6731919", "0.6722789", "0.6700546", "0.6682192", "0.6669581", "0.66609937", "0.6607032", "0.66013026", "0.6595529...
0.0
-1
Add timezone to the config file.
def add(timezone: str): utils.validate_timezone(timezone) config_file = variables.config_file if not utils.check_config(): with open(config_file, "w+") as newfile: pass with open(config_file, "r+") as file: data: List = [line.rstrip() for line in file] if timezone ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def push_config(_):\n await oppio.update_opp_timezone(str(opp.config.time_zone))", "async def push_config(_):\n nonlocal last_timezone\n\n new_timezone = str(hass.config.time_zone)\n\n if new_timezone == last_timezone:\n return\n\n last_timezone = new_timezone\...
[ "0.7436048", "0.70607764", "0.66701674", "0.63746566", "0.6243304", "0.5907421", "0.5874269", "0.5783111", "0.5781923", "0.57168907", "0.57168907", "0.57168907", "0.57168907", "0.57168907", "0.56476426", "0.55421925", "0.55402833", "0.5525726", "0.5525726", "0.5517851", "0.54...
0.7741442
0
Interactively select the timezone from your config file to get local time.
def select(): config_file = variables.config_file entry = [] with open(config_file, "r+") as file: data = [line.rstrip() for line in file] if not len(data): return console.print("Config file contains no timezone:x:") entry.append(utils.handle_interaction(data)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_offline(self):\n\t\t\n\t\twith open(\"/etc/timezone\") as f:\n\t\t\ttzone = f.readline().replace(\"\\n\",\"\")\n\t\t\n\t\treturn tzone", "def _get_local_tz(module, timezone='UTC'):\n if platform.system() == 'Linux':\n timedatectl = get_bin_path('timedatectl')\n if timedatectl is not ...
[ "0.69321513", "0.69120824", "0.68748194", "0.6818542", "0.6681057", "0.6604064", "0.65770125", "0.65099084", "0.646425", "0.6458504", "0.63390595", "0.63364404", "0.63094634", "0.62702614", "0.62679386", "0.6249638", "0.61925244", "0.61528033", "0.6106846", "0.61003494", "0.6...
0.8132545
0
Name of the item.
def name(self) -> str: return self.__name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_name(self):\n return self.__item_name", "def getName(self,item):\n return item.s", "def __str__(self):\n return self.item_name", "def name(self):\n return self[\"name\"]", "def name(self):\r\n return self.data[\"name\"]", "def name(self):\r\n return ...
[ "0.89887154", "0.8870011", "0.812679", "0.7900199", "0.7870695", "0.7870173", "0.7846036", "0.76872367", "0.76872367", "0.76872", "0.7669473", "0.76194465", "0.76194465", "0.76194465", "0.76194465", "0.76194465", "0.76194465", "0.76139754", "0.76139754", "0.76107305", "0.7610...
0.0
-1
Handle AssertionError to check that file do not exist after that
def test_existing_file_after_assert_error(exist_of_file): try: assert read_magic_number(exist_of_file) except AssertionError: print("Now lets do check of existing file")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_present_file(self):\n\t\ttry:\n\t\t\tmain.Main(['input/abc.txt']).run()\n\t\texcept:\n\t\t\tself.assertTrue(True)", "def test_error(file_path):\n assert check_file(file_path), \"Training file is not generated\"", "def verify_non_existing_path(self) -> None:\n path = \"/some/non/existing/...
[ "0.7727351", "0.7607101", "0.7519451", "0.75158405", "0.75158405", "0.7503947", "0.74978906", "0.7469097", "0.73064864", "0.7199656", "0.7188716", "0.7143456", "0.71375364", "0.7074403", "0.7070423", "0.70561296", "0.70530117", "0.70367646", "0.70226246", "0.70215935", "0.701...
0.7911295
0
Gets the timezone from latitude an longitude.
def get_from_position(self, position): timezones = self.filter(shape__contains=Point(float(position[1]), float(position[0]))) if not timezones.exists(): raise ObjectDoesNotExist return timezones.first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone(latitude, longitude):\n tf = TimezoneFinder()\n return pytz.timezone(tf.timezone_at(lng=longitude, lat=latitude))", "def timezone(self, latitude, longitude):\n root = self._api_call('GET', 'timezone', lat=latitude, lng=longitude)\n return { 'timezoneId': root[0].find(...
[ "0.80787736", "0.7275954", "0.66190004", "0.66100776", "0.59582835", "0.5890893", "0.5735886", "0.56260663", "0.562307", "0.5621796", "0.55702496", "0.55110323", "0.5362925", "0.533575", "0.5278222", "0.5274394", "0.51939744", "0.5111225", "0.5085646", "0.50673443", "0.506077...
0.4491189
92
Finding the closest number in a Binary Search tree given a target value
def find_closest_val_bst(tree,target,closest): current_node = tree while current_node is not None: if current_node is None: return closest if abs(target-closest) > abs(target - current_node.data): closest = current_node.data if target < current_node.data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest(self, value):\n coords = value[:2] # value only has 2 coords (x, y) right now, but it may have theta in the future\n hits = self.idx.nearest(self.make_bounding_box(coords), 1, objects=False)\n for hit in hits:\n # take the first index in the event of any ties\n ...
[ "0.73052025", "0.7292866", "0.69597816", "0.66701585", "0.64771897", "0.64593774", "0.639703", "0.63623595", "0.6335978", "0.631448", "0.62686163", "0.625217", "0.6217977", "0.6208431", "0.61941314", "0.61941314", "0.61834854", "0.61815226", "0.61742985", "0.61524224", "0.614...
0.7971483
0
String for representing the MyModelName object (in Admin site etc.).
def __str__(self): return self.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model ...
[ "0.77822053", "0.77822053", "0.77084845", "0.7525811", "0.74508363", "0.7227562", "0.71816665", "0.71482503", "0.71063095", "0.71033597", "0.71033597", "0.71033597", "0.7090797", "0.7085791", "0.708007", "0.708007", "0.708007", "0.708007", "0.708007", "0.70512253", "0.7031677...
0.0
-1
String for representing the MyModelName object (in Admin site etc.).
def __str__(self): return self.plan.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model ...
[ "0.77813596", "0.77813596", "0.7708451", "0.7525213", "0.7450629", "0.7227507", "0.71823025", "0.7147577", "0.7105943", "0.71030724", "0.71030724", "0.71030724", "0.70900977", "0.7085584", "0.7080111", "0.7080111", "0.7080111", "0.7080111", "0.7080111", "0.7051613", "0.703164...
0.0
-1
Creates a string for the Genre. This is required to display genre in Admin.
def display_skill(self): return ', '.join([skill.name for skill in self.skill.all()[:3]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_genre(self):\n \n # Get first 3 genres and join to a string.\n return ', '.join([ genre.name for genre in self.genre.all()[:3] ])", "def add_genre(request):\n\tif request.method == \"POST\":\n\t\tform = GenreForm(request.POST)\n\t\tif form.is_valid():\n\t\t\tgenre = form.save(co...
[ "0.6889997", "0.6838813", "0.6693049", "0.6686029", "0.6639797", "0.6589276", "0.6586637", "0.6582929", "0.65671587", "0.65493095", "0.64921796", "0.6376532", "0.634303", "0.62912947", "0.62802744", "0.61385614", "0.6095737", "0.60845554", "0.6042862", "0.5985019", "0.5960763...
0.0
-1
construct sliding windows for BERT processing
def construct_sliding_windows(sequence_length: int, sliding_window_size: int): sliding_windows = [] stride = int(sliding_window_size / 2) start_index = 0 end_index = 0 while end_index < sequence_length: end_index = min(start_index + sliding_window_size, sequence_length) left_value = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def featurize_windows(data, start, end, window_size = 1):\n ret = []\n for sentence, labels in data:\n from util import window_iterator\n sentence_ = []\n for window in window_iterator(sentence, window_size, beg=start, end=end):\n ...
[ "0.6182956", "0.6109211", "0.5979294", "0.5949124", "0.5926888", "0.5889836", "0.5775665", "0.5772046", "0.5765072", "0.5760294", "0.5727664", "0.5722844", "0.571784", "0.5704565", "0.56835735", "0.5650381", "0.5642163", "0.56215435", "0.55916774", "0.5583824", "0.5539918", ...
0.519714
63
Method to display file's message digest
def printsha(self): print(self.sha256.hex())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileMD5(f: java.io.File, monitor: ghidra.util.task.TaskMonitor) -> unicode:\n ...", "def file_digest(file):\n # 'rb' file mode reads the file as bytes\n input_file = open(file, 'rb')\n data = input_file.read()\n # getting the digest\n digest = hash_comparing(data).hexdigest()\n in...
[ "0.6657623", "0.64775866", "0.6428634", "0.6428634", "0.6428634", "0.636605", "0.63572514", "0.6268484", "0.6097165", "0.6065086", "0.6056656", "0.59753186", "0.5921181", "0.59192973", "0.5811372", "0.57694525", "0.5728033", "0.56957", "0.5692614", "0.5680829", "0.5642849", ...
0.52701515
66
Convert two np arrays or torch Tensors design matrix and targets into torch.utils.data.DataLoader instance.
def generate_dataloader( design_matrix: Union[np.ndarray, torch.Tensor], targets_array: Union[np.array, torch.Tensor], data_type: torch.dtype = torch.float32, batch_size: int = 256, shuffle: bool = False, num_workers: int = 0, ): datalo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)", "def make_dataloaders(params):\r\n transform_train = transforms.Compose([transforms.RandomCrop(32, padding=4),\r\n tr...
[ "0.67099935", "0.66233", "0.65713674", "0.6546972", "0.651274", "0.64949536", "0.64791816", "0.6457504", "0.6443693", "0.6401127", "0.63705087", "0.63701004", "0.63586634", "0.6358641", "0.63505423", "0.63471806", "0.63295406", "0.6329433", "0.6329259", "0.63162506", "0.63097...
0.62198967
26
Create torch Dataloaders from raw design_matrix/ground truth array for a training and validation set and assign to instance's training_dataloader and validation_dataloader instances, respectively. See documentation for generate_training_validation_split and generate_dataloader for how this splitting/creation is done.
def initialize_dataloaders( self, X: Union[np.ndarray, pd.DataFrame], y: Union[np.ndarray, np.array] ): training_design_matrix, training_targets_array, validation_design_matrix, validation_targets_array = self.generate_training_validation_split( X, y ) training_datalo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataloaders(params):\r\n transform_train = transforms.Compose([transforms.RandomCrop(32, padding=4),\r\n transforms.RandomHorizontalFlip(),\r\n transforms.ToTensor(),\r\n transform...
[ "0.70194924", "0.6902347", "0.68239915", "0.6769449", "0.6762841", "0.6757982", "0.67204124", "0.67181975", "0.6647398", "0.6628096", "0.6622123", "0.6604419", "0.6596581", "0.657681", "0.65263945", "0.65104026", "0.6496584", "0.6494077", "0.64902407", "0.64851284", "0.639757...
0.7270912
0
Propagate input_tensor through the network, assigning the result to self.output. Call backprop after forward to take a training step.
def forward(self, input_tensor: torch.Tensor): self.network_output = self.network.forward(input_tensor.type(self.data_type)) return self.network_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training_step(self, input_tensor: torch.Tensor, target_tensor: torch.Tensor):\n self.forward(input_tensor)\n self.backprop(target_tensor)", "def forward(self, input=None):\n if (input is not None) and (self.result is None):\n self.result = self.act(input)\n\n # Pull the...
[ "0.76192695", "0.7476042", "0.7247275", "0.7190799", "0.7097013", "0.7049881", "0.70454407", "0.70386153", "0.70009863", "0.70009863", "0.70009863", "0.6991871", "0.6921098", "0.6884117", "0.6868437", "0.68664396", "0.6865133", "0.6865133", "0.68162066", "0.68028265", "0.6800...
0.7474546
2
Returns a 404 page when content is not found
def page_not_found(e): media = session.query(Medium).all() return render_template('404.html', media=media), 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_not_found(e):\n return render_template(\"404.html\"), 404", "def page_not_found():\n return render_template(\"errors/404.html\"), 404", "def page_not_found(e):\n return render_template('404.html'), 404", "def page_not_found(e):\n return render_template('404.html'), 404", "def page_not_...
[ "0.8396219", "0.83885485", "0.8365385", "0.8365385", "0.8302319", "0.83009803", "0.8291375", "0.821227", "0.81817174", "0.81752056", "0.8130846", "0.8130846", "0.8130846", "0.8130846", "0.8130846", "0.8130846", "0.8130846", "0.81244415", "0.81244415", "0.81244415", "0.8124441...
0.77322155
41
Checks whether the provided pixel coordinates are valid.
def valid_pixel_coordinates(u, v, IMAGE_HEIGHT, IMAGE_WIDTH): return (u >= 0 and v >= 0 and v < IMAGE_HEIGHT and u < IMAGE_WIDTH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_coordinates(self, x, y):\n return ((x >= 0) and (x < self.width) and\n (y >= 0) and (y < self.height))", "def valid_pixel(pixel, img_size):\n size_x, size_y = img_size\n valid = (((pixel[0] > -1) and (pixel[0] < size_x)) and\n ((pixel[1] > -1) and (pixel[1] < siz...
[ "0.7922656", "0.7370419", "0.72798556", "0.7236088", "0.709305", "0.7078133", "0.7010258", "0.69708955", "0.6934466", "0.6930281", "0.69116956", "0.6879952", "0.6849011", "0.67557263", "0.6753096", "0.67200124", "0.6575535", "0.6570169", "0.65532666", "0.6549414", "0.65228415...
0.8017633
0
Returns audio duration in seconds.
def audio_duration(self) -> float: for track in self.mi.tracks: if track.track_type == "Audio": return track.duration / 1000.0 raise LookupError("Audio duration not available")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration(self):\n with audioread.audio_open(self.path) as f:\n return f.duration", "def duration_in_seconds(self):\n \"Should not set track length\"\n return self.duration / float(self.samplerate)", "def duration_seconds(self):\n duration = 0.0\n if self.is_vid...
[ "0.85626525", "0.83942616", "0.8001902", "0.795367", "0.78477466", "0.7613614", "0.75010014", "0.7475822", "0.7446304", "0.74352086", "0.73622966", "0.73489124", "0.73429453", "0.7327469", "0.7280112", "0.7278265", "0.72650725", "0.7243033", "0.72258705", "0.7208126", "0.7196...
0.86336166
0
Test that the directory where temp file locks are saved can be configured via the env variable that configures the global Ray temp dir.
def test_temp_file_lock(tmp_path, monkeypatch): monkeypatch.setenv("RAY_TMPDIR", str(tmp_path)) assert str(tmp_path) in ray._private.utils.get_user_temp_dir() with TempFileLock(path="abc.txt"): assert RAY_LOCKFILE_DIR in os.listdir(tmp_path) assert os.listdir(tmp_path / RAY_LOCKFILE_DIR)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_temp_dir(tmpdir):\n f = open(os.path.join(os.path.dirname(__file__), \"log.log\"), \"w\")\n\n tmpdirstr = str(tmpdir)\n f.write(\"\\nTESTSETDIR:\\t\" + os.path.dirname(__file__))\n f.write(\"\\nTEMPDIR:\\t\" + tmpdirstr)\n f.write(\"\\nCURRENTDIR:\\t\" + os.getcwd())\n assert tmpdirstr !...
[ "0.708538", "0.7043003", "0.70015144", "0.69962054", "0.6903755", "0.68366796", "0.66905797", "0.6659715", "0.6650493", "0.6626244", "0.6567479", "0.65531653", "0.6528127", "0.64938426", "0.6444582", "0.6419093", "0.6418124", "0.6417401", "0.6408138", "0.6407247", "0.6405341"...
0.8059971
0
Initialize a new Perceptron instance. A perceptron classifies data points as either belonging to a particular class (+1) or not (1). `dimensions` is the dimensionality of the data. For example, dimensions=2 would mean that the perceptron must classify 2D points.
def __init__(self, dimensions): self.w = nn.Parameter(1, dimensions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_perceptron(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> PerceptronClassifier:\n raise Exception(\"Must be implemented\")", "def train_perceptron(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> PerceptronClassifier:\n raise Exception(\"Must be imp...
[ "0.6327905", "0.6327905", "0.60304344", "0.5751358", "0.57286155", "0.572685", "0.5708273", "0.5660392", "0.5653367", "0.5612706", "0.5564261", "0.551884", "0.55085725", "0.54992133", "0.5454495", "0.54507285", "0.5441649", "0.5425569", "0.53892314", "0.53858024", "0.5374424"...
0.5599027
10
Calculates the predicted class for a single data point `x`.
def get_prediction(self, x): "*** YOUR CODE HERE ***" if (nn.as_scalar(self.run(x)) >= 0.0): return 1 return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self,x):\n preds = [tree.predict(x) for tree in self.forest]\n if self.classify:\n cls_counts = [0] * self.param['numClasses']\n for p in preds:\n cls_counts[p] += 1\n return argmax(cls_counts)\n else:\n return sum(preds) /...
[ "0.7661651", "0.75753754", "0.7556014", "0.75414187", "0.75184566", "0.73654395", "0.7346767", "0.7346767", "0.7323489", "0.72752434", "0.7250776", "0.7235224", "0.7227206", "0.7222244", "0.7208223", "0.719751", "0.71940434", "0.71724", "0.716746", "0.71540064", "0.71501386",...
0.0
-1
Sets the id of this Permission.
def id(self, id): if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.__id = id", "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\...
[ "0.7477681", "0.74697006", "0.74042314", "0.72403574", "0.71248585", "0.7110337", "0.71046674", "0.6993181", "0.6830333", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809871", "0.6809586", "0.6809586"...
0.0
-1
Sets the permission_type of this Permission.
def permission_type(self, permission_type): if self.local_vars_configuration.client_side_validation and permission_type is None: # noqa: E501 raise ValueError("Invalid value for `permission_type`, must not be `None`") # noqa: E501 allowed_values = ["Unknown", "AccessRights", "PublishRights...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(self, type):\n self._type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def membership_type(self, membership_type):\n\n self._membership_type = membership_type", "def permission(self, permission):\n\n ...
[ "0.6926698", "0.69166565", "0.69166565", "0.66899323", "0.6663167", "0.6663167", "0.65128064", "0.6360045", "0.6360045", "0.6360045", "0.6357107", "0.63422745", "0.63422745", "0.63378006", "0.63378006", "0.63378006", "0.63378006", "0.63378006", "0.63378006", "0.63378006", "0....
0.78733516
0
Sets the resource_type of this Permission.
def resource_type(self, resource_type): if self.local_vars_configuration.client_side_validation and resource_type is None: # noqa: E501 raise ValueError("Invalid value for `resource_type`, must not be `None`") # noqa: E501 allowed_values = ["Unknown", "File", "PeopleStageElement", "PeopleS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self, resource_type):\n\n self._resource_type = resource_type", "def resource_type(self, resource_type):\n\n self._resource_type = resource_type", "def resource_type(self, resource_type):\n\n self._resource_type = resource_type", "def resource_type(self, resource_type):...
[ "0.8392729", "0.8392729", "0.8392729", "0.8392729", "0.7130598", "0.7028627", "0.67594707", "0.66218334", "0.65561104", "0.65561104", "0.6479436", "0.64240164", "0.6240815", "0.6236265", "0.6231332", "0.6231332", "0.62219644", "0.62219644", "0.62219644", "0.62219644", "0.6221...
0.7107149
5
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Permission): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80886984", "0.80886984", "0.8055307", "0.7983415", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, Permission): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Gets the date_format of this TextDateAnnotationAllOf.
def date_format(self): return self._date_format
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_formats(self) -> localedata.LocaleDataDict:\n return self._data['date_formats']", "def datetime_formats(self) -> localedata.LocaleDataDict:\n return self._data['datetime_formats']", "def strfdate(self, fmt):\n pattern = r'%({})'.format(reduce(lambda x, y: '{}|{}'.format(x, y), FOR...
[ "0.67268175", "0.6045171", "0.5998679", "0.585201", "0.58288497", "0.5777592", "0.5723241", "0.5651489", "0.56252724", "0.5625171", "0.5585419", "0.5537072", "0.54956543", "0.5491222", "0.54838187", "0.54833716", "0.54657906", "0.5456581", "0.539794", "0.5381589", "0.53670484...
0.7592857
0
Return True if the graph g is strongly connected with vertices v. Return False otherwise.
def isSC(g, v): a = [False]*(v) # mark vertices not visited DFS(g, 0, a) # perform depth-first search if any(i == False for i in a): # see if we have visited all vertices return False gr = tranpose(g) # create a reversed (tranposed) graph. a = [False]*(v) # again, mark vertices ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_strongly_connected(G):\n if not G.is_directed():\n raise nx.NetworkXError(\"\"\"Not allowed for undirected graph G.\n See is_connected() for connectivity test.\"\"\")\n\n if len(G)==0:\n raise nx.NetworkXPointlessConcept(\n \"\"\"Connectivity is undefined for the ...
[ "0.6915168", "0.6774563", "0.6676239", "0.66653675", "0.6609251", "0.65960485", "0.6554186", "0.65451866", "0.6420272", "0.63737625", "0.63476247", "0.63472843", "0.6319721", "0.6315316", "0.6293272", "0.6277522", "0.6272848", "0.62577784", "0.6223724", "0.62018114", "0.61510...
0.7413836
0
Start time of the capture
def start_time(self) -> datetime: return self.root_hartree.start_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time(self):\n pass", "def start_time(self) -> float:\r\n ...", "def start_time(self):\n return self.__start", "def capture_start(self):\n pass", "def start_time(self):\n return self._start_time", "def start_time(self):\n return self._start_time", "def...
[ "0.7689823", "0.76747555", "0.73899543", "0.7356778", "0.72503877", "0.72503877", "0.72503877", "0.72503877", "0.72503877", "0.72503877", "0.72503877", "0.72503877", "0.7231546", "0.7199898", "0.7182459", "0.71774435", "0.7175954", "0.716142", "0.7151642", "0.71179044", "0.71...
0.6496418
79
String representation of the object.
def __repr__(self): return pformat(vars(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_string(self):\n return self.__repr__()", "def __str__(self):\n return str(self.serialize())", "def __str__(self):\n return str(self.__dict__['_obj'])", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "...
[ "0.83423275", "0.8339047", "0.8336227", "0.82525414", "0.82525414", "0.82525414", "0.82525414", "0.82525414", "0.8222602", "0.8200007", "0.8189974", "0.8178854", "0.8169206", "0.8169206", "0.81645656", "0.81572324", "0.81572324", "0.81572324", "0.81572324", "0.81572324", "0.8...
0.0
-1
Get the avgerage w2v embedding
def _get_emb(self, w2v): toks = tokenizer(self.opn.lower()) + tokenizer(self.asp.lower()) self.is_valid = len(toks) > 0 if not self.is_valid: return None embs = torch.stack([self._get_tok_emb(tok, w2v) for tok in toks], dim=0) return torch.mean(embs, dim=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_embedding(self):\n raise NotImplementedError(\"has to be overwritten\")", "def loadw2v(embfile, embsize, myzipfile=None, maxvoc=None):\n word_to_ix = {}\n word_to_ix[constants.PAD_ITEM] = 0\n word_to_ix[constants.UNK_ITEM] = 1\n # fill padding word with zeros\n model = [[0.]*e...
[ "0.64828616", "0.6355673", "0.6244414", "0.611821", "0.6068264", "0.60607207", "0.60412014", "0.6032032", "0.598846", "0.5948787", "0.59178853", "0.58323926", "0.5813899", "0.5788827", "0.57141304", "0.56617945", "0.56568575", "0.56429327", "0.5611083", "0.5476943", "0.547216...
0.6777541
0
Generate target file name.
def _get_target_name(self, n, k, att, pol, emb_dim): threshold = str(int(self.threshold * 10)) agg_name = "_{}_{}_{}_{}_{}_{}".format(n, k, att, pol, emb_dim, threshold) target_file = self.source_file[:-4] + agg_name + ".csv" return target_file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_name(product, ext='json'):\n return f\"./output/{product}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}_transformed_{version}.{ext}\"", "def create_filename (self):\n\t\tassert self.__patient_name and self.__location_name, \"New filename could not be determined, one or more needed arguments is empty!\...
[ "0.71602863", "0.711742", "0.7097988", "0.7018736", "0.7010822", "0.7002739", "0.6876224", "0.68743545", "0.6862436", "0.68469715", "0.6824495", "0.6786948", "0.67746854", "0.6769576", "0.6766668", "0.673292", "0.67244", "0.67222184", "0.67116123", "0.66945106", "0.66944754",...
0.69853437
6
function takes a list of strings creates a dictionary of bigrams with their counts as values and a dictionary of unigrams and their counts as values
def get_counts(data): bigrams = {} unigrams = {} #range is len-1 because the bigram uses ith+1 element data=list(data) for i in range(0, len(data)-1): #ith element and ith+1 element bigram=(data[i],data[i+1]) if(bigram in bigrams): count=bigrams[bigram] bigrams[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBigrams(wordlist, bigrams = {}, count = 0):\n\n\tif len(wordlist) == 0:\n\t\treturn bigrams, count\n\n\tfor i in range(len(wordlist) - 1):\n\t\tif bigrams.has_key(wordlist[i] + \" \" + wordlist[i + 1]):\n\t\t\tbigrams[wordlist[i] + \" \" + wordlist[i + 1]] += 1\n\t\telse:\n\t\t\tbigrams[wordlist[i] + \" \" ...
[ "0.7721288", "0.7556624", "0.7191888", "0.7184775", "0.7147738", "0.6930455", "0.6917897", "0.6894944", "0.68667", "0.6854226", "0.6837605", "0.6811413", "0.67373043", "0.67323124", "0.66666174", "0.66601306", "0.6635897", "0.6612936", "0.65898794", "0.6584541", "0.6544514", ...
0.77772415
0
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.76063275", "0.7448982", "0.7406428", "0.7281554", "0.72111535", "0.71669143", "0.7158234", "0.7146057", "0.7146057", "0.7146057", "0.7146057", "0.7146057", "0.7146057", "0.7132513", "0.710193", "0.70674044", "0.7065279", "0.70634556", "0.70634556", "0.70634556", "0.7063455...
0.7097878
23
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.7489828", "0.7288409", "0.7159824", "0.7154165", "0.7065367", "0.6984403", "0.69661975", "0.69546765", "0.6912145", "0.6832722", "0.68177325", "0.6809298", "0.6804907", "0.6804907", "0.6804907", "0.6804907", "0.6804907", "0.6804907", "0.67856276", "0.675751", "0.675751", ...
0.67549044
39
Sets the learning rate to the initial LR decayed by 0.2 every steep step
def adjust_learning_rate(epoch, opt, optimizer): steps = np.sum(epoch > np.asarray(opt.lr_decay_epochs)) if steps > 0: new_lr = opt.learning_rate * (opt.lr_decay_rate ** steps) for param_group in optimizer.param_groups: param_group['lr'] = new_lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self....
[ "0.79089975", "0.7855975", "0.7855975", "0.76759", "0.7554692", "0.7521177", "0.7498775", "0.7453499", "0.74243516", "0.74151623", "0.74016815", "0.7401177", "0.7384982", "0.73641056", "0.7327836", "0.7324489", "0.7313845", "0.7302488", "0.72984177", "0.7262473", "0.725475", ...
0.0
-1
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8330746", "0.8284342", "0.823773", "0.8229572", "0.82199436", "0.81861925", "0.81845963", "0.81748337", "0.8171267", "0.81697196", "0.81662124", "0.81641984", "0.8163521", "0.81619215", "0.81619215", "0.81619215", "0.81619215", "0.81619215", "0.81619215", "0.81619215", "0....
0.7846725
90
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7642627", "0.7417984", "0.7417116", "0.72703016", "0.7245068", "0.7244174", "0.72359973", "0.7221287", "0.72093123", "0.70574844", "0.68535876", "0.6785699", "0.6785369", "0.6770165", "0.6727407", "0.67198336", "0.67198336", "0.67198336", "0.67198336", "0.67198336", "0.671...
0.0
-1
Return the boolean response if the node is on.
def is_on(self): return bool(self._insteon_device_group.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return bool(self.arest.data.get('state'))", "def is_on(self):\n return bool(getattr(self.resource, self.variable))", "def is_on(self):\n request = requests.get(self._resource+\"/state\", timeout=10)\n \n try:\n if int(float(request.text)) > 0:\n ...
[ "0.72769415", "0.69706124", "0.69539726", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.68100405", "0.67907774", "0.67648447", "0.67610705", "0.67610705", "0.67610705", "0.6745256",...
0.0
-1
create and move YAML file to the export repository
def create_yaml(response, file): output_file = open(file, "w") dest_file = os.path.join(export_path, file) yaml.dump(response, output_file, default_flow_style=False, allow_unicode=True) if os.path.exists(dest_file): os.remove(dest_file) shutil.move(file, export_path) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_dump(self):\n dumpdir = self._dump_dirname\n if not os.path.isdir(dumpdir):\n os.makedirs(dumpdir)\n\n dump = False\n yaml_filename = self._yaml_filename\n\n if not os.path.isfile(yaml_filename):\n dump = True\n else:\n with open(...
[ "0.6288186", "0.6249913", "0.62333703", "0.61922216", "0.61852723", "0.6141159", "0.6062473", "0.60248685", "0.6014824", "0.5972707", "0.5954981", "0.5945015", "0.5905807", "0.59032726", "0.58566165", "0.58437693", "0.578314", "0.5772876", "0.5771202", "0.5743185", "0.5742891...
0.6823638
0
Remove the association with a member.
def disassociate(self, community, member): if __debug__: from community import Community assert isinstance(community, Community) assert isinstance(member, Member) self._associations.remove((community.cid, member))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_member(self, member):\r\n return self.delete(self.member_path % (member))", "def remove_member(self, member_to_remove):\r\n self._members.remove(member_to_remove)", "def remove_member(self, persona):\n if persona in self.members:\n self.members.remove(persona)", "de...
[ "0.75541234", "0.73814577", "0.7123647", "0.6968422", "0.6926451", "0.6906316", "0.67304605", "0.6708905", "0.6666156", "0.6665265", "0.66034174", "0.65343213", "0.6527884", "0.6515461", "0.6404298", "0.6393606", "0.6346781", "0.63461375", "0.63157684", "0.62912846", "0.62564...
0.7613311
0
Returns True if any of the associated communities are still active. This is used when deciding if this candidate can be used for communication, the assumption is that if any community is still active, that all will still be active. The exception to this rule is when a node decides to leave one or more communities while...
def is_any_active(self, now): if self._timestamps: return now <= max(timestamps.last_active for timestamps in self._timestamps.itervalues()) + CANDIDATE_INACTIVE return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_active(self) -> bool:\n return not any((self.is_ancillary, self.is_removed, self.is_system))", "def is_active(self) -> bool:\n return any(x is not None for x in self._constraints)", "def is_community(self):\n context = aq_inner(self.context)\n for obj in aq_chain(context):\n ...
[ "0.66526544", "0.64718455", "0.646834", "0.62206805", "0.621995", "0.6200346", "0.6124982", "0.6102073", "0.6067873", "0.6005343", "0.59736866", "0.58627695", "0.58206344", "0.57805175", "0.57650787", "0.5758289", "0.5723861", "0.5710154", "0.5710154", "0.5707551", "0.5707511...
0.56002975
30
Finds the densest window of size w_nrows by w_ncols.
def find_densest(m, w_ncols, w_nrows): # Implement your solution here. pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dwindow(window):\r\n \r\n h=window\r\n nh=len(h)\r\n lh=(nh-1)/2\r\n stepheight=(h[0]+h[-1])/2.\r\n ramp=float((h[-1]-h[0]))/nh\r\n h2=np.zeros(nh+2)\r\n h2[1:nh+1]=h-stepheight-ramp*np.arange(start=-lh,stop=lh+1,step=1)\r\n \r\n dwin=(h2[2:nh+2]-h2[0:nh])/2.+ramp\r\n dwin[0]=d...
[ "0.58731085", "0.57987773", "0.57116", "0.56407976", "0.559432", "0.55354124", "0.54044235", "0.53994685", "0.5340274", "0.53117836", "0.52654916", "0.52533376", "0.522019", "0.52149177", "0.51716256", "0.511105", "0.5091993", "0.50787735", "0.50764143", "0.50761384", "0.5070...
0.7347287
0
Instantiate tokenizers that vectorize the text corpus, by turning the text into either a sequence token indices (position in token dictionary). The flag '' was added to word index and used to replace outofvocabulary (oov) words input tokenize instantiate tokenizers for utterance, their IOB tags and the intent labels
def create_train_utterance_tokenizer(data): data.seq_in_tokenizer = Tokenizer( filters="", oov_token="<unk>", split=data.arg.split ) # open training data file input_file_path = os.path.join(data.full_train_path, data.arg.input_file) with open(input_file_path, encoding=data.arg.encode_mode) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_inputs(token_mapping, w2v_W, w2v_U, sentences):\n tokens = [tokenize(token_mapping, sentence) for sentence in sentences] \n \n depth = len(token_mapping)\n one_hot_tokens = []\n for sentence in tokens:\n one_hot_sentence = []\n for i, token in enumerate(sentence):\n ...
[ "0.6495153", "0.6456038", "0.6456038", "0.6441285", "0.6416258", "0.6389787", "0.63812387", "0.63453615", "0.63438255", "0.63331145", "0.6323453", "0.63190955", "0.6314779", "0.62983966", "0.628261", "0.62533635", "0.6233471", "0.6230803", "0.6213758", "0.6202503", "0.6177903...
0.0
-1
Instantiate tokenizers that vectorize the text corpus, by turning the text into either a sequence token indices (position in token dictionary) or into a vector where the coefficient for each token could be binary, based on word count, based on tfidf token are splitted by spaces ' ' and the flak '' was added to word ind...
def create_train_slots_tokenizer(data): data.seq_out_tokenizer = Tokenizer( filters="", split=data.arg.split, oov_token="<unk>" ) # open training data file input_file_path = os.path.join(data.full_train_path, data.arg.input_file) with open(input_file_path, encoding=data.arg.encode_mode) as ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n tokens=word_tokenize(text)\n lemmatizer=WordNetLemmatizer()\n \n clean_tokens=[]\n for tok in tokens:\n clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n clean_tokens.append(clean_tok)\n return clean_tokens\n pass", "def tokenize(text):\n \n te...
[ "0.67361695", "0.66994274", "0.6696903", "0.6696903", "0.6679995", "0.6662851", "0.66434646", "0.6622006", "0.6619217", "0.6594788", "0.6593422", "0.6566618", "0.65595216", "0.6549805", "0.65485066", "0.65442896", "0.65356", "0.65219915", "0.65114003", "0.6506697", "0.6495878...
0.0
-1
Instantiate tokenizers that vectorize the text corpus, by turning the text into either a sequence token indices (position in token dictionary) or into a vector where the coefficient for each token could be binary, based on word count, based on tfidf token are splitted by spaces ' ' and the flak '' was added to word ind...
def create_train_label_tokenizer(data): data.label_tokenizer = Tokenizer( filters="", split=data.arg.split, oov_token="<unk>" ) # open training data file input_file_path = os.path.join(data.full_train_path, data.arg.input_file) with open(input_file_path, encoding=data.arg.encode_mode) as fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n tokens=word_tokenize(text)\n lemmatizer=WordNetLemmatizer()\n \n clean_tokens=[]\n for tok in tokens:\n clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n clean_tokens.append(clean_tok)\n return clean_tokens\n pass", "def tokenize(text):\n \n te...
[ "0.6733505", "0.66968155", "0.66943693", "0.66943693", "0.66783136", "0.666011", "0.66411155", "0.6619489", "0.6618478", "0.6592164", "0.65907335", "0.6563857", "0.6556833", "0.6547363", "0.6545728", "0.65422", "0.6536451", "0.65191436", "0.6508636", "0.6503927", "0.6494075",...
0.0
-1
Instantiate tokenizers that vectorize the text corpus, by turning the text into either a sequence token indices (position in token dictionary) or into a vector where the coefficient for each token could be binary, based on word count, based on tfidf token are splitted by spaces ' ' and the flak '' was added to word ind...
def create_predict_utterance_tokenizer(data): data.seq_in_tokenizer = Tokenizer( filters="", oov_token="<unk>", split=data.arg.split ) # open training data file infer_file = os.path.join(data.full_infer_path, data.arg.input_file) with open(infer_file, encoding=data.arg.encode_mode) as fin: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n tokens=word_tokenize(text)\n lemmatizer=WordNetLemmatizer()\n \n clean_tokens=[]\n for tok in tokens:\n clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n clean_tokens.append(clean_tok)\n return clean_tokens\n pass", "def tokenize(text):\n \n te...
[ "0.67342174", "0.6697216", "0.66947156", "0.66947156", "0.6679146", "0.66610974", "0.66410685", "0.66202104", "0.66192013", "0.65928143", "0.65916014", "0.65647876", "0.655771", "0.65479237", "0.65466416", "0.65420324", "0.6537973", "0.6520104", "0.65096", "0.65046746", "0.64...
0.0
-1
Sets minimum edge count per node in the graph (default 1)
def set_min_edges(self, edges): self.min_edges = edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_num_nodes_from(edgelist):\n return np.max(edgelist) + 1", "def min_node_count(self) -> int:\n return pulumi.get(self, \"min_node_count\")", "def min_fill_node(g):\r\n return min( g.nodes(),key = lambda x:fill_edges(g,x) )", "def node_count(self, node_count):\n\n self._node_count...
[ "0.69741255", "0.67236376", "0.63361996", "0.62038386", "0.6180363", "0.6139218", "0.60454965", "0.6023457", "0.6022614", "0.6017935", "0.5997239", "0.59827787", "0.59593093", "0.59503376", "0.58902293", "0.58702856", "0.5855053", "0.5809543", "0.5730581", "0.5714872", "0.571...
0.73011297
0
Sets maximum edge count per node in the graph (default 3)
def set_max_edges(self, edges): self.max_edges = edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def control_edge_count_max(self) -> int:\n return int(self.graph_tuple_stats.control_edge_count_max or 0)", "def edge_count_max(self) -> int:\n return int(self.graph_tuple_stats.edge_count_max or 0)", "def node_count_max(self) -> int:\n return int(self.graph_tuple_stats.node_count_max or 0)", "def g...
[ "0.73967844", "0.7117065", "0.69219285", "0.6872858", "0.6856172", "0.67671895", "0.6529442", "0.6512895", "0.6387753", "0.63379467", "0.6305709", "0.6277957", "0.6266501", "0.62648016", "0.62630135", "0.6258248", "0.6234936", "0.6233327", "0.6231646", "0.6120529", "0.6104573...
0.72329956
1
Sets maximum edge count per node in the graph (default 20)
def set_treasure_count(self, treasures): self.treasure_count = treasures
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_edges(self, edges):\n self.max_edges = edges", "def control_edge_count_max(self) -> int:\n return int(self.graph_tuple_stats.control_edge_count_max or 0)", "def edge_count_max(self) -> int:\n return int(self.graph_tuple_stats.edge_count_max or 0)", "def node_count_max(self) -> int:\n...
[ "0.7621593", "0.73919356", "0.7181384", "0.6942645", "0.6896142", "0.6760413", "0.67601323", "0.6628556", "0.6596878", "0.6592386", "0.6531753", "0.64810133", "0.63785255", "0.6332413", "0.63015467", "0.62764424", "0.6275405", "0.6266777", "0.6258416", "0.6248587", "0.6169727...
0.0
-1
Find last parent using formula last_parent=(index 1)//2, where index=len(array). Then after last_parent, all the consecutive number in the array will be leaf nodes. So, (last_parent + 1) is our first leaf node. Hence, simply traverse the array starting from first leaf node to end of an array to get MIN
def find_min_in_max_heap(self): min_number = None last_parent = (self.size - 1) // 2 first_leaf = last_parent + 1 # Shortcut to find first_leaf: # (self.size - 1) //2 + 1 = (self.size + 1) // 2 # But for simplicity, we will use variable first_leaf in steps for i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _findMin(root, parent):\n\n # we use an ugly trick: the parent node is passed in as an argument\n # so that eventually when the leftmost child is reached, the \n # call can return both the parent to the successor and the successor\n\n if root.left:\n return _findMin(root.left, root)\n els...
[ "0.7003251", "0.6798231", "0.66105044", "0.6273762", "0.62532014", "0.6190462", "0.61890286", "0.61822313", "0.60967267", "0.6052176", "0.6035083", "0.60298634", "0.5990767", "0.59396946", "0.5927586", "0.59215415", "0.59148586", "0.58915865", "0.5878223", "0.58660996", "0.58...
0.580002
28
Shows homepage with list of available pets.
def show_homepage(): pets = Pet.query.all() rando_pet = get_info_random_pet() name = rando_pet['petfinder']['pet']['name']['$t'] age = rando_pet['petfinder']['pet']['age']['$t'] image = rando_pet['petfinder']['pet']['media']['photos']['photo'][0]['$t'] return render_template('homepage.html', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_home_page():\n\n pet_list = Pet.query.all()\n return render_template('index.html', pet_list=pet_list)", "def home():\n pets = Pets.query.all()\n return render_template('home.html', pets=pets)", "def home():\n pets = Pet.query.order_by(desc('id')).all()\n return render_template('home....
[ "0.7736524", "0.7662108", "0.6913914", "0.6790103", "0.6540624", "0.65121984", "0.64982915", "0.6404737", "0.6378614", "0.6337327", "0.6312125", "0.6268142", "0.6242273", "0.6200499", "0.61997515", "0.6199029", "0.6193546", "0.617541", "0.6158051", "0.61571157", "0.61538744",...
0.7534235
2
Compare two lists and get percent of they matches.
def calculate_accuracy(actual_list, predicted_list): valid_part_len = sum(i == j for i, j in zip(actual_list, predicted_list)) return (100.0 / len(actual_list)) * valid_part_len
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_lists(l1, l2):\n score = 0\n total = len(l1)\n weight = 110\n\n for item in range(len(l2)):\n if item in range(len(l1)):\n score += math.log(weight/total) * (weight)\n else:\n score += math.log(0.5/total) * (1)\n weight -= 10\n return score", ...
[ "0.72589564", "0.70430297", "0.70412517", "0.69926983", "0.6971838", "0.6916602", "0.68256336", "0.6801933", "0.66741973", "0.666804", "0.65389776", "0.6500704", "0.64981174", "0.6457331", "0.64472735", "0.6436", "0.6347122", "0.6343804", "0.63382417", "0.62792635", "0.625077...
0.63589644
16
Returns the UTF8 encoded canonical JSON representation of _signed.
def canonical(_signed: Json) -> bytes: return encode_canonical(_signed).encode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_bytes_signed_canonical(request) -> bytes:\n return get_test_data(request, __name__, \"config_signed_canonical.json\")", "def signed(self, encoded):\n signature = self.sign(encoded)\n return encoded + signature", "def raw(self) -> bytes:\n return bytes(self._signing_key)", "de...
[ "0.70332706", "0.65825224", "0.640644", "0.6244425", "0.61013544", "0.60873574", "0.6033142", "0.6021747", "0.6002308", "0.5918726", "0.5903427", "0.5890493", "0.5882765", "0.5852054", "0.58246374", "0.5785805", "0.57636935", "0.57496685", "0.5747822", "0.57474756", "0.574307...
0.868238
0
sample from a normal distribution
def sample(args): mu = args[0] log_sigma = args[1] noise = tf.random_normal(tf.shape(mu), 0, 1, dtype=tf.float32) z = mu + tf.exp(log_sigma/2.0) * noise return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_sample(mu, sigma):\n return mu + sigma * torch.randn_like(sigma)", "def random_normal():\r\n return inverse_normal_cdf(random.random())", "def random_normal():\n return inverse_normal_cdf(random.random())", "def _sampling_normal(self, args):\n z_mean, z_log_var = args\n retu...
[ "0.81640226", "0.7827157", "0.7723825", "0.7581095", "0.7581095", "0.7581095", "0.7581095", "0.7581095", "0.7543352", "0.7512658", "0.745575", "0.7404053", "0.72788954", "0.71652067", "0.7156522", "0.6965056", "0.6919898", "0.68881375", "0.6841446", "0.6783916", "0.6755791", ...
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): ctx.save_for_backward(input) # save input for backward pass # get lists of odd and even indices output = torch.ones_like(input) return output
{ "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.6953969", "0.69059783", "0.68103176", "0.6703455", "0.66886437", "0.6685371", "0.66599965", "0.65301317", "0.6529663", "0.65086865", "0.64699554", "0.6463273", "0.6463273", "0.64293873", "0.6387083", "0.6381638", "0.6370769", "0.6352236", "0.6346914", "0.63464415", "0.6321...
0.6454891
13
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): grad_input = None # set output to None input, = ctx.saved_tensors if ctx.needs_input_grad[0]: grad_input = input.clone() 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.8172036", "0.81505144", "0.79408896", "0.7932234", "0.79078716", "0.7903513", "0.78944093", "0.78629696", "0.7846937", "0.7827091", "0.7808059", "0.7789327", "0.77884394", "0.77742475", "0.77742475", "0.77543044", "0.7692092", "0.76756346", "0.76756346", "0.76484555", "0.7...
0.76972336
16
Get all leaf nodes
def get_leaf_nodes(self): leaf_nodes = [] for i in range(8): node = self.children[i] if node: if node.is_leaf(): leaf_nodes.append(node) else: leaf_nodes.extend(node.get_leaf_nodes()) return leaf_node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leaf_nodes(self):\n pass", "def leaf_nodes(self):\n return self.nodes.filter(lft=models.F('rght') - 1)", "def get_leafs(self) -> list:\n return self._leafs[:]", "def leaf_nodes(self):\n deps = set([\n item for sublist in self.edges.values() for item in sublist\n...
[ "0.8320265", "0.8287696", "0.79202545", "0.7683134", "0.75183856", "0.75067097", "0.7417917", "0.7327079", "0.7243139", "0.7241964", "0.7203362", "0.72021055", "0.71866137", "0.71277624", "0.71045333", "0.7087495", "0.7061689", "0.7058987", "0.7001071", "0.6960377", "0.695771...
0.7887873
3
Make color palette with `color_count` colors maximum
def make_palette(self, color_count): palette = [] palette_index = 0 leaf_count = len(self.get_leaves()) # reduce nodes # up to 8 leaves can be reduced here and the palette will have # only 248 colors (in worst case) instead of expected 256 colors for level in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(color_map, count):\n cols = plt.get_cmap(color_map, count + 1) # +1 to prevent wrapping, where col 0 is same as col -1\n cols = cols(range(count + 1)).tolist() # Create a list of colours\n return cols[:-1] # Remove overlapping colour and return", "def create_funky_cmap(n_colors):\n\n ...
[ "0.681443", "0.65821284", "0.63259506", "0.6216431", "0.6154877", "0.61538297", "0.6116537", "0.60914946", "0.6050158", "0.6023257", "0.6021494", "0.5991524", "0.59821874", "0.59661806", "0.59421015", "0.5903062", "0.5876187", "0.5862229", "0.5847804", "0.58335364", "0.583353...
0.70856875
0
Get palette index for `color`
def get_palette_index(self, color): return self.root.get_palette_index(color, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_palette_index(self, color, level):\n if self.is_leaf():\n return self.palette_index\n index = self.get_color_index_for_level(color, level)\n if self.children[index]:\n return self.children[index].get_palette_index(color, level + 1)\n else:\n # ge...
[ "0.7716852", "0.7375665", "0.70309967", "0.70033854", "0.66762996", "0.66553915", "0.66330177", "0.6461048", "0.6455848", "0.64265686", "0.6402053", "0.6355789", "0.625179", "0.62506115", "0.62446195", "0.624183", "0.6217734", "0.6123886", "0.6083354", "0.6083354", "0.6083354...
0.9002415
0
Construct a logitnormal distribution. The LogitNormal distribution models random variables between 0 and 1 whose logit (i.e., sigmoid_inverse, i.e., `log(p) log1p(p)`) is normally distributed with mean `loc` and standard deviation `scale`. It is constructed as the sigmoid transformation, (i.e., `1 / (1 + exp(x))`) of a...
def __init__(self, loc, scale, num_probit_terms_approx=2, gauss_hermite_scale_limit=None, gauss_hermite_degree=20, validate_args=False, allow_nan_stats=True, name='LogitNormal'): parameters = dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_scale_log_normal(mean_scale, one_sigma_at_scale):\n\n log_sigma = math.log(one_sigma_at_scale)\n return mean_scale*math.exp(random.normalvariate(0.0, log_sigma))", "def lognormal(mu, hw, x): \n return np.exp(-( np.log(x/mu) / (0.01*hw) )**2)", "def logit_normal_mean_gh(loc, scale, deg):\n ...
[ "0.6666014", "0.6419678", "0.6389511", "0.63780326", "0.6329202", "0.63165087", "0.62779", "0.625409", "0.60836244", "0.605162", "0.5979313", "0.5979313", "0.5979313", "0.5979313", "0.5957147", "0.5923656", "0.5923656", "0.59163284", "0.59088606", "0.5885344", "0.58660614", ...
0.7102822
0
Distribution parameter for the pretransformed mean.
def loc(self): return self.distribution.loc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prior_distribution(self):\n out = self.model.forward(self.inducing_points)\n return MultivariateNormal(out.mean, out.lazy_covariance_matrix.evaluate_kernel())", "def mean(self):\n return self.mu", "def gaussian_prior(self):\n self.prior = sps.multivariate_normal(self.m0,self.S0)...
[ "0.70197463", "0.6558482", "0.65151334", "0.6486658", "0.6482913", "0.6450676", "0.64118123", "0.6361286", "0.629559", "0.62954944", "0.628191", "0.6272269", "0.62604165", "0.62604165", "0.62604165", "0.62604165", "0.62604165", "0.623648", "0.62289083", "0.62015194", "0.62009...
0.0
-1