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
App is in testing config (test_basics.AppTest)
def test_app_is_testing(self): self.assertTrue(current_app.config['TESTING'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config(app):\n assert app.testing", "def test_config():\n assert not create_app().testing\n assert create_app(TestConfig).testing", "def test_config():\n assert not sample.create_app().testing\n assert sample.create_app({\"TESTING\": True}).testing", "def test_app_is_testing(self):\n ...
[ "0.8668405", "0.85153544", "0.8505037", "0.8208351", "0.8200938", "0.81275815", "0.76655614", "0.7630378", "0.75359917", "0.74892235", "0.745675", "0.745582", "0.74472284", "0.7415486", "0.73453236", "0.72559136", "0.72388124", "0.72212666", "0.7210432", "0.7203444", "0.71951...
0.86457294
2
Return True if the backend graph is directed. The Gremlinbacked datastore is always directed.
def is_directed(self) -> bool: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_directed(self):\n return self.G.is_directed()", "def is_directed(self):\n return self.graph_properties.directed", "def is_directed(self) -> bool:\n return self._directed", "def is_directed(G):\n return G.is_directed()", "def is_directed(self):\n return True", "def is...
[ "0.79627573", "0.78262556", "0.7661164", "0.75749224", "0.7518689", "0.746787", "0.746787", "0.7348088", "0.7265645", "0.7102285", "0.70416903", "0.61883163", "0.61317015", "0.5777387", "0.5670721", "0.5663669", "0.56486577", "0.5641953", "0.563757", "0.5622453", "0.5592876",...
0.7716199
2
Determine if a cached value from the given compare time is still valid
def is_study_mapping_in_sync(self, unit_id: str, compare_time: float): return compare_time > self._last_study_mapping_update_times[unit_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid(t):\n return float(t) > time.time()", "def is_cache_valid(self):\n if os.path.isfile(self.cache_filename):\n mod_time = os.path.getmtime(self.cache_filename)\n current_time = time()\n if (mod_time + self.cache_max_age) > current_time:\n return T...
[ "0.6786222", "0.6448674", "0.64324737", "0.63750684", "0.630569", "0.63012683", "0.6299927", "0.6272141", "0.6211941", "0.6175154", "0.61743593", "0.61084133", "0.6042745", "0.6010127", "0.6009563", "0.60086095", "0.6004558", "0.59777814", "0.5974766", "0.5972415", "0.5965831...
0.0
-1
Delete participant_groups by Participant Group IDs
def delete_participant_groups_by_participant_group_ids( self, participant_group_ids: List[str] = None, ) -> None: if not participant_group_ids: return None with self.table_access_condition, self._get_connection() as conn: c = conn.cursor() partic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_by_list(self, group_ids):\n path = '/members/%s/groups/remove' % self.member['member_id']\n data = {'group_ids': group_ids}\n if self.member.account.adapter.put(path, data):\n self._dict = dict(x for x in self._dict.items()\n if x[0] not in group_ids)", ...
[ "0.7311787", "0.71487516", "0.7011263", "0.68069136", "0.67244774", "0.6704495", "0.66740835", "0.6641592", "0.65757996", "0.6495186", "0.6485396", "0.64465976", "0.64452267", "0.6428455", "0.64257216", "0.6414882", "0.63549817", "0.6336999", "0.6336016", "0.632371", "0.62640...
0.79611284
0
Duration of current playing media in seconds.
def media_duration(self): # The lovelace app loops media to prevent timing out, don't show that if self.app_id == CAST_APP_ID_HOMEASSISTANT_LOVELACE: return None media_status = self._media_status()[0] return media_status.duration if media_status else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_duration(self):\n return self._table.active_track_total_time.total_seconds()", "def media_duration(self):\n if (self._playing_localfile or self._playing_spotify or self._slave_mode or self._playing_mediabrowser or self._playing_mass) and self._state != STATE_UNAVAILABLE:\n retu...
[ "0.84306645", "0.8335323", "0.83195865", "0.82777256", "0.82241994", "0.822305", "0.7930684", "0.7795198", "0.7728614", "0.76679045", "0.7623727", "0.7617457", "0.751701", "0.75141466", "0.74585915", "0.7447879", "0.7447879", "0.7447879", "0.7447879", "0.7447879", "0.7447879"...
0.8074582
6
Artist of current playing media (Music track only).
def media_artist(self): media_status = self._media_status()[0] return media_status.artist if media_status else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_artist(self):\n return self._state.get(\"artist\", None)", "def media_artist(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.Artists", "def media_artist(self):\n return self._media_artist", "def media_artist(self):\n return self._media_artis...
[ "0.86874646", "0.85988027", "0.8364579", "0.8364579", "0.8197227", "0.81845474", "0.7796168", "0.7759904", "0.7709477", "0.7638341", "0.76134145", "0.7604214", "0.7216594", "0.70622", "0.69644237", "0.664528", "0.6623426", "0.6593583", "0.6548443", "0.6520028", "0.6481482", ...
0.85100645
2
Album artist of current playing media (Music track only).
def media_album_artist(self): media_status = self._media_status()[0] return media_status.album_artist if media_status else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_album_artist(self):\n return self._media_album_artist", "def get_album_artist(self) -> Optional[str]:\n return self.album_artist", "def media_artist(self):\n return self._state.get(\"artist\", None)", "def media_album_name(self):\n return self.coordinator.data.nowplaying...
[ "0.81840837", "0.7835972", "0.7712547", "0.7702581", "0.7554247", "0.7536851", "0.7434496", "0.72885025", "0.72885025", "0.7223202", "0.7175744", "0.7165362", "0.71355593", "0.71222913", "0.7099083", "0.7094133", "0.6977519", "0.69404376", "0.68596905", "0.6855399", "0.685407...
0.84469926
0
Episode of current playing media (TV Show only).
def media_episode(self): media_status = self._media_status()[0] return media_status.episode if media_status else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActiveEpisode():\n active_flights = ACTIVE_FLIGHT_MODEL.get().objects.all()\n for active in active_flights:\n if active.flight.group:\n try:\n episode = getClassByName(settings.XGDS_VIDEO_GET_EPISODE_FROM_NAME)(active.flight.group.name)\n return episode\...
[ "0.6934281", "0.6746794", "0.6712165", "0.6654626", "0.6633293", "0.6572893", "0.64877284", "0.62584066", "0.61310756", "0.6034781", "0.6034651", "0.5998257", "0.59886754", "0.5972742", "0.59479594", "0.59300554", "0.5926739", "0.5904139", "0.58850104", "0.58233595", "0.58165...
0.8226775
0
Name of the current running app.
def app_name(self): return self._chromecast.app_display_name if self._chromecast else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_name(self) -> str:\n return self._app_name", "def app_name(self):\n return self._app_name", "def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")", "def get_name():\n return config.APP_NAME", "def app_name(self): # pylint:disable=funct...
[ "0.8613469", "0.8589207", "0.84504217", "0.83667713", "0.8312501", "0.82835007", "0.8204041", "0.8153177", "0.8153177", "0.8016665", "0.8007741", "0.79585636", "0.7892773", "0.7882123", "0.78177106", "0.77182496", "0.77128357", "0.7517927", "0.74986947", "0.74986947", "0.7498...
0.729358
27
Method that tests unsucceeded `create` method of Suggested Topic class object.
def test_suggested_topic_none_create(self): owner = CustomUser.objects.get(id=301) created_suggested_topic = SuggestedTopics.create(owner=owner, name='name', description=None) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_suggested_topic_success_create(self):\n owner = CustomUser.objects.get(id=301)\n created_suggested_topic = SuggestedTopics.create(owner=owner,\n name='name',\n description = 'descr...
[ "0.81488794", "0.6388328", "0.630519", "0.62200063", "0.61642885", "0.5938463", "0.58879864", "0.5836021", "0.5724208", "0.5717265", "0.5694818", "0.5686947", "0.56767154", "0.5663233", "0.56482834", "0.5613224", "0.5601721", "0.5600852", "0.5573624", "0.5564065", "0.55499464...
0.8154706
0
Method that tests 'get_all' method of SuggestedTopics class object.
def test_suggested_topic_get_all(self): with mock.patch('suggestedtopics.models.cache') as mock_cache: with mock.patch('suggestedtopics.models.pickle') as mock_pickle: mock_cache. __contains__.return_value = True mock_pickle.load.return_value = True a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_suggested_topic_get_all_not(self):\n expected_suggested_topic = SuggestedTopics.objects.all()\n actual_suggested_topic = SuggestedTopics.get_all()\n\n self.assertEqual(list(expected_suggested_topic), list(actual_suggested_topic))", "def test_get_topics(self):\n\n for m in sel...
[ "0.7913183", "0.64284724", "0.62716407", "0.5990252", "0.5962689", "0.5945319", "0.5941812", "0.5759044", "0.5701067", "0.56907225", "0.56774795", "0.5657713", "0.55916345", "0.5575331", "0.5572797", "0.55670506", "0.5543632", "0.5538378", "0.549383", "0.54784185", "0.5475497...
0.7623733
1
Method that tests 'get_all' method of SuggestedTopics class object.
def test_suggested_topic_get_all_not(self): expected_suggested_topic = SuggestedTopics.objects.all() actual_suggested_topic = SuggestedTopics.get_all() self.assertEqual(list(expected_suggested_topic), list(actual_suggested_topic))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_suggested_topic_get_all(self):\n with mock.patch('suggestedtopics.models.cache') as mock_cache:\n with mock.patch('suggestedtopics.models.pickle') as mock_pickle:\n mock_cache. __contains__.return_value = True\n mock_pickle.load.return_value = True\n\n ...
[ "0.76230043", "0.64270616", "0.6270716", "0.59887433", "0.5960977", "0.59443295", "0.5941821", "0.57601297", "0.57004356", "0.56896794", "0.5676449", "0.5658479", "0.55895734", "0.5574232", "0.5572608", "0.5566461", "0.55438894", "0.5538875", "0.5493661", "0.5479861", "0.5475...
0.79119927
0
Number of profiles in this Profiles object.
def Nprofiles(self): return self._nprofiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def people_count(self):\n return len(self.__users)", "def profiles(self):\n if not self._profiles:\n self.GetAllProfiles()\n return self._profiles", "def profiles(self):\n return self._profiles", "def profiles(self):\n return self._profiles", "def get_num_processes(profileDi...
[ "0.7029895", "0.6642839", "0.6615187", "0.6615187", "0.6601933", "0.6480705", "0.62588745", "0.62426597", "0.62356067", "0.6223385", "0.61923814", "0.6177046", "0.6174073", "0.61656374", "0.6163472", "0.6158623", "0.6132954", "0.6132809", "0.6125924", "0.61203516", "0.6095080...
0.8791688
0
Uses the class attribute Emailer._config to connect to SMTP client.
def _login(self): self._smtp = smtplib.SMTP(host=self._config.host, port=self._config.port) # send 'hello' to SMTP server self._smtp.ehlo() # start TLS encryption self._smtp.starttls() self._smtp.login(self._config.sender_email, self._con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_smtp():\n print(\"INFO: Setting up SMTP variables...\")\n conf = ConfigParser()\n conf.read(os.path.join(os.path.abspath(\n os.path.dirname(__file__)), '.', 'smtp.conf'))\n smtp = {\n \"server\": conf.get('smtp', 'smtp_server'),\n \"login\": conf.get('smtp', 'smtp_login')...
[ "0.7072876", "0.69906664", "0.67638105", "0.6386244", "0.6318851", "0.6307825", "0.62603664", "0.6239821", "0.6209453", "0.59868085", "0.59112954", "0.582289", "0.57935023", "0.5718859", "0.56930685", "0.5673814", "0.56400454", "0.5622428", "0.5608501", "0.5579572", "0.553708...
0.59974766
9
Generate a neatly formatted full name.
def get_formatted_name(first,last,middle = ''): if middle: full_name = first + ' ' + middle + ' ' + last else: full_name = first + ' ' + last return full_name.title()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_name(self):\n\t\tself.full_name = self.first + \" \" + self.last", "def full_name(self) -> str:\r\n\t\tname = f'{self.last_name} {self.first_name}'\r\n\t\tif self.middle_name:\r\n\t\t\tname += ' ' + self.middle_name\r\n\t\treturn name", "def get_formatted_name(first, last):\n full_name = f'{first...
[ "0.84015906", "0.8262383", "0.8231049", "0.8229208", "0.8199836", "0.8191048", "0.8168978", "0.81436765", "0.8132338", "0.81308675", "0.8123386", "0.80716896", "0.80716896", "0.80716896", "0.80230886", "0.80207074", "0.8016316", "0.79988605", "0.79969", "0.79969", "0.79969", ...
0.76526946
87
Returns true if track labels have already been assigned to a given frame
def labels_exist(self, frame_num): return self._frame_labels[frame_num] is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_label(self, label):\n return label in self.get_labels()", "def has_label(self, label):\n\t\treturn label in self.labels", "def has_label(self, label):\n\t\t\treturn label in self.labels", "def has_label(self, label):\n return label == self.label", "def has_label(self, label):\n ret...
[ "0.6462645", "0.64227855", "0.6422614", "0.6338353", "0.62672585", "0.61824983", "0.60186857", "0.5974276", "0.5969538", "0.58716065", "0.58103716", "0.57967025", "0.5790005", "0.5789058", "0.5760368", "0.5760037", "0.5759478", "0.5759478", "0.5738486", "0.5736193", "0.571848...
0.69120014
0
This function calculates qn values by constructing a list of q values starting from q0 up to qn, and returning the last one
def prob_list(n, p): ... #pn is the probability of seeing a pair of aces two hands in a row in n hands. #qn = 1 - pn #thus qn is the probability of NOT seeing a par of aces two hands in a row in n hands. list = [] qn_a = 1 qn_b = 1 list.append(qn_a) list.append(qn_b) for i in range(n-2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_quad(q):\n return [q[1], q[0], q[3], q[2]]", "def find_z(q):\n z = np.zeros(len(q) - 1, int)\n for i in range(len(q) - 1):\n z[i] = np.ceil(q[i]/2 + q[i+1]/2) # formula from class\n return np.concatenate([[0], z, [BITS-1]])", "def _interpolate_Q(Q, dQ, n):\n if n > 0:\n ...
[ "0.66430557", "0.6498868", "0.6292246", "0.62038547", "0.61917627", "0.60583544", "0.60085726", "0.5942998", "0.59386873", "0.5937982", "0.59218794", "0.5878637", "0.58481634", "0.5837961", "0.5837881", "0.58155376", "0.58154905", "0.5802288", "0.5796448", "0.57915133", "0.57...
0.60844547
5
Takes a list of float values and creates a padded torch.Tensor.
def forward(self, v: TorchscriptPreprocessingInput) -> torch.Tensor: if torch.jit.isinstance(v, List[torch.Tensor]): return self.forward_list_of_tensors(v) if torch.jit.isinstance(v, List[str]): return self.forward_list_of_strs(v) raise ValueError(f"Unsupported input: {v}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_list(xs: torch.Tensor, pad_value: int):\n n_batch = len(xs)\n max_len = max(x.size(0) for x in xs)\n pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)\n\n for i in range(n_batch):\n pad[i, : xs[i].size(0)] = xs[i]\n\n return pad", "def pad_lists(lists, pad_int, p...
[ "0.7406693", "0.70428735", "0.6466515", "0.6323249", "0.62024957", "0.60464835", "0.60222167", "0.6001368", "0.59981996", "0.59465325", "0.5926647", "0.5863943", "0.58620673", "0.5842579", "0.5789935", "0.5789883", "0.57518977", "0.5749336", "0.5729196", "0.5676192", "0.56408...
0.0
-1
Returns a config value
def __getitem__(self, key: str) -> Any: return self.variables[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def value(self) -> str:\n return self._config.get('value')", "def _get_config_value(self, section, key):\n return config.get(section, key)", "def config_value(name):\n ...
[ "0.83533496", "0.80241734", "0.79516804", "0.772929", "0.7663415", "0.7605796", "0.75783", "0.7518339", "0.747167", "0.74433523", "0.7403487", "0.7380993", "0.7370448", "0.7341626", "0.7287305", "0.7253601", "0.72316563", "0.72029024", "0.7199229", "0.7188936", "0.7181148", ...
0.0
-1
Returns the current config variable
def get_config() -> Optional[Config]: return CurrentConfig.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n return self.namespace['config']", "def config(self):\n return self[CONFIG_KEY]", "def config(self):\n return CurrentProject().config.config[self.key]", "def get_config_var(name):\n return get_config_vars().get(name)", "def _get_config(self):\n return self.__config...
[ "0.7465803", "0.7437359", "0.738738", "0.73662037", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", ...
0.6623554
93
Load requirements from a pip requirements file.
def parse_requirements(filename): try: lineiter = (line.strip() for line in open(filename)) return [line for line in lineiter if line and not line.startswith("#")] except OSError: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements_from_pipfile():\n lineiter = (line.strip() for line in open('Pipfile'))\n requirements_pipfile_style = [line for line in lineiter]\n start_index = requirements_pipfile_style.index('[packages]') + 1\n end_index = requirements_pipfile_style.index('[requires]') - 1\n requirements...
[ "0.7140471", "0.69411206", "0.6918211", "0.6898259", "0.6884532", "0.6796581", "0.67297643", "0.6702323", "0.6694401", "0.6694401", "0.6565847", "0.65304285", "0.6509914", "0.6489069", "0.6451843", "0.63243556", "0.63096094", "0.6305995", "0.6304723", "0.6291954", "0.6272886"...
0.0
-1
Returns the given HTML with all tags stripped. This is a copy of django.utils.html.strip_tags, except that it adds some whitespace in between replaced tags to make sure words are not erroneously concatenated.
def _strip_tags(value): return re.sub(r'<[^>]*?>', ' ', force_unicode(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},...
[ "0.81393677", "0.81104815", "0.79820424", "0.7756733", "0.7708477", "0.76916313", "0.7668854", "0.75973123", "0.75973123", "0.75871766", "0.75851536", "0.7555502", "0.7548902", "0.7544044", "0.75279355", "0.7509415", "0.74946666", "0.74862015", "0.74829584", "0.74829584", "0....
0.67829764
53
Test creation of product in db
def test_create_product(self): obj1 = Product.objects.first() obj2 = Product.objects.last() expected_str1 = f"{obj1.code} -- {obj1.name} -- " \ f"{obj1.schedule} -- {obj1.spl}" self.assertEqual(str(obj1), expected_str1) self.assertNotEqual(str(obj2), expected_str1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_create(self):\n self._create_model(\"product\", self.product_data, [\"name\", \"description\", \"image_link\", \"price\"])", "def test_create(self):\n self.assertEqual(Product.objects.count(), 2)\n payload = {\n 'name': 'New product',\n 'category': self...
[ "0.84601223", "0.8094423", "0.8065334", "0.79718393", "0.7751315", "0.77269304", "0.7685652", "0.7644878", "0.7614808", "0.7580474", "0.74933785", "0.7444505", "0.74412197", "0.7417311", "0.74115133", "0.7408773", "0.73953843", "0.73321605", "0.73079616", "0.7274021", "0.7238...
0.74196386
13
Tokenize the EnglishFrench dataset.
def tokenize_nmt(text, num_examples=None): source, target = [], [] for i, line in enumerate(text.split('\n')): if num_examples and i > num_examples: break parts = line.split('\t') if len(parts) == 2: source.append(parts[0].split(' ')) target.append(par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized", "def tokenize(text):\n #Clean data, remove all character except character and number,such as punctuation etc.\n text = re.sub(r'[^a-zA-Z0...
[ "0.64626545", "0.6432136", "0.63859737", "0.63650376", "0.6340642", "0.6323382", "0.62788206", "0.61670893", "0.6163081", "0.6136805", "0.6135087", "0.61167455", "0.61159277", "0.60797167", "0.6076323", "0.6063401", "0.60584503", "0.60016334", "0.59698486", "0.5962869", "0.59...
0.0
-1
Return the iterator and the vocabularies of the translation dataset.
def load_data_nmt(batch_size, num_steps, num_examples=600): text = preprocess_nmt(read_data_nmt()) source, target = tokenize_nmt(text, num_examples) src_vocab = Vocab(source, min_freq=2, reserved_tokens=['<pad>', '<bos>', '<eos>']) tgt_vocab = Vocab(target, min_freq=2, reserved...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vocab(self):\n\n\t\tself.parse_transcript() \n\t\tself.purge_words()\n\t\tself.analyze_words()\n\t\tself.sort_word_analysis()", "def gen_data(self):\n\n # 1,read the source text\n inputs, labels = self.read_data()\n print(\"read finished\")\n\n # 2. word label index\n w...
[ "0.66708165", "0.62934643", "0.6140089", "0.6073963", "0.6058157", "0.60472083", "0.60271215", "0.5885215", "0.5861043", "0.5831339", "0.57146364", "0.5694714", "0.5667509", "0.5655051", "0.5632006", "0.56251043", "0.5623835", "0.5607366", "0.5568643", "0.55617714", "0.555515...
0.0
-1
Perform softmax operation by masking elements on the last axis.
def masked_softmax(X, valid_lens): # `X`: 3D tensor, `valid_lens`: 1D or 2D tensor if valid_lens is None: return nn.functional.softmax(X, dim=-1) else: shape = X.shape if valid_lens.dim() == 1: valid_lens = torch.repeat_interleave(valid_lens, shape[1]) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\r\n e_x = np.exp(x - np.expand_dims(np.max(x, axis=-1), axis=-1))\r\n return e_x / np.expand_dims(e_x.sum(axis=-1), axis=-1) # only difference\r", "def softmax(x):\n orig_shape = x.shape\n\n if len(x.shape) > 1:\n # Matrix\n tmp = np.max(x, axis=1)\n x -= tmp.resh...
[ "0.7728093", "0.76540774", "0.755771", "0.7533926", "0.74397534", "0.7415308", "0.73890746", "0.7380633", "0.73651373", "0.7327089", "0.730505", "0.730505", "0.7289658", "0.72878665", "0.7286687", "0.72709596", "0.72696495", "0.726443", "0.72391045", "0.72330284", "0.72330284...
0.0
-1
Return the sum of time.
def sum(self): return sum(self.times)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self):\n\n return time_stat(self, stat=\"sum\")", "def getTotalTime(self):\n with self.lock:\n if self.tend == 0:\n total = -1\n else:\n total = self.tend - self.tstart\n return total", "def total_time(self):\n obs_times = self...
[ "0.771545", "0.7003199", "0.69464904", "0.69291514", "0.68037593", "0.6803497", "0.66858596", "0.6638962", "0.66272086", "0.6532529", "0.64491063", "0.6448546", "0.64167005", "0.6415029", "0.63799405", "0.63728005", "0.6360416", "0.63578796", "0.63459677", "0.6345115", "0.632...
0.7676582
3
Download and extract a zip/tar file.
def download_extract(name, folder=None): fname = download(name) base_dir = os.path.dirname(fname) data_dir, ext = os.path.splitext(fname) if ext == '.zip': fp = zipfile.ZipFile(fname, 'r') elif ext in ('.tar', '.gz'): fp = tarfile.open(fname, 'r') else: assert False, 'Onl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_unzip(url, extract_to='.'):\n http_response = urlopen(url)\n zipfile = ZipFile(BytesIO(http_response.read()))\n zipfile.extractall(path=extract_to)", "def download():\n response = requests.get(URL, stream=True)\n\n file = open(FILE_NAME, 'wb')\n file.write(response.content)\n\n...
[ "0.77640665", "0.75466156", "0.7488906", "0.74230695", "0.74208057", "0.74110913", "0.7349301", "0.7332468", "0.73241496", "0.73225963", "0.7294297", "0.72637457", "0.7244374", "0.7242405", "0.72403973", "0.7215931", "0.71965367", "0.71807736", "0.7064334", "0.7055785", "0.70...
0.7105519
18
Split text lines into word or character tokens.
def tokenize(lines, token='word'): if token == 'word': return [line.split() for line in lines] elif token == 'char': return [list(line) for line in lines] else: print('ERROR: unknown token type: ' + token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return text.split(' ')", "def tokenize_wordchars(lines):\n return", "def tokenize(self, text: str) -> ['token']:\n # project2: takes a str to tokenize instead of a text file\n tokens = []\n word = ''\n for char in text:\n # read one char at a time...
[ "0.7567518", "0.74264103", "0.74043775", "0.72504884", "0.71198", "0.7098041", "0.7047674", "0.70413697", "0.7035768", "0.701771", "0.69855034", "0.69731724", "0.69402796", "0.69257873", "0.6905738", "0.69048613", "0.6899457", "0.6895861", "0.6894406", "0.689058", "0.68888366...
0.73633885
3
action_scores of shape (batch, num_action_cands) action_mask of shape (batch, num_action_cands)
def select_max_q( action_scores: torch.Tensor, action_mask: torch.Tensor ) -> torch.Tensor: # we want to select only from the unmasked actions # if we naively take the argmax, masked actions would # be picked over actions with negative scores if there are no # actions with po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_scores(self, board):\n return self._dqn(self.get_dqn_state(board))[0].detach().numpy()", "def action_mask_from_obs(observations):\r\n if observations is None:\r\n return []\r\n if type(observations) == list:\r\n obs = np.array(observations)\r\n elif type(observations) != ...
[ "0.6208378", "0.59804124", "0.5917529", "0.58936703", "0.57873505", "0.572659", "0.5675336", "0.5633573", "0.5620895", "0.5590206", "0.5586422", "0.55637527", "0.5549526", "0.5499729", "0.5492791", "0.5470186", "0.5447316", "0.5443749", "0.54360235", "0.5434696", "0.54285395"...
0.5836872
4
Returns the call/put price corresponding the implied vol at strike K
def option_price(self, K, payoff='Call'): return self.IV.price_from_vol(self.smile_func(K), self.f, K, self.T_expiry, payoff=payoff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_from_vol( self, vol ):\n if self._vol_type == \"LogNormal\":\n S = self._deal_terms[ \"underlyer\" ].spot_value\n K = self._deal_terms[ \"payoff\" ].payoff_terms[ \"strike\" ]\n time_to_mat = self._deal_terms[ \"maturity\" ] - self._pricing_date...
[ "0.74730724", "0.72675455", "0.70773613", "0.70316756", "0.6866724", "0.6865428", "0.67700785", "0.6473597", "0.64252746", "0.63514227", "0.634056", "0.6305643", "0.63045806", "0.6284474", "0.61870676", "0.6160804", "0.6160804", "0.6160804", "0.61449486", "0.6058198", "0.6036...
0.7444923
1
Probability density function of the underlyer, derived by differentiating twice the model implied call prices with respect to the strike.
def pdf(self, K): return derivative(partial(self.option_price, payoff='Call'), K, dx=ONE_BP/10, n=2, order=3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pred_prob(hp, ss, y):\n K = len(ss['counts'])\n N = sum(ss['counts'])\n assert y >= 0 and y <= K\n if y < K:\n return log((ss['counts'][y] - hp['d']) / (hp['alpha'] + N))\n elif y == K:\n return log((hp['alpha'] + hp['d'] * K) / (hp['alpha'] + N))", "def __density(self, x):\n\n ...
[ "0.6059916", "0.6055147", "0.6046978", "0.59971094", "0.5987896", "0.598393", "0.5967974", "0.5934836", "0.5818869", "0.5782429", "0.57336473", "0.5710351", "0.57036066", "0.56798124", "0.5569836", "0.5547724", "0.55355376", "0.5527198", "0.5523163", "0.55132097", "0.55124503...
0.5550777
15
return a string containing the object in a pretty formated version
def format(self, obj): return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ': '))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)", "def pretty_str(self) -> str:\n ...", "def to_str(self):\n return pprint.pformat(self.to_dict())", "def pretty_string(self):\n return self._tree.toStringPret...
[ "0.807015", "0.80332047", "0.76868", "0.76223564", "0.75916594", "0.756914", "0.756914", "0.7537861", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0.7513253", "0....
0.0
-1
return a list of concept classes that match the given prefix
def suggestConceptClasses(self, prefix: str, lang: str = "eng", conceptLang: str = "eng", source: Union[str, List[str]] = ["dbpedia", "custom"], page: int = 1, count: int = 20, returnInfo: ReturnInfo = ReturnInfo(), **kwargs): assert page > 0, "page parameter should be above 0" params = { "prefix": pref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_start_with_prefix(self, prefix: str) -> List[str]:\n if not self.starts_with(prefix):\n return []\n if self.search(prefix):\n return [prefix]\n\n curr = self.root\n for ch in prefix:\n curr = curr.children.get(ch)\n ...
[ "0.63769776", "0.6048061", "0.60433567", "0.587656", "0.583887", "0.57681125", "0.57679045", "0.5767587", "0.5692277", "0.5622705", "0.5620777", "0.55592585", "0.5542315", "0.5525467", "0.5497741", "0.5459923", "0.5453932", "0.54335916", "0.53916717", "0.53893685", "0.5383738...
0.5906344
3
return the URI of the source group that best matches the name
def getSourceGroupUri(self, sourceGroupName: str): matches = self.suggestSourceGroups(sourceGroupName) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURI(self, *args):\n return _libsbml.GroupsExtension_getURI(self, *args)", "def _source(self, namespace):\n if not namespace:\n source = self._default_source\n else:\n source = self._sources.get(namespace)\n if not source:\n raise GroupResolverSo...
[ "0.62811434", "0.6188032", "0.6106267", "0.5954231", "0.58817136", "0.58752364", "0.5858591", "0.580521", "0.57376444", "0.56671643", "0.56523913", "0.56210285", "0.55978084", "0.55902463", "0.55665797", "0.5522302", "0.55100167", "0.54542893", "0.54542893", "0.54542893", "0....
0.7802163
0
return event type uri that is the best match for the given label
def getEventTypeUri(self, eventTypeLabel: str): matches = self.suggestEventTypes(eventTypeLabel) if matches is not None and isinstance(matches, list) and len(matches) > 0 and "uri" in matches[0]: return matches[0]["uri"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCategoryUri(self, categoryLabel: str):\n matches = self.suggestCategories(categoryLabel)\n if matches != None and isinstance(matches, list) and len(matches) > 0 and \"uri\" in matches[0]:\n return matches[0][\"uri\"]\n return None", "def get_type_label(type_url):\n retur...
[ "0.5890905", "0.5888158", "0.5736647", "0.57230157", "0.57189935", "0.56664103", "0.5650868", "0.5550143", "0.5519739", "0.54728514", "0.5453214", "0.5382518", "0.53772074", "0.533073", "0.5309743", "0.52296954", "0.51811314", "0.5180448", "0.5166474", "0.51578933", "0.514757...
0.7921001
0
Function returns a reduced Term object
def reduce_bits(nums): num1, num2 = nums result = "" for index, bit in enumerate(num1): result += bit if bit == num2[index] else '-' return Term(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args, **kw):\n return self.transform(Term.__call__(self, *args, **kw))", "def __call__(self, *args: TermLike) -> 'Term':\n return Term(self, args)", "def _get_term(self):\n return self.__term", "def _get_term(self):\n return self.__term", "def _get_term(self):\n r...
[ "0.6299694", "0.6096665", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5878431", "0.5758068", "0.56476766", "0.55836403", "0.5566976", "0.5552307", "0.55443543", "0.553262", "0.5525708", "0.55073017", "0.5463503", ...
0.0
-1
Function uses itertools.combinations to generate possible permutations of minterms and xterms
def get_pairs(terms): return itertools.combinations(terms, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(xs):\n if not xs:\n yield []\n else:\n for x, xs in selections(xs):\n for ys in permutations(xs):\n yield [x] + ys", "def get_combinations(self):\n all_steps = self.do_steps()\n self.option = [k for k, v in all_steps.items()]\n r...
[ "0.63869417", "0.62922204", "0.6280528", "0.60896415", "0.60720867", "0.6060668", "0.6060022", "0.6006552", "0.5943192", "0.59218216", "0.59115046", "0.5862979", "0.586069", "0.58377963", "0.5827487", "0.5826101", "0.5818908", "0.57880336", "0.57866234", "0.576338", "0.575172...
0.6309878
1
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict, output_dict, exec_properties, executor_class_path, training_inputs, job_id) -> Dict[Text, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]],\n output_dict: Dict[Text, List[types.Artifact]],\n exec_properties: Dict[Text, Any],\n executor_class_path: Text,\n training_inputs: D...
[ "0.70724356", "0.6887883", "0.68650603", "0.6819622", "0.6720383", "0.6570948", "0.6565429", "0.65353024", "0.6483057", "0.6375926", "0.6367454", "0.63338363", "0.6326136", "0.6322333", "0.6315006", "0.629442", "0.62928957", "0.6290497", "0.6287055", "0.62419564", "0.61994785...
0.7656704
0
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], exec_properties: Dict[Text, Any], executor_class_path: Text, training_inputs: Dict[Text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass", "def get_train_args():\n d_train = cfg.get_train_args_schema().fields\n \n if num_local_gpus ...
[ "0.7657387", "0.6888748", "0.68656194", "0.682167", "0.67204", "0.6571265", "0.6566474", "0.6535822", "0.6482168", "0.63752997", "0.6367284", "0.6333624", "0.6325504", "0.6321786", "0.63143045", "0.62942094", "0.62941766", "0.6291347", "0.6287213", "0.6240908", "0.61983275", ...
0.70728606
1
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module.
def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]], output_dict: Dict[Text, List[types.Artifact]], exec_properties: Dict[Text, Any], executor_class_path: Text, training_inputs: Dict[Text,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass", "def create_training_args(self, input_dict: Dict[Text, List[types.Artifact]],\n ...
[ "0.7656112", "0.7071737", "0.68881834", "0.6817965", "0.6719776", "0.65706426", "0.6564103", "0.65336037", "0.6483007", "0.6375374", "0.6366846", "0.6333173", "0.6325439", "0.6321799", "0.63139856", "0.62937886", "0.62911975", "0.62895596", "0.6287303", "0.62421274", "0.61994...
0.6864444
3
Construct a toplevel widget with the parent MASTER.
def __init__(self, master=None, cnf={}, **kw): if kw: cnf = _cnfmerge((cnf, kw)) extra = () for wmkey in ['screen', 'class_', 'class', 'visual', 'colormap']: if wmkey in cnf: val = cnf[wmkey] # TBD: a hack needed because s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, master, _type=REGULAR, **kw):\r\n Frame.__init__(self, master, **kw)\r\n self.main_frame = Frame(self, bd=1)\r\n self.main_frame.pack()", "def __init__(self, master=None):\n\n # Use super() to inherit Frame method from superclass tk\n super().__init__(master)...
[ "0.69735175", "0.67381746", "0.669472", "0.668831", "0.6686077", "0.6609715", "0.6572637", "0.6540365", "0.6484257", "0.64818954", "0.6438975", "0.64249706", "0.6423365", "0.64200574", "0.6408428", "0.63591474", "0.6356483", "0.63561195", "0.63275886", "0.62708426", "0.626065...
0.6029286
36
testuser1 has a 'testing' subnamespace, testuser2 tries to see its permissions but fails.
def testRandomUserCannotGETRandomUserSubNamespace(self): headers = { 'accept': 'application/json', } self.addBasicAuthHeader(headers, 'testuser2', 'secret') path = defaults.sep.join([defaults.namespaceCategoryName, 'testuser1', 'testing']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_namespace_access(self, namespace, user):\n if not namespace.owners.filter(id=user.id).count():\n raise exceptions.PermissionDenied(\n 'The namespace listed on your filename must match one of '\n 'the namespaces you have access to.'\n )", "def ...
[ "0.6429766", "0.6371066", "0.6243876", "0.6156751", "0.6154213", "0.61048347", "0.6101933", "0.60836434", "0.60561347", "0.6050891", "0.6036248", "0.60299695", "0.6001029", "0.5991596", "0.59487164", "0.5943904", "0.5931206", "0.5913553", "0.5899936", "0.58955866", "0.5859986...
0.66301256
0
Plot rank1 nearest neighbor confusion matrix. Rows and columns are different ethnicitygender. The value in row x and column y is the error rate that each image of ethnicitygender x and its rank1 nearest neighbor of ethnicitygender y is not the same person
def confusion_matrix(im_paths, dir_embeddings, save_figure_path=None): data = pd.read_csv(im_paths) image_list = data["path"].to_list() feature = load_features_from_image_list(image_list, dir_embeddings, ext_feat="npy") data = get_attribute_gender_ethnicity(data, "path") data["id"] = ( data[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\...
[ "0.62481976", "0.5850511", "0.5787129", "0.57802856", "0.57566446", "0.5724097", "0.5712232", "0.57106066", "0.57067007", "0.56925535", "0.5681571", "0.5677563", "0.5672164", "0.56678575", "0.56661797", "0.56371564", "0.56120133", "0.5598198", "0.5593582", "0.5592196", "0.558...
0.5498344
34
Get the dict of all the models.
def get_modelDict(self): return self.__modelDict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_models(self):\n self.load()\n return self._models", "def models(self):\n return self.config.models()", "def get():\n\n return {'model_ids': mgmt.get_model_ids()}", "def availablemodels(self):\n return self.__models.keys()", "def models(self):\n models = []\...
[ "0.7804294", "0.76579976", "0.75055176", "0.74330866", "0.74149823", "0.7380831", "0.7361207", "0.7147118", "0.70524144", "0.701926", "0.7019033", "0.7019033", "0.69760513", "0.6950567", "0.6934331", "0.69281614", "0.6834468", "0.68259096", "0.6761999", "0.6757449", "0.674159...
0.66702574
24
True if the array is on GPU.
def _on_gpu(self) -> bool: return self._current_device_index != CPU_INDEX
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cuda(self):\n return self._tensor.is_cuda", "def is_cuda(self):\n return self.share.is_cuda", "def is_cuda(self):\n return next(self.parameters()).is_cuda", "def is_cuda(self):\n return next(self.parameters()).is_cuda", "def is_cuda(self):\n return next(self.parame...
[ "0.8066833", "0.80317914", "0.7962641", "0.7962641", "0.7962641", "0.7962641", "0.76606196", "0.7649934", "0.7581296", "0.7256203", "0.7212082", "0.71569055", "0.7072309", "0.69844073", "0.6894186", "0.6885231", "0.6819945", "0.679821", "0.6741122", "0.6666283", "0.6656444", ...
0.75827485
8
Returns the entropy of a discrete distribution p
def entropy(p): assert (p >= 0).all() assert abs(np.sum(p)-1) < 1e-6 return -np.sum(p*np.log(p+1e-12))
{ "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 P_nan = P.copy()\n P_nan[P_nan == 0] = np.nan\n return np.nansum(np.multiply(P_nan, np.log2(1 / P_nan)))", "def entropy(p: torch.Tensor):\n nz = (p > 0).to(p.device)\n\n eps = torch.finfo(p.dtype).eps\n p_sta...
[ "0.8535428", "0.8026321", "0.7933022", "0.7899416", "0.7778248", "0.7755773", "0.7616017", "0.7574335", "0.7550206", "0.75214255", "0.74680275", "0.7442331", "0.7418228", "0.73868614", "0.7344822", "0.7340159", "0.7325228", "0.7321643", "0.73122334", "0.7301384", "0.728359", ...
0.8559822
0
Extends masses array with columns of zeros for missing energies.
def extend_energies(target_energies, energies, masses): energies = list(energies) N = masses.shape[0] res = np.zeros((N, len(target_energies))) for i, energy in enumerate(target_energies): if energy not in energies: res[:, i] = np.zeros((N, )) else: res[:, i] = ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cdm_missing_columns(self, all_merged_obs):\n #cdm_keys = self.obs_table_columns \n nan_array = np.empty( all_merged_obs['observed_variable'].shape )\n nan_array[:] = np.nan\n for k in self.obs_table_columns:\n if k not in list(all_merged_obs.colu...
[ "0.5828517", "0.5681226", "0.55303085", "0.5472589", "0.54533696", "0.5409089", "0.54075205", "0.5340413", "0.5293353", "0.5269589", "0.5262647", "0.5260811", "0.5245497", "0.5217069", "0.5212759", "0.5197485", "0.5173649", "0.5173649", "0.5170683", "0.5164495", "0.5139979", ...
0.6560954
0
Calculate the Surface Area of a Cuboid. >>> surface_area_cuboid(1, 2, 3) 22 >>> surface_area_cuboid(0, 0, 0) 0 >>> surface_area_cuboid(1.6, 2.6, 3.6) 38.56 >>> surface_area_cuboid(1, 2, 3)
def surface_area_cuboid(length: float, breadth: float, height: float) -> float: if length < 0 or breadth < 0 or height < 0: raise ValueError("surface_area_cuboid() only accepts non-negative values") return 2 * ((length * breadth) + (breadth * height) + (length * height))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area_cube(side_length: float) -> float:\r\n if side_length < 0:\r\n raise ValueError(\"surface_area_cube() only accepts non-negative values\")\r\n return 6 * side_length**2", "def surface_area_of_cube(side):\n return side", "def compute_surface_area(self):\n return np.sum(sel...
[ "0.6666402", "0.64514595", "0.64180577", "0.6362404", "0.6269711", "0.6249463", "0.62020266", "0.6193033", "0.617231", "0.6169103", "0.61569345", "0.60257256", "0.60193086", "0.5955302", "0.590112", "0.5897125", "0.5896731", "0.589559", "0.58863145", "0.58802015", "0.5876737"...
0.75224274
0
Calculate the Surface Area of a Sphere.
def surface_area_sphere(radius: float) -> float: if radius < 0: raise ValueError("surface_area_sphere() only accepts non-negative values") return 4 * pi * radius**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area_hemisphere(radius: float) -> float:\r\n if radius < 0:\r\n raise ValueError(\"surface_area_hemisphere() only accepts non-negative values\")\r\n return 3 * pi * radius**2", "def sphere_area(radius : number) -> number:\n area = 4*pi*radius*radius\n return area", "def sphereAre...
[ "0.75944006", "0.7547221", "0.74640936", "0.7159024", "0.71472585", "0.66771775", "0.6609041", "0.6607308", "0.6575029", "0.6481573", "0.64479804", "0.6444091", "0.64219826", "0.6398195", "0.6333034", "0.6320497", "0.6280175", "0.6243655", "0.6232985", "0.6222155", "0.6218048...
0.77417064
0
Calculate the Surface Area of a Hemisphere.
def surface_area_hemisphere(radius: float) -> float: if radius < 0: raise ValueError("surface_area_hemisphere() only accepts non-negative values") return 3 * pi * radius**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def surface_area(DEM, resolution):\n\n resolution_squared = resolution ** 2.\n cross_distance_squared = 2.0 * (resolution ** 2.)\n\n m1 = ((DEM[0:-1, 0:-1] - DEM[0:-1, 1:]) ** 2.0 + resolution_squared) ** 0.5\n m2 ...
[ "0.72399956", "0.7046556", "0.69472444", "0.68784386", "0.67994255", "0.67446357", "0.67176634", "0.6669289", "0.6648197", "0.6646721", "0.6634711", "0.6555099", "0.6460852", "0.63712317", "0.6334383", "0.63145924", "0.63024366", "0.629782", "0.6238995", "0.62154955", "0.6206...
0.73289835
0
Calculate the Surface Area of a Cone.
def surface_area_cone(radius: float, height: float) -> float: if radius < 0 or height < 0: raise ValueError("surface_area_cone() only accepts non-negative values") return pi * radius * (radius + (height**2 + radius**2) ** 0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def surfaceArea(self):\n surfaceArea = self.sideLength**2 * 6\n return surfaceArea", "def getSurfaceArea(self) -> float:\n ...
[ "0.7281637", "0.70571977", "0.6995431", "0.69417614", "0.68043363", "0.6756402", "0.66293764", "0.66006935", "0.6541381", "0.6532924", "0.65126425", "0.6484024", "0.64582616", "0.6379687", "0.63465464", "0.63313115", "0.6306597", "0.63061565", "0.63036686", "0.6277776", "0.62...
0.6303602
19
Calculate the Surface Area of a Conical Frustum. >>> surface_area_conical_frustum(1, 2, 3) 45.511728065337266 >>> surface_area_conical_frustum(4, 5, 6) 300.7913575056268 >>> surface_area_conical_frustum(0, 0, 0) 0.0 >>> surface_area_conical_frustum(1.6, 2.6, 3.6) 78.57907060751548 >>> surface_area_conical_frustum(1, 2,...
def surface_area_conical_frustum( radius_1: float, radius_2: float, height: float ) -> float: if radius_1 < 0 or radius_2 < 0 or height < 0: raise ValueError( "surface_area_conical_frustum() only accepts non-negative values" ) slant_height = (height**2 + (radius_1 - radius...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def __CalculateArea(self, contour):\r\n return cv2.contourArea(contour)", "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def getSurfaceArea(self) -> float:\n return self.area(...
[ "0.6291956", "0.58364004", "0.5753722", "0.57246095", "0.5682314", "0.5677191", "0.5626083", "0.5558596", "0.5558541", "0.55439174", "0.55187523", "0.5473769", "0.54420286", "0.537165", "0.5346501", "0.53398824", "0.53286076", "0.5327467", "0.5319384", "0.5314725", "0.5282321...
0.61237943
1
Calculate the Surface Area of a Cylinder.
def surface_area_cylinder(radius: float, height: float) -> float: if radius < 0 or height < 0: raise ValueError("surface_area_cylinder() only accepts non-negative values") return 2 * pi * radius * (height + radius)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_area(self) -> float:\n return 4 * np.pi * self.radius**2", "def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())", "def surfaceArea(self):\n surfaceArea = self.sideLength**2 * 6\n return surfaceArea", "def cylinder_area(radius: number, height: n...
[ "0.7548897", "0.749687", "0.74844456", "0.74813986", "0.7271498", "0.72686654", "0.71798384", "0.7160601", "0.7061284", "0.7021645", "0.7017651", "0.69561744", "0.6951494", "0.6949457", "0.6934319", "0.6928398", "0.6916603", "0.6916603", "0.69163173", "0.6913666", "0.6912519"...
0.72211707
6
Calculate the Area of a Torus.
def surface_area_torus(torus_radius: float, tube_radius: float) -> float: if torus_radius < 0 or tube_radius < 0: raise ValueError("surface_area_torus() only accepts non-negative values") if torus_radius < tube_radius: raise ValueError( "surface_area_torus() does not support spi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self) -> torch.Tensor:\n box = self.tensor\n area = (box[:, 2] - box[:, 0]) * (box[:, 3] - box[:, 1])\n return area", "def area(self) -> float:\n raise NotImplementedError", "def area(self):\n area = 0\n last = self._coordinates[-1]\n for c in self._coo...
[ "0.7800431", "0.7706884", "0.75886077", "0.7577049", "0.75663716", "0.7547722", "0.75137764", "0.75137764", "0.75086504", "0.7508373", "0.7478298", "0.7464217", "0.7462269", "0.7459668", "0.74048436", "0.7402549", "0.7401049", "0.7399664", "0.7391779", "0.73916525", "0.737006...
0.0
-1
Calculate the area of a square. >>> area_square(10) 100 >>> area_square(0) 0 >>> area_square(1.6) 2.5600000000000005 >>> area_square(1)
def area_square(side_length: float) -> float: if side_length < 0: raise ValueError("area_square() only accepts non-negative values") return side_length**2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_square(l):\n x = l * l\n return x", "def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area", "def square_area(side):\n return side**2", "def area(x, y):\n return x*y/2", "...
[ "0.7286142", "0.72473055", "0.7205924", "0.7182893", "0.7121043", "0.7083093", "0.70261645", "0.70175433", "0.6921208", "0.6849839", "0.6845397", "0.68417615", "0.6837337", "0.67906415", "0.6776792", "0.6761042", "0.6683266", "0.6667608", "0.6652926", "0.6637591", "0.6605035"...
0.7561725
0
Calculate area of triangle when the length of 3 sides are known.
def area_triangle_three_sides(side1: float, side2: float, side3: float) -> float: if side1 < 0 or side2 < 0 or side3 < 0: raise ValueError("area_triangle_three_sides() only accepts non-negative values") elif side1 + side2 < side3 or side1 + side3 < side2 or side2 + side3 < side1: raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_area(side1: number, side2: number, side3: number) -> number:\n s = (side1+side2+side3)/2\n area = sqrt(s*(s-side1)*(s-side2)*(s-side3))\n return sqrt(s*(s-side1)*(s-side2)*(s-side3))", "def area_of_a_triangle(length_1, length_2, length_3):\r\n half_perimeter = (length_1 + length_2 + leng...
[ "0.8733833", "0.86254233", "0.82618403", "0.80721945", "0.7990782", "0.79050994", "0.78296477", "0.77779496", "0.773841", "0.7719263", "0.7699428", "0.7680037", "0.761518", "0.75288564", "0.7486223", "0.74066657", "0.7402571", "0.7341327", "0.72961754", "0.72634614", "0.72093...
0.8315102
2
Calculate the area of a ellipse. >>> area_ellipse(10, 10) 314.1592653589793 >>> area_ellipse(10, 20) 628.3185307179587 >>> area_ellipse(0, 0) 0.0 >>> area_ellipse(1.6, 2.6) 13.06902543893354 >>> area_ellipse(10, 20)
def area_ellipse(radius_x: float, radius_y: float) -> float: if radius_x < 0 or radius_y < 0: raise ValueError("area_ellipse() only accepts non-negative values") return pi * radius_x * radius_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ellipse_area(semi_major_axis: number, semi_minor_axis : number) -> number:\n area = pi*semi_major_axis*semi_minor_axis\n return area", "def ellipse_area(preds, target):\n # unpack target = (target, mask)\n target, mask = target\n if preds.size(2) != 4:\n raise ValueError('Prediction mus...
[ "0.7569128", "0.7252887", "0.70606506", "0.67599463", "0.66614044", "0.6620491", "0.65754545", "0.65114665", "0.6509608", "0.64492077", "0.63622475", "0.6348709", "0.6340304", "0.63310313", "0.63249993", "0.63071716", "0.62976605", "0.6270165", "0.6263262", "0.6239973", "0.62...
0.811346
0
Calculate the area of a regular polygon.
def area_reg_polygon(sides: int, length: float) -> float: if not isinstance(sides, int) or sides < 3: raise ValueError( "area_reg_polygon() only accepts integers greater than or \ equal to three as number of sides" ) elif length < 0: raise ValueError( "are...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_polygon(polygon):\n o = centroid_points(polygon)\n u = subtract_vectors(polygon[-1], o)\n v = subtract_vectors(polygon[0], o)\n a = 0.5 * length_vector(cross_vectors(u, v))\n for i in range(0, len(polygon) - 1):\n u = v\n v = subtract_vectors(polygon[i + 1], o)\n a += 0...
[ "0.8058221", "0.8032072", "0.80290425", "0.775125", "0.7730882", "0.7655108", "0.7603578", "0.75836736", "0.7458248", "0.7318181", "0.7303265", "0.7278403", "0.7259592", "0.7246163", "0.72038543", "0.7143232", "0.70988834", "0.7087016", "0.70269674", "0.69372404", "0.69024974...
0.7105422
16
Generate a random string of letters and digits
def randomStringDigits(stringLength=1000): lettersAndDigits = string.ascii_letters + string.digits return ''.join(random.choice(lettersAndDigits)+'\r\n' for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out", "def get_random_alphanumeric_string():\n return get_random_string(char_choice=string.ascii_letters + string.digits)", "def gen_rand_str(n):\n return \"\".join(random.choice(string.ascii_l...
[ "0.86016387", "0.84852463", "0.8366202", "0.83620757", "0.83602", "0.8158604", "0.8123532", "0.81143093", "0.8089975", "0.80873764", "0.8011259", "0.7957295", "0.79525083", "0.794848", "0.7927194", "0.79182523", "0.7897885", "0.788374", "0.787901", "0.7854035", "0.78254104", ...
0.7398179
82
Tests get_regular_master when 'Variable Font Origin' custom parameter name is used with master set to 'Regular Text'. This is the current default custom parameter name in the Glyphs editor / glyphs source file specification.
def test_custom_parameter_vfo_current(): source_path = os.path.join("tests", "data", "CustomParameterVFO.glyphs") font = GSFont(source_path) assert font.customParameters["Variation Font Origin"] is None test_id = font.customParameters["Variable Font Origin"] assert test_id == "ACC63F3E-1323-486A-94A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_regular_master(masters, regularName=None):\n assert len(masters) > 0\n if regularName is not None:\n for font in masters:\n if font.info.styleName == regularName:\n return font\n base_style = find_base_style(masters)\n if not base_style:\n base_style = '...
[ "0.69350207", "0.6909895", "0.6648281", "0.5223326", "0.5092955", "0.4946685", "0.46939337", "0.468453", "0.46685544", "0.46685544", "0.4646657", "0.4641774", "0.46350524", "0.4610456", "0.45767817", "0.45586544", "0.45528513", "0.45253748", "0.45107546", "0.45049223", "0.447...
0.75802004
0
Tests get_regular_master when 'Variation Font Origin' custom parameter name is used with master set to 'Regular Text'. This custom parameter name is not used in current releases of the Glyphs editor / glyphs source file specification.
def test_custom_parameter_vfo_old_name(): source_path = os.path.join("tests", "data", "CustomParameterVFO.glyphs") font = GSFont(source_path) # mock up source for this test with a source file from another test del font.customParameters["Variable Font Origin"] font.customParameters["Variation Font O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_custom_parameter_vfo_current():\n source_path = os.path.join(\"tests\", \"data\", \"CustomParameterVFO.glyphs\")\n font = GSFont(source_path)\n assert font.customParameters[\"Variation Font Origin\"] is None\n test_id = font.customParameters[\"Variable Font Origin\"]\n assert test_id == \"A...
[ "0.7359684", "0.67687136", "0.6363678", "0.51723284", "0.50032544", "0.48569408", "0.48275173", "0.47787303", "0.4668857", "0.4668857", "0.4658506", "0.4607545", "0.46026233", "0.45687926", "0.45522752", "0.45285955", "0.4505046", "0.44999492", "0.4479202", "0.44763657", "0.4...
0.69167006
1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SemMap, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.header is None: self.header = std_msgs.msg.Header() if self.namespace is None: self.namespace = '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794351", "0.7719884", "0.7719884", "0.7686347", "0.76253426", "0.7562994", "0.74395365", "0.7416649", "0.73515975", "0.730761", "0.7279932", "0.72373426", "0.72264934", "0.7223775", "0.7223775", "0.72189564", "0.72111243", "0.72111243", "0.72111243", "0.72111243", "0.7211...
0.0
-1
Reward at state. Optional action makes this into the reward for performing the action at state. MUST `set_world_state` before this
def reward(self): if self.num_steps >= self.timeout: return self.fail_penalty return self.default_reward
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, state, action, nextState, reward):\n util.raiseNotDefined()", "def agent_step(self, reward, state):\n self.sum_rewards += reward\n self.episode_steps += 1\n\n # Make state an array of shape (1, state_dim) to add a batch dimension and\n # to later match the get_...
[ "0.70163804", "0.69934577", "0.6972369", "0.69639444", "0.693336", "0.6870321", "0.6836065", "0.68152875", "0.681367", "0.68106467", "0.6810196", "0.68010736", "0.6797167", "0.67968327", "0.67484176", "0.66801345", "0.66743845", "0.6645795", "0.66411126", "0.66180277", "0.660...
0.0
-1
Creates a new queue with the defined settings. All settings except qid must exist.
def create_queue(q_settings): db = get_db() cursor = db.cursor() cursor.execute(INSERT_QUEUE) q_settings['qid'] = cursor.lastrowid cursor.execute(INSERT_QUEUE_SETTINGS, qsettings_dict_to_db_tuple(q_settings)) cursor.close() db.commit() permissions.add_permission_list(get_uids(q_settings[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)", "def create_queue(self):\n queue_name = self.generate_name()\n try:\n queue = self.sqs.create_queue(QueueName=queue_name)\n except Excepti...
[ "0.7581136", "0.70347965", "0.69530344", "0.65396017", "0.6517988", "0.650838", "0.6362824", "0.63077843", "0.62122697", "0.6168579", "0.61568266", "0.6059989", "0.6057603", "0.59346896", "0.5918184", "0.59084517", "0.58973634", "0.5895379", "0.58948785", "0.58845586", "0.581...
0.80698436
0
Retrieves the queue_settings associated with qid.
def get_queue_settings(qid): db = get_db() rows = query_db(GET_QUEUE_SETTINGS_BY_ID, (qid,)) if (not rows) or (len(rows) == 0): raise sqlite3.Error('The queue does not exist.') return rows[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getQueueDetails(self, queue_name, project_id=\"\"):\n if project_id == \"\":\n project_id = self.project_id\n url = \"%sprojects/%s/queues/%s?oauth=%s\" % (self.url, project_id,\n queue_name, self.token)\n body = self.__get(url)\n queue = json.loads(body)\n...
[ "0.6426058", "0.6181275", "0.60460794", "0.60399467", "0.60134006", "0.6009682", "0.5998501", "0.596838", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5869374", "0.5864781", "0.57995844", "0.5773101", "0.57453996",...
0.84848475
0
Add a vertical line corresponding to line at the specified temperature.
def addTcline(self, line, temperature=None): self._checkfigure() ld = self._get_linedict(line) line = ld['line'] if temperature is None: temperature = ld['Tc'] color = line.get_c() axvl = self.axes.axvline(temperature, color=color, ls='--') # self.axvl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vert_lines(self, timestamp: datetime = None) -> None:\n self._logger.debug(\"running\")\n for axes in self.figure.get_axes():\n if timestamp:\n self._vlines.append(timestamp)\n axes.axvline(timestamp)\n self.refresh_self()\n e...
[ "0.6347238", "0.6204931", "0.61713815", "0.6061019", "0.5882949", "0.5863026", "0.57749057", "0.5748844", "0.56307054", "0.5602868", "0.55812764", "0.5558648", "0.55533946", "0.5510339", "0.5501377", "0.542325", "0.5418261", "0.5417373", "0.5402615", "0.53853005", "0.536729",...
0.81121063
0
Change the scale of the y axis.
def yscale(self, newscale, linthreshy=1.e-4): self._checkfigure() if newscale == 'symlog': self.axes.set_yscale(newscale, linthreshy=linthreshy) else: self.axes.set_yscale(newscale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yscale(self, value='linear'):\r\n for ax in self._subaxes:\r\n ax.set_yscale(value)\r\n self.figure.canvas.draw()", "def setScaleY(self,starty,endy):\r\n if starty == endy:# Prevent /0 errors when scaling\r\n endy += 0.1\r\n self.scaleLock.acquire()\r\n ...
[ "0.83540624", "0.7639247", "0.76304406", "0.7609599", "0.7424399", "0.7308757", "0.7259377", "0.72316325", "0.7127579", "0.7097566", "0.7009638", "0.6943726", "0.69134957", "0.6899598", "0.6857216", "0.6814696", "0.67792916", "0.6751122", "0.6750558", "0.67136586", "0.6713658...
0.77396965
1
Show and redraw the figure. Generally not useful if HKEPlotter is being used to serve up figures to a different frontend, but is useful for interactive use of HKEPlotter on its own.
def draw(self): self.figure.show() self.figure.canvas.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_figure(self):\n\n self.draw()", "def show_figure(self):\n pylab.show()", "def redraw(self):\n dummy_figure = plt.figure()\n new_manager = dummy_figure.canvas.manager\n new_manager.canvas.figure = self.figure\n self.figure.set_canvas(new_manager.canvas)\n ...
[ "0.7442054", "0.72985405", "0.72740227", "0.7139864", "0.7054566", "0.70101815", "0.6959752", "0.6950756", "0.68631804", "0.68610996", "0.68610996", "0.68610996", "0.6855939", "0.66993093", "0.668948", "0.668948", "0.65383893", "0.64258283", "0.6350744", "0.63269967", "0.6323...
0.7369711
1
Change this CIGAR string, starting at base `at` (integer) by
def operationAt(self, op, n, at): self._changed = True bpTokenStart = 0 # in bp (base pairs) # iToken and tokenLength are used ouside of loop for iStartToken,tokenLength in enumerate(t[0] for t in self._tokens): if bpTokenStart + tokenLength > at: break bpTokenSt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_fill(i, n):\r\n return str(i).zfill(n)", "def string(self,pos_0,pos_1,n):\r\n n=int(n)\r\n if pos_0 <10:\r\n pos_0=\"00\"+str(pos_0)\r\n elif pos_0<100:\r\n pos_0=\"0\"+str(pos_0)\r\n\r\n if n <10:\r\n n=\"0\"+str((n))\r\n \r\n\r\n\r\...
[ "0.59899414", "0.58692604", "0.5826843", "0.5657849", "0.55905974", "0.5525048", "0.54885286", "0.5405841", "0.53604394", "0.53604394", "0.53569674", "0.53217363", "0.5308425", "0.52913743", "0.5268704", "0.5261682", "0.52560335", "0.5253637", "0.52421796", "0.5230379", "0.52...
0.49945837
44
No sigmoid in forward because we are going to use BCEWithLogitsLoss Which applies sigmoid for us when calculating a loss
def forward(self, inputs): x, meta = inputs features = self.arch(x) if self.n_meta_features: meta_features = self.meta(meta) features = torch.cat((cnn_features, meta_features), dim=1) return self.ouput(features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_propagate(self, x):\n self.z_h = np.dot( x, self.w_ih ) + self.b_h\n #Activations of hidden layer\n self.a_h = self.sigmoid( self.z_h )\n self.z_o = np.dot( self.a_h, self.w_ho ) + self.b_o\n #yEst = activations of output layer\n yEst = self.sigmoid( self.z_o )...
[ "0.718558", "0.7111254", "0.70874214", "0.70765215", "0.7072784", "0.703616", "0.7004094", "0.70040655", "0.6996144", "0.69507974", "0.69271636", "0.69134355", "0.68908584", "0.6888275", "0.68787265", "0.6857336", "0.68468887", "0.68463176", "0.6829951", "0.6828119", "0.68076...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistantType, config_entry: ConfigEntry): unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(config_entry, component) for component in SUPPORTED_PLATFORMS ] ) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.64135826
39
Load the model, training and evaluation configs for PET from the given command line arguments.
def load_pet_configs(args) -> Tuple[WrapperConfig, pet.TrainConfig, pet.EvalConfig]: model_cfg = WrapperConfig(model_type=args.model_type, model_name_or_path=args.model_name_or_path, wrapper_type=args.wrapper_type, task_name=args.task_name, label_list=args.label_list, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n hpo_warning = 'Flag overwrites config value if set, used for HPO and PBT runs primarily'\n parser = argparse.ArgumentParser('train.py')\n add_arg = parser.add_argument\n add_arg('config', nargs='?', default='configs/hello.yaml')\n add_arg('-d', '--distributed', choices=['ddp-file...
[ "0.64883953", "0.6423853", "0.6339392", "0.63173246", "0.63055223", "0.6296296", "0.6258348", "0.6205302", "0.6176762", "0.61579216", "0.61514276", "0.61273324", "0.6091553", "0.6090854", "0.60844326", "0.608109", "0.6078909", "0.607694", "0.6071167", "0.60487896", "0.6036241...
0.6690745
0
Returns mean score between tasks in pipeline that can be used for early stopping.
def _score_for_model(meta): mean_acc = list() pipes = meta["pipeline"] acc = meta["accuracy"] if "tagger" in pipes: mean_acc.append(acc["tags_acc"]) if "morphologizer" in pipes: mean_acc.append((acc["morphs_acc"] + acc["pos_acc"]) / 2) if "parser" in pipes: mean_acc.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avgcpu(self):\n return (self._total_cpu['value'] / self._total_cpu['count']) if self._total_cpu['count'] else 0", "def score(self, task):\n raise NotImplementedError(\"must subclass and implement score(task)\")", "def getAverage(self):\n return sum(self.scores) / len(self.scores)", "...
[ "0.6135161", "0.60931313", "0.60613865", "0.5927177", "0.5919117", "0.59168655", "0.58380854", "0.58222544", "0.5811924", "0.57893497", "0.5779506", "0.57702696", "0.5763837", "0.5745407", "0.57277334", "0.5717946", "0.571239", "0.568665", "0.567822", "0.567822", "0.567822", ...
0.6233691
0
Load pretrained weights for the 'tokentovector' part of the component models, which is typically a CNN. See 'spacy pretrain'. Experimental.
def _load_pretrained_tok2vec(nlp, loc): with loc.open("rb") as file_: weights_data = file_.read() loaded = [] for name, component in nlp.pipeline: if hasattr(component, "model") and component.model.has_ref("tok2vec"): component.get_ref("tok2vec").from_bytes(weights_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self):\n if self.ckpt_flag:\n LOG('Skip Loading Pre-trained Model......')\n else:\n if self.params.pre_trained_from is not None and os.path.exists(self.params.pre_trained_from):\n try:\n LOG('Loading Pre-trained Model at %s' % sel...
[ "0.6386861", "0.63678175", "0.6225031", "0.62216717", "0.61162937", "0.6101295", "0.6054075", "0.6042603", "0.6018365", "0.59910965", "0.59458715", "0.5943918", "0.59387076", "0.5920058", "0.5915071", "0.59099936", "0.59086907", "0.5901546", "0.59015244", "0.58882916", "0.588...
0.6853876
0
Attempt to find the resource directory for the python package of the ChRIS plugin. It usually looks like /usr/local/lib/python3.9/sitepackages/something If unsuccessful, return empty string.
def find_resource_dir(self, dock_image: str, meta: dict) -> str: try: return self.interrogate_python_package_location(dock_image, meta) except CalledProcessError: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource(self, rsc_path):\n\n\t\ttry:\n\t\t\tfrom pkg_resources import resource_filename\n\t\t\treturn resource_filename(__name__, rsc_path)\n\t\texcept ImportError:\n\t\t\treturn os.path.join(os.path.dirname(__file__), rsc_path)", "def get_package_dir():\n return Path(__file__).parent", "def _get_d...
[ "0.6721056", "0.6668326", "0.6601748", "0.6568538", "0.6526997", "0.64291966", "0.63636035", "0.63410276", "0.62239856", "0.6217715", "0.6213123", "0.6172258", "0.6157969", "0.61543185", "0.613424", "0.61182326", "0.60999566", "0.6063436", "0.6055837", "0.60502505", "0.604980...
0.70710635
0
Create a new API class for your application. 'root' shoudl be your base route, and routes is a mapping of routeshortname > path suffix for your API.
def API(root, **routes): # this creats a dict of properties that create Senders for # all the friendly name --> suffix combidantions passed in props = {'root': Route(root)} for (short, path) in routes.iteritems(): props[short] = lambda self, content: self.sender.send_path(path, content) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app():\r\n app = Flask(__name__, instance_relative_config=False)\r\n app.config.from_object('config.Config') \r\n \r\n api = Api(app) \r\n \r\n with app.app_context():\r\n from .flights import TicketRoute, FlightRoute\r\n api.add_resource(TicketRoute,\"/api/ticket...
[ "0.73801404", "0.7200694", "0.71829164", "0.6970352", "0.671085", "0.67097706", "0.67093503", "0.6705557", "0.6694073", "0.66517067", "0.6583034", "0.6547196", "0.64564484", "0.64072907", "0.6406355", "0.6401527", "0.63456136", "0.63084906", "0.62602186", "0.6221953", "0.6214...
0.75148106
0
Init function. This first defines the network compression model that implements layer removal/shrinkage and training to get reward. It also obtains the number of layers, and the network state shape, number_of_layers x number_of_parameters_for_each_layer. This method also defines action_space and observation_space for G...
def __init__(self, config={}): _, fileprefix = mkstemp() idx = fileprefix.rfind('/') fileprefix = fileprefix[idx + 1:] self.network = NetworkCompression(prefix = fileprefix) self.num_actions = self.network.get_action_space() self.input_shape = self.network.get_observatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, device, state_space, action_space, num_actions):\n # initialize all parameters\n super(DQN_MLP_model, self).__init__(device, state_space, action_space,\n num_actions)\n # architecture\n self.layer_sizes = [(768, 768), (768, 7...
[ "0.6963171", "0.67967623", "0.6782904", "0.67258465", "0.66817856", "0.66595465", "0.66574657", "0.6555321", "0.655193", "0.6515325", "0.64991766", "0.648771", "0.6485449", "0.6467087", "0.6460257", "0.64164853", "0.64157426", "0.6414727", "0.6405644", "0.6402848", "0.6392700...
0.6200549
50
Converts a list of strings to a string by concatenating all elements of the list
def collapse(L): output = "" for s in L: output = output + s return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string", "def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_string", "def list_to_str(list_to_convert):\n return ' '.join(to_str(item) for it...
[ "0.845377", "0.7836319", "0.7773371", "0.7705512", "0.7661951", "0.7658474", "0.7595569", "0.7587454", "0.7479857", "0.7459654", "0.74586385", "0.7406689", "0.7406689", "0.7394045", "0.7386286", "0.7349678", "0.7333463", "0.733121", "0.7291625", "0.7260772", "0.71728444", "...
0.652098
56
r""" Initialize a collision with two wavefunctions, presumably a nucleus and a proton. One must implement the wilson line, though the order of the arguments does not matter. In the case that both wavefunctions implement the wilson line, the first (wavefunction1) will be used as such. In the case that neither implement ...
def __init__(self, wavefunction1: Wavefunction, wavefunction2: Wavefunction): # Make sure that at least one has a wilson line wilsonLineExists1 = callable(getattr(wavefunction1, "wilsonLine", None)) wilsonLineExists2 = callable(getattr(wavefunction2, "wilsonLine", None)) if not wilsonL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_library_charges_to_two_waters(self):\n ff = ForceField(\n get_data_file_path(\"test_forcefields/test_forcefield.offxml\"),\n get_data_file_path(\"test_forcefields/tip3p.offxml\"),\n )\n mol = Molecule.from_file(\n get_data_file_path(os.path.join(\"syst...
[ "0.5363549", "0.53437185", "0.5282484", "0.4975989", "0.49336395", "0.49139965", "0.4913422", "0.4866941", "0.485196", "0.4840935", "0.4831913", "0.48300686", "0.48231012", "0.48094025", "0.47987574", "0.47694734", "0.47500825", "0.47249275", "0.47237548", "0.4697747", "0.467...
0.781818
0
Get current date and time with the format= .
def getTime(form=Constants.record_name_format): # Get the date and time from the system now = datetime.now() # Format and return return now.strftime(form)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_now():\r\n now = dt.datetime.now()\r\n now_str = now.strftime(\"%d/%m %H:%M\")\r\n return now_str", "def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )", "def current_time():\n now = datetime.datetime.now()\n time = now.strftime(\"%Y-%m...
[ "0.8194152", "0.7987566", "0.7932862", "0.79326594", "0.79113275", "0.7893641", "0.78934723", "0.78358227", "0.7831609", "0.7829139", "0.7818449", "0.78158355", "0.7813814", "0.78097653", "0.775849", "0.77103084", "0.76516235", "0.764516", "0.76419735", "0.7633488", "0.762019...
0.7465342
35
Get the seconds of the string.
def getSecondsFromStringDateTime(date_time): split_date_time = date_time.split(Constants.record_name_sep) if len(split_date_time) == 5: for value in split_date_time: if not isNumber(value): return Constants.return_value_invalid_datetime_value result = int(split_date_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSeconds(self, s):\n duration = 0\n \n for i in s.split('-'):\n if 'h' in i: duration = duration + int(i.split('h')[0])*3600\n if 'm' in i: duration = duration + int(i.split('m')[0])*60\n if 's' in i: duration = duration + int(i.split('s')[0])\n ...
[ "0.7766101", "0.7115368", "0.71104825", "0.7041365", "0.70393634", "0.70393634", "0.6951356", "0.69008636", "0.6872411", "0.6872411", "0.68332404", "0.68117046", "0.66860545", "0.6683153", "0.6572782", "0.65385103", "0.65095", "0.65092576", "0.6505078", "0.6484745", "0.642686...
0.58662844
53
Convert a dictionary to a list.
def convertToList(data): try: # Try to create a list from dictionary result = list(data.items()) # Successfully created # Return the list return result except Exception as err: # Couldn't convert the dictionary to a list print(err) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dictToLst(dictionary):\n keys = []\n values = []\n for key, value in dictionary.iteritems():\n keys.append(key)\n values.append(value)\n return [keys, values]", "def dict_to_list(dict: Dict, name_key: str = \"name\", value_key: str = \"value\"):\n ...
[ "0.82195216", "0.80905014", "0.80083996", "0.7971248", "0.7794634", "0.7763368", "0.7755257", "0.7734761", "0.741443", "0.741443", "0.73810256", "0.73580605", "0.71780914", "0.7127262", "0.71178746", "0.7070168", "0.70463735", "0.7015465", "0.6966923", "0.6900855", "0.6895519...
0.7301802
12
Crops to center of image with padding then scales to target size.
def _decode_and_center_crop(image_buffer, image_size): shape = tf.image.extract_jpeg_shape(image_buffer) image_height = shape[0] image_width = shape[1] padded_center_crop_size = tf.cast( 0.875 * tf.cast(tf.minimum(image_height, image_width), tf.float32), tf.int32) offset_height = ((image_height ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_crop(image, source=(218, 178, 3), target=128):\n height, width, channel = source\n\n off_h = np.ceil((height - target) / 2).astype(int)\n off_w = np.ceil((width - target) / 2).astype(int)\n return image[off_h: off_h+target, off_w: off_w+target, :]", "def _crop_image_and_paste(self, image, ...
[ "0.7128099", "0.70488757", "0.68803775", "0.6781932", "0.6731713", "0.67305714", "0.6663504", "0.664844", "0.6613311", "0.6602656", "0.6566218", "0.65391105", "0.65155274", "0.64812684", "0.6468684", "0.6438739", "0.6353911", "0.632617", "0.6314719", "0.6305832", "0.63000154"...
0.58932555
50
Get box regression transformation deltas (dx, dy, dw, dh) that can be used to transform the `src_boxes` into the `target_boxes`. That is, the relation ``target_boxes == self.apply_deltas(deltas, src_boxes)`` is true (unless any delta is too large and is clamped).
def get_deltas(self, src_boxes, target_boxes): assert isinstance(src_boxes, torch.Tensor), type(src_boxes) assert isinstance(target_boxes, torch.Tensor), type(target_boxes) TO_REMOVE = 1 # TODO remove src_widths = src_boxes[:, 2] - src_boxes[:, 0] + TO_REMOVE src_heights ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_deltas(self, deltas, boxes):\r\n assert torch.isfinite(deltas).all().item(), \"Box regression deltas become infinite or NaN!\"\r\n boxes = boxes.to(deltas.dtype)\r\n\r\n TO_REMOVE = 1 # TODO remove\r\n widths = boxes[:, 2] - boxes[:, 0] + TO_REMOVE\r\n heights = boxes[...
[ "0.699108", "0.6511962", "0.645136", "0.6319423", "0.6214895", "0.6214895", "0.61235464", "0.60987717", "0.56899726", "0.55584025", "0.55373454", "0.54795", "0.54542905", "0.54477835", "0.5432317", "0.54260546", "0.537766", "0.5244466", "0.523219", "0.5218577", "0.51628095", ...
0.84701025
0
Load all test cases and return a unittest.TestSuite object.
def load_tests(loader, filter): suite = unittest.TestSuite() for r, d, f in os.walk(test_path): module_path = os.path.relpath(r, os.path.dirname(test_path)).replace(os.path.sep, ".") for file in f: filename, ext = os.path.splitext(file) if ext == ".py" and not file.starts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suite():\n\tts = unittest.TestSuite()\n\tfor test_module in __all__:\n\t\tm = importlib.import_module(\"pyroclast.test.\" + test_module)\n\t\tfor n in dir(m):\n\t\t\tc = getattr(m, n)\n\t\t\tif is_test_case(c):\n\t\t\t\ts = unittest.TestLoader().loadTestsFromTestCase(c)\n\t\t\t\tts.addTests(s)\n\treturn ts", ...
[ "0.8478419", "0.8108045", "0.80656457", "0.80470455", "0.8037982", "0.8037982", "0.79625636", "0.7948463", "0.7787993", "0.774353", "0.77031124", "0.768088", "0.7679084", "0.76632", "0.7583168", "0.75241446", "0.7513062", "0.75110626", "0.7492876", "0.7442735", "0.7425314", ...
0.6891633
56
Makes PyTorch DataLoaders for extraction.
def get_extract_dataloaders(data_path, image_shape=None, batch_size=1, num_workers=0): if image_shape is None and batch_size != 1: import warnings batch_size = 1 warnings.warn('Since you wish to use variable image sizes, setting batch_size=1.' '\nDealing with variable inputs is not trivial.', RuntimeWarni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)", "def dataloaders():\n # train data path\n data_train = '../dataset/train/'\n # set transformations\n train_transforms = transforms.Compose([\n ...
[ "0.7184117", "0.7172089", "0.7103049", "0.70585805", "0.7023571", "0.69776785", "0.6923268", "0.6862011", "0.6858555", "0.6841408", "0.6834583", "0.68124217", "0.6796105", "0.6769847", "0.6736129", "0.6662132", "0.664149", "0.6600465", "0.65924054", "0.65893775", "0.65822655"...
0.0
-1
Returns the minimax action using self.depth and self.evaluationFunction
def getAction(self, gameState): "*** YOUR CODE HERE ***" legalActions = gameState.getLegalActions(0) legalActions.remove('Stop') alpha = float("-inf") beta = float("inf") besctaction = Directions.STOP score = float("-inf") for action in legalActions: child = gameState.generate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o...
[ "0.7482665", "0.7383559", "0.71806973", "0.7110041", "0.70884514", "0.70694935", "0.70683014", "0.7048308", "0.70055133", "0.69651455", "0.69642085", "0.69604385", "0.6945924", "0.68998593", "0.6895832", "0.688605", "0.6826282", "0.6767276", "0.6758028", "0.6751636", "0.67054...
0.0
-1
Returns an action. You can use any method you want and search to any depth you want. Just remember that the minicontest is timed, so you have to trade off speed and computation. Ghosts don't behave randomly anymore, but they aren't perfect either they'll usually just make a beeline straight towards Pacman (or away from...
def getAction(self, gameState): "*** YOUR CODE HERE ***" util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState):\n return self.minimax(gameState, self.depth, 0)", "def getAction(self, gameState):\n \"*** YOUR CODE HERE ***\"\n def minMaxHelper(gameState, deepness, agent):\n if agent >= gameState.getNumAgents():\n agent = 0\n deepness ...
[ "0.6819004", "0.6791531", "0.67102724", "0.6693187", "0.6638914", "0.6618938", "0.6614788", "0.66092956", "0.6582351", "0.6573214", "0.6567215", "0.65612036", "0.65345424", "0.6523664", "0.65080947", "0.6482032", "0.64712214", "0.64578146", "0.64441186", "0.6432857", "0.64244...
0.0
-1
Returns the timezone as an hour/minute offset in the form "+HHMM" or "HHMM".
def _format_timezone_offset(converted_time): # Windows treats %z in the format string as %Z, so we compute the hour/minute offset # manually. if converted_time.tm_isdst == 1 and time.daylight: utc_offset_secs = time.altzone else: utc_offset_secs = time.timezone ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone_offset():\n timezone = get_localzone()\n offset_minutes = timezone.utcoffset(datetime.datetime.now()).total_seconds() // SECONDS_IN_MINUTE\n return parse_int(offset_minutes)", "def get_fixed_timezone(offset):\n if isinstance(offset, timedelta):\n offset = offset.total_seconds(...
[ "0.7235955", "0.67034847", "0.6700693", "0.66685057", "0.6638393", "0.66248596", "0.6586953", "0.6572008", "0.65655357", "0.64952195", "0.64378357", "0.6383715", "0.6347221", "0.63229084", "0.6319341", "0.62767327", "0.62652457", "0.6222787", "0.62033075", "0.61946964", "0.61...
0.71226084
1
Declare a the queue as highly available, passing in a list of nodes the queue should live on. If no nodes are passed, the queue will be declared across all nodes in the cluster.
def ha_declare(self, nodes=None): if nodes: self._arguments['x-ha-policy'] = 'nodes' self._arguments['x-ha-nodes'] = nodes else: self._arguments['x-ha-policy'] = 'all' if 'x-ha-nodes' in self._arguments: del self._arguments['x-ha-nodes'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def declare_queue(self):\n\n self._channel.queue_declare(queue=self._queue_name, durable=True)\n print(\"Queue declared....\")", "def _create_queue(self):\n # Instantiate\n queue = pbs.queue(verbose=not self.quiet)\n\n if self.q == 'ember':\n # Submitting to Utah emb...
[ "0.62286747", "0.60477805", "0.58977777", "0.5751411", "0.5699497", "0.5601299", "0.5536529", "0.5517704", "0.55171967", "0.54711384", "0.54707986", "0.5445398", "0.5411856", "0.54114914", "0.5409894", "0.53511775", "0.5346529", "0.5311034", "0.52988267", "0.5228136", "0.5223...
0.57938516
3
Displays image and the topn predicted probabilities in a bar graph
def plot_preds(image, preds): plt.imshow(image) plt.axis('off') plt.figure() """labels = ("BEANS", "CAKE","CANDY","CEREAL","CHIPS", "CHOCOLATE", "COFFEE", "CORN", "FISH", "FLOUR", "HONEY", "JAM", "JUICE", "MILK", "NUTS","OIL","PASTA", "RICE", "SODA", "SPICES", "SUGAR", "TEA"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_preds(image, preds): \r\n #image\r\n plt.imshow(image)\r\n plt.axis('off')\r\n \r\n #bar graph\r\n plt.figure() \r\n order = list(reversed(range(len(preds)))) \r\n bar_preds = [pr[2] for pr in preds]\r\n labels = (pr[1] for pr in preds)\r\n plt.barh(order, bar_preds, alpha=0.5)\r\n plt.ytick...
[ "0.7922684", "0.77978665", "0.7721485", "0.769006", "0.76070917", "0.71370405", "0.70984143", "0.7009505", "0.68326867", "0.6766593", "0.6606671", "0.6594294", "0.6510035", "0.64082754", "0.63103276", "0.63035893", "0.62614477", "0.6234734", "0.6204136", "0.62028116", "0.6188...
0.7603528
5
At this moment `name` bound to the group of "positive events" defined in config (i.e. "settings_yaml.yaml"). But in future implementation the naming principle could be changed.
def train_model(self, name): if self.data_provider.get_events_count > 10: logging.debug("Start training model") events = self.data_provider.get_events() df = self.data_provider.events_to_dataframe(events) logging.info('Started parsing configs: {}'.format(df.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_name(self, event_name):\n self['event_name'] = event_name", "def configName(name):\n s.setConfigName(name)", "def name(self, name):\n pass", "def name(self):\n return self.config[\"name\"]", "def _getConfigName(self):\n pass", "def set_sysmon_events(self, event_na...
[ "0.6007125", "0.5761646", "0.5601685", "0.56003094", "0.5599171", "0.5488947", "0.5475686", "0.53462094", "0.53240913", "0.53206116", "0.53188646", "0.5305123", "0.53017944", "0.52758616", "0.5275524", "0.52629584", "0.52628016", "0.5255684", "0.5232966", "0.5196814", "0.5167...
0.0
-1
Tests the return of `load_cri_image` function
def test_load_cri_image(self, path): cmd = utils.cmd_output( stderr='time="2020-07-02T08:02:46Z" ' 'level=debug msg="unpacking 1 images"', stdout="unpacking k8s.gcr.io/my-image:3.1 (sha256:3efe4ff64c93123e" "1217b0ad6d23b4c87a1fc2109afeff55d2f27d70c55d8f73)...done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_image(self):\n pass", "def test_CreateROI1(self):\r\n\r\n self.delayDisplay(\"Starting the test\")\r\n #\r\n # first, get some data\r\n #\r\n import urllib\r\n downloads = (\r\n ('http://slicer.kitware.com/midas3/download?items=5767', 'FA.nrrd', slicer.util.loadVolum...
[ "0.69967496", "0.6590686", "0.65902233", "0.6497048", "0.6327282", "0.6300939", "0.62152237", "0.62148", "0.62034553", "0.61346054", "0.6108102", "0.6102628", "0.6064511", "0.60624236", "0.60367256", "0.60231346", "0.60110754", "0.59880245", "0.5982799", "0.59773093", "0.5951...
0.8183807
0
Get the specified JSON input file's contents as a dict
def get_inputs_from_file(filename=""): import json with open(filename) as input_text: json_obj = json.load(input_text) return json_obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file) as f:\n return json....
[ "0.7587827", "0.7587827", "0.7569293", "0.7569293", "0.75602573", "0.753806", "0.7389315", "0.7381221", "0.73781174", "0.7354496", "0.7349716", "0.73322374", "0.73126495", "0.7310526", "0.7288044", "0.728155", "0.7277607", "0.7270094", "0.7233338", "0.7233158", "0.72300816", ...
0.7359419
9
Return an array of item comparisons, avoiding selfcomparisons.
def pairwise_equalities(things): return np.array([things[i] == things[j] for i in range(len(things)) for j in range(i + 1, len(things))])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_comparer(self):\n return self.item_comparer_value", "def OnCompareItems(self, item1, item2):\r\n\r\n return cmp(self.GetItemText(item1), self.GetItemText(item2))", "def by_equality(cls, *expected_items):\n return cls(*(to_matcher(EqualsMatcher, i) for i in expected_items))", "de...
[ "0.58421564", "0.56897765", "0.5672012", "0.5588486", "0.5552559", "0.5403639", "0.5401066", "0.53403103", "0.5271652", "0.5211439", "0.51990104", "0.5190706", "0.5167556", "0.51661444", "0.51609856", "0.5154473", "0.51290977", "0.5125599", "0.5107754", "0.5106961", "0.510658...
0.48618746
46
Return version key to use given a specific version. For example, if a dictionary only has instructions for version 'generic', will return 'generic' given any version string. Raises `ValueError` if no key could be found for requested version.
def get_version_key(self, version): if self._generic_only: return GENERIC_VERSION else: self.check_version_exists(version) return version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetKey(self, version_number):\n return self.dict[str(version_number)]", "def key_version(self) -> Optional[str]:\n return pulumi.get(self, \"key_version\")", "def get_version(self, key, version=None):\n if version is None:\n if key not in self._data:\n raise KeyEr...
[ "0.7516901", "0.6918039", "0.6749801", "0.6605578", "0.6401275", "0.6225745", "0.620228", "0.619842", "0.6191113", "0.6155921", "0.6147764", "0.60847867", "0.6057561", "0.60508114", "0.5988967", "0.59874403", "0.59791094", "0.59724796", "0.5945546", "0.59303916", "0.58354455"...
0.8208527
0
Creates a keras regularizer.
def get_regularizer(type, l1, l2): if type == 'l1': reg = keras.regularizers.l1(l1) elif type == 'l2': reg = keras.regularizers.l2(l2) elif type == 'l1_l2': reg = keras.regularizers.l1_l2(l1, l2) else: reg = None return reg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_regularizer(self, regularizer = regularizers.l1(0.1)):\n # for layer in self.layers:\n # layer.kernel_regularizer = regularizer\n self.list_cnn[-1].kernel_regularizer = regularizer", "def add_regularization(self, regularizer):\n for layer in self.prenet_layers:\n ...
[ "0.6614855", "0.6163753", "0.6110547", "0.60351515", "0.5921308", "0.5716683", "0.56689423", "0.5552135", "0.54837906", "0.5478638", "0.546309", "0.5458307", "0.54565173", "0.5401835", "0.53959936", "0.5376531", "0.5373115", "0.5337177", "0.5316122", "0.53155696", "0.52800167...
0.6125757
2
Return a strategy that holds if and only if pending >= x or player reaches goal.
def hold_at(x): def strategy(state): # your code here p, me, you, pending = state return "hold" if (pending >= x or me + pending >= goal) else "roll" strategy.__name__ = 'hold_at(%d)' % x return strategy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hold_at(x):\n\n def strategy(state):\n (p, me, you, pending) = state\n return 'hold' if (pending >= x or me + pending >= goal) else 'roll'\n\n strategy.__name__ = 'hold_at(%d)' % x\n return strategy", "def Pwin(state):\n # Assumes opponent also plays with optimal strategy\n p, me...
[ "0.7355454", "0.60242695", "0.6023155", "0.5951468", "0.5937637", "0.572351", "0.5663513", "0.56209296", "0.56154317", "0.56149787", "0.5597981", "0.55769897", "0.556702", "0.55660975", "0.5485379", "0.54448724", "0.5435684", "0.54253024", "0.5404603", "0.5403368", "0.5395781...
0.7068357
1
A strategy that maximizes the expected difference between my final score and my opponent's.
def max_diffs(state): # your code here return best_action(state, pig_actions, Q_pig, win_diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_strategy(score, opponent_score):\r\n free, k = opponent_score // 10 + 1, 1\r\n winning = score > opponent_score\r\n ratio = (goal - score) / (goal - opponent_score)\r\n mean = make_mean_strategy(3)(score, opponent_score)\r\n if goal - score <= free: return 0\r\n while k < 4:\r\n ...
[ "0.7319641", "0.7241692", "0.72058785", "0.70882905", "0.69610775", "0.6886896", "0.688641", "0.6814296", "0.6810675", "0.67275155", "0.67186815", "0.6703836", "0.6694766", "0.6693455", "0.6671631", "0.666438", "0.6662398", "0.66298085", "0.6617561", "0.6569686", "0.6525511",...
0.6654747
17