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
Computes the forward pass for a layer of rectified linear units (ReLUs).
def relu_forward(x): out = None ########################################################################### # TODO: Implement the ReLU forward pass. # ########################################################################### out = x.copy() out[x<=0] = 0 ###...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ...
[ "0.6776496", "0.6630567", "0.66034645", "0.6524613", "0.65097547", "0.64478225", "0.63858074", "0.62696755", "0.620592", "0.6181689", "0.61548615", "0.6139935", "0.6056323", "0.6049887", "0.60487914", "0.60198", "0.5997235", "0.59914005", "0.59708583", "0.59648687", "0.595074...
0.6063423
12
Computes the backward pass for a layer of rectified linear units (ReLUs).
def relu_backward(dout, cache): dx, x = None, cache ########################################################################### # TODO: Implement the ReLU backward pass. # ########################################################################### dx = dout.copy() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################...
[ "0.70412636", "0.694716", "0.6897693", "0.6847592", "0.6847592", "0.6846935", "0.6841099", "0.68178034", "0.6766849", "0.6754919", "0.67536426", "0.67530656", "0.67419785", "0.6713423", "0.6708748", "0.6699276", "0.6696307", "0.6696307", "0.66860896", "0.6665928", "0.6665928"...
0.6739244
13
Forward pass for batch normalization. During training the sample mean and (uncorrected) sample variance are computed from minibatch statistics and used to normalize the incoming data. During training we also keep an exponentially decaying running mean of the mean and variance of each feature, and these averages are use...
def batchnorm_forward(x, gamma, beta, bn_param): mode = bn_param['mode'] eps = bn_param.get('eps', 1e-5) momentum = bn_param.get('momentum', 0.9) Xshape = x.shape if len(Xshape) > 2: #deal with 2d inputs N,C,H,W = x.shape x = np.swapaxes(x,1,3) D = C x = np.reshape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_...
[ "0.7338873", "0.70185083", "0.69407904", "0.69350904", "0.69315374", "0.68895227", "0.68717885", "0.6847517", "0.6767817", "0.6715243", "0.6704498", "0.6646542", "0.6600791", "0.659915", "0.6578266", "0.65171987", "0.65148103", "0.6461142", "0.6452949", "0.6411437", "0.638789...
0.6756687
9
A naive implementation of the forward pass for a maxpooling layer.
def max_pool_forward(x, pool_param): out = None ########################################################################### # TODO: Implement the max-pooling forward pass # ########################################################################### (N, C, H, W) = x.shape ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pool_forward_naive(x, pool_param):\n out = None\n ###########################################################################\n # TODO: Implement the max pooling forward pass #\n ###########################################################################\n N,C,H,W ...
[ "0.7848364", "0.7747396", "0.7589175", "0.7583903", "0.75477105", "0.7419348", "0.7406021", "0.73784006", "0.73185766", "0.7133479", "0.7100079", "0.7076823", "0.69906706", "0.6926053", "0.6922141", "0.687887", "0.6813063", "0.68046343", "0.679283", "0.679283", "0.67856866", ...
0.7224327
9
Soft undelete all objects included in this queryset.
def undelete(self): objects = self.filter(deleted__isnull=False) if objects.count(): LOGGER.debug( 'Soft undeleting %s objects: %s', self.model.__name__, ', '.join(str(pk) for pk in objects.values_list('pk', flat=True))) o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n for obj in self:\n _unset_related_objects_relations(obj)\n\n self.update(deleted=now())", "def _purge(self):\n for _ in self.all():\n self.delete(_)", "def undelete(self):\n if self.deleted is not None:\n LOGGER.debug('Soft-undele...
[ "0.7775583", "0.7648506", "0.75364727", "0.70050657", "0.70050657", "0.69240206", "0.6891578", "0.68431973", "0.66635644", "0.6452652", "0.64517033", "0.64481574", "0.64269197", "0.64024746", "0.640173", "0.6346941", "0.6341191", "0.6325436", "0.6316071", "0.6282519", "0.6269...
0.8562543
0
Undelete this softdeleted object.
def undelete(self): if self.deleted is not None: LOGGER.debug('Soft-undeleting object %s %s', self._meta.model.__name__, self.pk) self.deleted = None self.save() return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undelete(self):\n objects = self.filter(deleted__isnull=False)\n if objects.count():\n LOGGER.debug(\n 'Soft undeleting %s objects: %s', self.model.__name__,\n ', '.join(str(pk)\n for pk in objects.values_list('pk', flat=True)))\n ...
[ "0.78353626", "0.7044692", "0.6946034", "0.6711948", "0.6290562", "0.6212208", "0.61986816", "0.6167826", "0.6163988", "0.6161209", "0.61515373", "0.612617", "0.612287", "0.612287", "0.612287", "0.612287", "0.612287", "0.612287", "0.612287", "0.612287", "0.612287", "0.61228...
0.88690126
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, title='Confusion matrix', cmap=plt.cm.Blues): cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title, fontsize=30) plt.colorbar() tick_mark...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Retrieves an article instance by slug
def fetch(cls, slug): try: article = Article.objects.get(slug=slug) except Article.DoesNotExist: raise exceptions.NotFound(f'Article of slug {slug} nonexistent') else: return article
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch(cls, slug):\n try:\n article = Article.objects.get(slug=slug)\n except Article.DoesNotExist:\n raise exceptions.NotFound(f'Article with slug {slug} nonexistent')\n else:\n return article", "def get_article(self, slug):\n\t\tarticle = Blog.objects.ge...
[ "0.85958314", "0.8506934", "0.8110329", "0.79361844", "0.78539926", "0.76428974", "0.71877354", "0.709687", "0.70077795", "0.6740493", "0.6717442", "0.66809005", "0.6593266", "0.6559878", "0.6551789", "0.65463233", "0.6518413", "0.6484419", "0.64334583", "0.6341164", "0.63099...
0.85910726
1
Retrieves all comments associated with an article
def get(self, request, slug): article = ArticleInst.fetch(slug) comments = Comment.objects.filter(article=article) serializer = self.serializer_class(comments, many=True) response = {'data': serializer.data} response.update( {'comments count': comments.count()} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_comments_by_article(api: NytApi, article_url: str, article_id: Optional[str] = None, pagination_size: int = 100) -> List[Dict]:\n\n comments = fetch_top_level_comments(api, article_url, pagination_size=pagination_size)\n fetch_replies(api, article_url, comments, pagination_size=pagination_size)\n\n...
[ "0.8050328", "0.732948", "0.73149073", "0.6835663", "0.6629535", "0.65066797", "0.6407542", "0.6355919", "0.6319557", "0.6241318", "0.62000376", "0.6161543", "0.6161491", "0.61549735", "0.61095816", "0.6074199", "0.60129213", "0.59445703", "0.59358597", "0.59356374", "0.59193...
0.6543755
5
Queries for an existing comment object
def check_comment(cls, key, article): try: comment = Comment.objects.get(pk=key, article=article) except Comment.DoesNotExist: raise exceptions.NotFound(f'Comment of ID {key} nonexistent') return comment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_comment(self, comment_id, **args):\n return self.fetch(\"/comment/\" + comment_id, **args)", "def get_comment(self, object_id):\n return self.get_object(\"comment\", object_id)", "def get_object(self, id):\n try:\n return Comment.objects.get(id=id)\n except Comm...
[ "0.6801074", "0.67693067", "0.6702177", "0.6696655", "0.66105837", "0.65742934", "0.6515823", "0.64759314", "0.6462417", "0.6450817", "0.64109236", "0.6364227", "0.6363132", "0.63257164", "0.6319082", "0.6303914", "0.62870663", "0.62663925", "0.62433016", "0.6201057", "0.6164...
0.6270821
17
Posts a reply to a comment
def post(self, request, slug, id): article = ArticleInst.fetch(slug) comment = request.data.get('comment', {}) posted_comment = CommentAPIView.check_comment( id, article) serializer = self.serializer_class(data=comment) serializer.is_valid(raise_exception=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_reply(self, comment):\n\t\tpass", "def cmd_comment_reply(client, args):\n comment_reply = client.post_comment_reply(args.comment_id, args.image_id,\n args.comment)\n generate_output({'comment_reply': comment_reply})", "def post_reply(request, pk=None)...
[ "0.8557212", "0.80830026", "0.7464502", "0.7454756", "0.73025185", "0.70379573", "0.6953753", "0.69517976", "0.69267356", "0.6920172", "0.6898812", "0.685946", "0.68350935", "0.67654383", "0.67534816", "0.67506546", "0.670308", "0.66353905", "0.66115403", "0.6559514", "0.6551...
0.6990167
6
Updates a reply to a comment
def update(self, request, slug, id, key): article = ArticleInst.fetch(slug) updated_reply = request.data.get('comment', {}) parent = CommentAPIView.check_comment(id, article) comment = self.get_reply(parent=parent, child=key) similar_comment = CommentReply.objects.filter( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_reply(name, title, reply_id):\n reply = reply_service.get_reply(reply_id)\n if reply:\n if reply.user_id != current_user.id:\n return redirect(url_for(\"post.post\", name=name, title=title))\n form = ReplyForm()\n if form.validate_on_submit():\n reply_ser...
[ "0.7375476", "0.7176409", "0.7150972", "0.6933991", "0.6819595", "0.68132824", "0.6738296", "0.6662346", "0.6409086", "0.64086366", "0.6390998", "0.6361553", "0.6337784", "0.6322883", "0.63135684", "0.6293877", "0.6291488", "0.6286815", "0.6283177", "0.62692153", "0.62605363"...
0.7180171
1
Queries for a reply to a comment using the reply's primary key and the comment foreign key
def get_reply(self, parent, child): try: reply = CommentReply.objects.get( pk=child, comment_to=parent) except CommentReply.DoesNotExist: raise exceptions.NotFound( f'Comment reply of ID {child} nonexistent' ) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answerComment(r, comment, answeredDB, helper):\n\n cards, answer = helper.parseText(comment.body)\n\n if cards and answer and not answeredDB.exists(comment.parent_id, cards):\n # reply to comment\n log.info(\"replying to comment: %s %s with %s\",\n comment.id, comment.author....
[ "0.68092936", "0.65351033", "0.64578533", "0.6399497", "0.6314453", "0.6314005", "0.62689596", "0.6100489", "0.6052141", "0.6008324", "0.600773", "0.5981933", "0.5968596", "0.5807133", "0.5802016", "0.57956845", "0.57856786", "0.5744666", "0.5736091", "0.57186806", "0.5715331...
0.74181384
0
Return the absolute path to the specified binary.
def Which(binary, path=None): if path is None: path = os.environ.get('PATH', '') for p in path.split(':'): p = os.path.join(p, binary) if os.access(p, os.X_OK): return p return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_binary():\n file_location = prompt_base(\"where is the file located?\")\n file_location = os.path.abspath(file_location)\n return file_location", "def binary_location(cmd, USE_PATH=False):\n return os.path.join(BIN_PREFIX, cmd)", "def getBinary():\n binary = shutil.which(_ROCKETLO...
[ "0.7471814", "0.744936", "0.73367304", "0.73123205", "0.72481656", "0.7173063", "0.7107043", "0.7100915", "0.707256", "0.70329857", "0.70031244", "0.6961139", "0.6915897", "0.6886918", "0.6846617", "0.6817588", "0.6805108", "0.6657711", "0.66264236", "0.6605834", "0.65735793"...
0.6856968
14
Look for a relative path, ascending through parent directories. Ascend through parent directories of current path looking for a relative
def FindInPathParents(path_to_find, start_path, test_func=None): if test_func is None: test_func = os.path.exists for path in IteratePathParents(start_path): target = os.path.join(path, path_to_find) if test_func(target): return target return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_to_rel_location(directory_to_find):\n path = Path.cwd()\n num_tries = 5\n for num_up_folder in range(num_tries):\n path = path.parent\n if path / directory_to_find in path.iterdir():\n break\n\n if num_tries == num_up_folder:\n raise FileNotFoundError(f\"The...
[ "0.70760447", "0.69693434", "0.6941556", "0.69349515", "0.6843399", "0.68156123", "0.6702668", "0.66005063", "0.65006596", "0.6353335", "0.6341714", "0.6304848", "0.63002527", "0.62443334", "0.61926556", "0.61466026", "0.60806197", "0.6076745", "0.60734797", "0.6072998", "0.6...
0.66023016
7
Generate a tempdir, modifying the object, and env to use it. Specifically, if update_env is True, then from this invocation forward, python and all subprocesses will use this location for their tempdir. The matching _TempDirTearDown restores the env to what it was.
def _TempDirSetup(self, prefix='tmp', update_env=True, base_dir=None): # Stash the old tempdir that was used so we can # switch it back on the way out. self.tempdir = tempfile.mkdtemp(prefix=prefix, dir=base_dir) os.chmod(self.tempdir, 0o700) if update_env: with tempfile._once_lock: self._tempdir_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.prevdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp()\n os.chdir(self.tempdir)\n return self.tempdir\n\n def __exit__(self, *a, **kwa):\n os.chdir(self.prevdir)\n ...
[ "0.65600824", "0.6517266", "0.64446086", "0.6426027", "0.6386173", "0.6364851", "0.6364851", "0.6326897", "0.63160133", "0.6303309", "0.62600225", "0.6233043", "0.620513", "0.620513", "0.6190408", "0.61745065", "0.61622757", "0.61618954", "0.6155542", "0.6130545", "0.61290205...
0.7734488
0
ContextManager constraining all tempfile/TMPDIR activity to a tempdir
def TempDirContextManager(prefix='tmp', base_dir=None, storage=None, sudo_rm=False): if storage is None: # Fake up a mutable object. # TOOD(build): rebase this to EasyAttr from cros_test_lib once it moves # to an importable location. class foon(object): pass storage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secure_temp_dir(context):\n tmpd = tempfile.TemporaryDirectory()\n context.tempdir = tmpd", "def _get_directory_context_manager(outdir):\n if outdir:\n return contextlib.nullcontext(outdir)\n else:\n return tempfile.TemporaryDirectory()", "def tempdir():\n\n class ctx(object):\...
[ "0.75509894", "0.72421664", "0.70320386", "0.6814566", "0.68072873", "0.6758299", "0.67368346", "0.6729706", "0.667541", "0.6672724", "0.6617201", "0.6547067", "0.65365887", "0.651003", "0.6509396", "0.6503801", "0.64694476", "0.6462623", "0.6427541", "0.64224917", "0.6421086...
0.7161609
2
Restore the environment variables to that of passed in dictionary.
def SetEnvironment(env): os.environ.clear() os.environ.update(env)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_env():\n\n def restore(key, value):\n if value is None:\n if key in os.environ:\n del os.environ[key]\n else:\n os.environ[key] = value\n\n restore(\"TF_XLA_FLAGS\", ORIGINAL_TF_XLA_FLAGS)\n restore(\"TF_FORCE_GPU_ALLOW_GROWTH\", ORIGINAL_TF_F...
[ "0.726292", "0.6727779", "0.6704393", "0.66477937", "0.6630372", "0.64882445", "0.64762366", "0.64619315", "0.6332729", "0.63148457", "0.62082964", "0.61878765", "0.6185419", "0.61318153", "0.60417116", "0.60417116", "0.6012145", "0.600259", "0.598263", "0.59585905", "0.59412...
0.5716636
30
Initializer for StandardConvergerStandardInputTemplate. Note that inheriting from this class and overwriting methods is another option.
def __init__(self, convObjs, createBasicObjFunct, modCalcObjFunct, stdInpFromCalcObjs, attrDict=None): self._convObjs = convObjs self._createBasicObjFunct = createBasicObjFunct self._modCalcObjFunct = modCalcObjFunct self._stdInpFromCalcObjs = stdInpFromCalcObjs if attrDict is not None: for key,val in att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createStandardInput(self):\n\t\traise NotImplementedError(\"\")", "def __init__(self, stdin=None, stdout=None):\n self._stdin = stdin or sys.stdin\n self._stdout = stdout or sys.stdout\n self._builtins = self._make_builtins()", "def __init__(self, **inputs):\n super().__init__(*...
[ "0.64910805", "0.60847557", "0.5736477", "0.57228565", "0.572092", "0.5719801", "0.5714915", "0.56754947", "0.559878", "0.5596769", "0.54730016", "0.54615384", "0.5456807", "0.54496306", "0.54333276", "0.54124266", "0.5407913", "0.54079115", "0.540288", "0.5385086", "0.537218...
0.0
-1
create list of batch indices
def shuffle_batch(y, batch_size): rnd_idx = np.random.permutation(len(y)) n_batches = len(y) // batch_size batch_list = [] for batch_idx in np.array_split(rnd_idx, n_batches): batch_list.append([x for x in batch_idx]) return batch_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_indices(self):\n b = self.batch_size\n return [np.arange(i*b, i*b+b) for i in range(self.num_batches)]", "def compute_batch_indices(batch_size: int, beam_size: int) ->torch.LongTensor:\n batch_pos = torch.arange(batch_size)\n batch_pos = batch_pos.view(-1, 1).expand(batch_size, beam...
[ "0.84326243", "0.7300249", "0.7221809", "0.7161237", "0.71588814", "0.70744306", "0.68750566", "0.6825795", "0.6759448", "0.67435443", "0.67260003", "0.66654444", "0.6642343", "0.6627527", "0.6620131", "0.66059947", "0.66012627", "0.65474844", "0.6539724", "0.6534247", "0.651...
0.0
-1
Create an action for optional arguments which provides two defaults. Use as argument `action` to the argparse.ArgumentParser.add_argument` method. This defines a command line argument which, in addition to its normal default, has an additional default value which is taken when this optional argument is
def default_arg(default): class DefaultArg(argparse.Action): def __call__(self, parser, namespace, value, option_string): if value is None: setattr(namespace, self.dest, default) else: setattr(namespace, self.dest, value) return DefaultArg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_argument(*args, **kwargs):\n if 'action' in kwargs:\n val = kwargs.pop('action')\n if val == 'store_true':\n kwargs['const'] = True\n kwargs['nargs'] = '?'\n elif val == 'store_false':\n kwargs['const'] = False\n ...
[ "0.68507427", "0.6403236", "0.6131243", "0.60557085", "0.5996159", "0.5989206", "0.5904569", "0.58817375", "0.5835471", "0.58206767", "0.58011943", "0.57539177", "0.57538146", "0.57301015", "0.57099235", "0.57055557", "0.57048225", "0.5684694", "0.5652228", "0.56350726", "0.5...
0.7133609
0
Reshape x so that the last dimension becomes two dimensions. The first of these two dimensions is n.
def split_last_dim(self, x, n): old_shape = list(x.size()) last = old_shape[-1] new_shape = old_shape[:-1] + [n] + [last // n if last else None] ret = x.view(new_shape) return ret.permute(0, 2, 1, 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_last_dimension(x, n):\n x_shape = shape_list(x)\n m = x_shape[-1]\n if isinstance(m, int) and isinstance(n, int):\n assert m % n == 0\n return tf.reshape(x, x_shape[:-1] + [n, m // n])", "def split_last_dimension(x, n):\n old_shape = x.get_shape().dims\n last = old_shape[-1]\n ...
[ "0.73021156", "0.72806466", "0.727416", "0.72017586", "0.7137547", "0.7065171", "0.70424175", "0.69658244", "0.69242", "0.6820341", "0.6561438", "0.6518949", "0.6497071", "0.6470221", "0.6422806", "0.6359682", "0.6277855", "0.62476885", "0.62466705", "0.6239059", "0.623731", ...
0.74958134
0
Reshape x so that the last two dimension become one.
def combine_last_two_dim(self, x): old_shape = list(x.size()) a, b = old_shape[-2:] new_shape = old_shape[:-2] + [a * b if a and b else None] ret = x.contiguous().view(new_shape) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x):\n return reshape(x, (x.shape[0], -1))", "def reshape(x, shape):\n return Reshape(shape)(x)", "def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batc...
[ "0.7624362", "0.7361735", "0.7356254", "0.73524576", "0.7211992", "0.71524197", "0.70263374", "0.69711345", "0.69283223", "0.6908497", "0.67825496", "0.6772853", "0.67166173", "0.67037886", "0.66884685", "0.66884685", "0.6648974", "0.6637822", "0.660816", "0.658997", "0.65652...
0.5980656
63
Test humidity sensor with device class humidity.
def test_sensor_humidity(self): with patch.dict(TYPES, {'HumiditySensor': self.mock_type}): state = State('sensor.humidity', '20', {ATTR_DEVICE_CLASS: 'humidity', ATTR_UNIT_OF_MEASUREMENT: '%'}) get_accessory(None, state, 2, {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_humidity(self):\n xknx = XKNX(loop=self.loop)\n sensor = Sensor(\n xknx,\n 'TestSensor',\n group_address_state='1/2/3',\n value_type=\"humidity\")\n sensor.sensor_value.payload = DPTArray((0x0e, 0x73))\n\n self.assertEqual(sensor....
[ "0.7566833", "0.7559146", "0.75242794", "0.7332435", "0.7294313", "0.72768813", "0.705482", "0.6785941", "0.6698963", "0.6649476", "0.66266364", "0.661288", "0.6586842", "0.65737927", "0.65552545", "0.65416485", "0.65021384", "0.64758176", "0.64583695", "0.64450765", "0.64357...
0.76015294
0
Return True if given point is inside the region
def contains_point(self, point): threshold = 0.6 x = point[0] y = point[1] if (x >= (self.xmin - threshold) and x <= (self.xmax + threshold) and y >= (self.ymin - threshold) and y <= (self.ymax + threshold)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_region(point, plotregion):\n\n if ((point[0] >= plotregion[0]) and\n (point[0] < plotregion[1]) and\n (point[1] >= plotregion[2]) and\n (point[1] < plotregion[3])):\n return True\n else:\n return False", "def is_point_in(self, point):\n return (self.upperlef...
[ "0.84268963", "0.82822615", "0.82822615", "0.80607045", "0.80080736", "0.79913193", "0.79300755", "0.79184914", "0.790464", "0.78905946", "0.78905946", "0.78729934", "0.7825603", "0.7789861", "0.77777475", "0.7722789", "0.7714577", "0.77041644", "0.76953435", "0.7682446", "0....
0.79659414
6
True if x is not equal to y
def ne (x,y): return not (le(x,y) and le(y,x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n return self.x != other.x or self.y != other.y", "def __ne__(self,other):\n if self.x != other.x or self.y != other.y:\n return True\n else:\n return False\n pass", "def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)", "d...
[ "0.77232945", "0.75922924", "0.7589078", "0.7514516", "0.7490505", "0.7272956", "0.72537637", "0.72512174", "0.72395384", "0.7235421", "0.72253937", "0.72253937", "0.72160476", "0.71871483", "0.7186462", "0.71859884", "0.71859884", "0.71797", "0.7174977", "0.7163262", "0.7144...
0.7334514
5
Returns true if the object has been deleted, or if it is brand new and hasnt yet been generated.
def isDeleted(self): return self.air is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_deleted(self):\n if self.deleted:\n return True\n return False", "def deleted(self) -> bool:\n return pulumi.get(self, \"deleted\")", "def delete(self) -> bool:\n return False", "def is_deleted(self):\n return 'deleted_at' in self._dict and bool(self._dict...
[ "0.78143626", "0.75699645", "0.7249292", "0.7163401", "0.71481985", "0.703286", "0.703286", "0.6986986", "0.68162465", "0.6770576", "0.67374504", "0.66846347", "0.6656306", "0.66060483", "0.65790814", "0.6549675", "0.6549675", "0.6544291", "0.6539444", "0.6522954", "0.6502663...
0.7244925
3
Get the goal state 1 list of tokens.
def get_goal_state_1(self): goal_state_1 = [str(i) for i in range(1, self.puzzle_length)] goal_state_1.append('0') return goal_state_1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokens(self):\n # type: () -> List[Token]\n return self._tokens", "def get_tokens(self):\r\n return self.token_set", "def get_tokens(self) -> List[str]:\n return self.tokens", "def tokens(self):\n return self.__tokens", "def tokens(self):\n return self._tokens", "def...
[ "0.7043598", "0.69490224", "0.6948903", "0.67569155", "0.6755311", "0.6755311", "0.6755311", "0.6578088", "0.65691566", "0.6439235", "0.64335614", "0.6382194", "0.6352393", "0.63347477", "0.6250971", "0.6225999", "0.622206", "0.6170228", "0.61680025", "0.61387247", "0.6131474...
0.63037497
14
Get the goal state 2 list of tokens.
def get_goal_state_2(self): # Create a list with the total number of elements for this puzzle goal_state_2 = ['0'] * self.puzzle_length counter = 1 for j in range(self.puzzle_width): for i in range(self.number_of_rows): goal_state_2[i * self.puzzle_width + j]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tokens(self) -> List[str]:\n return self.tokens", "def tokens(self):\n # type: () -> List[Token]\n return self._tokens", "def tokens(self):\n return self.__tokens", "def tokens(self):\n return self._tokens", "def tokens(self):\n return self._tokens", "def tokens(...
[ "0.66007215", "0.6578599", "0.6445192", "0.6396133", "0.6396133", "0.6396133", "0.6319831", "0.63155085", "0.6249407", "0.62064713", "0.6201021", "0.6070529", "0.60202503", "0.59695756", "0.59530824", "0.59368986", "0.59350616", "0.58843017", "0.58267516", "0.58257556", "0.58...
0.5832608
18
The "default" heuristic, defined by the assignment specifications. If the '0' tile is in the last index, return 0, otherwise return 1, for all states.
def h0(self, current_state): index = current_state.index('0') if index == self.puzzle_length - 1: return 0 return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nullHeuristic(state, problem=None):\n\treturn 0", "def null_heuristic(state, problem=None):\n return 0", "def nullHeuristic(state, problem=None):\n return 0", "def nullHeuristic(state, problem=None):\n return 0", "def nullHeuristic(state, problem=None):\n return 0", "def nullHeuristic(sta...
[ "0.6168579", "0.61673695", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", "0.6164148", ...
0.70699334
0
Sets the display_name of this UpsertLegalEntityRequest.
def display_name(self, display_name): if display_name is None: raise ValueError("Invalid value for `display_name`, must not be `None`") # noqa: E501 if display_name is not None and len(display_name) > 512: raise ValueError("Invalid value for `display_name`, length must be less t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(self, di...
[ "0.69833905", "0.697926", "0.697926", "0.697926", "0.697926", "0.697926", "0.697926", "0.69392663", "0.6848441", "0.6848441", "0.6848441", "0.6848441", "0.6848441", "0.6848441", "0.6551265", "0.5899759", "0.587173", "0.58632195", "0.5842585", "0.57741594", "0.57472414", "0....
0.57641935
20
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, UpsertLegalEntityRequest): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457167", "0.8393036", "0.81455255", "0.8139734", "0.81333447", "0.8094964", "0.8093362", "0.8093362", "0.8093362", "0.80863476", "0.80863476", "0.8077286", "0.8077286", "0.806682" ]
0.0
-1
Return the mantissa and exponent of x as the pair (m, e).
def frexp(x): return 0.0, 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_to_mant_exp( num ):\n try:\n exponent = math.floor(math.log10(abs(num)))\n except ValueError: # Case of log10(0)\n return (0, 0) # Convention: 0 = 0*10^0\n mantissa = num/10**exponent\n\n return (mantissa, int(exponent))", "def to_sign_exponent_mantissa(value, exponent_bits=e...
[ "0.62576574", "0.59120786", "0.5799326", "0.5773877", "0.5749223", "0.57331926", "0.5609811", "0.55997044", "0.5560775", "0.55223507", "0.54639906", "0.53929675", "0.5374162", "0.530014", "0.530014", "0.5285618", "0.5237823", "0.5233033", "0.52218395", "0.5199668", "0.5194057...
0.53403705
13
Return the natural logarithm of the absolute value of the Gamma function at x.
def lgamma(x): return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gamma(x):\n return 0.0", "def guestimate_gamma(x_data, time):\n ga0 = np.clip(np.log(max(x_data[0], 0) / (x_data[-1] + 1e-6)) / time[-1], 1e-3, 1e3)\n return ga0", "def gamma(x):\r\n gammax = ((x + 0.055) / 1.055) ** 2.4 if x > 0.04045 else x / 12.92\r\n return gammax", "def log_gamma_...
[ "0.7630428", "0.73520887", "0.7133683", "0.7055506", "0.70000726", "0.69280255", "0.69168675", "0.68913037", "0.6857785", "0.68464714", "0.6797368", "0.6790346", "0.6765616", "0.6745875", "0.67363745", "0.6714679", "0.6710858", "0.67030716", "0.66985625", "0.66793585", "0.667...
0.7845373
0
Get the length of the object wrapped by this partition.
def length(self, materialize=True): if self._length_cache is None: self._length_cache = self.apply(len)._data if isinstance(self._length_cache, Future) and materialize: self._length_cache = DaskWrapper.materialize(self._length_cache) return self._length_cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n if self.length is None:\n self.length = 0\n for _ in self:\n self.length += 1\n\n return self.length", "def __len__(self):\n if self.length is None:\n self.length = 0\n for _ in self:\n self.length...
[ "0.75699544", "0.75699544", "0.75699544", "0.7559258", "0.7559258", "0.7527028", "0.7527028", "0.75111943", "0.750711", "0.74776655", "0.74681664", "0.7467868", "0.74654704", "0.7450176", "0.7449474", "0.74455565", "0.74455565", "0.7438276", "0.7438276", "0.74373716", "0.7431...
0.0
-1
Returns the field type that would likely be associated with each MongoEngine type.
def api_field_from_mongo_field(cls, f, default=tastypie_fields.CharField): result = default if isinstance(f, (mongoengine.ComplexDateTimeField, mongoengine.DateTimeField)): result = tastypie_fields.DateTimeField elif isinstance(f, mongoengine.BooleanField): resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_type(name):\n if name not in field_types:\n field_types[name] = records.fields_get([name], attributes=['type'])[name]['type']\n return field_types.get(name)", "def type(self):\n return self._field.type", "def get_pymongo_type_string(\n self, field_ty...
[ "0.7780395", "0.7389808", "0.7369339", "0.71276194", "0.70825595", "0.70779616", "0.69403815", "0.692038", "0.68395346", "0.67952377", "0.6672835", "0.6656459", "0.6592109", "0.6558388", "0.64808756", "0.6448031", "0.6416925", "0.64007765", "0.6383194", "0.6327399", "0.632739...
0.0
-1
Construct a PATCH request.
def requestfactory_patch(self, path, data=None, content_type=client.MULTIPART_CONTENT, **extra): data = data or {} patch_data = self._encode_data(data, content_type) parsed = urlparse.urlparse(path) request = { 'CONTENT_LENGTH': len(patch_data), 'CONTENT_TYPE': content_type, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def httpPatch(self, url='', data='', params={}, headers={}):\n\n return self.httpRequest('PATCH', url, data, params, headers)", "def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)", "def patch(self, obj):\r\n self.require_item()\r\n request = http.Request('...
[ "0.6829371", "0.66681767", "0.66297865", "0.6587338", "0.6578215", "0.6562824", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", "0.65524215", ...
0.74148107
0
Send a resource to the server using PATCH.
def client_patch(self, path, data=None, content_type=client.MULTIPART_CONTENT, follow=False, **extra): data = data or {} response = super(client.Client, self).patch(path, data=data, content_type=content_type, **extra) if follow: response = self._handle_redirects(response, **extra) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(self, resource, data, target=None, verb='patch', **kwargs):\n return self._modify_resource(resource, data, target, verb, **kwargs)", "def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)", "def patch(resource, data, **kwargs):\n\tresp = requests.patch(\n\t\t_endp...
[ "0.7256845", "0.72186434", "0.7136954", "0.6969061", "0.69669735", "0.6965865", "0.6957133", "0.6957133", "0.6957133", "0.69547486", "0.6877082", "0.68528956", "0.67895454", "0.67834586", "0.67329186", "0.67229724", "0.6714738", "0.6707765", "0.66935694", "0.667907", "0.66635...
0.65930605
22
Testing the injected variable representing the script.
def test_pipeline_bash_file_variable(self): config = ShellConfig(script='''echo "PIPELINE_BASH_FILE=$PIPELINE_BASH_FILE"''', model={}, env={}) container = Container.creator({}, config) output = [line for line in container.process() if line.lower().find("pipeline") >= 0] assert_that(len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_script(self):\n script = 'var %s = {foo: \"foo\"};' % _global\n\n utils.run_script(script)\n self.assertEqual('foo', utils.run_script('%s.foo' % _global))\n\n # Cleanup\n self.assertEqual('true', utils.run_script('delete %s.foo' % _global))", "def test_variables_ge...
[ "0.70464504", "0.65943426", "0.63664705", "0.62621444", "0.61888707", "0.61551434", "0.61534333", "0.6092367", "0.60421234", "0.60243803", "0.5981728", "0.5969614", "0.59538865", "0.59364724", "0.58996147", "0.5897441", "0.58768094", "0.586177", "0.5849991", "0.58340067", "0....
0.0
-1
Returns the name of the stock icon to use for the display. This assumes that this icon has already been registered as a stock icon.
def get_stock(self): return 'geo-show-family'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon(self):\n if self._name in [HA_MONTH_ENERGY_KWH, HA_LAST_ENERGY_KWH]:\n return ICON_GAS\n else:\n return ICON_PRICE", "def get_icon_title(self): # real signature unknown; restored from __doc__\n return \"\"", "def downloadicon_name(self):\n return 'plat...
[ "0.7458557", "0.72857326", "0.7218307", "0.71459764", "0.704603", "0.68933964", "0.6886491", "0.68848765", "0.6871405", "0.6871405", "0.6871405", "0.68594235", "0.68553084", "0.68553084", "0.6827701", "0.6811776", "0.6811776", "0.6811776", "0.6811776", "0.6811776", "0.6811776...
0.6528313
50
Indicates the navigation type. Navigation type can be the string name of any of the primary objects.
def navigation_type(self): return 'Family'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_object_type(self, data):\n if data.get(\"jsonmodel_type\") == \"archival_object\":\n if self.aspace_helper.has_children(data[\"uri\"]):\n return \"archival_object_collection\"\n return data.get(\"jsonmodel_type\")", "def object_type(self) -> str:\n re...
[ "0.6239871", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5907221", "0.5878207", "0.5878207", "0.58725524", "0.5826654", ...
0.67244804
0
Returns the name of the model
def __str__(self): return self.__name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_name(self) -> str:\n return self._model_name", "def name(self) -> str: # pragma: no cover\n return self.model.__name__", "def get_model_name(self) -> str:\n raise NotImplementedError", "def name(self) -> str:\n return self._model.name", "def get_model_name(self) -> st...
[ "0.9076556", "0.8915749", "0.8857596", "0.8836577", "0.8675336", "0.8594061", "0.8528894", "0.8482568", "0.8470602", "0.83704686", "0.834358", "0.8303561", "0.8163223", "0.809987", "0.8073449", "0.80385673", "0.79918647", "0.78837323", "0.7801244", "0.7796645", "0.7771296", ...
0.0
-1
ConfigurationError exception should be raised if the option `[authz_policy] authz_file` is empty.
def test_get_authz_file_empty_raises(self): self.env.config.set('authz_policy', 'authz_file', '') self.assertRaises(ConfigurationError, self.check_permission, 'WIKI_VIEW', 'änon', None, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_authz_file_notdefined_raises(self):\n self.env.config.remove('authz_policy', 'authz_file')\n self.assertRaises(ConfigurationError, self.check_permission,\n 'WIKI_VIEW', 'änon', None, None)", "def test_get_authz_file_notfound_raises(self):\n authz_file = ...
[ "0.7418602", "0.7259914", "0.65944797", "0.605611", "0.60378104", "0.5798308", "0.57452416", "0.5674308", "0.5660663", "0.557645", "0.55683213", "0.5517417", "0.5460611", "0.54594505", "0.5375839", "0.5356673", "0.5296177", "0.5212803", "0.51997113", "0.51782703", "0.51628655...
0.74941736
0
Returns a randomly chosen letter, with a trailing period if desired.
def initial(with_trailing_period=False): letter = _random.choice(string.letters).upper() return (letter if not with_trailing_period else letter + '.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_letter(letters):\n return random.choice(letters)", "def get_random_alphabetic_string():\n return get_random_string(char_choice=string.ascii_letters)", "def suffix():\r\n\r\n return _random.choice(\r\n [\r\n 'Sr.', 'Jr.', 'II', 'III', 'IV', 'V'\r\n ]\r\n )", "de...
[ "0.7242595", "0.7203279", "0.70668197", "0.7017358", "0.70149595", "0.68849945", "0.68665934", "0.68519855", "0.6819053", "0.6801439", "0.6744729", "0.67267376", "0.67146254", "0.67133594", "0.66855985", "0.6674079", "0.66668004", "0.66507673", "0.66083926", "0.6608264", "0.6...
0.8360207
0
Returns a randomly chosen female middle name.
def female_middle(): return female_first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name():\r\n return _random.choice([male_first(), female_first()])", "def get_random_female_name ():\n return db_random_pop_default(DB_FIRST_FEMALE, \"Jane\")", "def female_name():\n return dice.choice(names.woman)", "def male_middle_name():\r\n\r\n return male_first()", "def get_random_male...
[ "0.8246716", "0.81908685", "0.81641996", "0.8094339", "0.78628135", "0.7780701", "0.7705909", "0.7689909", "0.742177", "0.73689026", "0.73582405", "0.73445404", "0.7316687", "0.72910786", "0.7288012", "0.7259131", "0.72454214", "0.7171479", "0.71610135", "0.7115856", "0.70945...
0.7382717
9
Returns a randomly chosen male middle name.
def male_middle(): return male_first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def male_middle_name():\r\n\r\n return male_first()", "def name():\r\n return _random.choice([male_first(), female_first()])", "def get_random_male_name ():\n return db_random_pop_default(DB_FIRST_MALE, \"John\")", "def male_name():\n return dice.choice(names.man)", "def get_random_female_name ...
[ "0.8367928", "0.82412595", "0.810842", "0.80068403", "0.7857153", "0.77948576", "0.77776617", "0.7507554", "0.7503658", "0.7451521", "0.7386139", "0.7262262", "0.72318465", "0.7152687", "0.71390104", "0.7113378", "0.7105316", "0.7094616", "0.7092547", "0.70311207", "0.700438"...
0.748925
9
Returns a randomly chosen surname.
def surnames(): cursor.execute('SELECT * FROM surname order by RANDOM() limit 1') return cursor.fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_name():\n return dice.choice(names.lastname)", "def get_random_lastname_scottish ():\n name = db.get_database(DB_LAST_GAELIC2).random_pop()\n if not name:\n return get_random_lastname_simple()\n return \"%s%s\" % (random.choice(('Mc', 'Mac')), name)", "def get_random_lastname_family...
[ "0.7717693", "0.7543715", "0.74960935", "0.7489763", "0.7383605", "0.7324503", "0.73083574", "0.7167987", "0.71526", "0.7129584", "0.71090245", "0.71090245", "0.7105901", "0.7105901", "0.70044535", "0.6967047", "0.6962742", "0.6957423", "0.6872858", "0.686386", "0.6832383", ...
0.79233277
0
Returns name, middile initial and last name.
def male_full_name_w_middle_initial(with_period=False): return '{} {} {}'.format(male_first(), initial(with_period), surnames())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_name_and_initial(self):\n return u\"{} {}\".format(self.pref_first_name(), self.last_name[0])", "def get_full_name(self):\n return self.name+self.last_name", "def get_name(self):\r\n return ('%s %s' % ( self.first_name, self.last_name ))", "def get_short_name(self):\n la...
[ "0.76969755", "0.7628068", "0.758169", "0.75484985", "0.7481741", "0.7446383", "0.7410312", "0.740742", "0.7397838", "0.7363687", "0.7361114", "0.7358503", "0.73548585", "0.733484", "0.73075145", "0.7291793", "0.7277758", "0.7270159", "0.7247055", "0.7243501", "0.7232884", ...
0.0
-1
This function will pick 2 random last names and hyphenate them. ie hyphenated_last_name() = 'PerryJenkins'
def hyphenated_last_name(): return '{}-{}'.format(last_name(), last_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_name_last():\n while True:\n # We generate two random last names\n first_name = last_name()\n second_name = last_name()\n\n # The names are not allowed to be the same, therefore we need to\n # make sure that they aren't.\n if first_name == second_name:\n ...
[ "0.7911714", "0.764533", "0.7499593", "0.7456344", "0.74059224", "0.73304564", "0.7203291", "0.715162", "0.71177554", "0.7068802", "0.7043231", "0.69416046", "0.69146496", "0.69057375", "0.6845594", "0.6670983", "0.66605157", "0.66398156", "0.6610154", "0.6591536", "0.6579901...
0.77629393
1
Picks a random language.
def language(): cursor.execute('SELECT name from languages order by RANDOM() limit 1;') return cursor.fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_language(self):\n\n current_dir = os.curdir\n path = os.path.join(current_dir, \"audio\")\n languages = os.listdir(path)\n language_num = randint(0, len(languages) - 1)\n return languages[language_num]", "def programming_language(self) -> str:\n return self.ra...
[ "0.7954805", "0.7241465", "0.70558685", "0.6806038", "0.6501575", "0.6492072", "0.6434648", "0.63885784", "0.6337799", "0.6286942", "0.62583536", "0.62357235", "0.6202648", "0.6202648", "0.6202648", "0.60617673", "0.60598576", "0.60414195", "0.60321504", "0.5994602", "0.59840...
0.7702429
1
This function will return a last name from a list. ie last_name() = 'Smith'.
def last_name(): return surnames()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_name():\n return dice.choice(names.lastname)", "def get_last_name(people, individual):\n surname = people[individual]['NAME'].split()\n return surname[1]", "def get_last_name(self) -> str:\n return self.last_name", "def get_last(self):\n return \"%s%s%s\" % (\n ...
[ "0.7647276", "0.73629326", "0.7323391", "0.7266351", "0.71562827", "0.7058044", "0.70577586", "0.7025582", "0.70250624", "0.70250624", "0.69927615", "0.69642025", "0.6958447", "0.69292766", "0.69292766", "0.69292766", "0.69292766", "0.6851672", "0.6808927", "0.6779976", "0.67...
0.77843976
0
This function will return a random street type.
def street_type(): cursor.execute('SELECT * FROM street_types \ order by RANDOM() limit 1;') return cursor.fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def street_type():\r\n return _random.choice(\r\n [\r\n \"Abbey\", \"Acres\", \"Allée\", \"Alley\", \"Autoroute\", \"Avenue\",\r\n \"Bay\", \"Beach\", \"Bend\", \"Boulevard\", \"By-pass\", \"Byway\",\r\n \"Campus\", \"Cape\", \"Carré\", \"Carrefour\", \"Centre\", \"Cercle...
[ "0.8542503", "0.71580154", "0.71548486", "0.59842634", "0.5979136", "0.5788351", "0.5741943", "0.5722414", "0.5707577", "0.5692631", "0.567315", "0.56668156", "0.56602377", "0.5652541", "0.56311953", "0.56243646", "0.56227005", "0.5603994", "0.5564704", "0.55142057", "0.54858...
0.8298395
1
This returns a suffix from a small list.
def suffix(): return _random.choice( [ 'Sr.', 'Jr.', 'II', 'III', 'IV', 'V' ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix(sequence, l):\n if l > len(sequence):\n return sequence\n else:\n return sequence[-l:]", "def get_suffix_configuration(lst):\n suffix_conf = ''\n for elem in lst: \n suffix_conf += '_'\n if type(elem) != str: \n elem = str(elem)\n suffix_conf +...
[ "0.71769714", "0.7000931", "0.6599814", "0.65312815", "0.6408614", "0.6148086", "0.61447895", "0.61160254", "0.6102459", "0.6033458", "0.5982443", "0.59704953", "0.5921727", "0.5921727", "0.5911996", "0.5910776", "0.5893895", "0.588884", "0.5859104", "0.58412117", "0.58412117...
0.6454487
4
This is a convenience function for creating timestamps.
def timestamp(style=False): if not style: return time.strftime('%H:%M:%S%p %D', time.localtime()) else: return time.strftime(style, time.localtime())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())", "def _generate_timestamp():\n\t\treturn strftime(\"%Y%m%dT%H%M%S\")", "def _create_timestamp():\n return (datetime.utcnow() - datetime(1970,1,1)).total_seconds()", "def create_...
[ "0.72431684", "0.7117313", "0.7071348", "0.7046661", "0.6947904", "0.69334686", "0.6820246", "0.6788962", "0.67160976", "0.67107177", "0.67087317", "0.66923654", "0.66591537", "0.66340846", "0.650617", "0.64839303", "0.64302415", "0.633329", "0.62981635", "0.62974125", "0.626...
0.5925604
43
return the first index of item in array or None if item is not found
def linear_search(array, item): # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests # return linear_search_iterative(array, item) return linear_search_recursive(array, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def np_index_of(array, item):\n where = np.where(array == item)\n if len(where) == 0:\n raise ValueError(\"{0} not found in array\".format(item))\n return where[0][0] # where is a 2d array", "def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n e...
[ "0.7654498", "0.76485795", "0.73254657", "0.7152995", "0.70068246", "0.6965024", "0.6964481", "0.6916574", "0.6872765", "0.6827316", "0.67693734", "0.6750015", "0.66990155", "0.668622", "0.66723377", "0.6657315", "0.66358805", "0.66342586", "0.661365", "0.6607807", "0.6569612...
0.60730076
60
return the index of item in sorted array or None if item is not found
def binary_search(array, item): # change this to call your implementation to verify it passes all tests # return binary_search_iterative(array, item) return binary_search_recursive(array, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val", "def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1", "def binary_search(elem: int, arr:...
[ "0.7911487", "0.723239", "0.70944625", "0.7049101", "0.70248735", "0.70152944", "0.6976257", "0.6937132", "0.691218", "0.6905791", "0.6879843", "0.6862452", "0.68274254", "0.6823422", "0.67618924", "0.6724244", "0.66873103", "0.6676464", "0.66450155", "0.65676993", "0.6559574...
0.60009736
72
Test string representation for Project Model
def test_project_str(self): project = mommy.make('ona.Project', name='Project Zero') self.assertEqual(str(project), 'Project Zero')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_project_str(self):\n project = models.Project.objects.create(\n user=sample_user(),\n title='Videogame Project',\n description='Making a triple A videogame',\n price=50.00\n )\n\n self.assertEqual(str(project), project.title)", "def test_p...
[ "0.7752334", "0.7213779", "0.7055024", "0.7032889", "0.6979861", "0.6921673", "0.68282384", "0.6672846", "0.6638818", "0.66314745", "0.6605419", "0.6568851", "0.6551951", "0.6549202", "0.65460676", "0.65446436", "0.6530631", "0.65277904", "0.65263903", "0.6474234", "0.6466452...
0.8188227
0
List of tokens created from processed text.
def tokens(self): return self.__tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tokenize(self, text: str) -> List[str]:\n tokens = []\n for token in re.findall(self._pat, text):\n tokens.extend(bpe_token for bpe_token in self._bpe(token).split(\" \"))\n return tokens", "def get_token_list(text):\n return text.split()", "def get_tokens(self, text):\n\t...
[ "0.8176478", "0.80443", "0.79711527", "0.79468435", "0.7910405", "0.7893175", "0.78621083", "0.7778379", "0.7776586", "0.7624961", "0.7614397", "0.75975686", "0.75880516", "0.7578978", "0.75592965", "0.75521165", "0.7506349", "0.74804676", "0.7471548", "0.74435496", "0.743700...
0.7191767
34
Initialize a matmul layer that has 'num_nodes' nodes
def __init__( self, name: str, num_nodes: int, layers: List[Layer], posteriors: Optional[List[Layer]] = None, log_level: int = logging.ERROR ): super().__init__( name=name, num_nodes=num_nodes, layers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, N_sym, n_nodes, activations, N_element, bias = True, scaling = None):\n super(MultiLayerNet, self).__init__()\n N_layers = len(n_nodes)\n if N_layers == 0:\n self.net = torch.nn.Linear(N_sym, N_element, bias = bias)\n else:\n layers = []\n ...
[ "0.666574", "0.6395804", "0.623192", "0.61707485", "0.61090165", "0.60877216", "0.6057512", "0.58617854", "0.5851198", "0.58427095", "0.5817765", "0.581776", "0.5814572", "0.5804891", "0.5803346", "0.5772056", "0.5756266", "0.57516515", "0.574608", "0.57450485", "0.5744601", ...
0.0
-1
labeler function that returns meaningless labels. Convenient for pretraining, where the labels are totally unused
def make_null_labeler(): def labeler(data): return {**data, 'outcome': tf.zeros([1]), 'y0': tf.zeros([1]), 'y1': tf.zeros([1]), 'treatment': tf.zeros([1])} return labeler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_labels_encoder_no_classes(self):\n\n class L2UTransformer(object):\n def transform(self, y):\n return np.array([yi.upper() for yi in y])\n\n oz = ClassificationScoreVisualizer(GaussianNB(), encoder=L2UTransformer())\n with pytest.warns(YellowbrickWarning, mat...
[ "0.7146166", "0.6918323", "0.68128586", "0.66789925", "0.667188", "0.66469276", "0.66469276", "0.66469276", "0.65993804", "0.658801", "0.65863127", "0.6551131", "0.6524671", "0.6508366", "0.64795214", "0.6417138", "0.6417138", "0.6417138", "0.6417138", "0.6417138", "0.6417138...
0.7491019
0
Return file object based on file_name
def file_by_file_name(self, file_name): ls = self.files.filter_by(file_name=file_name) return ls[0] if 0 < len(ls) else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self, filename):\r\n\r\n return File.from_name(self, filename)", "def _get_file_object(infilename):\n\n _, extension = os.path.splitext(infilename)\n if extension.lower() == '.spe':\n return parsers.SpeFile(infilename)\n elif extension.lower() == '.spc':\n return parser...
[ "0.7975323", "0.7854524", "0.7580964", "0.7469616", "0.7382322", "0.70451075", "0.69777906", "0.6952943", "0.6951699", "0.69331473", "0.6800219", "0.6672949", "0.6638296", "0.6637399", "0.66129553", "0.6579716", "0.65158707", "0.64669615", "0.6409229", "0.63866496", "0.637743...
0.731095
5
Returns a list of tasks that have no predecessors
def get_tasks_without_predecessors(self) -> TaskList: return TaskList([task for task in self._tasks if not len(task.predecessors)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessors(self):\n predecessors = []\n for inst in self.inst.uses():\n if inst.op_name != 'OpPhi':\n predecessors.append(inst.basic_block)\n return predecessors", "def remove_from_predecessors(self, next_task: Task) -> None:\n for task in self._tasks:\...
[ "0.6753965", "0.66662055", "0.6440192", "0.6151322", "0.61292696", "0.60731226", "0.6049877", "0.60363233", "0.5946373", "0.5945425", "0.5939654", "0.59316474", "0.5898738", "0.5895866", "0.5883427", "0.58815837", "0.58763605", "0.5861356", "0.58612484", "0.5840523", "0.58227...
0.8865706
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, labels, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(labels)) pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81920755", "0.8093736", "0.8028212", "0.8017333", "0.79923165", "0.7989431", "0.79789335", "0.7974398", "0.795948", "0.79555666", "0.7935652", "0.7932704", "0.7932632", "0.7929465", "0.7924336", "0.7922666", "0.79221356", "0.7921299", "0.79209703", "0.7920307", "0.7916008"...
0.0
-1
Function that returns all possible combinations of a given length, considering an excluded list of elements.
def _sublist(self, lst, exclude, length): for sublist in itertools.combinations([e for e in lst if e not in exclude], length): yield list(sublist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AllCombinations(data, comblength):\n return [c for c in itertools.combinations(data, comblength)]", "def combinations(sequence, length, NULL=object()):\r\n if length <= 0:\r\n combos = [NULL]\r\n else:\r\n combos = []\r\n for i, item in enumerate(sequence, 1):\r\n rem...
[ "0.7378369", "0.69922686", "0.6610251", "0.65539074", "0.6436269", "0.6396576", "0.6384093", "0.6333533", "0.63323766", "0.62846476", "0.6254326", "0.6236639", "0.6090494", "0.6070298", "0.60493356", "0.6040016", "0.60080713", "0.5994642", "0.59879476", "0.59775025", "0.59509...
0.6470623
4
Returns a string to be used as the name for an S3 bucket. As of this writing (20200512), directly referring to bucket ARNs and names in stacks causes circular dependencies between common and the bucketowning stack. Since we calculate the bucket name during the synthesis phase, values such as self.region and self.accoun...
def get_bucket_name(self, tag) -> str: region = self.node.try_get_context("region") account = self.node.try_get_context("account") bucket_tag = f"{region}-{account}-{tag}" bucket_hash = hashlib.md5(bucket_tag.encode()).hexdigest() bucket_name = f"integ-test-{self.id}-{tag}-{bucke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_name(self) -> str:\n ...", "def bucket_name(self) -> str:\n return jsii.get(self, \"bucketName\")", "def bucket_name(self) -> str:\n return jsii.get(self, \"bucketName\")", "def bucket_name(self) -> str:\n return pulumi.get(self, \"bucket_name\")", "def bucket_name(se...
[ "0.79094636", "0.7882844", "0.7882844", "0.7852468", "0.7622656", "0.7622656", "0.7622656", "0.7622656", "0.7622656", "0.7613365", "0.75062156", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.748272", "0.728383...
0.76785344
4
loads the list of known datasets from a given folder
def get_dataset_list(data_folder=None): known_dataset_list = ["raw_clean_32", # High Versus Low inhibitory Stimuli of Tinnitus and control patients "Distress2010", # Tinnitus Distress patients (1, 2, 3, 4 Distress) - resting state "NormativeDB", # Control...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_datasets_from_dir(path: github_api.GithubPath) -> List[str]:\n if not path.exists():\n # Should be fault-tolerant in the future\n raise FileNotFoundError(f'Could not find datasets at {path}')\n return sorted([ds for ds in path.iterdir() if _is_dataset_path(ds)])", "def getDatasets(self, dirname...
[ "0.71243644", "0.70869225", "0.70654714", "0.70300823", "0.7016533", "0.69334185", "0.69263065", "0.6921224", "0.6906948", "0.688317", "0.68765426", "0.68543136", "0.6833656", "0.6785148", "0.67476135", "0.66857153", "0.6682972", "0.66733414", "0.6586321", "0.65761214", "0.65...
0.65977615
18
Sets the id of this EventType.
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 set_id(self, id):\n self.__id = id", "def set_id(self, id_):\n\n self.id_ = id_", "def setId(self, *args):\n return _libsbml.Event_setId(self, *args)", "def set_id(self, id):\n self.data['id'] = id", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):...
[ "0.7413128", "0.73614675", "0.72248137", "0.72199553", "0.7205373", "0.71232045", "0.70914483", "0.70914483", "0.70914483", "0.70914483", "0.70914483", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0.707845", "0...
0.0
-1
Sets the created of this EventType.
def created(self, created): if self.local_vars_configuration.client_side_validation and created is None: # noqa: E501 raise ValueError("Invalid value for `created`, must not be `None`") # noqa: E501 self._created = created
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created(self, created):\n if created is None:\n raise ValueError(\"Invalid value for `created`, must not be `None`\")\n\n self._created = created", "def created(self, created):\n\n self._created = created", "def created(self, created):\n\n self._created = created", ...
[ "0.78300685", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.780391", "0.7176892", "0.7176892", "0.7176892", "0.7176892", "0.7176892", "0.7176892", "0.7176892", "0.7095706", ...
0.686153
22
Sets the name of this EventType.
def name(self, name): if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501 raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and name is not None and len(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setName(self, *args):\n return _libsbml.Event_setName(self, *args)", "def event_name(self, event_name):\n self['event_name'] = event_name", "def event_name(self, event_name):\n\n self._event_name = event_name", "def set_name(self, name):\n self._name = name", "def set_name(s...
[ "0.79142314", "0.7751995", "0.7743061", "0.752352", "0.74894536", "0.74894536", "0.7464451", "0.7464426", "0.7440115", "0.7440115", "0.7440115", "0.7440115", "0.7440115", "0.74198544", "0.73965484", "0.7367737", "0.7362727", "0.7303555", "0.72325194", "0.72325194", "0.7232519...
0.0
-1
Sets the mime_type of this EventType.
def mime_type(self, mime_type): if self.local_vars_configuration.client_side_validation and mime_type is None: # noqa: E501 raise ValueError("Invalid value for `mime_type`, must not be `None`") # noqa: E501 allowed_values = ["application/json", "application/x-www-form-urlencoded", "none"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mime_type(self, mime_type):\n\n self._mime_type = mime_type", "def attachment_mime_type(self, attachment_mime_type):\n\n self._attachment_mime_type = attachment_mime_type", "def blob_mime_type(self, blob_mime_type):\n\n self._blob_mime_type = blob_mime_type", "def attachment_file_typ...
[ "0.8534817", "0.74580055", "0.72189665", "0.65762305", "0.6302185", "0.6280117", "0.6280117", "0.62095344", "0.61835724", "0.61371624", "0.6053879", "0.59578204", "0.5828971", "0.5823409", "0.5786674", "0.57774925", "0.57571876", "0.5734133", "0.57257795", "0.56385547", "0.56...
0.740594
2
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, EventType): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, EventType): 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
Conv2D wrapper, with bias add and ReLu activation function
def conv2d(self, x, W, b, strides=1): net = tf.nn.conv2d(x, W, strides=[1, strides, strides, 1], padding=STRIDE) net = tf.nn.bias_add(net, b) net = tf.nn.relu(net) return net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conv_block( inputs, filters, kernel, strides, nl):\n channel_axis = 1 if K.image_data_format() == 'channels_first' else -1\n x = Conv2D(filters, kernel, padding='same', strides=strides)(inputs)\n x = BatchNormalization(axis=channel_axis)(x)\n return _return_activati...
[ "0.69144255", "0.6869261", "0.68603045", "0.6771322", "0.6764705", "0.6763808", "0.67508733", "0.6720809", "0.6677142", "0.6677142", "0.6618039", "0.65978426", "0.65954334", "0.65928644", "0.6556468", "0.65507543", "0.6537399", "0.6536172", "0.6497817", "0.64966166", "0.64893...
0.68860275
1
Get label to mat index mappings.
def get_label_ix_mapping(labels): return {label: i for i, label in enumerate(labels)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_of_label(self, label_name):\n return self.indices_of('label', label_name)", "def get_label_map(labels):\n label_map = dict()\n for i,v in enumerate(np.ravel(labels.data)):\n if v in label_map.keys():\n label_map.get(v).append(i)\n else:\n label_map[v] = [i...
[ "0.7051809", "0.6984512", "0.6893664", "0.6670937", "0.6664595", "0.6619766", "0.65581757", "0.6449272", "0.64057404", "0.63551646", "0.63132936", "0.62389386", "0.61545753", "0.61531657", "0.6113825", "0.61015135", "0.6078372", "0.6028266", "0.60125124", "0.59842646", "0.598...
0.7629585
0
Returns true if the string is a number or False otherwise
def is_number(number): if type(number) == type(1) or type(number) == type(0.1) or type(number) == type('') or type(u''): try: float(number) return True except ValueError: return False except TypeError: return False else: return Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n float(s)\r\n ...
[ "0.8854936", "0.879279", "0.86789924", "0.86555886", "0.8628976", "0.8625355", "0.8611347", "0.8611347", "0.8611347", "0.86027825", "0.8589621", "0.8550259", "0.8516888", "0.8478422", "0.84673643", "0.8412445", "0.8403247", "0.83807015", "0.8278528", "0.8272441", "0.8247956",...
0.7423526
69
Returns onehotencoded array of size N x C
def to_one_hot_encoding(target_data): target_data = target_data.squeeze() n_class = len(np.unique(target_data)) res = np.eye(n_class)[target_data.astype(int)] return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(Y, n_c):\n Y_onehot = np.zeros((Y.size, n_c))\n Y_onehot[np.arange(Y.size), Y] = 1\n return Y_onehot.T", "def one_hot_encode(x, n_classes):\n return np.eye(n_classes)[x]", "def one_hot(array, N):\r\n\r\n array = array.astype(int)\r\n assert numpy.max(array) < N\r\n assert numpy...
[ "0.84308505", "0.81625235", "0.8082208", "0.7946731", "0.7934992", "0.78157073", "0.7799698", "0.7775537", "0.77689964", "0.7746849", "0.7740138", "0.7724413", "0.7715345", "0.7706223", "0.76916957", "0.7666756", "0.76498514", "0.76338655", "0.7590643", "0.7578633", "0.756876...
0.6928322
93
List of ints specifying indices for binary features.
def set_binary_feature_idx_list(self): binary_indices_ = utils.get_binary_indices(self.data_x, self.non_num_idx) self.binary_idx_list = np.array(binary_indices_) self.non_num_idx = np.setdiff1d(self.non_num_idx, self.binary_idx_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_34index_list(self):\n msk = self.load_mask()\n return [i for (i,v) in enumerate(msk) if v==1]", "def indices(self):\n\n # We used lookup tables here. Read more about other methods here:\n # https://chessprogramming.wikispaces.com/Bitboard+Serialization\n\n if self.num =...
[ "0.7462112", "0.7373834", "0.7083068", "0.7028624", "0.7017072", "0.69672614", "0.6901751", "0.6733047", "0.6641008", "0.6533554", "0.6519904", "0.6491599", "0.6467682", "0.6442618", "0.642368", "0.6416651", "0.63947743", "0.6393453", "0.63868165", "0.63597393", "0.6357831", ...
0.75452685
0
List of ints specifying indices for numerical features.
def set_len_numerical_feat(self): cur_len_ = len(self.numerical_idx) if self.binary_idx_list is not None: cur_len_ += len(self.binary_idx_list) self.len_numerical_feat = cur_len_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_34index_list(self):\n msk = self.load_mask()\n return [i for (i,v) in enumerate(msk) if v==1]", "def get_indices(self):\r\n return self._indices", "def getIndices(schema_attr_levels):\n return np.array(list(schema_attr_levels.values())).flatten().tolist()", "def vir_indices(se...
[ "0.7125732", "0.67494166", "0.6748896", "0.6708266", "0.6672246", "0.6666634", "0.66496754", "0.66132057", "0.66026926", "0.6560567", "0.6514331", "0.6504886", "0.6503922", "0.64621216", "0.64582556", "0.6449065", "0.6444436", "0.644208", "0.6428834", "0.6426765", "0.6389559"...
0.0
-1
Drop columns in array if there is only a single unique element in it plus np.nan.
def drop_one_elem_columns(self, df): df_ = df.copy() # Incldue columns in dataframe include_idx = [] for i in df_.columns: len_unique = df_[i].dropna().unique().size if len_unique > 1: include_idx.append(i) df_ = df_[include_idx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_nan_columns(arrays):\n\n # Keep all column indices\n not_nan_filter = ones(len(arrays[0]), dtype=bool)\n\n # Currently keeping all columns!\n\n # Keep column indices without missing value in all arrays\n # for a in arrays:\n # not_nan_filter &= ~isnan(a)\n\n return [a[not_nan_filt...
[ "0.75196254", "0.6794466", "0.6619757", "0.65998524", "0.655495", "0.6496642", "0.6493709", "0.6349335", "0.6285975", "0.622744", "0.620139", "0.61766136", "0.6163357", "0.6148076", "0.61369705", "0.61339676", "0.60335064", "0.60280085", "0.60248303", "0.59601843", "0.5903704...
0.70511913
1
Gets the total number of elapsed seconds in the day.
def get_elapsed_seconds(): utcnow = datetime.utcnow() midnight_utc = datetime.combine(utcnow.date(), time(0)) delta = utcnow - midnight_utc return delta.total_seconds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_seconds(self):\n return (\n (self.days * 86400 + self.seconds) * 10**6 + self.microseconds\n ) / 10**6", "def get_total_seconds(td):\n return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6", "def total_seconds(td):\n return (td.microseconds + (td.sec...
[ "0.81510127", "0.75990295", "0.75369143", "0.73405945", "0.731698", "0.7314861", "0.72670084", "0.7266481", "0.71389884", "0.7138954", "0.7074033", "0.6922083", "0.6887722", "0.6866305", "0.6835305", "0.6834427", "0.6829918", "0.6747456", "0.6744547", "0.67347586", "0.6716087...
0.7559496
2
encode a numpy.ndarray object.
def encode_data(data, order='C', compression_level=None): if compression_level is None: compression_level = DEFAULT_COMPRESSION_LEVEL return _zlib.compress(data.tobytes(order=order), compression_level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encodeArray(self, array):\n\n # Actually, we want dtype,naxis,axNlen,base64(array)\n return base64.b64encode(array.tostring())", "def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))", "def json_serialize_numpy_array(array):\n return json.dumps(json...
[ "0.7388475", "0.72840333", "0.72840333", "0.72325563", "0.70944256", "0.6864758", "0.6859525", "0.68453753", "0.6825534", "0.678497", "0.6737545", "0.67369246", "0.6732886", "0.67132276", "0.6693044", "0.6669051", "0.6662419", "0.6659878", "0.6631461", "0.6623487", "0.6599330...
0.0
-1
Shows the object readable name.
def __unicode__(self): return self.first_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_name(self):\n return self.name", "def display_name(self, obj):\n return six.text_type(obj)", "def __str__(self):\n return self._name", "def __str__(self):\n \n return self._name", "def __str__(self):\n return self.__name", "def __str__(self):\n re...
[ "0.79824275", "0.7952787", "0.7620327", "0.7567258", "0.7565897", "0.75293285", "0.75293285", "0.75293285", "0.75293285", "0.75293285", "0.7505057", "0.7505057", "0.7505057", "0.7505057", "0.7505057", "0.7505057", "0.7505057", "0.7491893", "0.7491893", "0.7474296", "0.7432366...
0.0
-1
Create a header dict for requests. Uses abstract method self._handle_token().
def _get_headers(self, token: str, override: dict = None) -> dict: headers = self._headers.copy() if isinstance(override, dict): headers.update(override) headers = {k: v for k, v in headers.items() if v is not None} token = self._handle_token(token) if token: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_header(self, token: str) -> dict:\n\n header = HEADER.copy()\n # modify to represent how to build the header\n header['Authorization'] = f\"Bearer {token}\"\n\n return header", "def _make_headers() -> CaseInsensitiveDict:\n headers = CaseInsensitiveDict()\n hea...
[ "0.77233416", "0.77175784", "0.7619331", "0.74734694", "0.745365", "0.745365", "0.7437346", "0.74198985", "0.7418513", "0.7377463", "0.7373184", "0.7327852", "0.72947776", "0.72704124", "0.7254404", "0.72341573", "0.71817356", "0.7069325", "0.7065175", "0.70478094", "0.703856...
0.70295393
22
Adds dx to x and projects onto nonegative orthant. Modifies x inplace.
def _raveled_step(x, dx, ss): for i in range(len(x)): x[i] = np.maximum(x[i] - ss * dx[i], 0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orth_left(self, n):\n self.A[n], self.C, nC, Dr = self._mps_decompose_AC(self.A[n])\n self.normC *= nC\n self.D[n + 1] = Dr\n self.pC = n + 1", "def set_velocity_x(self):\n self.__dx *= -1", "def orthonormalize_inplace(self):\n Q = np.linalg.qr(self.components.T)[0...
[ "0.54029065", "0.5393102", "0.53596807", "0.531709", "0.5302657", "0.51897436", "0.51739675", "0.5171763", "0.5168066", "0.51651657", "0.51633316", "0.5145802", "0.51267904", "0.5125848", "0.51123387", "0.50996625", "0.5079069", "0.5048507", "0.5046948", "0.50266683", "0.5019...
0.0
-1
given an array of sorted numbers, return the len of the array after removing duplicates. Cannot use extra space. E.g remove_duplicates([2, 3, 3, 3, 6, 9, 9]) > 4
def remove_duplicates(arr): if not arr: return 0 last_unique = None ans = 0 for curr in range(len(arr)): if arr[curr] != last_unique: ans += 1 last_unique = arr[curr] return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(nums: List[int]) -> int:\n\n if not nums:\n return 0\n\n slow = 0\n for fast in range(1, len(nums)):\n # compare element with a next one in order to find a duplicate in a non-decreasing array\n # if current element is unique,\n ...
[ "0.7054584", "0.6557031", "0.65025586", "0.64530194", "0.6446219", "0.6285838", "0.61946934", "0.61217576", "0.6063203", "0.6049841", "0.6023138", "0.60101676", "0.5958672", "0.58498824", "0.5844696", "0.5808737", "0.57510465", "0.5743431", "0.57402325", "0.57100475", "0.5707...
0.7217159
0
Extract a model from its distributed containers.
def extract_model_from_parallel(model, keep_fp32_wrapper: bool = True): options = (torch.nn.parallel.DistributedDataParallel, torch.nn.DataParallel) if is_deepspeed_available(): options += (DeepSpeedEngine,) while isinstance(model, options): model = model.module if not keep_fp32_wrappe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(self):\n # just return the first model, since all replicas are the same\n return self.call_async(0, '_async_get_model').gen()", "def mount(xpu, model):\n # Unwrap the core model if necessary\n model = xpu.raw(model)\n model = xpu.move(model)\n if xpu._devic...
[ "0.5688722", "0.54218143", "0.5330874", "0.5304086", "0.5158258", "0.515126", "0.5133338", "0.5120814", "0.51146066", "0.5066321", "0.5037615", "0.5027615", "0.50150514", "0.5002548", "0.49894935", "0.4984471", "0.49471045", "0.49388418", "0.49255636", "0.492262", "0.4920862"...
0.55487835
1
Recursively merges two dictionaries.
def merge_dicts(source, destination): for key, value in source.items(): if isinstance(value, dict): node = destination.setdefault(key, {}) merge_dicts(value, node) else: destination[key] = value return destination
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dictionaries(d1, d2):\n\n if d2 is None: \n return\n\n for k, v in d2.items():\n if k not in d1:\n d1[k] = dict()\n if isinstance(v, dict):\n merge_dictionaries(d1[k], v)\n else:\n d1[k] = v", "def _merge_dicts(d1, d2):\n for key, va...
[ "0.8181976", "0.8098495", "0.80977166", "0.8016462", "0.8014323", "0.7977815", "0.7961704", "0.7961704", "0.79225457", "0.78900236", "0.7867636", "0.7813001", "0.7757917", "0.7718618", "0.7710909", "0.77047026", "0.7698717", "0.7683261", "0.7636343", "0.76229715", "0.75825846...
0.7629517
19
Return a dash definition of an HTML table for a Pandas dataframe
def make_dash_table(df): table = [] for index, row in df.iterrows(): html_row = [] for i in range(len(row)): html_row.append(html.Td([row[i]])) table.append(html.Tr(html_row)) return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dash_table(selection, df):\n\n df_subset = df.loc[df[\"NAME\"].isin(selection)]\n table = []\n\n for index, row in df_subset.iterrows():\n rows = []\n rows.append(html.Td([row[\"NAME\"]]))\n rows.append(html.Td([html.Img(src=row[\"IMG_URL\"])]))\n rows.append(html.Td([...
[ "0.7303906", "0.715068", "0.7145016", "0.71170115", "0.6868719", "0.67809016", "0.67613304", "0.6704634", "0.669976", "0.66738397", "0.6633055", "0.6612183", "0.6597025", "0.6459958", "0.64555556", "0.6449526", "0.6445133", "0.6415424", "0.6381656", "0.6372886", "0.63684595",...
0.7628653
1
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
61
Return the path of the david_data directory.
def get_data_home(data_home: str = None): if not data_home: data_home = os.environ.get( 'DAVID_DATA', os.path.join('~', 'david_data')) data_home = os.path.expanduser(data_home) if not os.path.exists(data_home): os.makedirs(data_home) return data_home
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_path():\n\treturn _paths[_DATA_DIRECTORY_KEY]", "def data_dir(self) -> Path:\n return self._data_dir", "def get_data_dir(self):\n return self.data_dir", "def get_data_directory():\n return gdc19.DATA_DIRECTORY", "def data_directory(self):\n\n return self.get_raw(\"data_...
[ "0.79911995", "0.79468125", "0.7916519", "0.7873608", "0.78342336", "0.78231156", "0.7801691", "0.7751921", "0.77319187", "0.7721735", "0.7721735", "0.7707022", "0.770389", "0.7679155", "0.76777494", "0.7573083", "0.75606763", "0.7557315", "0.75190115", "0.7475164", "0.747035...
0.6772123
57
Generate random string .
def generate_random_string(prefix="", suffix="", size=20): import random import string left_size = size - len(prefix) - len(suffix) random_str = "" if left_size > 0: random_str = ''.join( random.choice(string.ascii_uppercase + string.digits) for _ in ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def r...
[ "0.8635078", "0.84493166", "0.83262223", "0.8009337", "0.7946448", "0.79347456", "0.7920454", "0.7918671", "0.7908916", "0.7867601", "0.78303945", "0.7795594", "0.77655584", "0.7758686", "0.7748804", "0.77403396", "0.77213657", "0.7694533", "0.76429945", "0.76317865", "0.7601...
0.0
-1
return the path of the project directory.
def get_project_path(): file_path = os.path.abspath(__file__) root_dir = os.path.join(os.path.dirname(file_path), "..") return os.path.abspath(root_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_dir():\n\n return Path(settings.PROJECT_DIR)", "def projectDir(self):\n logger.debug(\"Func: projectDir/getter\")\n return self._pathsDict[\"projectDir\"]", "def get_project_dir(self):\n dir_path = _paths.concat(self._gnbase, _DIRNAME_PROJECT)\n if not _os.path.is...
[ "0.86510855", "0.85523444", "0.8470787", "0.8427606", "0.8418452", "0.8261944", "0.8234983", "0.8035564", "0.7970211", "0.78705966", "0.78632295", "0.786066", "0.785521", "0.78462315", "0.7801716", "0.7801716", "0.7746228", "0.7746228", "0.7746228", "0.7746228", "0.7703054", ...
0.8299746
5
Verify two json are equal.
def verify_json(steps, expected_response, response): try: assert expected_response.items() <= response.items() steps.get_last_step().set_status(Status.PASSED) except AssertionError as e: message = constant.JSON_INCORRECT.format(str(e)) steps.get_last_step().set_status(Status.FAIL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_json(json1, json2):\r\n return JsonType.eq(json1, json2)", "def compare_json(js1, js2):\n return js1.items() <= js2.items()", "def compare_json_to_json(json1, json2): # , json_object, filters):\n return ordered(json1) == ordered(json2)", "def __eq__(self, other) -> bool:\n if jso...
[ "0.8282562", "0.7734557", "0.7525242", "0.73088014", "0.7283516", "0.72751945", "0.712147", "0.6985986", "0.6859054", "0.68366945", "0.67452747", "0.67416406", "0.665583", "0.6633823", "0.6633293", "0.6632718", "0.6615652", "0.65889376", "0.6576137", "0.6561503", "0.6551756",...
0.61074436
57
Return a pairwise json that gotten from wallet.
def create_gotten_pairwise_json(my_did: str = None, metadata=None) -> dict: result = {} if my_did is not None: result['my_did'] = my_did if metadata is not None: result['metadata'] = metadata return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_wallets2(mnemonic, coin, numderive):\n command = 'php hd-wallet-derive/hd-wallet-derive.php -g --mnemonic={mnemonic} --cols=path,address,privkey,pubkey --format=json --coin=“{coin}” --numderive= 2'\n p = subprocess.Popen(command2, stdout=subprocess.PIPE, shell=True)\n (output, err) = p.communi...
[ "0.59901667", "0.5804148", "0.5752912", "0.5666241", "0.56342757", "0.56247604", "0.5562812", "0.55311173", "0.55222476", "0.5477982", "0.54693055", "0.5428445", "0.5361837", "0.5285944", "0.52683496", "0.52585196", "0.52457124", "0.52359855", "0.52246886", "0.51950514", "0.5...
0.5196326
19
Calculates entropy in probability distribution P.
def entropy(P): P_nan = P.copy() P_nan[P_nan == 0] = np.nan return np.nansum(np.multiply(P_nan, np.log2(1 / P_nan)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy_py(p):\n return 2 ** np.sum(-p*np.log2(p+1e-10))", "def entropy(p):\n assert (p >= 0).all()\n assert abs(np.sum(p)-1) < 1e-6\n return -np.sum(p*np.log(p+1e-12))", "def entropy_(P):\n res = 0.0\n\n mask = P != 0.0 # avoid 0 in log\n f = lambda x: x*np.log2(x)\n # map-reduce s...
[ "0.8536388", "0.8431395", "0.82184947", "0.8098491", "0.80688846", "0.78975147", "0.7886234", "0.78607935", "0.7854597", "0.7843047", "0.78367263", "0.7820612", "0.7577854", "0.75214887", "0.74972475", "0.7486658", "0.74641824", "0.74573493", "0.7433797", "0.7383558", "0.7375...
0.8298413
2
Calculates conditional entropy in joint probability distribution P.
def conditional_entropy(P): P_nan = P.copy() P_nan[P_nan == 0] = np.nan marginals = np.nansum(P_nan, axis=1) P_cond = P_nan / marginals[:, None] return np.nansum(np.multiply(P_nan, np.log2(1 / P_cond)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cond_entropy(joint_prob, cond_prob):\n # Computing log2(P cond)\n log2_p = (np.ma.log2(cond_prob)).filled(0)\n # Multipling element wise the arrays\n prod_entropy = np.multiply(joint_prob, log2_p)\n # Getting the - sum of the resulting array.\n H = -( np.sum(prod_entropy))\n return H", "...
[ "0.81030995", "0.779996", "0.75139546", "0.72964513", "0.7284838", "0.7206772", "0.7110792", "0.7035106", "0.6981679", "0.6935873", "0.6905336", "0.6887118", "0.68439007", "0.6809565", "0.67182827", "0.6695674", "0.66748357", "0.6630083", "0.66291535", "0.6533243", "0.6531881...
0.791429
1
If we have selected a new logo, it will be changed the logo name in site_properties
def changeLogoName(self): new_logo = self.request.form.get('image_selected') portal_properties = getToolByName(self.context, 'portal_properties') site_properties = getattr(portal_properties, 'site_properties') if site_properties.hasProperty('logo_name'): site_properties.manag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo_image(self):\n return self.company_logo or \"upload/default_avatar.gif\"", "def logo(self, logo: str):\n\n self._logo = logo", "def setHRLogo(self,**kwargs):\n self.baxter.display.setImage(self.baxter.datapath + \"logo1024.jpg\")", "def test_logo(self):\n key = api.portal...
[ "0.6627549", "0.6627545", "0.6222198", "0.60418296", "0.5943676", "0.59340596", "0.59340596", "0.59340596", "0.59340596", "0.58221424", "0.58221424", "0.58139145", "0.5722555", "0.5717571", "0.5662804", "0.56527275", "0.56527275", "0.5647125", "0.5647009", "0.5579923", "0.552...
0.8527286
0
Add interceptor to the end of the internal list.
def append(cls, interceptor): cls._check(interceptor) cls._interceptors.append(interceptor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(cls, index, interceptor):\n cls._check(interceptor)\n cls._interceptors.insert(index, interceptor)", "def addInterceptions(self, number):\n self.interceptions += number\n self.ssp += (number * __SSP_INTERCEPTION__)", "def add_observer(self, observer):\n if observer...
[ "0.6123669", "0.55338955", "0.5289747", "0.5277503", "0.52753854", "0.524498", "0.5219246", "0.51981825", "0.518592", "0.5177225", "0.51431936", "0.5142524", "0.51294285", "0.51110685", "0.510856", "0.5094091", "0.50867295", "0.5083817", "0.5081685", "0.5078884", "0.5063323",...
0.7966266
0
Add interceptor to the given index in the internal list.
def insert(cls, index, interceptor): cls._check(interceptor) cls._interceptors.insert(index, interceptor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(cls, interceptor):\n cls._check(interceptor)\n cls._interceptors.append(interceptor)", "def add_index(self, index):\n self.add_index_sig(IndexSignature.from_index(index))", "def add_index(self, index):\n self.add_index_sig(IndexSignature.from_index(index))", "def insert...
[ "0.6558803", "0.62259084", "0.62259084", "0.60555005", "0.5966407", "0.59287256", "0.59138817", "0.59138817", "0.59070206", "0.582478", "0.578067", "0.57742923", "0.576577", "0.5763571", "0.5726408", "0.57096267", "0.5688677", "0.5653646", "0.56492966", "0.56247634", "0.56200...
0.80589885
0