query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Set the P_source for the single source constraint
def _set_p_source(self, p_source, p_rec_div=1): self.p_source = p_source self.p_S_fin = (1-p_source)*self.p_sus self.p_rec_div = p_rec_div self.p_infect_fin = (1-p_source)* (1-self.p_sus) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_source(self, source):\n self.data['source'] = source", "def set_flow_source(self, source):\n self._source = source", "def _set_source(self, source):\n if source != self._source:\n self._source = source\n self._channel = \"\"\n self._channel_name = \...
[ "0.7000559", "0.6853645", "0.684918", "0.67619085", "0.6555328", "0.6456665", "0.64430463", "0.64430463", "0.64430463", "0.64430463", "0.64430463", "0.64430463", "0.64430463", "0.6427387", "0.6293089", "0.62723905", "0.6253527", "0.6253527", "0.61970097", "0.6196628", "0.6192...
0.71566385
0
Set the logp values
def _update_logprobs(self): #self._logp_src = self._log_lim(self.p_source) self._logp_I0 = self._log_lim(self.p_source) self._logp_R0 = self._log_lim(self.p_source/(self.p_rec_div)) self._logp_S_fin = self._log_lim(self.p_S_fin) self._logp_inf_fin = self._log_lim(self.p_infect_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_from_main(self, *args):\n if self.logarithmic:\n self.scale.props.adjustment.props.value = \\\n self.smart_log(self.adjustment.props.value)", "def logp(self, x):\n pass", "def logP(self):\n raise NotImplementedError", "def __convert_to_log(self):\n ...
[ "0.70663077", "0.69361013", "0.6926119", "0.6848954", "0.6629823", "0.66100806", "0.6530385", "0.64838487", "0.64838487", "0.64012814", "0.6313983", "0.6302697", "0.629172", "0.62717354", "0.62027687", "0.61778677", "0.6150077", "0.6138653", "0.6104388", "0.6076358", "0.60307...
0.7145263
0
Attempt to submit a bad file
def testBadFileSubmit(self, mock_open): mock_open.side_effect = IOError self.assertRaises( auacm.exceptions.InvalidSubmission, auacm.submit.submit, ['problem 1', 'notafile.cpp'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_bad_file(self):\n url = image_upload_url(self.reteta.id)\n res = self.client.post(url, {'image': 'notimage'}, format='multipart')\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)", "def test_file_upload_fail(self):\r\n module = self.get_module_from_loca...
[ "0.71990144", "0.7005815", "0.6821353", "0.6793216", "0.6602382", "0.6537717", "0.6516978", "0.6459598", "0.640576", "0.6296545", "0.6278691", "0.6249999", "0.62274677", "0.6221819", "0.6215732", "0.62119937", "0.620819", "0.62067413", "0.6171933", "0.6168765", "0.61468196", ...
0.7296077
0
Return a mapping of bike station ids to the predicted number of bikes needed, e.g. >>> weather_data = {
def predict_bike_demand(weather_data): # TODO: connect to the real deal! return {s["extra"]["uid"]: random.randint(0, 11) for s in MOCK_STATION_STATS}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bikes_prediction(station_id,time_hour):\r\n\r\n # get the data through openWeather api\r\n r = requests.get('http://api.openweathermap.org/data/2.5/forecast?appid=9511c6f09bf671d3bd65bf650197234f&q=Dublin')\r\n weathers = r.json()\r\n\r\n weather_detalis = weathers[\"list\"]\r\n temp = weather_d...
[ "0.6407551", "0.6013032", "0.5959645", "0.5732601", "0.5715449", "0.5615073", "0.5461735", "0.5427727", "0.5422435", "0.5406403", "0.53591686", "0.5297303", "0.5228484", "0.52237123", "0.52150697", "0.5209488", "0.519387", "0.5190188", "0.5189188", "0.51510733", "0.51246756",...
0.7164526
0
Takes a list and puts turn every element in list to integer and returns a tuple of those integers. Prints error message and returns empty tuple if there is an element that i not list
def list_to_tuple(list): templist = [] for i in list: try: templist.append(int(i)) except ValueError: print('Error. Please enter only integers.') return () return tuple(templist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processed(N:int)->tuple:\n l1= str(N)\n a,b = '',''\n for i in range(len(l1)):\n if l1[i] == '4':\n a+='2'\n b+='2'\n else:\n a+=str(l1[i])\n b+='0'\n return int(a), int(b)", "def _to_tuple(values: Union[int, Iterable[int]]) -> Tuple[int, ...
[ "0.6849902", "0.65656465", "0.6465324", "0.63646877", "0.617637", "0.61712325", "0.61625373", "0.61295885", "0.61062", "0.60706764", "0.6066202", "0.6066202", "0.6066202", "0.6015309", "0.5969996", "0.59488297", "0.5945779", "0.59452987", "0.5942725", "0.59121597", "0.5907333...
0.84013814
0
Calculate the loss. You can calculate the loss using mse or mae.
def compute_loss(y, tx, w): # *************************************************** # INSERT YOUR CODE HERE # TODO: compute loss by MSE / MAE # *************************************************** # vector e e = compute_e(y, tx, w) N = compute_N(e) L_MSE = np.dot(np.matrix.transpose(e)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def calc_loss(self, x: np.ndarray, y: np.ndarray) -> float:\n return self.descent.calc_loss(x, y)", "def calculate_loss(self, X, y):\n probs = self.predict(X)\n\n num_examples = X.shape[0]\n\n sub = np.subtract(probs, y)\n abs_sum = np.abs(sub)\n ...
[ "0.80474067", "0.77250457", "0.77212405", "0.7686314", "0.76515734", "0.7590657", "0.7590657", "0.7521977", "0.75205433", "0.7510856", "0.7470165", "0.7456652", "0.7438454", "0.7398427", "0.73179173", "0.73172104", "0.7310165", "0.7301446", "0.72921497", "0.72774357", "0.7251...
0.7866642
1
Creates a MainWindow using 75% of the available screen resolution.
def create_main_window(): main_win = MainWindow() main_windows.append(main_win) available_geometry = app.desktop().availableGeometry(main_win) main_win.resize(available_geometry.width() * 2 / 3, available_geometry.height() * 2 / 3) main_win.show() return main_win
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.app = qt.QApplication(sys.argv)\n self.window = qt.QMainWindow()\n self.screenSize = qt.QDesktopWidget().screenGeometry(-1)\n self.window.setGeometry(self.getDims()[1]/4, self.getDims()[0]/4, self.getDims()[1]/2, self.getDims()[0]/2)", "def placeWindow(self)...
[ "0.71360654", "0.66262525", "0.66070336", "0.65157807", "0.65085334", "0.65072685", "0.64285207", "0.64025426", "0.63241714", "0.627627", "0.610974", "0.6101933", "0.6099385", "0.60701615", "0.60571706", "0.60571706", "0.60571706", "0.6039301", "0.60290587", "0.5989896", "0.5...
0.77146345
0
Creates a MainWindow with a BrowserTabWidget.
def create_main_window_with_browser(): main_win = create_main_window() return main_win.add_browser_tab()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, parent):\n self.widget = _QMainWindow(parent)", "def createWindow(self, type):\n # this = Browser(self.url())\n # this.show()\n\n self.popup = SequanixQWebView(**self.kwargs)\n self.popup.setObjectName(\"web_content\")\n self.popup.setWindowTitle(\"Sequa...
[ "0.68949765", "0.6478098", "0.6435696", "0.6413921", "0.62903494", "0.62232417", "0.6180552", "0.6119633", "0.61178416", "0.6103711", "0.60432786", "0.60425925", "0.59410733", "0.59396756", "0.5931825", "0.59298074", "0.58862966", "0.5838804", "0.5838804", "0.58258635", "0.58...
0.7908725
0
Parse notification from page
def _parse_notification(self, node): if not node: return [] messages = [] notify_node = node.find('div', class_='notify') if notify_node: for p in notify_node.select('p.notification'): messages.append(p.get_text()) return messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInfo(notification):", "def parse_atwho(my_text):\n notification_list = []\n \n #markdown_link_regex = re.compile(\"\\[.*?\\] \\((.*?) \\\".*?\\\"\\)\", re.IGNORECASE) # need to test this.\n markdown_link_regex = re.compile(\"\\[([^\\]]+)\\]\\(([^)\\\"]+)(?: \\\\\\\"([^\\\\\\\"]+)\\\\\\\")?\\)...
[ "0.64302725", "0.64142305", "0.6221922", "0.6151411", "0.5999759", "0.58872384", "0.5816123", "0.57522553", "0.5707328", "0.5624357", "0.56066173", "0.55695975", "0.5541741", "0.55331326", "0.55007076", "0.54943013", "0.5464355", "0.5452439", "0.5447044", "0.5440226", "0.5401...
0.72214854
0
Convert comment data JSON for mobile display
def _convert_comment(self, data): output = {} output['id'] = int(data['id']) output['author'] = data['user_display_name'] output['profile_url'] = data['user_url'] output['date'] = data['comment_added_at'] output['date_ago'] = timeago.format(self._parse_datetime(data['com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment_in_json(self):\n\t\tpass", "def comments(self):\n comments_url = self.data['comments_url']\n return json.load(urllib2.urlopen(comments_url))", "def comment_to_object(self, comment, post_author_id=None):\n # the message_tags field is different in comment vs post. in post, it's a\n ...
[ "0.7134723", "0.64888424", "0.637814", "0.62791246", "0.61551374", "0.6044316", "0.5998198", "0.5990303", "0.59835607", "0.5981284", "0.59108824", "0.5874552", "0.58657545", "0.5792547", "0.5747527", "0.57035154", "0.56909966", "0.5671392", "0.5666398", "0.5646678", "0.564570...
0.79955125
0
Get logged in user from cache
def get_logged_in_user(self): if type(self.cache) is Cache: sessionId = self.cache.get('user.sessionId') userId = self.cache.get('user.id') if sessionId and userId: self.sessionId = sessionId self.userId = userId user = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logged_user():\n return get_from_session(KEY_USER)", "def get_cached_user(user_id):\n cache_key = app_settings.CACHED_USER_KEY_TEMPLATE.format(\n site_id=settings.SITE_ID, \n user_id=user_id\n )\n user = cache.get(cache_key, None)\n if user is None:\n try:\n ...
[ "0.77119267", "0.7561403", "0.75211304", "0.7454216", "0.73541325", "0.73536277", "0.7330943", "0.72674334", "0.7243006", "0.7223945", "0.71723396", "0.7157568", "0.71509427", "0.7140306", "0.7090559", "0.7074809", "0.70509964", "0.7049927", "0.70444727", "0.7029923", "0.7027...
0.815407
0
Parse user's messages from page
def _parse_user_messages_page(self, html): if not html: return None dom = BeautifulSoup(html, 'html.parser') data = self._parse_logged_in_user(dom) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_message(self, soup):\n kind, = soup.attrs[u'class']\n title = soup.findChild().text\n body = ''.join(t.text for t in soup.findChildren()[1:])\n message = dict(kind=kind, title=title, body=body)\n for val in message.values():\n assert type(val) == str\n ...
[ "0.6575689", "0.6570656", "0.63135284", "0.628515", "0.62355065", "0.6216852", "0.6142316", "0.607651", "0.60617214", "0.6023116", "0.6011333", "0.5981321", "0.59291005", "0.59062594", "0.58831334", "0.58828837", "0.5859643", "0.5853651", "0.5852005", "0.5831771", "0.58298653...
0.82223177
0
Try get session Id from WebKit cookies DB
def get_session_id_from_cookie(self): conn = sqlite3.connect(COOKIE_PATH) cursor = conn.cursor() params = ('together.jolla.comsessionid',) cursor.execute('SELECT * FROM cookies WHERE cookieId = ?', params) row = cursor.fetchone() if row is not None: cookie = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_id(self):\n return self.browser.crawlera_session", "def get_session_id(self):\n return self.request_data['id']", "def _getswabid(environ):\n try:\n return environ['swab.id']\n except KeyError:\n pass\n cookie = Request(environ).cookies.get('swab')\n if cookie...
[ "0.684743", "0.6749757", "0.67293745", "0.66384244", "0.6619955", "0.65192", "0.6503215", "0.63944334", "0.63649696", "0.6357397", "0.63556963", "0.6275198", "0.620214", "0.6145915", "0.6140672", "0.6135115", "0.61138916", "0.6101876", "0.60884416", "0.60752755", "0.60656494"...
0.7772008
0
Parse logged in user info from page header
def _parse_logged_in_user(self, node): user_node = node.select_one('div#userToolsNav') if not user_node: return None user_stats = user_node.select_one('span.user-info') if not user_stats: return None data = {} user_link = user_node.select_one('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_user_data (self, netflix_page_data):\n user_data = {};\n important_fields = [\n 'authURL',\n 'gpsModel',\n 'guid'\n ]\n\n # values are accessible via dict (sloppy parsing successfull)\n if type(netflix_page_data) == dict:\n f...
[ "0.6791457", "0.67451113", "0.6516258", "0.65075475", "0.65075475", "0.63439125", "0.63034827", "0.6252347", "0.6215166", "0.61992705", "0.6198551", "0.61583066", "0.61355966", "0.61322826", "0.61292905", "0.6124725", "0.6091143", "0.6075794", "0.6075346", "0.6038846", "0.602...
0.7291526
0
Parse question data from DOM node
def _parse_question_html(self, node): if node is None: return None data = {} data['has_more_comments'] = False data['has_more_answers'] = False data['id'] = int(node.get('id').replace('question-', '')) h2_node = node.find('h2') if h2_node is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_question(self, text, params={}):\n\n dom = BeautifulSoup(text, 'html.parser')\n\n data = {}\n\n # If requested page is not first page, it mean we only need load more answers\n if params['page'] == 1:\n # Parse user info\n data['users'] = []\n ...
[ "0.6670985", "0.5976315", "0.59380513", "0.58029866", "0.57788837", "0.5576191", "0.53909415", "0.5249243", "0.5216531", "0.5199933", "0.51827544", "0.51701975", "0.51307523", "0.5097334", "0.5091783", "0.5084911", "0.5055956", "0.5032215", "0.5027602", "0.5010149", "0.499679...
0.770682
0
Parse question details from html response
def _parse_question(self, text, params={}): dom = BeautifulSoup(text, 'html.parser') data = {} # If requested page is not first page, it mean we only need load more answers if params['page'] == 1: # Parse user info data['users'] = [] post_node = dom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_question_html(self, node):\n\n if node is None:\n return None\n\n data = {}\n\n data['has_more_comments'] = False\n data['has_more_answers'] = False\n data['id'] = int(node.get('id').replace('question-', ''))\n\n h2_node = node.find('h2')\n if ...
[ "0.7339163", "0.68039155", "0.66917884", "0.631492", "0.6244135", "0.61681545", "0.6128832", "0.6124948", "0.6037291", "0.59815145", "0.59344417", "0.5837285", "0.5769417", "0.575594", "0.57425815", "0.56890744", "0.56850564", "0.5662544", "0.56593573", "0.56189245", "0.56130...
0.6876753
1
Build url for question list
def build_list_url(self, params={}): url = BASE_URL + 'api/v1/questions/' if params: url += '?' + urllib.parse.urlencode(self.clean_params(params)) return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_post_list_url(self):\n return urljoin(self.BASE_URL, self.POST_LIST_URL)", "def url(self):\n return reverse('snippet-list')", "def construct_url(self):\n path = [self.path]\n path.extend([str(x) for x in self.params])\n\n url = self.client.base_url + '/'.join(x for x...
[ "0.6373155", "0.63654226", "0.6280937", "0.6246357", "0.6218233", "0.6205551", "0.6102574", "0.60705477", "0.60506797", "0.6043795", "0.60000736", "0.5996932", "0.59536606", "0.5917964", "0.5904006", "0.58995205", "0.5893151", "0.5887981", "0.58844286", "0.5881763", "0.584906...
0.8045995
0
Build url for question page details, including paging, sorting
def build_details_url(self, params={}): if 'url' in params: url = params['url'] url += '?page=' + str(int(params['page'])) + '&sort=' + str(params['sort']) return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(self, page_number=1):\n return ''.join(\n ['http://a.qidian.com/', '?size=', str(self.size), '&sign=', str(self.sign), '&tag=', str(self.tag),\n '&chanId=', str(self.chanId), '&subCateId=', str(self.subCateId), '&orderId=', str(self.orderId),\n '&update=', str(...
[ "0.6673839", "0.65708864", "0.6440531", "0.6379734", "0.62787867", "0.6092793", "0.6091528", "0.6076074", "0.60007733", "0.5961712", "0.59066933", "0.5900967", "0.58840996", "0.58442384", "0.58360463", "0.5823607", "0.5817216", "0.5812188", "0.58041906", "0.5783659", "0.57749...
0.7364159
0
Return Gravatar with maximum size
def get_gravatar(self, source, size=100): return re.sub('s=(\d+)', 's=' + str(size), self.get_link(source))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avatar(self, size=200, d=\"robohash\"):\n\t\tdigest = md5(self.email.lower().encode('utf-8')).hexdigest()\n\t\tg = \"https://gravatar.com/avatar/{}?d={}&s={}\".format(digest, d, size)\n\t\treturn g", "def gravatar_url(email, size=80):\n return 'http://www.gravatar.com/avatar/%s?d=identicon&s=%d' % \\\n ...
[ "0.6543706", "0.652166", "0.652166", "0.64982855", "0.6495083", "0.6452975", "0.6447085", "0.62740374", "0.622244", "0.6142005", "0.6137685", "0.59658086", "0.5932887", "0.59247464", "0.5919478", "0.5854818", "0.5753524", "0.5750543", "0.57245594", "0.5715687", "0.55389243", ...
0.708055
0
Convert html to DOM for process images, links... Also return string processed
def convert_content(self, html): try: dom = BeautifulSoup(html, 'html.parser') return self.parse_content(dom) except: return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_html():\n return", "def promed_html_to_formatted_text(html):\n # This is to fix some cases in malformed html where <s aren't esacaped.\n # >s can be parsed without escaping.\n normed_html = html.\\\n replace(\"<<\", \"&lt;<\").\\\n replace(\"<http\", \"&lt;http\").\\\n ...
[ "0.7239839", "0.659467", "0.657226", "0.656696", "0.6490043", "0.6425265", "0.6414505", "0.64094734", "0.6365156", "0.63646567", "0.63585263", "0.63093334", "0.6302106", "0.623015", "0.62219685", "0.6208928", "0.6206838", "0.6191704", "0.6181132", "0.61616075", "0.61527205", ...
0.6950768
1
Parse questions from API response
def _parse_questions(self, text, params): try: data = json.loads(text) except ValueError as e: Utils.log(traceback.format_exc()) raise Exception('Could not get content') output = {} output['count'] = data['count'] output['pages'] = data['page...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_get_responses():\n json_data = open('/Users/williamliu/GitHub/surveys/get_responses.json')\n loaded_data = json.load(json_data)\n test = json_normalize(loaded_data['data'])\n\n print type(test)\n print test.head()\n\n # Get first respondent's questions and answers back\n #print loade...
[ "0.6683125", "0.64587665", "0.6452531", "0.63551277", "0.6319017", "0.62600535", "0.62520546", "0.62217253", "0.6206413", "0.6111697", "0.6105986", "0.60504484", "0.6041145", "0.6023531", "0.60067135", "0.5974075", "0.59160846", "0.5890735", "0.58624613", "0.58607596", "0.585...
0.6853872
0
Convert question raw data
def convert_question(self, q): item = {} item['id'] = q['id'] item['title'] = q['title'] item['body'] = q['text'] item['author_id'] = q['author']['id'] item['author'] = q['author']['username'] item['url'] = q['url'] item['score'] = q['score'] item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertData(data):\n\n return data", "def convert_txt_to_data():\n pass", "def _get_converted_data(self):\n pass", "def transform(self, data):", "def decode_input_data(self, rawdata):\n return self.get_content_type().loads(rawdata, self)", "def data_for_question(self, question...
[ "0.65550745", "0.6127209", "0.60165995", "0.5991417", "0.57663774", "0.5749049", "0.5713165", "0.567219", "0.5659159", "0.56423324", "0.56397426", "0.55999476", "0.5513851", "0.5502245", "0.5497998", "0.5479821", "0.5475443", "0.5465245", "0.545568", "0.54260504", "0.54260504...
0.6391561
1
Convert count number to label
def convert_count(self, count): count = int(count) if count >= 1000: return str(int(count / 1000)) + 'k' else: return str(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numToStrLabel(self, value):\n zero_count = 3 - len(str(value))\n return zero_count * \"0\" + str(value)", "def int_to_text(self, labels):\n string = []\n for i in labels:\n string.append(self.index_map[i])\n return ''.join(string).replace('', ' ')", "def create...
[ "0.7585147", "0.6444092", "0.6398636", "0.63696074", "0.6362171", "0.62847257", "0.62568784", "0.62455547", "0.62153375", "0.62082916", "0.6184615", "0.61571884", "0.6150326", "0.614304", "0.61208063", "0.60952497", "0.6082725", "0.60614187", "0.60454804", "0.60439867", "0.59...
0.6841037
1
Initialise bishop, sets color of piece.
def __init__(self, color, *args, **kwargs): # Initialise bishop with correct symbol super().__init__( color, symbol = PieceRepresentation.KING, *args, **kwargs, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, color):\n self.id = Piece.PIECE_ID\n self.crowned = False\n self.color = color\n\n Piece.PIECE_ID += 1", "def __init__(self, color, location):\n\n super().__init__(color, location)\n self._piece_type = 'Ho'", "def __init__(self, color, location):\n\n...
[ "0.6933153", "0.69328475", "0.6804505", "0.67297816", "0.6722225", "0.66612196", "0.66514975", "0.6557041", "0.6474227", "0.6467087", "0.6432223", "0.64256966", "0.62181336", "0.6193901", "0.6152506", "0.61518973", "0.61518973", "0.61518973", "0.61518973", "0.61518973", "0.61...
0.71482193
0
Take a JSON POST body, add an attribute to it "SeenByFakeDocker", then pass it back as a response.
def render_POST(self, request): jsonPayload = request.content.read() jsonParsed = json.loads(jsonPayload) if "SeenByFakeDocker" in jsonParsed: raise Exception("already seen by a fake docker?!") jsonParsed["SeenByFakeDocker"] = 42 if not self.rawStream: req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_post(method):\n def wrap(*args, **kwargs):\n # idx is the position of the data\n idx = 0\n if not isinstance(args[0], webob.Request):\n idx = 1\n\n json_data = json.loads(args[idx].body)\n kwargs['post_data'] = json_data\n\n #print \"JP:\", repr(args...
[ "0.579965", "0.5641818", "0.5623903", "0.54964966", "0.5440844", "0.53810656", "0.5376849", "0.52939844", "0.52551764", "0.5233824", "0.52013814", "0.51728314", "0.517167", "0.5169562", "0.51675385", "0.51555437", "0.5133879", "0.5133879", "0.5101325", "0.50688505", "0.502594...
0.74861807
0
OK, we got to the meat of it. This render handles JSON POST requests. If pre is set, it succeeds on JSON which looks like.
def render_POST(self, request): jsonPayload = request.content.read() jsonParsed = json.loads(jsonPayload) if self.explode: request.setResponseCode(500) return "sadness for you, today." if jsonParsed["Type"] == "pre-hook" and self.pre: return self._re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_POST(self, request):\n jsonPayload = request.content.read()\n jsonParsed = json.loads(jsonPayload)\n if \"SeenByFakeDocker\" in jsonParsed:\n raise Exception(\"already seen by a fake docker?!\")\n jsonParsed[\"SeenByFakeDocker\"] = 42\n if not self.rawStream...
[ "0.651392", "0.5857324", "0.585235", "0.58278984", "0.58079636", "0.57987946", "0.56987077", "0.5682887", "0.566622", "0.56309", "0.5614444", "0.55940974", "0.55289334", "0.5502075", "0.5488988", "0.54605556", "0.54228806", "0.5408678", "0.5402406", "0.539539", "0.53892547", ...
0.6845635
0
Remove a guild's configuration from the database.
async def clear_config(self, ctx, guild_id: int): try: result = await db.Config.filter(guild_id=guild_id).delete() except Exception as e: result = f"{e.__class__.__name__}: {e}" db.config_cache.pop(guild_id) await ctx.send(f"```py\n{result}\n```")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def remove_guild(self, guild_id):\n\n await self.db[str(guild_id)].drop()", "async def on_guild_remove(self, guild):\n self.jfile.data.pop(str(guild.id), None)\n self.jfile.save\n log.guildinfo(\"Removed\", guild.id)", "async def on_guild_remove(self, guild):\n\t\tself.leaderb...
[ "0.68177557", "0.6752706", "0.66133314", "0.6459288", "0.6397447", "0.63166744", "0.6134505", "0.59588444", "0.5935352", "0.5916336", "0.5829168", "0.5798249", "0.57827187", "0.57659113", "0.5725611", "0.5722255", "0.57106936", "0.5624269", "0.5620863", "0.5614595", "0.561379...
0.69693434
0
Completely remove a guild's modlog data from the database.
async def clear_modlog(self, ctx, guild_id: int): # remove infractions try: result_1 = await db.Infraction.filter(guild_id=guild_id).delete() except Exception as e: result_1 = f"{e.__class__.__name__}: {e}" # remove user history try: result_2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_guild_remove(self, guild):\n self.jfile.data.pop(str(guild.id), None)\n self.jfile.save\n log.guildinfo(\"Removed\", guild.id)", "async def logremove(self, ctx):\n if await check_if_logged(channel_id=ctx.channel.id):\n c.execute(\"DELETE FROM logging.channels W...
[ "0.71187824", "0.65700024", "0.6538177", "0.64906514", "0.64783925", "0.6283352", "0.6217291", "0.61778146", "0.60201395", "0.58525705", "0.5699053", "0.56744224", "0.56560785", "0.5587909", "0.5570198", "0.55293846", "0.55292803", "0.5519154", "0.55070776", "0.54834366", "0....
0.73581076
0
an im2col function, transferring an image to patches of size window (length 2 list). the step size is the stride of the sliding window.
def im2col(A, window, stepsize=1): return viewW(np.ascontiguousarray(A), (window[0], window[1])).reshape(-1, window[0] * window[1]).T[:, ::stepsize]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfold(input, kernel_size, dilation=1, padding=0, stride=1):\n nd_util = utils._ntuple(input.ndimension() - 2)\n out = FunctionLib.apply(\n 'Im2Col',\n input.device,\n [input],\n kernel_shape=nd_util(kernel_size),\n strides=nd_util(stride),\n pads=nd_util(padding...
[ "0.6645364", "0.6491519", "0.62999904", "0.60910404", "0.604907", "0.58832616", "0.5740589", "0.5653002", "0.5623746", "0.5609291", "0.55689853", "0.55332327", "0.5455916", "0.5418624", "0.5417081", "0.5379944", "0.5376328", "0.53699076", "0.53666115", "0.5354386", "0.5336", ...
0.71692234
0
sample N psized patches from images after standardising them.
def sample_patches(images, psize=(8, 8), n=10000, remove_mean=True): d = psize[0] * psize[1] patches = np.zeros((d, n)) standardized = grayscale_and_standardize(images, remove_mean) shapes = [] for pic in standardized: shapes.append(pic.shape) rand_pic_num = np.random.randint(0, len(st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_patches(images, npatches, patch_sz):\n\tnimages, nrows, ncols = images.shape\n\timg_index = np.random.randint(0, nimages, npatches)\n\trow_index = np.random.randint(0, nrows-patch_sz, npatches)\n\tcol_index = np.random.randint(0, ncols-patch_sz, npatches)\n\tpatches = np.empty((npatches, patch_sz, patch...
[ "0.67314327", "0.6650126", "0.6467092", "0.64232033", "0.63184655", "0.6244714", "0.61122465", "0.6007285", "0.5839796", "0.5838395", "0.5829985", "0.5823634", "0.58136296", "0.580021", "0.5799174", "0.5792084", "0.5783304", "0.576639", "0.5761128", "0.57605505", "0.57274", ...
0.75956285
0
A function for denoising an image. The function accepts a noisy gray scale image, denoises the different patches of it and then reconstructs the image.
def denoise_image(Y, model, denoise_function, noise_std, patch_size=(8, 8)): (h, w) = np.shape(Y) cropped_h = h - patch_size[0] + 1 cropped_w = w - patch_size[1] + 1 middle_linear_index = int( ((patch_size[0] / 2) * patch_size[1]) + (patch_size[1] / 2)) # split the image into columns and de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_denoising(image, model, denoise_function,\n noise_range=(0.01, 0.05, 0.1, 0.2), patch_size=(8, 8)):\n h, w = np.shape(image)\n noisy_images = np.zeros((h, w, len(noise_range)))\n denoised_images = []\n cropped_original = crop_image(image, patch_size)\n\n # make the image n...
[ "0.6804645", "0.6336191", "0.6276971", "0.61491084", "0.6051832", "0.6048815", "0.6029486", "0.60108566", "0.59982866", "0.5986291", "0.596342", "0.5904856", "0.5863499", "0.5794029", "0.57855695", "0.5770762", "0.572468", "0.5707011", "0.5696118", "0.56886435", "0.5676679", ...
0.66669136
1
Given a matrix in log space, return the matrix with normalized columns in log space.
def normalize_log_likelihoods(X): h, w = np.shape(X) return X - np.tile(logsumexp(X, axis=0), (h, 1)) # return X - np.matlib.repmat(logsumexp(X, axis=0), h, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_normalize(log_prob, axis):\n log_sum = logsumexp(log_prob, axis=axis)\n \n if not isinstance(log_sum, np.ndarray):\n log_sum = np.array([log_sum])\n if log_prob.shape[0] == log_sum.shape[0]:\n # column normalize \n return (log_prob.transpose() - log_sum).transpose()\n el...
[ "0.71530575", "0.66780686", "0.64958405", "0.633474", "0.63256425", "0.63216084", "0.6304669", "0.62542933", "0.62441796", "0.6148054", "0.6142754", "0.6142461", "0.611145", "0.60670215", "0.59872395", "0.59844184", "0.59607893", "0.5960525", "0.5908303", "0.58673406", "0.585...
0.71583116
0
Given image patches and a MVN model, return the log likelihood of the patches according to the model.
def MVN_log_likelihood(X, model): D, M = X.shape X_normalized = normalize_log_likelihoods(X.copy()) mvn = multivariate_normal(mean=model.mean, cov=model.cov) return mvn.logpdf(X_normalized.T).sum() # log_2pi = D * np.log(2 * np.pi) # log_det = np.log(np.linalg.det(model.cov)) # residuals = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GSM_log_likelihood(X, model):\n D, M = X.shape\n k = model.mix.shape[0]\n log_likelihood = 0\n for i in range(M):\n logpdf_X = 0\n for j in range(k):\n mvn = multivariate_normal(cov=model.cov[j, :])\n logpdf_X = mvn.logpdf(x=X[:, i]) * model.mix[j]\n log_l...
[ "0.6581772", "0.6201777", "0.6165119", "0.6070179", "0.5969646", "0.5882966", "0.58730745", "0.586947", "0.58435184", "0.5781459", "0.57760274", "0.5753418", "0.57469696", "0.5681554", "0.56661844", "0.5662688", "0.5646431", "0.5612954", "0.56089133", "0.5596493", "0.55937177...
0.65176845
1
Given image patches and a GSM model, return the log likelihood of the patches according to the model.
def GSM_log_likelihood(X, model): D, M = X.shape k = model.mix.shape[0] log_likelihood = 0 for i in range(M): logpdf_X = 0 for j in range(k): mvn = multivariate_normal(cov=model.cov[j, :]) logpdf_X = mvn.logpdf(x=X[:, i]) * model.mix[j] log_likelihood += l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loglike(self, params):\n\n if type(params) is not MixedLMParams:\n params = MixedLMParams.from_packed(params, self.k_fe,\n self.use_sqrt)\n\n fe_params = params.get_fe_params()\n cov_re = params.get_cov_re()\n try:\n ...
[ "0.6422759", "0.6289507", "0.61328065", "0.59302616", "0.58532107", "0.5736071", "0.5675968", "0.56670296", "0.56350833", "0.556734", "0.5563308", "0.55380976", "0.5481087", "0.5438895", "0.54248834", "0.5403001", "0.5399288", "0.539747", "0.53716975", "0.5363187", "0.5358293...
0.68105716
0
Given image patches and an ICA model, return the log likelihood of the patches according to the model.
def ICA_log_likelihood(X, model): # TODO: YOUR CODE HERE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_function(self, instance):\r\n\r\n try:\r\n return self.fit_interferometer_for_instance(\r\n instance=instance\r\n ).figure_of_merit\r\n except (\r\n exc.PixelizationException,\r\n exc.InversionException,\r\n exc....
[ "0.61544716", "0.6020137", "0.59118134", "0.5785453", "0.5719369", "0.56867313", "0.5613568", "0.5562878", "0.5560809", "0.55222946", "0.55194604", "0.5514143", "0.55073017", "0.54521865", "0.5437854", "0.5399128", "0.5386203", "0.5381811", "0.5379536", "0.53365344", "0.53302...
0.6737606
0
Denoise every column in Y, assuming an MVN model and gaussian white noise. The model assumes that y = x + noise where x is generated by a single 0mean multivariate normal distribution.
def MVN_Denoise(Y, mvn_model, noise_std): return calc_weiner_filter(Y, mvn_model.mean, mvn_model.cov, noise_std)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GSM_Denoise(Y, gsm_model, noise_std):\n X = np.empty(Y.shape)\n k = gsm_model.mix.shape[0]\n I = np.identity(gsm_model.cov[0, :].shape[0])\n for i in range(k):\n mvn = multivariate_normal(cov=(gsm_model.cov[i, :] + ((noise_std**2) * I)))\n upper_arg = gsm_model.mix[i] * (mvn.logpdf(Y[...
[ "0.7035352", "0.6817909", "0.651164", "0.60872686", "0.599298", "0.5948621", "0.5867001", "0.5618468", "0.5616018", "0.55830455", "0.5568835", "0.5553988", "0.5434292", "0.5406714", "0.53591746", "0.53309554", "0.5318294", "0.53102773", "0.5291699", "0.5256051", "0.5250106", ...
0.780044
0
Denoise every column in Y, assuming a GSM model and gaussian white noise. The model assumes that y = x + noise where x is generated by a mixture of 0mean gaussian components sharing the same covariance up to a scaling factor.
def GSM_Denoise(Y, gsm_model, noise_std): X = np.empty(Y.shape) k = gsm_model.mix.shape[0] I = np.identity(gsm_model.cov[0, :].shape[0]) for i in range(k): mvn = multivariate_normal(cov=(gsm_model.cov[i, :] + ((noise_std**2) * I))) upper_arg = gsm_model.mix[i] * (mvn.logpdf(Y[:, i])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ICA_Denoise(Y, ica_model, noise_std):\n\n # TODO: YOUR CODE HERE", "def denoise_image(Y, model, denoise_function, noise_std, patch_size=(8, 8)):\n (h, w) = np.shape(Y)\n cropped_h = h - patch_size[0] + 1\n cropped_w = w - patch_size[1] + 1\n middle_linear_index = int(\n ((patch_size[0] ...
[ "0.66855353", "0.6581606", "0.63768095", "0.61107254", "0.5810138", "0.5789084", "0.56934977", "0.5500701", "0.5492713", "0.54288906", "0.54254895", "0.53467345", "0.5328296", "0.532445", "0.5312437", "0.5300838", "0.5274596", "0.5271104", "0.5264344", "0.52400446", "0.523026...
0.7913218
0
Denoise every column in Y, assuming an ICA model and gaussian white noise. The model assumes that y = x + noise where x is generated by an ICA 0mean mixture model.
def ICA_Denoise(Y, ica_model, noise_std): # TODO: YOUR CODE HERE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def denoise_image(Y, model, denoise_function, noise_std, patch_size=(8, 8)):\n (h, w) = np.shape(Y)\n cropped_h = h - patch_size[0] + 1\n cropped_w = w - patch_size[1] + 1\n middle_linear_index = int(\n ((patch_size[0] / 2) * patch_size[1]) + (patch_size[1] / 2))\n\n # split the image into co...
[ "0.69057566", "0.68267506", "0.64559305", "0.5843955", "0.5648864", "0.55616444", "0.54743546", "0.5460113", "0.5383557", "0.5348004", "0.5341139", "0.53100145", "0.5273911", "0.5260276", "0.5248578", "0.52413625", "0.5236249", "0.5236249", "0.5236249", "0.5203331", "0.516558...
0.78871566
0
Operates on literal level. Works the same as uniform_crossover, except that constraints are not matched on their (meaningless) index in the individual, but based on their syntactic similarity. In a first step, each constraint in each individual is matched with the most syntactically similar (based on Hamming distance) ...
def matched_uniform_crossover(ind1, ind2): # We calculate the pairwise match between ind1's and ind2's clauses match_matrix = np.zeros((len(ind1), len(ind2))) for i in range(len(ind1)): clause1 = ind1[i] for j in range(len(ind2)): clause2 = ind2[j] curr_syntactic_matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniform_clause_crossover(ind1, ind2):\n k = len(ind1)\n for i in range(k):\n if random.random() < 0.5:\n temp = ind1[i]\n ind1[i] = ind2[i]\n ind2[i] = temp", "def scramble_clause_crossover(ind1, ind2):\n all_clauses = ind1 + ind2\n random.shuffle(all_claus...
[ "0.6022955", "0.57126135", "0.56022096", "0.55702895", "0.55280787", "0.5495883", "0.5482473", "0.5477625", "0.54446507", "0.54238015", "0.5409056", "0.54083395", "0.5406118", "0.53358424", "0.5321293", "0.5319676", "0.5170372", "0.5108026", "0.5097792", "0.5073639", "0.50590...
0.6571927
0
Operates on constraint level. Crosses over two individuals by first collecting all constraints occurring in the individuals in a list of size 2k, randomly scrambling the list, and then assigning the first k constraints in the list to the first individual, and the second k constraints to the second individual. Note that...
def scramble_clause_crossover(ind1, ind2): all_clauses = ind1 + ind2 random.shuffle(all_clauses) ind1[0:len(ind1)] = all_clauses[0:len(ind1)] ind2[0:len(ind2)] = all_clauses[len(ind1):len(ind1) + len(ind2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniform_clause_crossover(ind1, ind2):\n k = len(ind1)\n for i in range(k):\n if random.random() < 0.5:\n temp = ind1[i]\n ind1[i] = ind2[i]\n ind2[i] = temp", "def avoid_duplicate_clauses_scramble_clause_crossover(ind1, ind2):\n ind_length = len(ind1)\n ind...
[ "0.6233484", "0.6091983", "0.59595877", "0.59208804", "0.5847458", "0.572482", "0.5696735", "0.55340487", "0.5419363", "0.54179275", "0.541135", "0.53817564", "0.5309946", "0.5270483", "0.5232102", "0.5205794", "0.5137773", "0.5123041", "0.5108216", "0.5081783", "0.50262445",...
0.64498144
0
Operates on constraint level. Works the same as scramble_clause_crossover, except that all occurrences of clauses that occur multiple times in either individual, or that occur in both individuals, are first evenly divided over both individuals.
def avoid_duplicate_clauses_scramble_clause_crossover(ind1, ind2): ind_length = len(ind1) ind1_copy = copy.deepcopy(ind1) ind2_copy = copy.deepcopy(ind2) clauses_both_have = [] remaining_clauses = [] for clause in ind1: try: index = ind2_copy.index(clause) clause...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scramble_clause_crossover(ind1, ind2):\n all_clauses = ind1 + ind2\n random.shuffle(all_clauses)\n ind1[0:len(ind1)] = all_clauses[0:len(ind1)]\n ind2[0:len(ind2)] = all_clauses[len(ind1):len(ind1) + len(ind2)]", "def smart_clause_crossover_infeasibility(ind1, ind2, examples, greedy=True, probabi...
[ "0.61003923", "0.5727573", "0.5701313", "0.55589473", "0.5536318", "0.5445367", "0.5374365", "0.53616214", "0.525692", "0.51231486", "0.51078594", "0.5093244", "0.5026292", "0.49627778", "0.49534568", "0.4926632", "0.4865228", "0.48644775", "0.4859577", "0.48368546", "0.47880...
0.619435
0
Dispatches to the appropriate smart clause crossover operator, depending on whether the distinct should be made between infeasible and suboptimal negative examples
def smart_clause_crossover_dispatch(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None, use_infeasibility=False): if use_infeasibility: smart_clause_crossover_infeasibility(ind1, ind2, examples, greedy=greedy, probability_variant=probability_variant, temp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smart_clause_crossover(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None):\n allow_duplicates = False # allow_duplicates denotes whether the resulting indivuals may contain duplicate clauses\n number_of_clauses = len(ind1)\n all_clauses = ind1+ind...
[ "0.6515465", "0.63803405", "0.5759596", "0.56984735", "0.5618533", "0.550331", "0.5501639", "0.5486603", "0.5480942", "0.544881", "0.54109794", "0.5244485", "0.5237865", "0.52373815", "0.52060795", "0.51889914", "0.5187329", "0.5187329", "0.51770586", "0.5146552", "0.5139957"...
0.67763466
0
Operates on constraint level. This function does not make use of the distinction between suboptimal and infeasible negative examples. Performs a smart crossover on the two given individuals, and produces 1 individual (both individuals will be changed into this single resulting individual). Makes use of a heuristic that...
def smart_clause_crossover(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None): allow_duplicates = False # allow_duplicates denotes whether the resulting indivuals may contain duplicate clauses number_of_clauses = len(ind1) all_clauses = ind1+ind2 ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smart_clause_crossover_infeasibility(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None):\n allow_duplicates = False # allow_duplicates denotes whether the resulting indivuals may contain duplicate clauses\n ind1_hard_constraints = [constr for constr ...
[ "0.6610924", "0.5716931", "0.5647401", "0.5542738", "0.5517727", "0.55064774", "0.548928", "0.5414949", "0.5401225", "0.539947", "0.53967386", "0.53481674", "0.53454256", "0.5297864", "0.5291615", "0.5256472", "0.525462", "0.52351964", "0.52085125", "0.51946014", "0.51941335"...
0.606364
1
Operates on constraint level. This function makes use of the distinction between suboptimal and infeasible negative examples. Performs a smart crossover on the two given individuals, and produces 1 individual (both individuals will be changed into this single resulting individual). Makes use of a heuristic that values ...
def smart_clause_crossover_infeasibility(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None): allow_duplicates = False # allow_duplicates denotes whether the resulting indivuals may contain duplicate clauses ind1_hard_constraints = [constr for constr in ind1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smart_clause_crossover(ind1, ind2, examples, greedy=True, probability_variant=None, temperature=1, clause_bitvector_cache=None):\n allow_duplicates = False # allow_duplicates denotes whether the resulting indivuals may contain duplicate clauses\n number_of_clauses = len(ind1)\n all_clauses = ind1+ind...
[ "0.6040425", "0.57220644", "0.5651253", "0.5630593", "0.5616365", "0.5534202", "0.5531391", "0.5526905", "0.54685897", "0.54388416", "0.54252905", "0.5397082", "0.53935945", "0.5393315", "0.53874266", "0.53383327", "0.5333689", "0.53286886", "0.5300002", "0.52907956", "0.5286...
0.6755689
0
Data { get; } > int
def Data(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self) -> int:\n return self._data", "def getInteger(self):", "def getInteger(self):", "def getValue(self) -> int:\n ...", "def data(self, value):\n if not isinstance(value, int):\n raise TypeError(\"data must be an integer\")\n else:\n self.__data...
[ "0.7560098", "0.6998426", "0.6998426", "0.69836044", "0.68988633", "0.6810876", "0.68026674", "0.6762897", "0.6762579", "0.6620448", "0.6615782", "0.65521204", "0.6511656", "0.6465311", "0.6452893", "0.643525", "0.6413299", "0.6396933", "0.63801414", "0.6359766", "0.6356796",...
0.86933905
0
Item { get; set; } > bool
def Item(self) -> bool:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\n return bool(self._items)", "def __bool__(self):\n return bool(self._items)", "def get_bool(self, item: str) -> bool:\n return as_bool(self[item])", "def __bool__(self):\n return bool(self.get_value())", "def value(self) -> bool:", "def __contains__ (self,...
[ "0.76140684", "0.76140684", "0.71920353", "0.7042644", "0.70174855", "0.6897622", "0.68056196", "0.67807496", "0.67592233", "0.6713015", "0.66944444", "0.66852814", "0.6675724", "0.6628342", "0.6621324", "0.6621324", "0.6600947", "0.6575022", "0.6563937", "0.65453804", "0.652...
0.8566267
0
Mask { get; } > int
def Mask(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n return self.mask_index", "def mask(self):\n return ((2**(self.width) - 1) << self.lsb)", "def mask_index(self) -> int:\n return self._mask_index", "def mask(self):", "def mask(self) -> list[int]:\n return self._mask", "def mask(self):\n return self._ma...
[ "0.7837592", "0.76170206", "0.75914097", "0.75121796", "0.74010247", "0.7349037", "0.7349037", "0.7349037", "0.7349037", "0.71888405", "0.70815897", "0.7005188", "0.6910063", "0.6910063", "0.68605787", "0.68557954", "0.68479794", "0.67024934", "0.6688607", "0.66692984", "0.66...
0.8851983
0
Offset { get; } > int
def Offset(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset(self):\n return self.__offset", "def offset(self):\n return self.__offset", "def offset(self):\r\n return self._get_instantiation()[3]", "def offset(self):\n return self._offset", "def offset(self):\n return self._offset", "def offset(self):\n return s...
[ "0.7361396", "0.7361396", "0.72346246", "0.7174349", "0.7174349", "0.7174349", "0.7174349", "0.7174349", "0.7174349", "0.7174349", "0.71212727", "0.708579", "0.70526683", "0.7044136", "0.70365083", "0.70010835", "0.6850568", "0.6844158", "0.6821544", "0.6786369", "0.6754752",...
0.8861596
0
Keys { get; } > NameObjectCollectionBase.KeysCollection
def Keys(self) -> NameObjectCollectionBase.KeysCollection:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keys(self):\r\n return self._keys", "def keys(self) -> List:\n pass", "def keys(self):\r\n return [k for k in self]", "def keys(self):\n raise NotImplementedError", "def keys(self):\n raise NotImplementedError('keys() should have been replaced by a metaclass')", "def ke...
[ "0.8030493", "0.79718614", "0.78185", "0.771581", "0.76575226", "0.76478493", "0.7614883", "0.7614883", "0.75922537", "0.758795", "0.758302", "0.75540566", "0.75408614", "0.753722", "0.75090593", "0.74985516", "0.7471102", "0.7463831", "0.7463831", "0.7461818", "0.7459962", ...
0.93455327
0
AllKeys { get; } > Array
def AllKeys(self) -> _n_0_t_1[str]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self) -> List:\n pass", "def keysAll():", "def keys(self):\r\n return [k for k in self]", "def get_keys(self):\r\n return self._keys", "def keys(self):\n return [ x for x in self ]", "def getkeys(self):\n return list(self.keys)", "def keys(self):\n return", ...
[ "0.824508", "0.8210384", "0.811888", "0.80539304", "0.79637027", "0.79416925", "0.78825855", "0.786728", "0.7850918", "0.78212106", "0.7814491", "0.7814491", "0.7811005", "0.77953106", "0.77004904", "0.76996964", "0.76911926", "0.76835346", "0.7661703", "0.76457775", "0.76288...
0.83905303
0
Item { get; set; } > str
def Item(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __str__(self):\r\n return str(self._items)", "def __str__(self):\r\n return str(self._items)", "def Value(self) -> str:", "def __str__(self):\n return str(self._items)", "def string(self):\n return self._my_string", ...
[ "0.74461406", "0.70737", "0.70737", "0.6902582", "0.6873929", "0.68218076", "0.67909247", "0.67569864", "0.67167395", "0.66953707", "0.66953707", "0.66953707", "0.6675318", "0.66375804", "0.6594026", "0.65922886", "0.6584816", "0.654529", "0.6544038", "0.65272146", "0.6521561...
0.8269495
1
Action { get; } > NotifyCollectionChangedAction
def Action(self) -> NotifyCollectionChangedAction:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_collection_updated(self, obj, state, old_name):\n icon_files = {\n \"gerber\": self.app.resource_location + \"/flatcam_icon16.png\",\n \"excellon\": self.app.resource_location + \"/drill16.png\",\n \"cncjob\": self.app.resource_location + \"/cnc16.png\",\n ...
[ "0.57026577", "0.55472505", "0.5491581", "0.5480743", "0.5450638", "0.53421706", "0.53055394", "0.5241962", "0.5201908", "0.5185991", "0.51797247", "0.51797247", "0.51709735", "0.51709735", "0.51529616", "0.51474416", "0.51144034", "0.51144034", "0.5096343", "0.5094186", "0.5...
0.92143404
0
NewItems { get; } > IList
def NewItems(self) -> _n_1_t_7:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OldItems(self) -> _n_1_t_7:", "def items(self) -> List:\n pass", "def new():\n list_new()", "def add_item(self, new_item):\n [self.item_list.append(new_item) for item in self.item_list\n if new_item not in self.item_list]", "def handle_list_items(self, object, name, old, new):\n ...
[ "0.7087581", "0.68237215", "0.66904354", "0.66464525", "0.6514788", "0.64900506", "0.63648415", "0.62899405", "0.6236077", "0.6183304", "0.6155255", "0.6122164", "0.60757506", "0.60671026", "0.6063697", "0.60569775", "0.60379", "0.60241634", "0.6001961", "0.59869635", "0.5974...
0.81301445
0
NewStartingIndex { get; } > int
def NewStartingIndex(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OldStartingIndex(self) -> int:", "def index(self) -> int:", "def _index(self) -> int:\n return -1", "def get_next_position(self):", "def up_index(index):\n return 2 * index", "def index(self, x) -> int:\n pass", "def start_index(self):\r\n return (self.per_page * (self.page_numb...
[ "0.8996522", "0.6921661", "0.685216", "0.6768644", "0.6754769", "0.657122", "0.64902514", "0.6434296", "0.6434296", "0.6434296", "0.6347615", "0.63349503", "0.6308652", "0.62746763", "0.62228894", "0.6207351", "0.617466", "0.6152202", "0.61070955", "0.60914516", "0.6084145", ...
0.91030383
0
OldItems { get; } > IList
def OldItems(self) -> _n_1_t_7:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeOldItems(self):\n pass", "def GetOldItem(self):\r\n\r\n return self._itemOld", "def handle_list_items(self, object, name, old, new):\n raise NotImplementedError", "def NewItems(self) -> _n_1_t_7:", "def handle_list_items(self, object, name, old, new):\n self.handle_lis...
[ "0.70305353", "0.6830201", "0.663443", "0.6420602", "0.63441193", "0.62663555", "0.6243105", "0.61490303", "0.6047346", "0.6038509", "0.60280555", "0.6027139", "0.6003214", "0.5964436", "0.5814353", "0.5791283", "0.5747276", "0.5704636", "0.5686104", "0.5667873", "0.56523323"...
0.8244279
0
OldStartingIndex { get; } > int
def OldStartingIndex(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NewStartingIndex(self) -> int:", "def _index(self) -> int:\n return -1", "def index(self) -> int:", "def start_index(self):\r\n return (self.per_page * (self.page_number - 1)) + 1", "def get_next_position(self):", "def _left(self, index):\r\n return 2*index + 1", "def Offset(se...
[ "0.86372566", "0.68770224", "0.66470605", "0.65928936", "0.65164727", "0.65080565", "0.6458375", "0.6458375", "0.6458375", "0.6396853", "0.6364111", "0.6346274", "0.6303965", "0.62449104", "0.6215478", "0.6213587", "0.61976075", "0.6184642", "0.61814433", "0.614664", "0.61424...
0.93224186
0
Count { get; } > int
def Count(self) -> int:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return int()", "def count(self):\n return int()", "def count() -> int:\n pass", "def count(self):\n # TODO not implemented yet\n return 0", "def get_count(self):\r\n return self.count", "def count(self):\n\n raise NotImplementedError", "de...
[ "0.8202064", "0.8202064", "0.8039796", "0.7807312", "0.7733252", "0.77277046", "0.77222186", "0.77221006", "0.77153176", "0.77069134", "0.76832217", "0.7601363", "0.7601363", "0.7588302", "0.75655687", "0.751755", "0.7516682", "0.75138134", "0.75138134", "0.75138134", "0.7492...
0.85905355
0
IsSynchronized { get; } > bool
def IsSynchronized(self) -> bool:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interlocked(self):\n return not bool(self.interlock.get())", "def is_concurrent(self):\n return self.concurrent", "def is_synchronized(self):\r\n sync_state = True\r\n \r\n for particle in self.population:\r\n sync_state = (sync_state and particle.sync)\r\n ...
[ "0.72966087", "0.72377276", "0.7227178", "0.7179509", "0.71317625", "0.6986824", "0.6875304", "0.6810426", "0.6744867", "0.67237324", "0.65174085", "0.65084296", "0.6480448", "0.647981", "0.64671266", "0.6462374", "0.64194214", "0.63950187", "0.6380033", "0.63241255", "0.6321...
0.9197473
0
Item { get; set; } > str
def Item(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.item)", "def __str__(self):\r\n return str(self._items)", "def __str__(self):\r\n return str(self._items)", "def Value(self) -> str:", "def __str__(self):\n return str(self._items)", "def string(self):\n return self._my_string", ...
[ "0.74461406", "0.70737", "0.70737", "0.6902582", "0.6873929", "0.68218076", "0.67909247", "0.67569864", "0.67167395", "0.66953707", "0.66953707", "0.66953707", "0.6675318", "0.66375804", "0.6594026", "0.65922886", "0.6584816", "0.654529", "0.6544038", "0.65272146", "0.6521561...
0.8269495
0
SyncRoot { get; } > object
def SyncRoot(self) -> object:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSyncObj(self):\n \n return self.sync_obj", "def get_root(self) -> object:", "def getRoot(obj):", "def get_sync_attrs(self):\n return self._sync_attrs", "def obj(self) -> object:\n pass", "def obj(self):\n if not self._obj:\n self._get()\n return sel...
[ "0.7451063", "0.6630365", "0.65472794", "0.6129156", "0.6124222", "0.6085068", "0.60512507", "0.6035903", "0.59617585", "0.59338695", "0.58426213", "0.5795738", "0.56910855", "0.55769795", "0.5556127", "0.5556127", "0.5536175", "0.553319", "0.55188656", "0.55188656", "0.55188...
0.83236295
0
Current { get; } > str
def Current(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current(self) -> str:\n return self.s[self.pos]", "def string_val(self) -> str:\n return self.current_token", "def __str__(self) -> str:\n\n return str(self.current_obj)", "def get_string(self):\n return self.__str", "def Value(self) -> str:", "def get_string(self):\n ...
[ "0.7923747", "0.7441225", "0.7267023", "0.7167032", "0.71462184", "0.70835453", "0.70250505", "0.6957958", "0.6817078", "0.67957383", "0.679172", "0.6759429", "0.6736939", "0.66951215", "0.6673996", "0.6666931", "0.66513854", "0.66341764", "0.66341764", "0.66341764", "0.66341...
0.8545434
0
Get the profit_currency price of asset in the given timestamp
def get_rate_in_profit_currency(self, asset: Asset, timestamp: Timestamp) -> Price: if asset == self.profit_currency: rate = Price(ONE) else: rate = PriceHistorian().query_historical_price( from_asset=asset, to_asset=self.profit_currency, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coin_price(asset, time=None):\n url = 'https://rest.coinapi.io/v1/exchangerate/{}/USD'.format(asset)\n if time is not None:\n url = url + '?time={}'.format(time)\n headers = {'X-CoinAPI-Key': os.environ.get('COIN_API_KEY', '')}\n r = requests.get(url, headers=headers)\n if r.status_co...
[ "0.70943767", "0.64979786", "0.6457114", "0.6435026", "0.6293523", "0.6200089", "0.61181283", "0.6104213", "0.6102069", "0.6028417", "0.59867626", "0.5976813", "0.5961364", "0.5941147", "0.59125704", "0.58891153", "0.58765477", "0.5851118", "0.5827735", "0.5793684", "0.579364...
0.7192842
0
Add an asset acquisition event for the pot and count it in PnL if needed. If a custom price for the asset should be used it can be passed here via given_price. Price is always in profit currency during accounting.
def add_acquisition( self, # pylint: disable=unused-argument event_type: AccountingEventType, notes: str, location: Location, timestamp: Timestamp, asset: Asset, amount: FVal, taxable: bool, given_price: Optiona...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_asset(self, asset):\n from Game.models import Asset, Transaction\n asset_comms = ACommunication(settings.API_URL)\n asset = asset_comms.get_asset_quote(asset)\n total = (asset.buy * asset.quantity)\n buy = asset.buy\n sell = asset.sell\n quantity = asset.qua...
[ "0.5709984", "0.5651042", "0.512311", "0.511978", "0.5055525", "0.50209546", "0.49926344", "0.4990619", "0.49385113", "0.4801994", "0.47719896", "0.47582433", "0.4751332", "0.47279665", "0.47041407", "0.4679356", "0.4679356", "0.4679356", "0.4679356", "0.46743053", "0.4661694...
0.68399614
0
Add an asset spend event for the pot and count it in PnL if needed If a custom price for the asset should be used it can be passed here via given_price. Price is always in profit currency during accounting. If taxable_ratio is given then this is how we initialize the taxable and free amounts in the case of missing cost...
def add_spend( self, event_type: AccountingEventType, notes: str, location: Location, timestamp: Timestamp, asset: Asset, amount: FVal, taxable: bool, given_price: Optional[Price] = None, taxable_amou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_acquisition(\n self, # pylint: disable=unused-argument\n event_type: AccountingEventType,\n notes: str,\n location: Location,\n timestamp: Timestamp,\n asset: Asset,\n amount: FVal,\n taxable: bool,\n given_...
[ "0.5035324", "0.49876693", "0.49540687", "0.493301", "0.49177417", "0.49021614", "0.4851298", "0.48422468", "0.4785735", "0.47805077", "0.4779018", "0.47449985", "0.4704121", "0.46818066", "0.46495992", "0.46223575", "0.46067038", "0.46018207", "0.4594187", "0.4564389", "0.45...
0.74859834
0
Calculates the prices for assets going in and out of a swap/trade.
def get_prices_for_swap( self, timestamp: Timestamp, amount_in: FVal, asset_in: Asset, amount_out: FVal, asset_out: Asset, fee_info: Optional[tuple[FVal, Asset]], ) -> Optional[tuple[Price, Price]]: if ZERO in (amount_in, am...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_market_prices(prices):\n denom = prices.bid_volume + prices.ask_volume\n numer = (prices.bid_price * prices.ask_volume +\n prices.ask_price * prices.bid_volume)\n mask = denom == 0\n denom[mask] = 2\n numer[mask] = prices.bid_price[mask] + prices.ask_price[mask]\n prices =...
[ "0.6414581", "0.5868107", "0.5832748", "0.5781452", "0.57402825", "0.56914604", "0.56871104", "0.5682011", "0.567011", "0.5665571", "0.5613298", "0.5596176", "0.5581445", "0.5539411", "0.55184567", "0.5488983", "0.54832494", "0.54776424", "0.54453236", "0.5431624", "0.5424075...
0.69301
0
Predict response for given x based on fitted coefficients.
def predict(self, x: np.ndarray): return self.fit_function(x, self.coefficients)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, x):\n \"\"\"containing values for the independent variables.\"\"\"\n _linear_predictor_typecheck(x, self._coeff)\n return dot(self._coeff, x) + self._intercept", "def predict(self, x):\n if(self.__trained == False):\n raise ModelNotTrainedException(self.pr...
[ "0.81227326", "0.79453236", "0.7797504", "0.76598966", "0.7611417", "0.75813264", "0.74996483", "0.74753344", "0.74670166", "0.7459472", "0.7450515", "0.744085", "0.74362046", "0.7429248", "0.7394951", "0.7328513", "0.73182887", "0.7303986", "0.7303986", "0.7303986", "0.73039...
0.8447172
0
Get residual after fit.
def get_residual(self) -> np.ndarray: return self._calculate_residual(self.coefficients)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residuals(self):\r\n return self.__residuals", "def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory", "def residuals_(self):\n return self._residuals", "def _residuals(self):\n if self.model_fit is None:\n self._uvts_cls_logger.error(\"N...
[ "0.74578893", "0.7413885", "0.740772", "0.7328536", "0.7270871", "0.711375", "0.71051645", "0.7091559", "0.7005274", "0.69731915", "0.69583935", "0.69441044", "0.68942314", "0.6860036", "0.68399817", "0.6828115", "0.68206584", "0.68188107", "0.6794833", "0.6759753", "0.672911...
0.77138394
0
Get estimated response vector based on fit.
def get_estimate(self) -> np.ndarray: return self.fit_function(self.x, self.coefficients)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fittedvalues(self):\n return self.model.predict(self.params)\n # TODO: GH#5255 is this necessarily equivalent to self.predict()?", "def predict(self, fit_result, x):\n raise NotImplementedError()", "def estimate(self, x, y):\n\n self.regressor.fit(x, y)\n y_predict = self...
[ "0.63615495", "0.62313896", "0.5925463", "0.59242433", "0.58122206", "0.580785", "0.577574", "0.57283205", "0.57026815", "0.56927335", "0.56927335", "0.56927335", "0.56927335", "0.5685302", "0.56588197", "0.5631761", "0.5619938", "0.55874497", "0.5569511", "0.55256623", "0.55...
0.65292436
0
Open a csv file and return the data in a dictionary where each key is a corresponding csv column name and each value for the key correspond to a list of the windows data. Each data windows is a list.
def getCSV(filename, reference_column="time", windows_separator=""): reader = csv.DictReader(open(filename)) csv_data = {} for row in reader: for col, value in row.iteritems(): csv_data.setdefault(col, []).append(value) if reference_column not in csv_data.keys(): raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_some_data(the_file_name: str) -> dict:\n\n result: dict = open_csv(file_name=the_file_name)\n return result", "def _csv_to_dict(name):\n csv_path = _get_csv_path(name)\n result = []\n with open(csv_path) as csvfile:\n reader = csv.DictReader(csvfile)\n for row in reader:\n ...
[ "0.6284877", "0.62292904", "0.622039", "0.62021005", "0.61573863", "0.6139601", "0.613843", "0.6113844", "0.6068469", "0.6050086", "0.6049344", "0.60448176", "0.6007195", "0.6001365", "0.59572005", "0.5940141", "0.5926632", "0.5885316", "0.58824843", "0.58735824", "0.5866467"...
0.6242013
1
Creates an aiohttp session
async def create_session(self): # Creating a session under an async function is recommended self.session = aiohttp.ClientSession()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_session() -> aiohttp.ClientSession:\n\n headers = generate_header()\n\n client_session = aiohttp.ClientSession(headers=headers)\n return client_session", "def make_session():\n import aiohttp\n conn = aiohttp.TCPConnector(limit_per_host=int(\n os.getenv('AIO_CONN_LIMIT', 10...
[ "0.8836229", "0.83560354", "0.71402645", "0.7037424", "0.7029477", "0.70231855", "0.6983279", "0.69093186", "0.68392366", "0.6755684", "0.67054135", "0.6637041", "0.66357857", "0.66224635", "0.6607673", "0.65447205", "0.65434366", "0.6540857", "0.6540471", "0.6527224", "0.652...
0.8627391
1
Output a section header
def section_header(text): print "---- %s ----" % text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_section_header(title, color):\n block = \"#\" * (len(title) + 2)\n print(\"\\n\" + color + Style.BRIGHT + block)\n print(\"#\", title)\n print(block + \"\\n\" + Style.RESET_ALL)", "def print_section_header(title, color):\n\tblock = \"#\" * (len(title) + 2)\n\tprint(color + Style.BRIGHT + bl...
[ "0.7780516", "0.77521163", "0.7658305", "0.7110185", "0.71099603", "0.70462835", "0.70025337", "0.69644576", "0.6949137", "0.6932552", "0.6805164", "0.6789609", "0.677836", "0.67727095", "0.67724276", "0.67541957", "0.67465717", "0.67429996", "0.6727082", "0.6685526", "0.6671...
0.83694506
0
Return the first 10 digits of the sum
def first_10_digits_of_sum(): sum_ = sum([int(i) for i in read_data()]) return str(sum_)[:10]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sumDigit():", "def sum_of_digits(n):\n rest_of_num, last_num = split(n)\n if rest_of_num < 10:\n \treturn last_num + rest_of_num\n return last_num + sum_of_digits(rest_of_num)", "def digit_sum(x):\n s = 0\n while x>0:\n s = s+(x%10)\n x = x//10\n\n return s", "def sum_digits(n)...
[ "0.7978776", "0.7390683", "0.7385932", "0.72872734", "0.7234461", "0.71717376", "0.7130944", "0.6975113", "0.691324", "0.6908647", "0.6887424", "0.68067276", "0.667946", "0.6674701", "0.66520053", "0.6575619", "0.65425557", "0.64808357", "0.64773303", "0.64495385", "0.6437903...
0.88592225
0
Print ninja code block
def ninja_block(): return ''' ```sh # In build directory ninja ```'''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repl_print_statements():\n pass", "def ninja_simulate_block():\n return '''\n```sh\n# In build directory\nninja && ./simulate\n```'''", "def example():\n print \"\"\"\n \"\"\"", "def example():\n print \"\"\"\n \"\"\"", "def print_out():\n pass", "def debug():\n def _debug(x):...
[ "0.6483528", "0.63958025", "0.63629156", "0.63629156", "0.62017804", "0.6197296", "0.60597914", "0.6041047", "0.5984415", "0.5972134", "0.5945607", "0.58953977", "0.58189815", "0.5808244", "0.58080333", "0.5800939", "0.5800462", "0.57823473", "0.57628834", "0.57350373", "0.57...
0.68514085
0
Print simulate and ninja code block
def ninja_simulate_block(): return ''' ```sh # In build directory ninja && ./simulate ```'''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate_block():\n return '''\n```sh\n# In build directory\n./simulate\n```'''", "def sequential_print_statements():\n pass", "def repl_print_statements():\n pass", "def print_out():\n pass", "def run(self):\r\n self.inst.write(':RUN')", "def main():\n print \"Printing Samp...
[ "0.6855271", "0.6472742", "0.64571154", "0.6344158", "0.62682426", "0.6237703", "0.620284", "0.6160858", "0.6158303", "0.6095411", "0.6083449", "0.6054962", "0.60332555", "0.60188013", "0.5985015", "0.5985015", "0.59843993", "0.5969625", "0.5969625", "0.5918395", "0.59150785"...
0.69238406
0
Extract attributes from a raw data set which as class in the in the first column
def extractAttrs(data): return [instance[1:] for instance in data]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields(data):\n return data['train'][data['train'].keys()[0]].attrs.keys()", "def extract(self, data):", "def preprocess_soy(soy_path):\n\n print('[ INFO ]: Preprocessing soy data...')\n\n # Rename headers of data frame\n soy_data = pd.read_csv(soy_path, header=None)\n so...
[ "0.623917", "0.62341034", "0.5990778", "0.59630466", "0.5815131", "0.576771", "0.5712347", "0.5694353", "0.5662337", "0.56433815", "0.5634265", "0.55878204", "0.55013424", "0.5436354", "0.541804", "0.5418011", "0.5416972", "0.541447", "0.541183", "0.5401354", "0.5395833", "...
0.71550965
0
Return instances in duplicates from data. If remove_all then remove all instances else remove all but first instance
def removeDuplicates(data, duplicates, remove_all): matches = [{'instance':instance, 'number':0} for instance in duplicates] out = [] for instance in data: is_duplicate = False for m in matches: if m['instance'] == instance: if m['number'] > 0 or remove_all: is_duplicate = True m['number'] = m['n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_duplicates(self) -> \"SampleDataSet\":\n return SampleDataSet(self._data.drop_duplicates())", "def _remove_duplicates(self):\n self.search_query = remove_duplicates(self.search_query)", "def clean_duplicate(self):\r\n self.elements = list(set(self.elements))\r\n self.ele...
[ "0.69091046", "0.6639899", "0.6555161", "0.64862686", "0.6403717", "0.640026", "0.63934326", "0.62803054", "0.62781584", "0.6226226", "0.6102793", "0.60704607", "0.6057449", "0.60571265", "0.60397804", "0.6036129", "0.6002325", "0.5980732", "0.59714365", "0.5960172", "0.59350...
0.76257706
0
Append a description to file path made up of dir and file_name
def appendDescription(dir, file_name, description): path = os.path.join(dir, file_name) base, ext = os.path.splitext(path) return base + '.' + description + ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildPath(dir, file_name, ext, description = None):\n\tpath = os.path.join(dir, file_name)\n\tbase, _ = os.path.splitext(path)\n\tif not description == None:\n\t\tbase = base + '.' + description\n\treturn base + ext", "def format_filename(title: str, id: Any, ext: str = \".\", dirFormat=None):\r\n ...", ...
[ "0.69394153", "0.611801", "0.60918874", "0.6038287", "0.5996476", "0.59092975", "0.5773148", "0.5747158", "0.5734673", "0.5732687", "0.5712149", "0.57088184", "0.5703568", "0.56297904", "0.56046903", "0.56017125", "0.55617553", "0.55592865", "0.55451745", "0.5540674", "0.5525...
0.8635285
0
Build a path from a dir file_name and ext and optionally description
def buildPath(dir, file_name, ext, description = None): path = os.path.join(dir, file_name) base, _ = os.path.splitext(path) if not description == None: base = base + '.' + description return base + ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_file_path(dir_name, file_name, ext):\n return os.path.join(dir_name, os.path.extsep.join((file_name, ext)))", "def appendDescription(dir, file_name, description):\n\tpath = os.path.join(dir, file_name)\n\tbase, ext = os.path.splitext(path)\n\treturn base + '.' + description + ext", "def construct_...
[ "0.75661904", "0.6550482", "0.60422546", "0.6027538", "0.59308547", "0.59081006", "0.5825218", "0.582117", "0.58164984", "0.57852477", "0.57776", "0.57530975", "0.5721652", "0.56592196", "0.5570957", "0.5562757", "0.55584544", "0.55302304", "0.55194324", "0.5516335", "0.55006...
0.8475875
0
Parse an attributes file
def parseAttrs(file_name): lines = file(file_name).read().strip().split('\n') lines = [x.strip() for x in lines if len(x.strip()) > 0] return [parseAttrLine(x) for x in lines]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_attributes(filename):\n attributes = {}\n with open(filename) as f:\n for line in f:\n # Split line into student, college, year, major\n fields = line.split()\n student = int(fields[0])\n college = int(fields[1])\n year = int(fields[2]...
[ "0.68706465", "0.6828883", "0.6731427", "0.66256315", "0.6585804", "0.6552646", "0.6546952", "0.6446353", "0.639881", "0.63499784", "0.6308809", "0.62747127", "0.62701064", "0.62394685", "0.61743546", "0.6151755", "0.61405575", "0.6116673", "0.60649294", "0.605982", "0.600795...
0.80092627
0
Parse a classes file
def parseClasses(file_name): lines = file(file_name).read().strip().split('\n') lines = [x.strip() for x in lines if len(x.strip()) > 0] classes = [] for l in lines: classes = classes + [clean(x) for x in l.split(',')] return classes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetClassesFromFile(self,file_path):\n classes = []\n try:\n fl = open(file_path,\"r\")\n for line in fl.readlines():\n if \"class\" in line and \":\" in line:\n line = line.strip(\"class \")\n line2 = \"\"\n ...
[ "0.70792365", "0.6988579", "0.68228126", "0.68027467", "0.67254263", "0.6457001", "0.64242077", "0.6291333", "0.6243986", "0.61837405", "0.61154544", "0.60808533", "0.6032137", "0.59897196", "0.5954794", "0.5947654", "0.5940507", "0.58991724", "0.5892846", "0.5872633", "0.586...
0.76714414
0
Make a header from attrs . class label goes at start
def makeHeaderRow(attrs): return ['class'] + [attrs[i]['attr'] for i in range(len(attrs))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_header(self): \n \n # create the individual labels\n hdr_bits = [hb.format(hdr) for hb, hdr in zip(self.row_base, self.headers)]\n \n # stick it all together and return with hdr_sep underneath\n hdr_str = f\"|{'|'.join(hdr_bits)}|\\n\"\n ...
[ "0.69086003", "0.6790904", "0.6636566", "0.641912", "0.6298546", "0.62713695", "0.62139636", "0.62139636", "0.62044215", "0.6202156", "0.61957175", "0.61957115", "0.61588085", "0.61331064", "0.6132515", "0.6127647", "0.6101991", "0.6100927", "0.6078027", "0.6056748", "0.60401...
0.770182
0
Write a Weka .arff file
def writeArff(file_name, relation, classes, attrs, data): print 'writeArff:', file_name, len(data), len(data[0]) f = file(file_name, 'w') f.write('%\n') f.write('%% %s \n' % os.path.basename(file_name)) f.write('%\n') f.write('% Created by ' + os.path.basename(sys.argv[0]) + ' on ' + datetime.date.today().strftim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arff(features, path):\n out = open(path, 'w')\n\n # Header\n out.write(\"@RELATION music_speech\\n\")\n for i in range(features.shape[1]-1):\n out.write(\"@ATTRIBUTE MFCC_%i NUMERIC\\n\" % i)\n out.write(\"@ATTRIBUTE class {music,speech}\\n\\n@DATA\\n\")\n\n # Data\n for mfcc in fea...
[ "0.65214306", "0.64201504", "0.6406658", "0.6093845", "0.59766054", "0.59047896", "0.58643204", "0.58590144", "0.57665783", "0.5628115", "0.5613803", "0.5608763", "0.5576813", "0.55577165", "0.5512611", "0.55023175", "0.5419931", "0.53972125", "0.53967565", "0.5383743", "0.53...
0.7022959
0
Tries to return a relative path from staging
def get_relative_path_from_staging(staging_path): staging_dir = settings.EXPORT_STAGING_ROOT.lstrip(os.path.sep).rstrip(os.path.sep) staging_path = staging_path.lstrip(os.path.sep) if staging_dir in staging_path: return staging_path.replace(staging_dir, "") return staging_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _abs_path(rel_path):\n return os.path.join(BASE_DIR, rel_path)", "def _get_local_src(self, path: Path) -> Path:\n src = \"\"\n\n if str(path).startswith(\"~\"):\n path = Path(str(path).replace(\"~/\", \"\"))\n\n if self.category == \"global\":\n src = f\"{self.lo...
[ "0.6901522", "0.6555474", "0.64813983", "0.6473201", "0.6391527", "0.636764", "0.63647974", "0.63283", "0.62761253", "0.6239532", "0.6201204", "0.61716205", "0.61697423", "0.61479324", "0.6136124", "0.613316", "0.6131473", "0.610699", "0.6102893", "0.60969174", "0.60914755", ...
0.81900954
0
Stages the data in the `fileobj` for subsequent commital under the given `class_` and `key`.
def put(self, class_, key, fileobj): stageobj = StringIO() shutil.copyfileobj(fileobj, stageobj) fileobj.seek(0) stageobj.seek(0) idx = self._idx(class_, key) self.stage[idx] = (class_, key, stageobj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self,fileobj_out,fileobj_in):\n pass", "def __init__(self):\n self.keyingMethod=fileSize\n self.keyToFile=dict()", "def commit(self):\n if self.keys:\n # If there used to be some keys, there must exist an old dictionary blob somewhere in the database. It shoul...
[ "0.5468729", "0.5315217", "0.52870375", "0.5223776", "0.52032954", "0.5127768", "0.51020163", "0.50726545", "0.5038371", "0.50330997", "0.4992969", "0.49860293", "0.4952587", "0.49325135", "0.49083364", "0.4891398", "0.48681134", "0.48669374", "0.4853784", "0.48504323", "0.48...
0.73409903
0
writes HSRL data in CfRadial netcdf format output_filename = where to write the data start_td = = datetime.datetime object first time to retrieve. minutes = how many minutes to process timeres_s = time resolution in seconds (native would be 2.5) altres_m = altitude resolution in meters maxtimeslice_timedelta = datetime...
def write_cfradial(output_filename, start_dt, minutes, timeres_s = 5, altres_m =60, maxtimeslice_td=datetime.timedelta(seconds=30*60), instrument='gvhsrl', min_alt_m=0, max_alt_m=5000,store_calibrations=False): cdl = locate_file('hsrl_cfradial.cdl', forModule=lgtb) print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createnc(ncfout,xlat,xlon,times=None,zvals=None,wsvals=None,\\\n wdvals=None,olvals=None,attbts=None,ftype=\"timeseries\",dims=[7,180,180]):\n nc_out=nc.Dataset(ncfout,'w',clobber=True)\n\n # Set Attributes to the File\n if attbts is not None:\n final_attbts={}\n # Define pro...
[ "0.59763277", "0.58809626", "0.58501816", "0.58345604", "0.57742786", "0.57117915", "0.5656523", "0.5648311", "0.561094", "0.55820256", "0.5581089", "0.5577127", "0.5531285", "0.5526736", "0.5467026", "0.54665303", "0.54586935", "0.5431486", "0.5387424", "0.52717113", "0.5266...
0.7855086
0
Check if equal to another DFA by traversing their cross product. If equal returns None, otherwise returns a counter example.
def equivalence_with_counterexample(self, other): if self.is_word_in(tuple()) != other.is_word_in(tuple()): return tuple() cross_states = {(self.init_state, other.init_state): (tuple(), None)} to_check = [(self.init_state, other.init_state)] alphabet = self.alphabet ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iso_dfa(D1,D2):\n assert(is_consistent_dfa(D1)), \"Inconsist. DFA1 in iso_dfa\"\n assert(is_consistent_dfa(D2)), \"Inconsist. DFA2 in iso_dfa\"\n return (len(D1[\"Q\"]) == len(D2[\"Q\"]) and\n langeq_dfa(D1, D2))", "def langeq_dfa(D1, D2, gen_counterex=False):\n if D1[\"Sigma\"] != D2[...
[ "0.6204105", "0.5935996", "0.5769594", "0.5176918", "0.5175636", "0.5168933", "0.5157896", "0.5129171", "0.5082458", "0.5069077", "0.50641865", "0.5061806", "0.50514776", "0.503652", "0.50280046", "0.5011892", "0.5007164", "0.5002021", "0.4990112", "0.4943318", "0.49272498", ...
0.6685296
0
Checks whether this DFA's language is a subset of the language of other (checking A \cap A'^c != 0), by traversing the cross product of self and the complimentary of other. If equal returns None, otherwise returns a counter example.
def is_language_not_subset_of(self, other): if self.is_word_in(tuple()) & (not other.is_word_in(tuple())): return tuple() cross_states = {(self.init_state, other.init_state): (tuple(), None)} to_check = [(self.init_state, other.init_state)] alphabet = self.alphabet ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equivalence_with_counterexample(self, other):\n if self.is_word_in(tuple()) != other.is_word_in(tuple()):\n return tuple()\n\n cross_states = {(self.init_state, other.init_state): (tuple(), None)}\n to_check = [(self.init_state, other.init_state)]\n alphabet = self.alphab...
[ "0.6220115", "0.58154976", "0.5815043", "0.57204807", "0.54974604", "0.54746324", "0.5466859", "0.5449294", "0.5417679", "0.5412426", "0.54014486", "0.5397089", "0.5386101", "0.5358133", "0.53466886", "0.5341275", "0.52965057", "0.5286825", "0.52840143", "0.5269786", "0.52694...
0.7660876
0
Creates a customized Draft4ExtendedValidator.
def from_resolver(cls, spec_resolver): spec_validators = cls._get_spec_validators(spec_resolver) return validators.extend(Draft4Validator, spec_validators)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_validator(schema,etd):\n #Major version\n major_version=int(jsonschema.__version__.split('.')[0])\n if major_version < 4:\n #The easy way\n return ValidatorClass(schema,types=etd)\n else:\n #The hard way\n #Create the extra types functions dictionary\n etd_funcs={name:create_checker_fun...
[ "0.6791567", "0.58201903", "0.56023145", "0.5236828", "0.5219821", "0.5214271", "0.51001966", "0.50732434", "0.49859777", "0.49850696", "0.49794722", "0.4957833", "0.49058315", "0.48873714", "0.487872", "0.487541", "0.48698068", "0.48452082", "0.4801144", "0.47913477", "0.478...
0.6396528
1
Creates json documents validator from spec resolver.
def create(self, spec_resolver): validator_cls = self.spec_validator_factory.from_resolver( spec_resolver) return validator_cls( self.schema, resolver=self.schema_resolver)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_spec_resolver(cls, spec_resolver):\n deref = DerefValidatorDecorator(spec_resolver)\n for key, validator_callable in iteritems(cls.validators):\n yield key, deref(validator_callable)", "def from_resolver(cls, spec_resolver):\n spec_validators = cls._get_spec_validators(sp...
[ "0.6038106", "0.59799147", "0.5902257", "0.57491654", "0.5429676", "0.54261833", "0.5403806", "0.5362911", "0.53564113", "0.53234047", "0.53168976", "0.5265585", "0.52480936", "0.52251613", "0.5189247", "0.5176584", "0.5172658", "0.5112875", "0.5091649", "0.5087997", "0.50809...
0.61859643
0
get state of all known nodes of the cluster
def cluster_state(self): for ip in set([status.ip for status in self.cluster_status]): yield self.node_state(ip)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes(self):\n all_nodes = json.loads(self.sys_info.response).get('nodes_info')\n online_nodes = [node for node in all_nodes if node[\"infos\"][\"has_error\"] is False]\n return online_nodes", "def nodes(self) -> Sequence['outputs.GetClusterShardNodeResult']:\n return pulumi.get(s...
[ "0.67903185", "0.6746941", "0.667453", "0.66625124", "0.6581692", "0.65786994", "0.65495056", "0.65487826", "0.65190536", "0.65127057", "0.65086156", "0.65028393", "0.6470773", "0.6466806", "0.64126676", "0.637164", "0.6371118", "0.6356893", "0.63565904", "0.6340954", "0.6309...
0.7818429
0
Converts surface normals from world coords to camera coords using a provided quaternion to apply transform
def world_to_camera_normals(inverted_camera_quaternation, world_normals): exr_x, exr_y, exr_z = world_normals[0], world_normals[1], world_normals[2] camera_normal = np.empty([exr_x.shape[0], exr_x.shape[1], 3], dtype=np.float32) for i in range(exr_x.shape[0]): for j in range(exr_x.shape[1]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_normals(p,q,r): \n vx1 = p[0] - r[0] # x1 - x3. \n vy1 = p[1] - r[1] # y1 - y3. \n vz1 = p[2] - r[2] # z1 - z3. \n\n vx2 = q[0] - r[0] # x2 - x3. \n vy2 = q[1] - r[1] # y2 - y3. \n vz2 = q[2] - r[2] # z2 - z3. \n\n vnx = vy1*vz2 - vz1*vy2 \n vny = vz1*vx2 - vx1*vz2 \n vn...
[ "0.6527598", "0.59582293", "0.59039336", "0.58207244", "0.57282263", "0.5679537", "0.5604675", "0.55679154", "0.54979587", "0.5455145", "0.545264", "0.5418624", "0.54045796", "0.5378379", "0.5371932", "0.5358267", "0.5305178", "0.52894783", "0.52881867", "0.52851504", "0.5279...
0.7345408
0
Find the stack frame of the caller so that we can note the source file name, line number and function name.
def _findCaller(stack_info=False): f = logging.currentframe() #On some versions of IronPython, currentframe() returns None if #IronPython isn't run with -X:Frames. if f is not None: f = f.f_back rv = "(unknown file)", 0, "(unknown function)", None while hasattr(f, "f_code"): co =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findCaller(cls):\n f = currentframe()\n # On some versions of IronPython, currentframe() returns None if\n # IronPython isn't run with -X:Frames.\n if f is not None:\n f = f.f_back\n rv = \"(unknown file)\", 0, \"(unknown function)\"\n while hasattr(f, \"f_c...
[ "0.7863397", "0.77925444", "0.77843714", "0.7719026", "0.76551193", "0.75870043", "0.7571479", "0.74977046", "0.7495805", "0.7414687", "0.7359957", "0.7356189", "0.7281788", "0.72635347", "0.72338563", "0.71918875", "0.71641344", "0.71571225", "0.7153518", "0.71489084", "0.71...
0.7931316
0
log with color by different level
def log_with_color(level): def wrapper(text, exc_info=False): #modified by zhengchun 20180607 # color = log_colors_config[level.upper()] # getattr(logging, level.lower())(coloring(text, color)) # fn, lno, func, sinfo = _findCaller(stack_info=False) # out_text="[F:" + os.path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_format_onecolor(record):\n\n return LEVEL_COLORS.get(record.levelname)", "def get_color(self, record):\n if record.level >= logbook.ERROR:\n return 'red'\n elif record.level >= logbook.NOTICE:\n return 'yellow'\n elif record.level >= logbook.INFO:\n ...
[ "0.72820413", "0.67462224", "0.66891", "0.6607708", "0.6521738", "0.6501938", "0.64461005", "0.6437896", "0.6431689", "0.64296585", "0.6406766", "0.640526", "0.640376", "0.63724786", "0.63439846", "0.6341986", "0.6324903", "0.61996776", "0.61714673", "0.6170006", "0.6167977",...
0.7540215
0
Finds column names for coordinates, annotations, and cell names
def determine_coordinates_and_cell_names(self): self.coordinates_and_cell_headers = [ annot[0] for annot in self.file.columns if annot[0].lower() in ("z", "y", "x", "name") ] # annotation column names self.annot_column_headers = [ annot ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colnames(self):\n\n cd = self.conn.execute('select * from atom')\n print('Possible column names are:')\n names = list(map(lambda x: x[0], cd.description))\n print('\\trowID')\n for n in names:\n print('\\t'+n)", "def get_annot_colnames() -> List[str]:\n\n ...
[ "0.632583", "0.63223386", "0.6270446", "0.59763235", "0.59620404", "0.5937639", "0.59089094", "0.58520865", "0.58381534", "0.58223736", "0.57881415", "0.5786808", "0.57778555", "0.57523495", "0.5699752", "0.56966233", "0.5673672", "0.5629715", "0.5628198", "0.55986613", "0.55...
0.7893604
0
Sets data types for group annotations. This function assumes that annotation types passed into the function are valid.
def get_dtypes_for_group_annots(header: List, annot_types: List): group_dtypes = {} for annotation, annot_type in zip(header, annot_types): if annot_type != "numeric": group_dtypes[annotation] = np.str return group_dtypes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_type_annotations(self):\n valid = False\n invalid_types = []\n # skipping the TYPE keyword, iterate through the types\n # collecting invalid type annotations in list annots\n for t in self.annot_types[1:]:\n if t.lower() not in (\"group\", \"numeric\"):\n ...
[ "0.5981265", "0.54895484", "0.547235", "0.53883153", "0.53806806", "0.53698015", "0.5304921", "0.52900726", "0.52251786", "0.5142408", "0.5072298", "0.5048777", "0.5021037", "0.50178635", "0.5001251", "0.4979307", "0.4968987", "0.49605083", "0.49495628", "0.49360093", "0.4916...
0.5769833
1
Coerces numeric columns to floats and rounds annotation to 3 decimal places
def coerce_numeric_values(df, annot_types): if "numeric" in annot_types: numeric_columns = df.xs( "numeric", axis=1, level=1, drop_level=False ).columns.tolist() try: # Round numeric columns to 3 decimal places df[numeric_column...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_float(df, *cols):\n for col in cols:\n df[col] = df[col].str.replace(',', '')\n df[col] = df[col].str.replace(' ', '')\n df[col] = df[col].astype(float)\n return df", "def convert_dollars(df,col_name):\n df[col_name] = df[col_name].replace('[^.0-9]','',regex=True).ast...
[ "0.64902544", "0.61874473", "0.608199", "0.60813975", "0.6055885", "0.60087264", "0.5969837", "0.5932989", "0.59281605", "0.59061414", "0.5905307", "0.5799542", "0.57412326", "0.5664925", "0.565744", "0.56301486", "0.5617101", "0.5613498", "0.5609374", "0.5608853", "0.5603152...
0.7405629
0
Converts empty cells in numeric annotations to NaN
def coerce_empty_numeric_values(self): if "numeric" in self.annot_types: numeric_columns = self.file.xs( "numeric", axis=1, level=1, drop_level=False ).columns.tolist() self.file[numeric_columns].replace("", np.nan, inplace=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_nan_in_numeric(df):\n print(\" --- Filling NaN in Numerics.\")\n thresh = get_min_filled_threshold(df)\n columns = df.columns\n numerical = [x for x in columns if x.startswith('n_')]\n # fill NaN with mean or median, based on std dev\n for col in numerical:\n filled = get_non_miss...
[ "0.6934066", "0.66125906", "0.65770066", "0.65756345", "0.6518445", "0.6518293", "0.6511774", "0.6474103", "0.6398664", "0.6339298", "0.6284341", "0.6269383", "0.6237103", "0.62226254", "0.61696684", "0.61133254", "0.6088505", "0.60856736", "0.6034949", "0.59849316", "0.59741...
0.8349927
0
Create dataframe with proper dtypes for group annotations. Numeric annotations require special handling and are addressed in functions presented in preprocess() and preprocess_numeric_annot().
def create_data_frame(self): column_names = Annotations.create_columns(self.headers, self.annot_types) dtypes = Annotations.get_dtypes_for_group_annots(self.headers, self.annot_types) df = self.open_file( self.file_path, open_as="dataframe", # Coerce values in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dtypes_for_group_annots(header: List, annot_types: List):\n group_dtypes = {}\n for annotation, annot_type in zip(header, annot_types):\n if annot_type != \"numeric\":\n group_dtypes[annotation] = np.str\n return group_dtypes", "def FE_add_groupby_features_a...
[ "0.6742742", "0.57367635", "0.5632649", "0.55163085", "0.5503319", "0.5457204", "0.5316533", "0.53103656", "0.5284454", "0.5279293", "0.52708393", "0.5217111", "0.5212483", "0.52033097", "0.51998", "0.5162279", "0.51412517", "0.5125167", "0.5123744", "0.5106807", "0.510412", ...
0.59625477
1
Check header row starts with NAME (caseinsensitive).
def validate_header_keyword(self): valid = False if self.headers[0].upper() == "NAME": valid = True if self.headers[0] != "NAME": msg = f'File keyword "NAME" provided as {self.headers[0]}' self.store_validation_issue("warn", msg, "format:cap:name"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_csv_headers(csvfile, headers):\n\n with open(csvfile, 'rb') as f:\n csv_header = f.readline()\n\n # Check the lower ones\n if headers[1][0] not in csv_header.lower():\n return False\n\n return True", "def normalizeHeaderName(name):\n # type: (AnyStr) -> AnyStr\n return n...
[ "0.68957376", "0.6201394", "0.60827667", "0.60588807", "0.601952", "0.601952", "0.6007669", "0.59995687", "0.59966505", "0.5987942", "0.5969808", "0.59591544", "0.5956927", "0.59442854", "0.59016865", "0.5888689", "0.5867301", "0.58425367", "0.5842121", "0.58320737", "0.58273...
0.7514782
0
Check all header names are unique and not empty.
def validate_unique_header(self): valid = False unique_headers = set(self.headers) if len(unique_headers) == len(self.headers): valid = True else: seen_headers = set() duplicate_headers = set() for x in self.headers: if x in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_header_dups(header,\r\n errors):\r\n\r\n for curr_elem in range(len(header)):\r\n if header.count(header[curr_elem]) != 1:\r\n errors.append('%s found in header %d times. ' %\r\n (header[curr_elem], header.count(header[curr_elem])) +\r\n...
[ "0.76189494", "0.7537004", "0.73286694", "0.7190239", "0.6937977", "0.6811385", "0.6641252", "0.65809643", "0.6544887", "0.6544887", "0.6498212", "0.6487584", "0.6473634", "0.6463443", "0.6449808", "0.64381677", "0.6397096", "0.6381177", "0.63589174", "0.63446665", "0.6304771...
0.84468025
0