query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Given the edge matrix and V component in the HSV space of the chessboard image, as well as the list of chessboard squares, returns a list whose elements are either "W", when the corresponding square contains a white piece, "B", when the piece is black, or None, when it contains no pieces.
def recognize_pieces(edges, v, squares): pieces = [] v = cv2.equalizeHist(v) for p1, p2 in squares: # count the number of slightly centered edges occupancy = sum(edges[y][x] for x in range(p1.x + 5, p2.x - 5) for y in range(p1.y + 5, p2.y - 5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_chessboard_squares(image, min_square_dim):\n\n return compute_chessboard_squares(find_chessboard(image, min_square_dim))", "def find_empty_squares(board):\n for i in range(len(board)):\n for j in range(len(board[0])):\n if board[i][j] == 0:\n return (i,j) #row , c...
[ "0.60228205", "0.5887753", "0.5884547", "0.58834785", "0.58476514", "0.58331096", "0.5732005", "0.57127607", "0.57116115", "0.5710834", "0.5691793", "0.5652056", "0.5597705", "0.5587437", "0.5583285", "0.55695784", "0.55605954", "0.55177444", "0.551634", "0.5506915", "0.54989...
0.7327032
0
Percentencode the first segment of a URL path for a URL without a scheme specified.
def _encode_schemeless_path_part(text, maximal=True): if maximal: bytestr = normalize('NFC', text).encode('utf8') return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[b] for b in bytestr]) return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[t] if t in _SCHEMELESS_PATH_DELIMS else t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_path_percent_encoding():\n assert (normalize_url(\"http://example.com/hello world{}\") ==\n \"http://example.com/hello%20world%7B%7D\")", "def _encode_url(full_url):\n return urllib.parse.quote(full_url, safe=\"%/:=&?~#+!$,;'@()*[]|\")", "def url_fix(s, charset='utf-8'):\n if i...
[ "0.69515634", "0.65919477", "0.6536265", "0.6473818", "0.6298947", "0.62756145", "0.6270277", "0.6228756", "0.622486", "0.60647047", "0.60530454", "0.60281134", "0.6006414", "0.6005046", "0.59993607", "0.59897137", "0.59709895", "0.596607", "0.5951233", "0.59484327", "0.59419...
0.58089596
29
Percentencode a tuple of path parts into a complete path. Setting maximal to False percentencodes only the reserved characters that are syntactically necessary for serialization, preserving any IRIstyle textual data. Leaving maximal set to its default True percentencodes everything required to convert a portion of an I...
def _encode_path_parts(text_parts, rooted=False, has_scheme=True, has_authority=True, joined=True, maximal=True): if not text_parts: return u'' if joined else text_parts if rooted: text_parts = (u'',) + text_parts # elif has_authority and text_parts: # raise Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_schemeless_path_part(text, maximal=True):\n if maximal:\n bytestr = normalize('NFC', text).encode('utf8')\n return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[b] for b in bytestr])\n return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[t]\n if t in _SCHEMELESS_PATH_DEL...
[ "0.63581383", "0.57102215", "0.5471671", "0.5374249", "0.5238488", "0.51968086", "0.5165959", "0.51602685", "0.5149088", "0.5138075", "0.5114686", "0.5065956", "0.5055887", "0.5052824", "0.5023501", "0.49322093", "0.49182388", "0.4896321", "0.48926297", "0.48829225", "0.48339...
0.63382965
1
Percentencode a single query string key or value.
def _encode_query_key(text, maximal=True): if maximal: bytestr = normalize('NFC', text).encode('utf8') return u''.join([_QUERY_KEY_QUOTE_MAP[b] for b in bytestr]) return u''.join([_QUERY_KEY_QUOTE_MAP[t] if t in _QUERY_KEY_DELIMS else t for t in text])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_percent_encode_querystring():\n assert (normalize_url(\"http://example.com/?a=hello{}\") ==\n \"http://example.com/?a=hello%7B%7D\")", "def do_urlencode(value):\n return urllib.quote(value.encode('utf8'))", "def test_normalize_percent_encoding_in_querystring():\n assert (no...
[ "0.74184614", "0.6984509", "0.69428843", "0.67584896", "0.66555846", "0.66384226", "0.6440499", "0.63806623", "0.6343305", "0.6313485", "0.62320954", "0.6217586", "0.6214832", "0.6211704", "0.6156959", "0.61490625", "0.61067253", "0.60983014", "0.6032843", "0.6026147", "0.602...
0.56846964
47
Percentencode a single query string key or value.
def _encode_query_value(text, maximal=True): if maximal: bytestr = normalize('NFC', text).encode('utf8') return u''.join([_QUERY_VALUE_QUOTE_MAP[b] for b in bytestr]) return u''.join([_QUERY_VALUE_QUOTE_MAP[t] if t in _QUERY_VALUE_DELIMS else t for t in text])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_percent_encode_querystring():\n assert (normalize_url(\"http://example.com/?a=hello{}\") ==\n \"http://example.com/?a=hello%7B%7D\")", "def do_urlencode(value):\n return urllib.quote(value.encode('utf8'))", "def test_normalize_percent_encoding_in_querystring():\n assert (no...
[ "0.7418123", "0.69857657", "0.6942315", "0.67587477", "0.6654725", "0.66400814", "0.6441494", "0.63818866", "0.6345995", "0.6314268", "0.62331235", "0.62174475", "0.62163043", "0.6213482", "0.6158453", "0.61513036", "0.6107483", "0.6101127", "0.60347784", "0.6028213", "0.6023...
0.5947809
24
Quote the fragment part of the URL. Fragments don't have subdelimiters, so the whole URL fragment can be passed.
def _encode_fragment_part(text, maximal=True): if maximal: bytestr = normalize('NFC', text).encode('utf8') return u''.join([_FRAGMENT_QUOTE_MAP[b] for b in bytestr]) return u''.join([_FRAGMENT_QUOTE_MAP[t] if t in _FRAGMENT_DELIMS else t for t in text])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlQuote(string):\r\n return quote(string.encode(\"utf-8\"))", "def add_fragment(url, args):\n chunks = list(urlparse(url))\n chunks[5] = urlencode(args)\n return urlunparse(chunks)", "def url_quote_part(s, safechars='/', encoding=None):\n if isinstance(s, unicode):\n if encoding ...
[ "0.61974275", "0.59924036", "0.5939213", "0.5747138", "0.57312095", "0.57294613", "0.5690359", "0.5590902", "0.5539244", "0.5538318", "0.53728986", "0.53687245", "0.5364224", "0.53525794", "0.52671957", "0.52668244", "0.5259217", "0.52539384", "0.5233805", "0.5195989", "0.519...
0.5404409
10
>>> _decode_path_part(u'%61%77%2f%7a') u'aw%2fz' >>> _decode_path_part(u'%61%77%2f%7a', normalize_case=True) u'aw%2Fz'
def _decode_path_part(text, normalize_case=False, encode_stray_percents=False): return _percent_decode(text, normalize_case=normalize_case, encode_stray_percents=encode_stray_percents, _decode_map=_PATH_DECODE_MAP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename_decode(path):\n path = re.sub(r'--[0-9A-Fa-f]{32}', u'\\u2026', path)\n path = re.sub(r'-([0-9a-f]{4})', lambda match: unichr(int(match.group(1), 16)), path)\n return path", "def normalize(path):\n return os.path.normcase(os.path.realpath(path))", "def test_unicode_path():\n ass...
[ "0.6174186", "0.596646", "0.59375584", "0.58684134", "0.57936233", "0.56972635", "0.55720794", "0.5566638", "0.55595", "0.5549183", "0.55356246", "0.5523528", "0.5509594", "0.5505011", "0.546507", "0.5442592", "0.53878486", "0.5373581", "0.53517896", "0.5349128", "0.53461236"...
0.7498919
0
Normalize the URL path by resolving segments of '.' and '..'. For more details, see `RFC 3986 section 5.2.4, Remove Dot Segments`_.
def _resolve_dot_segments(path): segs = [] for seg in path: if seg == u'.': pass elif seg == u'..': if segs: segs.pop() else: segs.append(seg) if list(path[-1:]) in ([u'.'], [u'..']): segs.append(u'') return segs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_dot_segments():\n assert (normalize_url(\"http://www.example.com/../a/b/../c/./d.html\") ==\n \"http://www.example.com/a/c/d.html\")", "def normalize(cls, target):\n parts = collections.deque()\n for p in target.split('/'):\n if (p == '' or p == '.') and len(parts) > 0:\n...
[ "0.7755275", "0.74218404", "0.68000025", "0.6756878", "0.6730546", "0.66204673", "0.6587858", "0.654032", "0.6529061", "0.6492139", "0.6474724", "0.6392452", "0.63307244", "0.63173574", "0.6199412", "0.61959326", "0.6179483", "0.61668575", "0.6159764", "0.61401755", "0.613001...
0.6575333
7
The scheme is a string, and the first part of an absolute URL, the part before the first colon, and the part which defines the semantics of the rest of the URL. Examples include "http", "https", "ssh", "file", "mailto", and many others. See
def scheme(self): return self._scheme
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitscheme(url):\r\n # The scheme is valid only if it contains these characters.\r\n scheme_chars = \\\r\n \"abcdefghijklmnopqrstuvwxyz0123456789+-.\"\r\n\r\n scheme = \"\"\r\n rest = url\r\n\r\n spart = url.split(\":\", 1)\r\n if len(spart) == 2:\r\n\r\n # Normalize the scheme.\r\n s...
[ "0.753768", "0.70505", "0.6949365", "0.68439734", "0.6724282", "0.6701892", "0.66623825", "0.66535646", "0.6614464", "0.6475012", "0.6472128", "0.6469419", "0.64590096", "0.6393495", "0.6352747", "0.63165903", "0.6304048", "0.62795925", "0.6275786", "0.6260491", "0.62590736",...
0.6224932
23
A tuple of strings, created by splitting the slashseparated hierarchical path. Started by the first slash after the host, terminated by a "?", which indicates the start of the
def path(self): return self._path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pathsplit(path):\n stem, basename = os.path.split(path)\n if stem == '':\n return (basename,)\n if stem == path: # fixed point, likely '/'\n return (path,)\n return pathsplit(stem) + (basename,)", "def split_string_path(base, path):\n for i in range(len(path)):\n ...
[ "0.6889111", "0.6870747", "0.67441666", "0.66227365", "0.6527906", "0.65210426", "0.6467041", "0.6419429", "0.64044595", "0.64031863", "0.63737077", "0.63047993", "0.6289111", "0.62169623", "0.62022346", "0.6195827", "0.61938584", "0.61756563", "0.6155794", "0.6132837", "0.61...
0.0
-1
Convert from JSON dict to an instance
def fromJSON(cls, data): return SERIALISE_CLASS_LOOKUP[data['timeref_type']].fromJSON(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromJson(json):\r\n raise NotImplementedError(\"Returns instance\")", "def _from_json_dict(cls, dic):\n # create a new object\n obj = cls.__new__(cls)\n for attr, typ in cls._attrs_to_save.items():\n setattr(obj, attr, typ.to_python(dic[attr]))\n return obj", "def from_json(cls, b...
[ "0.79551023", "0.76986384", "0.7660535", "0.7658723", "0.7658723", "0.7658723", "0.73792714", "0.7363552", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", ...
0.66820604
99
Convert from JSON dict to an instance
def fromJSON(cls, data): return cls(start=data['start'], end=data['end'], interval=data['interval'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromJson(json):\r\n raise NotImplementedError(\"Returns instance\")", "def _from_json_dict(cls, dic):\n # create a new object\n obj = cls.__new__(cls)\n for attr, typ in cls._attrs_to_save.items():\n setattr(obj, attr, typ.to_python(dic[attr]))\n return obj", "def from_json(cls, b...
[ "0.79551023", "0.76986384", "0.7660535", "0.7658723", "0.7658723", "0.7658723", "0.73792714", "0.7363552", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", "0.7323774", ...
0.0
-1
Initialise the GameObject with the given Game as its parent.
def __init__ (self, game): pygame.sprite.Sprite.__init__(self) self.game_ref = game self.initialise()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_new_game(self):\n self.game = get_new_game(self.game_config)", "def make_game(self):\n game = Game(self.data['gamename'])\n self.game = game\n return game", "def __init__(self, ggui):\n self.gui: gamegui = ggui\n super().__init__(self.gui.top, \"New Game\")", ...
[ "0.64174336", "0.63924277", "0.5975358", "0.5823752", "0.5801307", "0.57709646", "0.57504463", "0.56525224", "0.5644515", "0.5583254", "0.5555567", "0.55288976", "0.55288976", "0.5512438", "0.5511699", "0.55100304", "0.5500407", "0.5493451", "0.5492681", "0.5477946", "0.54767...
0.61519575
2
Generates list of outputnodenames used in nnet3 model configuration. It will normally return 'output'.
def get_outputs_list(model_file, get_raw_nnet_from_am=True): if get_raw_nnet_from_am: outputs_list = common_lib.get_command_stdout( "nnet3-am-info --print-args=false {0} | " "grep -e 'output-node' | cut -f2 -d' ' | cut -f2 -d'=' ".format(model_file)) else: outputs_list = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_names(self):\n return []", "def output_names(self):\n msg = \"output_names() is not implemented by op {}\"\n raise NotImplementedError(msg.format(self.op_type))", "def getOutputsNames(self):\n self.layersNames = self.net.getLayerNames()\n # Get the names of the out...
[ "0.68937975", "0.66486293", "0.6558798", "0.65374", "0.6536277", "0.6467489", "0.64337146", "0.6412757", "0.6358682", "0.6328964", "0.6319807", "0.63165987", "0.62814003", "0.6272172", "0.6254628", "0.6254628", "0.625364", "0.61701953", "0.61687934", "0.613509", "0.6091971", ...
0.6364424
8
Displays the index page accessible at '/'
def main(): return render_template("index.html", title="Home", heading="Dublin Bus")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_index_page():\n\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\r\n return render_template('index.html')", "def index():\n return render_template('index.html')", "def index():\n return render_templ...
[ "0.8617144", "0.8612428", "0.86105794", "0.86065364", "0.86065364", "0.8585549", "0.8561872", "0.8558644", "0.8546361", "0.85463387", "0.85293406", "0.85190517", "0.85190517", "0.8458544", "0.84501946", "0.8403687", "0.8400753", "0.8383512", "0.8383512", "0.8383512", "0.83835...
0.0
-1
Returns Tile image sequence duration.
def image_sequence_duration(self): return self._image_sequence_duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n frame_dur = self.get_frame_duration()\n num_frames = self.get_num_frames()\n motion_dur = frame_dur * (num_frames - 1)\n return motion_dur", "def _get_duration(self):\n try:\n dur = self.im.info[\"duration\"] / 1000.0\n except KeyError:\n ...
[ "0.76041716", "0.74942654", "0.7319031", "0.72677875", "0.722871", "0.69734913", "0.6957251", "0.69290537", "0.69061404", "0.6869168", "0.6839367", "0.6831297", "0.68133473", "0.68023664", "0.679833", "0.679833", "0.67943233", "0.67884487", "0.6784803", "0.67680544", "0.67680...
0.8232446
0
Tests that controller cache is deleted.
def test_delete_cache(self): uid = self._game.uid self._game.delete_cache(self._ds) self._game = None self.assertIsNone(self._ds.get_strict_controller(Game, uid), "Game controller did not clear from cache.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cache_delete(self):\n self.cache.set('superman', 'clark kent')\n self.cache.set('recipe', {'sugar': 2, 'wine': 5}, 10)\n self.cache.set('secret', ['remains secret'], 0)\n\n self.cache.delete('superman')\n self.cache.delete('recipe')\n self.cache.delete('secret')\n...
[ "0.76176715", "0.7068884", "0.70276535", "0.70243865", "0.7022364", "0.6687986", "0.66680443", "0.6613503", "0.65807366", "0.65715605", "0.6570813", "0.65270036", "0.6526597", "0.6489077", "0.6476169", "0.64710987", "0.64673775", "0.6458829", "0.6428761", "0.63977754", "0.638...
0.81209487
0
Tests that controller and model is deleted.
def test_delete(self): uid = self._game.uid self._game.save(self._ds) self._game.delete(self._ds) self._game = None self.assertIsNone(self._ds.get_strict_controller(Game, uid)) with self.assertRaises(ValueError): self._ds.get_controller(Game, uid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete(self):\n pass", "def test_model_object_delete(self):\n car = Car.objects.first()\n car.delete_from_appsearch()\n self.assertEqual(self.client_destroy.call_count, 1)", "def test_delete_run(self):\n pass", "def test_destroy(self):\n DoctorFactory.create...
[ "0.78814876", "0.77263176", "0.75959426", "0.75892895", "0.75365204", "0.75348675", "0.75308096", "0.75233346", "0.73897266", "0.737479", "0.7354918", "0.7342948", "0.73071134", "0.7298923", "0.7296815", "0.7296456", "0.7296456", "0.7271298", "0.723112", "0.7230284", "0.72236...
0.7514735
8
The email address to send notifications to. The email address does not need to be a Google Account.
def email(self) -> str: return pulumi.get(self, "email")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_address() -> str:\n\n return os.environ.get(\"EMAIL_NOTIFICATION\", \"\")", "def get_email(self):\n return self.reference[REF_EMAIL_ADDRESS][REF_VALUE]", "def email_address(self) -> str:\n return self._email_address", "def contact_email(self) -> str:\n return pulumi.get(self...
[ "0.8170227", "0.7686174", "0.7657145", "0.7641621", "0.7640317", "0.7623239", "0.7623239", "0.7498176", "0.736614", "0.7340284", "0.7325949", "0.7325949", "0.7325949", "0.7325949", "0.72881", "0.72881", "0.72881", "0.72881", "0.7272182", "0.72689915", "0.72494495", "0.72125...
0.76684576
4
2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma])
def fspecial_gaussian(shape=(3, 3), sigma=0.5): m, n = [(ss - 1.) / 2. for ss in shape] y, x = np.ogrid[-m:m + 1, -n:n + 1] h = np.exp(-(x * x + y * y) / (2. * sigma * sigma)) h[h < np.finfo(h.dtype).eps * h.max()] = 0 sumh = h.sum() if sumh != 0: h /= sumh return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(size,sigma):\n a,b=np.ogrid[-size/2:size/2,-size/2:size/2]\n mask = a**2+b**2\n mask = np.exp(-mask.astype('float')/(2*float(sigma**2)))\n return mask", "def fit_gaussian(self, mask=None):\n data = self.data\n mask = numpy.logical_or(mask, numpy.ma.getmaskarray(data))\n ...
[ "0.7830274", "0.7225701", "0.7157045", "0.69491535", "0.6849642", "0.6787778", "0.6769758", "0.6751879", "0.6751879", "0.6716543", "0.6712592", "0.66879416", "0.6682756", "0.667663", "0.6641985", "0.6612434", "0.65852946", "0.6566338", "0.6559973", "0.6504771", "0.65046597", ...
0.75631243
1
Convert a date string to filenamefriendly format
def date_format(date_str): return date_str.replace("/", "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_filename(base_path, raw_date_string):\n raw_date_string = raw_date_string[:-1]\n month, day, year = raw_date_string.split(\"/\")\n relative_path = \"{}/{}/{}.md\".format(year, month, day)\n return base_path / relative_path", "def reformat_date(mdy_date_string):\n date = mdy_date_string...
[ "0.7654617", "0.730857", "0.71832246", "0.71288854", "0.704033", "0.6926674", "0.6919468", "0.6835124", "0.682005", "0.68199503", "0.68073237", "0.6784583", "0.67121476", "0.6677838", "0.6669579", "0.6640443", "0.66307676", "0.65710634", "0.6555773", "0.6538748", "0.64573705"...
0.771194
0
Estimate the uncertainties of the background polarisation, model and stellar model.
def Error_estimation(params, qu=None, qu_err=None, p_maxL=None, par=False): if par is True: print('Estimate uncertainties for the parameters') sigma = par_err(params) return(sigma) elif qu is not None: N = len(qu[0,:]) model_err = np.zeros((3, N)) star_err = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_sky_background(self):\n\n values_with_cat = get_sky_background(self.file_with_cat, bounding_box=self.bounding_box)\n values_without_cat = get_sky_background(self.file_witout_cat, bounding_box=self.bounding_box)\n relative_difference = math.fabs((values_without_cat[0]-values_with_c...
[ "0.58547527", "0.5688463", "0.55919516", "0.55232096", "0.54342407", "0.54130036", "0.5409423", "0.5409373", "0.538953", "0.53668743", "0.53398883", "0.5282908", "0.52204335", "0.5216535", "0.52021134", "0.51936644", "0.5191932", "0.51914936", "0.51444906", "0.51400286", "0.5...
0.0
-1
Returns the reward associated with each action taken
def get_action_cost(state: tuple, action: int) -> float: assert len(state) == 3 and state[0] < 5 and state[1] < 4 and state[2] < 3 and action < 3 if state[0] == 0: return 0.0 if state[0] == 1 and action == 0: return -20.0 + 10.0 * 0.5 return -20.0 # Penalty = 20 due to Team Number = 9
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reward(self, observations, actions):\n\n #initialize and reshape as needed, for batch mode\n self.reward_dict = {}\n if(len(observations.shape)==1):\n observations = np.expand_dims(observations, axis = 0)\n actions = np.expand_dims(actions, axis = 0)\n ...
[ "0.7573057", "0.7519566", "0.74534875", "0.7440747", "0.7432859", "0.7312876", "0.719975", "0.7198886", "0.71635175", "0.71419847", "0.7139158", "0.7131", "0.7092686", "0.7084796", "0.7084796", "0.7084004", "0.70262176", "0.7025256", "0.7001349", "0.6992559", "0.69917744", ...
0.0
-1
Just renders a page for /
def index(request): template = 'pages/index.html' return render(request, template)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderPage():\n return render_template(\"index.html\")", "def landing_page():\n\n return render_template('index.html')", "def get(self):\n self.render(\"index.html\")", "def main_page():\n return render_template(\"index.html\")", "def index_page():\n\n return render_template(\"index.ht...
[ "0.7847489", "0.77737665", "0.77508414", "0.7691625", "0.7687196", "0.7687196", "0.7687196", "0.76506484", "0.7637517", "0.76325065", "0.76239765", "0.76239765", "0.7619322", "0.7618352", "0.758153", "0.75491834", "0.75319755", "0.752033", "0.75080985", "0.75080985", "0.75080...
0.7283151
48
Get the height of the board.
def get_grid_height(self): return self._height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return self.board.shape[0]", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self.height", "def getHeight(self):\n return self._height", "def get_height(self):\n return self._height", "def get_height(self):\n return...
[ "0.8506178", "0.7828281", "0.7828281", "0.7792005", "0.77683884", "0.77683884", "0.77683884", "0.77683884", "0.77662206", "0.7763028", "0.776071", "0.77545404", "0.7742475", "0.77377915", "0.7721646", "0.769687", "0.76945823", "0.76945823", "0.76945823", "0.7678935", "0.76789...
0.7788401
4
Create a ``Dense`` layer.
def __init__( self, units, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, **kwargs ): super(Dense, self).__init__(**kwargs) self.inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense(in_layer):\n return Dense(neurons,\n kernel_initializer=initializer())(in_layer)", "def dense(self, input_tensor, units, name, activation='linear'):\n with tf.variable_scope('Dense', name):\n init_w = tf.truncated_normal(shape=(self.num_chann...
[ "0.75564796", "0.73921734", "0.7307958", "0.70343965", "0.6820574", "0.68191934", "0.6804003", "0.6723038", "0.6525088", "0.6481959", "0.64693815", "0.6426125", "0.6416243", "0.63848716", "0.63337976", "0.6285083", "0.6280479", "0.6274717", "0.6228125", "0.6204087", "0.619936...
0.6335794
14
Create a ``Dropout`` layer.
def __init__(self, rate, **kwargs): super(Dropout, self).__init__(**kwargs) self.rate = rate self.inplace = kwargs.get('inplace', False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dropout_layer(self):\n return tf.keras.layers.Dropout(rate=self.dropout)", "def dropout_create_layer(prev, n, activation, keep_prob):\n init = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n reg = tf.layers.Dropout(keep_prob)\n mod = tf.layers.Dense(n, activation, ke...
[ "0.86633456", "0.7532193", "0.7481706", "0.746232", "0.73892367", "0.7186784", "0.7115536", "0.7003306", "0.6755994", "0.6658514", "0.65808827", "0.65121865", "0.6507173", "0.64662296", "0.6463499", "0.63817304", "0.6333375", "0.63092995", "0.63043326", "0.63043326", "0.63043...
0.52865225
72
Create (unnormalized) probability array for a discretization grid. Lower edge/corner probabilities.
def prob_disc(shape): p = np.ones(shape) idx = np.nonzero(p) n = np.zeros(p.size) for i, size in zip(idx, shape): n += np.all([i > 0, i < size - 1], axis=0) p[idx] = 2**n return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_array(self, unnormalized=False):\n if self.dice_array is not None:\n raise Exception(\"P-array when using a dice_array not implemented yet.\")\n else:\n if (self.sides is not 6) or (self.number is not 2):\n raise Exception(\"Anything but two six-si...
[ "0.61458087", "0.6035294", "0.5958914", "0.59196705", "0.5877442", "0.57685053", "0.5734798", "0.57225114", "0.5673937", "0.5623372", "0.5542015", "0.5541386", "0.5540159", "0.55077606", "0.55069613", "0.5503933", "0.54912883", "0.54310286", "0.54272133", "0.5425883", "0.5422...
0.5894462
4
Block until media is playing, typically useful in a script. Another way to do the same is to check if the controller is_active or by using self.status.player_state.
def block_until_playing(self, media=None, timeout=None, **kwargs): # In case media isnt playing. self.play_media_event.clear() self.play_media(media, **kwargs) self.play_media_event.wait(timeout) self.play_media_event.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_until_playing(self, item, timeout=None):\n self.play_media_event.clear()\n self.play_media(item)\n self.play_media_event.wait(timeout)\n self.play_media_event.clear()", "def media_is_loading(self):\n metadata = PlayingState(playback_state=PlaybackState...
[ "0.73112506", "0.69484967", "0.6918306", "0.68083113", "0.67477334", "0.6725133", "0.670313", "0.66943944", "0.66783804", "0.667731", "0.66683555", "0.6566635", "0.65630853", "0.6546677", "0.6496603", "0.6494565", "0.64776367", "0.64410144", "0.64197254", "0.64197254", "0.641...
0.7741685
0
Get current media_item, media, & part for PMS.
def _get_current_media(self): key = int(self.status.content_id.split("/")[-1]) media_item = self.pms.fetchItem(key).reload() media_idx = self.status.media_custom_data.get("mediaIndex", 0) part_idx = self.status.media_custom_data.get("partIndex", 0) media = media_item.media[media_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_title(self):\n return self._current_item[\"name\"]", "def media_summary(self):\n return self._current_item[\"description\"]", "def media_track(self):\n return self._media_track", "def media_content_id(self):\n return int(self._gallery_status[\"current_item\"])", "def e...
[ "0.57332", "0.5687245", "0.5607989", "0.5556231", "0.55452216", "0.55167013", "0.5467086", "0.5464833", "0.542255", "0.54173946", "0.5386879", "0.5362278", "0.5362278", "0.5350001", "0.53148407", "0.53147006", "0.53125274", "0.52915543", "0.5279683", "0.5263635", "0.5262892",...
0.8217627
0
Get the next valid run id
def reserve_next_run_id(self): query = "SELECT NEXTVAL(pg_get_serial_sequence('task_history', 'run_id'))" cur = self.conn.cursor() cur.execute(query) self.conn.commit() return cur.fetchone()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_run_id_local(run_dir_root: str) -> int:\r\n dir_names = [d for d in os.listdir(run_dir_root) if os.path.isdir(os.path.join(run_dir_root, d))]\r\n r = re.compile(\"^\\\\d+\") # match one or more digits at the start of the string\r\n run_id = 0\r\n\r\n for dir_name in dir_names:\r\n ...
[ "0.74003047", "0.72451735", "0.70934284", "0.70767295", "0.70419943", "0.70079046", "0.6985732", "0.6972058", "0.69625205", "0.68697035", "0.6842018", "0.6842018", "0.68060046", "0.66828555", "0.65902674", "0.65631014", "0.6561333", "0.655831", "0.6554891", "0.65479845", "0.6...
0.8212941
0
Creates a Keras model as in the paper.
def create_model(): input_shape = (768,) input = keras.Input(shape=input_shape) x = layers.Dense(64, activation="sigmoid")(input) x = layers.Dense(64, activation="sigmoid")(x) x = layers.Dense(64, activation="sigmoid")(x) x = layers.Dense(64, activation="sigmoid")(x) out = layers.Dense(1, ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model():\n\n # Create a sequential model (a simple NN is created) adding a softmax activation at the end with 10 units:\n model = Sequential()\n model.add(Dense(units=128, activation=\"relu\", input_shape=(784,)))\n model.add(Dense(units=128, activation=\"relu\"))\n model.add(Dense(units=...
[ "0.7983285", "0.77246064", "0.7609753", "0.75745094", "0.75697845", "0.74997264", "0.7463886", "0.7451531", "0.7434139", "0.7413985", "0.7410586", "0.73816967", "0.7353634", "0.7353367", "0.7304792", "0.7296666", "0.7291704", "0.72805613", "0.72532266", "0.7236777", "0.722012...
0.7537234
5
Returns string dictionary serialization cast as string.
def as_str(self) -> str: return dumps(self.as_dict(), cls=NumpyEncoder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string(self):\n return str(self._dict)", "def dict_2_string(d):\n buff = io.StringIO()\n print_dictionary(d, output=buff)\n return buff.getvalue()", "def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})", "def _to_string(self) -> str:\n\n string_l...
[ "0.78481305", "0.77717197", "0.7389359", "0.7012255", "0.6923015", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", "0.6915299", ...
0.0
-1
Assembles a Structure object from a dictionary parameterizing one.
def from_dict(dictionary: dict)-> 'flare.struc.Structure': struc = Structure(cell=np.array(dictionary['cell']), positions=np.array(dictionary['positions']), species=dictionary['coded_species'], forces=dictionary.get('forces'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_structure(structdict, logger=None):\n from aiida.orm import DataFactory\n StructureData = DataFactory('structure')\n struct = StructureData(cell=structdict['lattice'])\n struct.set_pbc(structdict[\"pbc\"])\n atom_kinds = structdict.get(\"kinds\", None)\n\n if atom_kinds is None:\n ...
[ "0.6756273", "0.60232925", "0.5969138", "0.5862488", "0.5862488", "0.5857976", "0.5829684", "0.58186454", "0.57709754", "0.572965", "0.5728529", "0.57243526", "0.5684932", "0.5681282", "0.56764966", "0.5660098", "0.56598914", "0.56507903", "0.56427306", "0.5627443", "0.558776...
0.68902653
0
Returns FLARE structure as a pymatgen structure.
def to_pmg_structure(self): if not _pmg_present: raise ModuleNotFoundError("Pymatgen is not present. Please " "install Pymatgen and try again") site_properties = {'force:': self.forces, 'std': self.stds} return pmgstruc.Structure(lattice=self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_structure(self):\n final_structure = getattr(self.vasprun_obj, 'final_structure', None)\n if not final_structure:\n return None\n return get_data_node('structure', pymatgen=final_structure)", "def structures(self):\n pdb = self.name\n residues = self.__resi...
[ "0.6244702", "0.6154664", "0.60991675", "0.6053404", "0.60274804", "0.59549284", "0.5843134", "0.5812698", "0.580171", "0.576196", "0.5713444", "0.56651855", "0.5619667", "0.5600445", "0.5589753", "0.5585757", "0.5580204", "0.5575376", "0.5570575", "0.5570575", "0.5570575", ...
0.63120776
0
given an expression of the form ${lhs} = ${rhs} where $lhs is a sequence or object unpacking syntax return a new expression which can be minified returns None if the lhs is already trivialbly minifiable objects unpacking where the object attribute is assigned a default value need to have the expression rewritten to a f...
def _unpack_fix(self, lhs, rhs): ln = lhs.line co = lhs.index name = "$js$unpack$%d$%d_" % (ln, co) ident = Token(Token.T_TEXT, ln, co, name) comma = Token(Token.T_COMMA, ln, co, ",") comma.children.append( self._h_assign(ident, rhs) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_assignment(assignment, motif_node_dict):\n if type(assignment.rvalue).__name__ == 'FuncCall':\n motif_node, tree_node = eval_function_call(assignment.rvalue, motif_node_dict)\n # consider \"var = XXX;\" and \"*var = XXX\" and \"&var = XXX\" situations\n if (type(assignment.lvalue)....
[ "0.5632931", "0.5438055", "0.536297", "0.5360628", "0.5308538", "0.52829945", "0.5236419", "0.5138689", "0.50687164", "0.506529", "0.505845", "0.505845", "0.5031756", "0.5027583", "0.5001796", "0.4952994", "0.49004197", "0.48766077", "0.4871658", "0.48715335", "0.48708108", ...
0.5078407
8
Singleton factory that builds the Brendel (2020) Measured Commercial LED Spectra dataset loader.
def build_Brendel2020(load: bool = True) -> DatasetLoader_Brendel2020: global _DATASET_LOADER_BRENDEL2020 # noqa: PLW0603 if _DATASET_LOADER_BRENDEL2020 is None: _DATASET_LOADER_BRENDEL2020 = DatasetLoader_Brendel2020() if load: _DATASET_LOADER_BRENDEL2020.load() return _DATA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dataloader(bs, shfle):\n # change get_labels to correct version (classification vs regression)\n dataset = TensorDataset(rand_data(), get_labels())\n dataset = TensorDataset(rand_data(), get_regression_labels())\n\n return DataLoader(dataset, batch_size=bs, shuffle=shfle, num_workers=0)", "...
[ "0.61916256", "0.592501", "0.5912945", "0.5823901", "0.5788497", "0.5757547", "0.571573", "0.57085186", "0.56964743", "0.5692073", "0.5662569", "0.5631852", "0.56311184", "0.5606542", "0.5579585", "0.5576443", "0.55410516", "0.5526542", "0.5525028", "0.5520259", "0.55074954",...
0.6056415
1
Route for welcome page, it's like menu for further interactions
def main(): return render_template("main.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome_page():\n return redirect(\"/static/welcome.html\")", "def home():\n logging.info('Entering route: HOME')\n\n logging.info('Rendering template: main.html')\n return render_template('main.html')", "def index():\n is_admin = dbhandler.is_admin(current_user())\n return render_templat...
[ "0.7553658", "0.7425674", "0.7334936", "0.7309308", "0.7142669", "0.71309763", "0.71199995", "0.7073812", "0.7059673", "0.7013033", "0.70088494", "0.6990227", "0.69771266", "0.69632554", "0.6933642", "0.6923838", "0.69135517", "0.6910152", "0.69044995", "0.6869287", "0.686795...
0.0
-1
Read a DataFrame from the file. Load only the columns that show up in the feature guide and set the index intelligently using `PandasDataset.index_colname`. Currently this assumes csv files.
def read_using_fguide(fname, fguide): if isinstance(fguide, basestring): fguide = FeatureGuide(fguide) kwargs = { 'index_col': PandasDataset.index_from_feature_guide(fguide), 'usecols': fguide.all_names } return pd.read_csv(fname, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(path, file, verbose=False, index=0):\n \n df = pd.read_csv(path+file, index_col=index)\n \n if verbose:\n shape = f'{df.shape}'\n dtypes = f'{df.dtypes[:30]}'\n head = f'{df.head()[:10]}'\n name = file.split('.')[0]\n \n print(f'{name} shape'.cent...
[ "0.7135056", "0.70180535", "0.69924194", "0.69288963", "0.68164325", "0.67823493", "0.6770035", "0.6711918", "0.670997", "0.670997", "0.670997", "0.6634391", "0.66080666", "0.65084815", "0.65068966", "0.6501852", "0.65007675", "0.64886314", "0.64809924", "0.6410559", "0.64054...
0.64697146
19
Read a DataFrame from the file. Load only the columns that show up in the feature guide and set the index intelligently using `PandasDataset.index_colname`. Currently this assumes csv files.
def read(self, fname): return self.read_using_fguide(fname, self.fguide)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(path, file, verbose=False, index=0):\n \n df = pd.read_csv(path+file, index_col=index)\n \n if verbose:\n shape = f'{df.shape}'\n dtypes = f'{df.dtypes[:30]}'\n head = f'{df.head()[:10]}'\n name = file.split('.')[0]\n \n print(f'{name} shape'.cent...
[ "0.71359694", "0.70168364", "0.6993094", "0.69270647", "0.6815675", "0.678472", "0.6769766", "0.6713086", "0.67110735", "0.67110735", "0.67110735", "0.66336733", "0.6609732", "0.65095335", "0.65073806", "0.6502085", "0.6501412", "0.64894307", "0.64816475", "0.64686495", "0.64...
0.0
-1
Split the dataset based on a rowwise mask. This allows users to perform comparisons with fields of the DataFrame in the function call,
def split(self, train_mask, test_mask): train = self.dataset.loc[train_mask] test = self.dataset.loc[test_mask] return PandasTrainTestSplit.from_dfs(train, test, self.fguide)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataframe(df, split_elements_list):\n y = df.filter(split_elements_list)\n x = df.drop(split_elements_list, axis=1)\n\n return x, y", "def splitData(df, split):\n train = df.iloc[:int(len(df)*split)]\n test = df.iloc[int(len(df)*split):]\n \n return train, test", "def split_devic...
[ "0.6170406", "0.6055912", "0.6014616", "0.59700924", "0.5885788", "0.58658326", "0.5769585", "0.5756288", "0.57470036", "0.5727175", "0.57257", "0.56966984", "0.5672393", "0.56576735", "0.5649688", "0.5627125", "0.5607778", "0.5600751", "0.55790555", "0.5525489", "0.5509274",...
0.66029644
0
Initialize a dataset from DataFrame objects and a FeatureGuide already in memory.
def from_dfs(cls, train_df, test_df, fguide): # We only need to use columns that show up in the config file. usecols = fguide.all_names index_col = cls.index_from_feature_guide(fguide) if index_col is None: train = train_df.reset_index(drop=True)[usecols] test = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataset(self, df, **kwargs):\n\t\treturn df", "def prepare_data(args):\n logger.info('Loading dataframe from %s' % args.newspath)\n df = pd.read_csv(args.newspath, encoding='gb18030')\n logger.info('Dataframe size: %d observations %d features after loaded' % (df.shape[0], df.shape[1]))\n\n #...
[ "0.6769931", "0.62991035", "0.6292388", "0.62793726", "0.6244421", "0.62356234", "0.6220347", "0.61635345", "0.61570656", "0.61564827", "0.6148513", "0.61482173", "0.6145672", "0.6118643", "0.6099741", "0.60887766", "0.6059033", "0.6030796", "0.6023561", "0.59719825", "0.5950...
0.6334622
1
Return True if the given column has only NaN values, else False.
def df_column_is_all_null(df, column): return df[column].isnull().sum() == len(df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_nan(self) -> bool:\n\n return any([x is np.NaN for x in self.values])", "def is_nan(x):\n return (x is np.nan or x != x)", "def has_nan(a):\n return np.any(np.isnan(a))", "def _no_nan(self, feature: np.array) -> bool:\n if not np.any(np.isnan(feature)):\n return True\n ...
[ "0.77780175", "0.7462633", "0.73858464", "0.7221337", "0.7219205", "0.72079015", "0.71758157", "0.7150138", "0.711477", "0.7046322", "0.698421", "0.697042", "0.6937544", "0.68773717", "0.68398887", "0.67971754", "0.67560625", "0.67355484", "0.67075855", "0.67024904", "0.66911...
0.7809844
0
Onehot encode the given columns of the train and test data. The encoded features are returned as two `scipy.sparse.csr_matrix`
def one_hot_encode(self, columns): if not columns: return None logging.info('one-hot-encoding columns: %s' % ','.join(columns)) both_sets = pd.concat((self.train[columns], self.test[columns])) encoder = preprocessing.OneHotEncoder() encoded = encoder.fit_transform(b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(df, ohe_cols):\n return pd.get_dummies(df, columns=ohe_cols)", "def one_hot_enc(df, ohe_cols):\n for col in ohe_cols:\n df_ohe = pd.get_dummies(df[col], preffix=col)\n df = pd.concat([df, df_ohe], axis=1)\n df.drop(col, axis=1, inplace=True)\n return df", "def e...
[ "0.7900512", "0.7832099", "0.7777277", "0.7775682", "0.776482", "0.7756541", "0.7702387", "0.7678082", "0.7646962", "0.7593864", "0.7557105", "0.7461908", "0.73693955", "0.72528243", "0.720281", "0.7194157", "0.7184027", "0.7180836", "0.71731234", "0.7060334", "0.7059996", ...
0.7848153
1
Returns the full path of a Sikuli project module. To load a module in a Sikuli script, use execfile(getmodulepath(modulename)).
def getmodulepath(modulename): return USERLIBDIR + '\\' + modulename + '.sikuli\\' + modulename + '.py'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_path():\n return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))", "def _get_module_path():\n\n return os.path.dirname(os.path.realpath(__file__))", "def modulePath(self, name):\n return os.path.join(self.modulesDir, name)", "def get_module_path(module):\n return pathl...
[ "0.77119386", "0.7525079", "0.7456764", "0.7422012", "0.7397728", "0.73364455", "0.7238491", "0.70865417", "0.7049372", "0.7019027", "0.68733454", "0.6868767", "0.68665034", "0.68108463", "0.67949843", "0.6792065", "0.6792065", "0.67199206", "0.6654636", "0.66390073", "0.6631...
0.77303064
0
Get the kafka topic string for a message.
def get_topic_string(self, msg_type: str, msg_subtype: str, component_name: typing.Optional[str] = None, component_site: typing.Optional[str] = None): component_name = component_name if component_name is not None else self.component_name component_site =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kafka_topic(self):\n from corehq.apps.change_feed.topics import get_topic_for_doc_type\n return get_topic_for_doc_type(self.document_class().to_json()['doc_type'])", "def kafka_topic(self) -> str:\n return self._kafka_topic", "def topic(self):\n return self._topic_name", "def ...
[ "0.7280731", "0.71249217", "0.6897625", "0.6821359", "0.6702523", "0.6694478", "0.66248417", "0.658877", "0.649405", "0.6483746", "0.6370398", "0.6282885", "0.62503797", "0.62101936", "0.6167804", "0.6078987", "0.6077721", "0.6020825", "0.5996986", "0.59561086", "0.5913355", ...
0.5851098
22
Return the timestamp formatted correctly as per the ICD.
def _get_timestamp(): return '{}Z'.format( datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timestamp():\n return time.strftime('%Y-%m-%d %H:%M:%S')", "def _get_timestamp():\n return str(int(time.time()))", "def _get_timestamp() -> str:\n\n dt = timezone(\"UTC\").localize(datetime.utcnow()).strftime(\"%b. %d, %Y#%H:%M UTC\")\n date, time = dt.split(\"#\")\n ...
[ "0.7789721", "0.7708999", "0.7569324", "0.75247693", "0.7492911", "0.7475871", "0.74352854", "0.7311915", "0.7289902", "0.7261527", "0.72393423", "0.72393423", "0.72045416", "0.7202777", "0.71884894", "0.7179104", "0.71713656", "0.71064085", "0.7097272", "0.7083421", "0.70767...
0.7502949
4
Return the MAC address of the default interface. Platformspecific hack for Linux per
def _get_mac_address(): if not sys.platform.startswith('linux'): raise RuntimeError( 'Cannot get the MAC address on non-Linux platforms' ) ifname = get_default_iface_name_linux() s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) info = fcntl.ioc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address():\n eth0_interface = 'eth0'\n addresses = netifaces.ifaddresses(eth0_interface)[netifaces.AF_LINK][0]\n mac_address = addresses['addr']\n return mac_address", "def getMac(self):\n # Import netifaces here to prevent error importing this module in setup.py\n import ne...
[ "0.8076195", "0.8065709", "0.8045768", "0.78374714", "0.78374714", "0.77098304", "0.76101416", "0.74770516", "0.7271252", "0.71261764", "0.70321023", "0.70158494", "0.70158494", "0.7015012", "0.6997866", "0.69784534", "0.6974591", "0.6931664", "0.6882667", "0.6875614", "0.685...
0.8543561
0
Get padding and out padding for deconv layers.
def _get_deconv_pad_outpad(deconv_kernel): if deconv_kernel == 4: padding = 1 output_padding = 0 elif deconv_kernel == 3: padding = 1 output_padding = 1 elif deconv_kernel == 2: padding = 0 output_padding = 0 else: raise ValueError(f"Not supported ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_deconv_cfg(self, deconv_kernel):\n if deconv_kernel == 4:\n padding = 1\n output_padding = 0\n elif deconv_kernel == 3:\n padding = 1\n output_padding = 1\n elif deconv_kernel == 2:\n padding = 0\n output_padding = 0\n ...
[ "0.78015393", "0.74816775", "0.7480797", "0.7480797", "0.7480797", "0.7480797", "0.7480797", "0.7210895", "0.69440395", "0.6634688", "0.6626668", "0.6540815", "0.65065384", "0.6496972", "0.637711", "0.6264684", "0.61886394", "0.61839074", "0.61690956", "0.60535216", "0.597913...
0.76353306
1
Return the number of publishers on a given topic. `topic_name` may be a relative, private, or fully qualifed topic name. A relative or private topic is expanded using this node's namespace and name. The queried topic name is not remapped.
def count_publishers(self, topic_name): return self._count_publishers_or_subscribers(topic_name, _rclpy.rclpy_count_publishers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_subscribers(self, topic_name):\n return self._count_publishers_or_subscribers(topic_name, _rclpy.rclpy_count_subscribers)", "def get_total_partitions_for_topic(self, topic):\n return len(self.client.cluster.partitions_for_topic(topic))", "def topic_count():\n # get the number topics ...
[ "0.73476803", "0.6390559", "0.5956282", "0.5552248", "0.55169606", "0.5452071", "0.53669447", "0.5326968", "0.5271389", "0.52647334", "0.50830483", "0.4969086", "0.49304906", "0.49007905", "0.4855666", "0.48467386", "0.47765368", "0.47557527", "0.47360197", "0.47356427", "0.4...
0.8178514
0
Return the number of subscribers on a given topic. `topic_name` may be a relative, private, or fully qualifed topic name. A relative or private topic is expanded using this node's namespace and name. The queried topic name is not remapped.
def count_subscribers(self, topic_name): return self._count_publishers_or_subscribers(topic_name, _rclpy.rclpy_count_subscribers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_publishers(self, topic_name):\n return self._count_publishers_or_subscribers(topic_name, _rclpy.rclpy_count_publishers)", "def get_subscriptions(self, topic_name):\r\n resp = self._make_request('get',\r\n 'topics/%s/subscriptions' % topic_name)\r\n ...
[ "0.74618065", "0.64858437", "0.5836567", "0.56168777", "0.5537765", "0.5465071", "0.5459392", "0.54025996", "0.52928007", "0.5251367", "0.5238064", "0.52199054", "0.5174787", "0.51182085", "0.5116878", "0.50683266", "0.50647384", "0.50384855", "0.5021121", "0.49982363", "0.49...
0.80566245
0
Unicode representation of ProductImage.
def __str__(self): return f'{self.product.title} - Color {self.product.color}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image_as_unicode(image_file, **kwargs):\n char_set = kwargs['char_set']\n x256_mode = kwargs['x256']\n height = 20 # height of unicode character\n width = 10 # width of the unicode characters we are using\n # Credit ElTero and ABM (https://stackoverflow.com/a/7051075)\n if image_file ==...
[ "0.6025282", "0.59525174", "0.59301233", "0.58355874", "0.5823471", "0.5746074", "0.57269967", "0.57226336", "0.5686665", "0.5661257", "0.56381625", "0.5606962", "0.5586364", "0.55677336", "0.55675006", "0.55636615", "0.5533607", "0.5518763", "0.55176735", "0.5501053", "0.550...
0.0
-1
Sets the reg_id of this AttachmentViewModel.
def reg_id(self, reg_id): self._reg_id = reg_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_id(self, registration_id):\n\n self._registration_id = registration_id", "def registration_tid(self, registration_tid):\n\n self._registration_tid = registration_tid", "def set_regID():\n if not request.json or not 'regID' in request.json or not 'id' in request.json:\n ...
[ "0.6523132", "0.6015378", "0.575837", "0.5464582", "0.5390868", "0.5271694", "0.5264238", "0.5261741", "0.52247727", "0.52247727", "0.5173646", "0.51274043", "0.51070744", "0.5075839", "0.5070825", "0.5049064", "0.5049064", "0.5049064", "0.5049064", "0.5049064", "0.5049064", ...
0.765568
0
Sets the picture_id of this AttachmentViewModel.
def picture_id(self, picture_id): self._picture_id = picture_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_id(self, image_id):\n\n self._image_id = image_id", "def image_id(self, image_id):\n\n self._image_id = image_id", "def image_id(self, image_id):\n if image_id is None:\n raise ValueError(\"Invalid value for `image_id`, must not be `None`\") # noqa: E501\n\n se...
[ "0.67307395", "0.67307395", "0.604427", "0.597608", "0.5769138", "0.56159526", "0.55635685", "0.55197793", "0.53957415", "0.5338598", "0.5192693", "0.5186238", "0.51631904", "0.5058312", "0.5040226", "0.5020933", "0.4985115", "0.49697262", "0.49579874", "0.49571392", "0.49186...
0.7987821
0
Sets the photographer of this AttachmentViewModel.
def photographer(self, photographer): self._photographer = photographer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pathogen_morphology(self, pathogen_morphology):\n\n self._pathogen_morphology = pathogen_morphology", "def mother(self, mother):\n\n self.logger.debug(\"In 'mother' setter.\")\n\n self._mother = mother", "def photos(self, photos):\n\n self._photos = photos", "def attacher(self...
[ "0.55737853", "0.49111912", "0.48010647", "0.4714482", "0.45989436", "0.45147127", "0.45114234", "0.44495958", "0.43712753", "0.43663102", "0.43161353", "0.43023735", "0.42809683", "0.4270284", "0.42601532", "0.42583272", "0.423015", "0.4226989", "0.41979557", "0.41914412", "...
0.8057541
0
Sets the geo_hazard_name of this AttachmentViewModel.
def geo_hazard_name(self, geo_hazard_name): self._geo_hazard_name = geo_hazard_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geo_hazard_tid(self, geo_hazard_tid):\n\n self._geo_hazard_tid = geo_hazard_tid", "def geo_hazard_tid(self, geo_hazard_tid):\n\n self._geo_hazard_tid = geo_hazard_tid", "def trigger_name(self, trigger_name: \"str\"):\n self._attrs[\"triggerName\"] = trigger_name", "def land_slide_tri...
[ "0.63634187", "0.63634187", "0.626276", "0.5714656", "0.55655044", "0.55584437", "0.544792", "0.5383463", "0.5328067", "0.5297784", "0.5274341", "0.527407", "0.527407", "0.5270802", "0.5270802", "0.5265966", "0.5255302", "0.5254347", "0.5254258", "0.5249294", "0.5247349", "...
0.87623584
0
Sets the registration_tid of this AttachmentViewModel.
def registration_tid(self, registration_tid): self._registration_tid = registration_tid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_id(self, registration_id):\n\n self._registration_id = registration_id", "def set_tid(self, tid):\n self.__tid = tid", "def registration_number(self, registration_number):\n\n self._registration_number = registration_number", "def guid(self, guid):\n self._guid = ...
[ "0.6504463", "0.5935002", "0.56884325", "0.5423006", "0.5363919", "0.53467065", "0.53467065", "0.53467065", "0.5211674", "0.5161539", "0.5161539", "0.5161539", "0.5161539", "0.51089466", "0.5069953", "0.50696445", "0.5059008", "0.49867812", "0.49268264", "0.49058896", "0.4904...
0.80538756
0
Sets the registration_name of this AttachmentViewModel.
def registration_name(self, registration_name): self._registration_name = registration_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self, name):\n self._name = name", "def name(self, name):\n self._name = name", "def name(self, name):\n self._name = name", "def name(self, name):\n self._name = name", "def name(self, name):\n self._name = name", "def name(self, name):\n self._name = n...
[ "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60173804", "0.60098237", "0.5997677", "0.59962857", "0.59962857", "0.59962857", "0.59962857", "0.5991271", "0.5991271", ...
0.78067887
0
Sets the is_main_attachment of this AttachmentViewModel.
def is_main_attachment(self, is_main_attachment): self._is_main_attachment = is_main_attachment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_main_controller(is_main):\n # If the properties file does not exist, create it first.\n if not os.path.exists(FILE_PROPERTIES):\n open(FILE_PROPERTIES, \"x\").close()\n\n # Read the file contents and parse the JSON.\n f = open(FILE_PROPERTIES, \"r\")\n try:\n data = json.loads(...
[ "0.5437872", "0.54004514", "0.52261674", "0.51949036", "0.5187433", "0.5119293", "0.51087487", "0.5040282", "0.4755697", "0.4724633", "0.4722109", "0.47153226", "0.46702316", "0.4653628", "0.46515274", "0.45999354", "0.45999354", "0.4573638", "0.45614552", "0.4529129", "0.452...
0.88589025
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AttachmentViewModel): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Generate a random string of stringLength
def randomString(stringLength=8): return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))", "def random_string(le...
[ "0.86925906", "0.85734475", "0.84746855", "0.8443599", "0.843952", "0.84287953", "0.8417807", "0.84153235", "0.84066963", "0.840435", "0.84028375", "0.8392971", "0.8386087", "0.83850694", "0.83840364", "0.8364928", "0.8349178", "0.8348809", "0.8345499", "0.8329673", "0.832430...
0.8211052
34
Collection of options that are allowed for a specific property.
def options(self) -> Union[object, Sequence]: return self._options
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options(self):\n pclass_options = self.get_product_class().options.all()\n return pclass_options | self.product_options.all()", "def options(self):\n return list(self._moptions.keys())", "def getOptions(self, propertyListName: unicode) -> ghidra.framework.options.Options:\n ..."...
[ "0.6242525", "0.6212377", "0.6205646", "0.61794347", "0.617692", "0.61510175", "0.6101245", "0.6053434", "0.60511816", "0.59264433", "0.589645", "0.58952796", "0.5883731", "0.58265036", "0.57641643", "0.5742871", "0.57256293", "0.57115996", "0.568958", "0.568504", "0.56811434...
0.5564841
25
Add item to end of stack.
def push(self, item): self._list.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, item):\r\n self.stack.append(item)", "def push(self, item):\n self.stack.append(item)", "def push(self, item):\n self.stack.append(item)", "def push(self, item):\r\n self.stack.insert(0, item)", "def push(self, item):\n\n self._stack.append(item)", "def...
[ "0.8617164", "0.84178674", "0.84178674", "0.8400367", "0.8213554", "0.8037595", "0.8036368", "0.79968196", "0.7918985", "0.7892842", "0.7885461", "0.77812266", "0.77094644", "0.7647425", "0.7624902", "0.7624902", "0.7624902", "0.7624902", "0.7624902", "0.76033556", "0.7603019...
0.73176414
38
r"""Take a single view dataset and split it into multiple views.
def inverse_transform(self, X): pass # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datasplits(self, view=None):\n\t\tdf = pd.read_csv(self.splitsFile, index_col='d3mIndex')\n\t\t\n\t\tif view is None:\n\t\t\treturn df\n\t\telif view.upper() == 'TRAIN':\n\t\t\tdf = df[df['type']=='TRAIN']\n\t\t\treturn df\n\t\telif view.upper() == 'TEST':\n\t\t\tdf = df[df['type']=='TEST']\n\t\t\treturn d...
[ "0.65484107", "0.6540357", "0.6141009", "0.60056204", "0.5775292", "0.57197875", "0.5670629", "0.56295514", "0.5619426", "0.5580253", "0.55065316", "0.5441773", "0.53670347", "0.5363159", "0.53577036", "0.53539145", "0.5341736", "0.5321063", "0.5316874", "0.5315638", "0.53136...
0.0
-1
r"""Take a single view dataset and split it into multiple views. The input dimension must match the fitted dimension of the multiview dataset.
def inverse_transform(self, X): check_is_fitted(self) n_feature = X.shape[1] if n_feature != self.n_total_features_: raise ValueError( "The number of features in the input array ({}) does not match" " the total number of features in the multiview datas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __splitView(self):\n self.addSplit()", "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_test_and_train_data(self, test_...
[ "0.61281", "0.60384375", "0.6011891", "0.59815747", "0.5902314", "0.5897515", "0.58491033", "0.58137226", "0.5764436", "0.57559013", "0.5673649", "0.5663032", "0.56512034", "0.56171703", "0.56047", "0.5518049", "0.54144454", "0.5402312", "0.5400078", "0.53878117", "0.53835684...
0.0
-1
Constructor for the EmailSettingsSample object. Takes an email, password and an app id corresponding to a google apps admin account to demo the Email Settings API.
def __init__(self, domain, email, password, app): self.client = EmailSettingsClient(domain=domain) self.client.ClientLogin(email=email, password=password, source=app)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, email, private_key, refresh_token=None,\n feed=None, client=None):\n self.adapters = {}\n self.email = email\n self.refresh_token = refresh_token\n self.private_key = private_key\n self.feed = feed\n self.client = client", "def __init__...
[ "0.6125843", "0.6063301", "0.60597956", "0.58747786", "0.5871965", "0.5835401", "0.57823735", "0.57516176", "0.57399696", "0.5736076", "0.5729424", "0.57175773", "0.5671739", "0.5661746", "0.56279176", "0.5615302", "0.5575449", "0.55207294", "0.55168694", "0.5511044", "0.5504...
0.7435816
0
Computation pipeline based on a encoder + emotion classifier.
def compute_forward(self, batch, stage): batch = batch.to(self.device) wavs, lens = batch.sig # Feature extraction and normalization feats = self.modules.compute_features(wavs) feats = self.modules.mean_var_norm(feats, lens) # Embeddings + speaker classifier emb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_pipeline():\n # exchange = Fundamentals.exchange_id.latest\n # nyse_filter = exchange.eq('NYS')\n symbol_filter = StaticSids([TRADING_SID])\n set_benchmark(TRADING_SID) \n # volume_filter = VolumeFilter(\n # inputs=[USEquityPricing.volume],\n # window_length=1,\n # mask=s...
[ "0.6151563", "0.6076978", "0.60287476", "0.6008339", "0.59602565", "0.59006834", "0.58996844", "0.5843488", "0.578489", "0.57457525", "0.5732154", "0.57270837", "0.5723349", "0.57033813", "0.5699445", "0.56970775", "0.567495", "0.56680554", "0.5655927", "0.5636237", "0.563019...
0.5307159
90
return jenks configuration file
def get_configuration_file(): path = os.path.abspath(os.curdir) while path != os.sep: config_path = os.path.join(path, CONFIG_FILE_NAME) if os.path.exists(config_path): return config_path path = os.path.dirname(path) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_file(self):\n return self[CONFIG_FILE_KEY]", "def config_file(self):\n return join_path(self.prefix.etc.bohrium, \"config.ini\")", "def get_kube_config_file_path(self):\n return self._kube_config", "def getConfig():\n filepath = confighome+\"config\"\n with open(filepath...
[ "0.68726814", "0.68500286", "0.6820392", "0.66428393", "0.65919834", "0.6558856", "0.65458685", "0.65399057", "0.65298325", "0.65003353", "0.6479525", "0.6474058", "0.64501226", "0.63529766", "0.6322193", "0.6300796", "0.62968624", "0.62951607", "0.62798166", "0.6241388", "0....
0.5924413
45
Creates the self and global components. Self is a matrix of probability distributions (one for each user) and global is vector, that is the probability distribution of the entire population. Self is essentially the rows of the training data, normalized to sum to 1, after adding some smoothing.
def get_train_global(train, val, test, is_eval=False): r, c = get_max_row_column(train, val, test) smooth_factor = 1. / c if is_eval: train = np.vstack((train, val)) train_matrix = csr_matrix(_make_train(train, smooth_factor)) glb_matrix = csr_matrix(_make_global(train_matrix, smooth_factor)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_other_vars(self):\n self.endIndexOfClassConditionalProbability = self.numOfGridsIn1D \\\n * self.numOfGridsIn1D * self.numOfClasses\n self.endIndexOfObjectProbability \\\n = self.endIndexOfClassConditionalProbability \\\n + self.nu...
[ "0.6079281", "0.6070321", "0.59109205", "0.58092386", "0.5717721", "0.5695477", "0.56727225", "0.5653412", "0.5638205", "0.5620746", "0.56021786", "0.55986905", "0.5573674", "0.5558025", "0.5552711", "0.5544971", "0.55136496", "0.5511706", "0.5497658", "0.5494264", "0.5476132...
0.0
-1
Initialize the weights of Convolution2D and BatchNorm2D with normal.
def weights_init_normal(m): if isinstance(m, nn.Conv2d): m.weight.data.normal_(0.0, 0.02) elif isinstance(m, nn.BatchNorm2d): m.weight.data.normal_(1.0, 0.02) m.bias.data.fill_(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n for m in self.cls_convs:\n normal_init(m.conv, std=0.01)\n for m in self.reg_convs:\n normal_init(m.conv, std=0.01)\n bias_cls = bias_init_with_prob(0.01)\n normal_init(self.retina_cls, std=0.01, bias=bias_cls)\n normal_init(self.re...
[ "0.7976904", "0.7765352", "0.7706577", "0.76230925", "0.7612297", "0.7437348", "0.7425489", "0.7368854", "0.7261255", "0.7261255", "0.70941347", "0.70114374", "0.6989831", "0.6984422", "0.6981498", "0.6978294", "0.6978294", "0.6978294", "0.6964283", "0.6958896", "0.6957243", ...
0.7415096
7
Calculate the true positive, true negative, false positive and false negative ratios. Only a binary mask is considered zero and nonzero
def calc_pred_stats(gt, pred): t = pred == (gt != 0) f = ~t n = float(gt.numel()) tp = torch.sum(pred[t]) / n tn = torch.sum(t) / n - tp fp = torch.sum(pred[f]) / n fn = torch.sum(f) / n - fp return tp, tn, fp, fn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_evaluation(annotation_mask, result_mask, idx):\n\n true_positive = np.sum(np.logical_and(annotation_mask == 255, result_mask == 255)) \n false_positive = np.sum(np.logical_and(result_mask == 255, annotation_mask != result_mask))\n false_negative = np.sum(np.logical_and(annotation_mask == 255,...
[ "0.650884", "0.6118591", "0.6086604", "0.60788125", "0.57446456", "0.5701512", "0.56907797", "0.56736296", "0.56639135", "0.56230164", "0.56180304", "0.56076044", "0.5573995", "0.55338037", "0.5530362", "0.55251527", "0.54982984", "0.54792", "0.54779714", "0.54730976", "0.544...
0.0
-1
Get the recall for specific label or avalanche certainty only
def recall_for_label(gt, pred, label): mask = gt == label masked_pred = pred[mask] n = float(masked_pred.numel()) tp = torch.sum(masked_pred == 1) return tp / n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(prediction, ground_truth):\n return precision_recall_f1(prediction, ground_truth)[1]", "def show_recall(self):\r\n return round((recall_score(self.actual, self.predicted)*100),2)", "def recall(self, option='average'):\n\t\tif option == 'classwise':\treturn self.class_recall_\n\t\telif opti...
[ "0.70314246", "0.6760457", "0.6602591", "0.6599917", "0.65377766", "0.65101206", "0.649898", "0.64902014", "0.64599717", "0.64528483", "0.64167106", "0.6372914", "0.6331544", "0.6244571", "0.6200351", "0.6150671", "0.6123118", "0.6112943", "0.61094767", "0.60813296", "0.60790...
0.65624356
4
Takes a torch tensor of shape BxCxHxW and crops by border pixels in the spatial dimensions
def crop_to_center(tensor, border=50): return tensor[:, :, border:-border, border:-border]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_border(imgs, crop_border):\n if crop_border == 0:\n return imgs\n else:\n if isinstance(imgs, list):\n return [v[crop_border:-crop_border, crop_border:-crop_border, ...] for v in imgs]\n else:\n return imgs[crop_border:-crop_border, crop_border:-crop_border...
[ "0.64218587", "0.63688177", "0.6275371", "0.62342787", "0.61113167", "0.6034517", "0.5995558", "0.5994732", "0.59880173", "0.59177023", "0.5892089", "0.58792394", "0.5867771", "0.5842663", "0.5838215", "0.5823392", "0.5811195", "0.5779398", "0.5769167", "0.57649446", "0.57416...
0.6872003
0
read an arrow file from disk as cuxfilter.DataFrame
def from_arrow(cls, dataframe_location): if isinstance(dataframe_location, str): df = cudf.DataFrame.from_arrow(read_arrow(dataframe_location)) else: df = cudf.DataFrame.from_arrow(dataframe_location) return cls(df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_file(self):\n\n self.df = self.sqlContext.read.csv(self.source, sep=self.sep, header=True, inferSchema=True)", "def load() -> DataFrame:\n return load_file(__file__, \"default.csv.gz\")", "def read_data(filepath):\n df = pd.read_csv(filepath)\n return df", "def read_data(file...
[ "0.62870735", "0.6285025", "0.61814964", "0.61814964", "0.61814964", "0.60843694", "0.6063316", "0.60483366", "0.60481346", "0.6045804", "0.6042656", "0.6037168", "0.6018507", "0.59801924", "0.5947044", "0.59286124", "0.59248435", "0.5893717", "0.5871253", "0.5842906", "0.583...
0.0
-1
return the cell with minimum f_score from open cells
def minimum_f_cell(self): return sorted(self.open_cells,key = lambda cell: cell.f)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_score(self):\n return min(self._extract_set('score') or [0])", "def node_with_min_fscore(open_set, f_cost): # open_set is a set (of cell) and f_cost is a dict (with cells as keys)\n f_cost_open = dict([a for a in f_cost.items() if a[0] in open_set])\n return min(f_cost_open, key=f_cost_open....
[ "0.71012366", "0.701438", "0.701438", "0.68588877", "0.663567", "0.6630316", "0.6630316", "0.6589216", "0.6501682", "0.6465526", "0.64638966", "0.63998306", "0.63667846", "0.6299849", "0.62363106", "0.6224894", "0.6213931", "0.61984265", "0.61663485", "0.61574626", "0.6157077...
0.8075693
0
Compute the discounted reward for a batch of data. reward, value, and discount are all shape [horizon 1, batch, 1] (last element is cut off) Bootstrap is [batch, 1]
def compute_return(reward: th.Tensor, value: th.Tensor, discount: th.Tensor, bootstrap: th.Tensor, lambda_: float): next_values = th.cat([value[1:], bootstrap[None]], 0) target = reward + discount * next_values * (1 - lambda_) times...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discounted_reward(self, discount):\n\n tl = len(self)\n return (1 - discount) * np.sum(discount ** np.arange(tl) * self.rewards)", "def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \...
[ "0.6907771", "0.65610665", "0.6544231", "0.64829147", "0.6421873", "0.6185052", "0.6184409", "0.6167062", "0.61610484", "0.61480516", "0.6147162", "0.6146092", "0.6121334", "0.6115139", "0.61095023", "0.60967433", "0.60859716", "0.60778403", "0.60237706", "0.601486", "0.59936...
0.6947871
0
String for representing the Model object.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
String for representing the Model object.
def __str__(self): return self.nickname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Convert given time into seconds
def get_sec(time): m, s = time[-4:-2], time[-2:] if time[-4:2] == '' : m = 0 if time[-2:] == '' : s = 0 return int(m) * 60 + int(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_seconds(time):\n return 3600 * time", "def time_to_int(time):\n minutes = time.hour * 60 + time.minute\n seconds = minutes * 60 + time.second\n return seconds", "def string_time_to_second(time):\n time_split = time.split(':')\n hour = int(time_split[0])\n min...
[ "0.8537402", "0.7818949", "0.7668338", "0.7579564", "0.75568086", "0.7500476", "0.74179965", "0.7350185", "0.73016363", "0.7252342", "0.7242871", "0.7165478", "0.71569246", "0.7092923", "0.70715237", "0.70549816", "0.69871014", "0.6968615", "0.69579184", "0.69352514", "0.6928...
0.7343156
8
Convert a given board into many onehot encoded vectors for each position on the board
def get_board_positions_pieces_OHE(board): information = str(board).replace("\n", " ") one_hot_encoded_board_positions = np.zeros(shape = (8,8,12)) x = 0 y = 0 for piece in information: if(piece == " "): continue one_hot_encoded_board_positions[y, x, :] = get_piece_OHE(pi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def encode_one_hot(s):\n all = []\n for c in s:\n x = np.zeros((INPUT_VOCAB_SIZE)) \n index = char_indic...
[ "0.7204259", "0.7146975", "0.7110916", "0.69924283", "0.698124", "0.6953453", "0.68940675", "0.67805755", "0.67777807", "0.6676537", "0.66121763", "0.65840894", "0.65519315", "0.6542645", "0.6541865", "0.6515476", "0.6513955", "0.65102726", "0.6502783", "0.64924246", "0.64738...
0.62903535
48
Read in pgn files as numpy arrays.
def read_pgn(filepath, maxGames = 100000, timecontrol = 300, type = "Lichess Standard"): # import pgn file pgn_file = open(filepath) # read all games from pgn_file all_games = import_multiple_games(pgn_file, maxGames = maxGames) # create lists for saving variables board_maps = [] t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_npy_file(filename):\n np_arr = np.load(filename)\n return np_arr", "def read_file(self,file_name):\r\n data = np.genfromtxt(file_name)\r\n return data;", "def load_data(file_to_read):\n\n data = np.recfromtxt(file_to_read)\n data = np.asarray(data)\n\n return data", "def...
[ "0.7176929", "0.66945636", "0.66931856", "0.6684813", "0.66607994", "0.662475", "0.66039217", "0.65459985", "0.6544069", "0.65379864", "0.65302354", "0.6483311", "0.64821357", "0.6479137", "0.64659876", "0.6461799", "0.6428993", "0.6424379", "0.6394051", "0.6352607", "0.63401...
0.0
-1
Returns the data dictionary for the torrent.
def data(self): if self._data: return self._data else: raise exceptions.TorrentNotGeneratedException
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getData(self):\n return dict(self._dump_data)", "def data(self) -> dict[str, Any]:\n raise NotImplementedError()", "def get_data(self) -> dict:\n\n data = {\n 'title': self.get_title(),\n 'link' : self.get_link(),\n 'store': self.get_store_name()\n }...
[ "0.71905684", "0.6911929", "0.6852552", "0.68070734", "0.67941827", "0.67941827", "0.6750308", "0.6729866", "0.6664181", "0.66370493", "0.66336566", "0.65980446", "0.6592327", "0.64179623", "0.64173204", "0.6380297", "0.63329786", "0.62949944", "0.62420464", "0.6236113", "0.6...
0.6939043
1
Initializes and tie weights if needed.
def init_weights(self): # Initialize weights self.apply(self._init_weights) # Tie weights if needed self.tie_weights()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights_(self):\n raise NotImplementedError", "def init_weight(self):\n init_bn(self.norm0)", "def setWeightInitializer(self,weights):\n ...
[ "0.8227321", "0.8045011", "0.7986906", "0.76697594", "0.76092225", "0.7489868", "0.74560624", "0.7443789", "0.7420978", "0.73176545", "0.7313504", "0.73104966", "0.72690845", "0.7233648", "0.7220441", "0.7210592", "0.72080487", "0.71652585", "0.71536386", "0.7092526", "0.7088...
0.86048186
0
Return absolute path relative to this file.
def get_path_to(self, *args): return os.path.abspath(os.path.join(os.path.dirname(__file__), *args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_physical_path(self) -> str:\n return self._path", "def full_path(self):\n return os.path.abspath(self.path)", "def absolute(self):\n if self.relative == '':\n return self.root # don't join in this case as that appends trailing '/'\n return os.path.join(self....
[ "0.82320285", "0.8011656", "0.8003671", "0.7928333", "0.7849155", "0.77982527", "0.77763045", "0.77440715", "0.7694889", "0.7652381", "0.76253605", "0.76253605", "0.76253605", "0.76253605", "0.76253605", "0.7616306", "0.7609166", "0.7593681", "0.75501186", "0.75297886", "0.74...
0.6899035
75
Build command line argument list for running ansibleplaybook, optionally using sshagent for public/private key authentication.
def build_args(self, job, private_data_dir, passwords): creds = job.machine_credential ssh_username, become_username, become_method = '', '', '' if creds: ssh_username = creds.get_input('username', default='') become_method = creds.get_input('become_method', default='') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_args(self, ad_hoc_command, private_data_dir, passwords):\n creds = ad_hoc_command.credential\n ssh_username, become_username, become_method = '', '', ''\n if creds:\n ssh_username = creds.get_input('username', default='')\n become_method = creds.get_input('becom...
[ "0.7224383", "0.6457395", "0.6417497", "0.610729", "0.6095293", "0.6046027", "0.6007417", "0.6000504", "0.5994628", "0.5967205", "0.59651315", "0.5960397", "0.59461427", "0.5922495", "0.58986247", "0.58935344", "0.5889287", "0.58890074", "0.58791995", "0.586997", "0.58459544"...
0.67797923
1
Build command line argument list for running ansibleplaybook, optionally using sshagent for public/private key authentication.
def build_args(self, project_update, private_data_dir, passwords): args = [] if getattr(settings, 'PROJECT_UPDATE_VVV', False): args.append('-vvv') if project_update.job_tags: args.extend(['-t', project_update.job_tags]) return args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_args(self, ad_hoc_command, private_data_dir, passwords):\n creds = ad_hoc_command.credential\n ssh_username, become_username, become_method = '', '', ''\n if creds:\n ssh_username = creds.get_input('username', default='')\n become_method = creds.get_input('becom...
[ "0.7223298", "0.67804986", "0.64566386", "0.6419229", "0.61107004", "0.60923404", "0.60045815", "0.60006285", "0.5993651", "0.5965917", "0.5964988", "0.5957174", "0.59459865", "0.5920196", "0.5894896", "0.5893464", "0.5888387", "0.588718", "0.5879304", "0.58677304", "0.584279...
0.6044322
6
Return private data needed for inventory update. Returns a dict of the form {
def build_private_data(self, inventory_update, private_data_dir): if inventory_update.source in InventorySource.injectors: injector = InventorySource.injectors[inventory_update.source]() return injector.build_private_data(inventory_update, private_data_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(self):\n return {\"data\": self.data.dict(), \"inventory\": self.inventory.dict()}", "def return_as_dictionary(self):\n item = Inventory.return_as_dictionary(self)\n item['Brand'] = self.brand\n item['Voltage'] = self.voltage\n return item", "def return_as_dictionary...
[ "0.7707523", "0.70861936", "0.70596814", "0.6866257", "0.6856666", "0.68244636", "0.6626564", "0.65547276", "0.6325076", "0.6291212", "0.6250423", "0.6249767", "0.62026376", "0.61874783", "0.6133226", "0.6117816", "0.6089917", "0.60667646", "0.6065576", "0.60608584", "0.60356...
0.65157926
8
Build command line argument list for running ansible, optionally using sshagent for public/private key authentication.
def build_args(self, ad_hoc_command, private_data_dir, passwords): creds = ad_hoc_command.credential ssh_username, become_username, become_method = '', '', '' if creds: ssh_username = creds.get_input('username', default='') become_method = creds.get_input('become_method',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_args(self, job, private_data_dir, passwords):\n creds = job.machine_credential\n\n ssh_username, become_username, become_method = '', '', ''\n if creds:\n ssh_username = creds.get_input('username', default='')\n become_method = creds.get_input('become_method', d...
[ "0.6774776", "0.6553633", "0.65022385", "0.6144694", "0.61194015", "0.60842276", "0.607607", "0.602129", "0.6010651", "0.5997569", "0.59881717", "0.59745854", "0.59689087", "0.5955851", "0.5933324", "0.59283304", "0.5902776", "0.58957416", "0.5887024", "0.58835477", "0.587284...
0.7301881
0
Change dict to dataframe
def dict_to_DataFrame(data): return pd.DataFrame.from_dict(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_dict_to_df(self, dict):\n\t\treturn pd.concat(dict.values(), axis=1)", "def to_dataframe(self, data_dict):\n return pd.DataFrame.from_dict(data_dict, orient='index')", "def convert_measuerment_dict_to_DataFrame(measurement_dict):\n df = pd.DataFrame.from_dict(measurement_dict, orient='ind...
[ "0.7878239", "0.7803382", "0.77804554", "0.7761469", "0.7597851", "0.75740963", "0.75558746", "0.7321931", "0.7303326", "0.72096354", "0.7103137", "0.6910475", "0.68261313", "0.6781579", "0.6765897", "0.6759807", "0.67590094", "0.6758431", "0.6729074", "0.67287093", "0.668857...
0.815136
0
Parse the requirements file and generate a requirements list.
def requires(): install_reqs = parse_requirements(join(CWD, 'requirements', 'base.txt'), session=False) return [str(ir.req) for ir in install_reqs]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements_txt():\n root = os.path.dirname(os.path.abspath(__file__))\n\n requirements = []\n dependencies = []\n\n with open(os.path.join(root, 'requirements.txt'), 'r') as f:\n for line in f.readlines():\n line = line.rstrip()\n if not line or line.startswith(...
[ "0.7541879", "0.7441446", "0.7433949", "0.7422065", "0.736894", "0.73661757", "0.73356616", "0.7276237", "0.7165952", "0.7158944", "0.71030784", "0.7063986", "0.70134634", "0.7011347", "0.6969856", "0.6946507", "0.6944478", "0.69370407", "0.6887447", "0.6861928", "0.6857336",...
0.60182375
66
Letter from number position on alphabet.
def letter_num(num: int): if abs(num) > 26 or num == 0: let = ord('a') + 26 - 1 else: let = ord('a') + abs(num) - 1 return chr(let)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_alphabet(number):\n return chr(number + 96)", "def get_alphabet(number):\n return chr(number + 96)", "def letter_code(letter):\n value = ord(letter.lower()) - ord('a') + 10\n return value + value // 11", "def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A", "def let...
[ "0.8121449", "0.8121449", "0.8002449", "0.795019", "0.795019", "0.79070413", "0.79070413", "0.7844844", "0.7706609", "0.7661966", "0.764664", "0.74979883", "0.7428942", "0.7414222", "0.737544", "0.72239643", "0.7197244", "0.7153131", "0.71479833", "0.713399", "0.70821875", ...
0.8129342
0
Determines the existence of a triangle and its type.
def exsist_triangle(a: int, b: int, c: int): if a + b > c and a + c > b and b + c > a: print('Триугольник существует') if a == b == c: print('Триугольник равносторонний') elif a == b or a == c or b == c: print('Триугольник равнобедренный') else: pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify_triangle(x,y,z):\n\n if x > 0 and y > 0 and z > 0 : #if any of length is zero then false\n\n if x == y and x == z and y==z :\n return 'equilateral'\n \n elif x == y and x != z and y != z :\n return 'isoscels'\n \n elif x != y and x != z and y...
[ "0.6924511", "0.67670095", "0.6645036", "0.663136", "0.65511346", "0.64432466", "0.6426845", "0.6417205", "0.63622016", "0.63501287", "0.6325353", "0.63036644", "0.63032264", "0.62927425", "0.62727374", "0.6267121", "0.62669677", "0.62657875", "0.6265345", "0.6259769", "0.618...
0.5612531
48
Returns the filename of an example FASTA file with DOS line endings
def getDosFormattedFasta(): return _getAbsPath('barcodes-ed65-450.fasta')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_filename(prefix, suffix, seq_len, uncased):\n seq_str = \"seq-{}\".format(seq_len)\n if uncased:\n case_str = \"uncased\"\n else:\n case_str = \"cased\"\n\n file_name = \"{}.{}.{}.{}\".format(prefix, seq_str, case_str, suffix)\n\n return file_name", "def fastaRenameRemoveNewlines(filename, ...
[ "0.58929396", "0.58524936", "0.5828511", "0.5777155", "0.57519245", "0.5663198", "0.56470215", "0.5640949", "0.5606232", "0.55877906", "0.557865", "0.5571862", "0.5570751", "0.5542712", "0.54881424", "0.54868406", "0.5462561", "0.5455307", "0.5454465", "0.5447287", "0.5400683...
0.67360175
0
Whether we can ingest images from this provider.
def enabled(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_images(self):\n return len(self.images) > 0", "def hasImages(self):\n return len(self.getImages()) > 0", "def hasImages(self):\n return len(self.getImages()) > 0", "def create_image_allowed(self):\n return self._create_image_allowed", "def has_image(self):\n retur...
[ "0.7355688", "0.7155173", "0.7155173", "0.7025366", "0.69973564", "0.6919165", "0.685426", "0.68231755", "0.67908454", "0.6682904", "0.659401", "0.65397656", "0.65102494", "0.6497241", "0.6497241", "0.6488279", "0.6484416", "0.6484416", "0.64373523", "0.64204943", "0.64031196...
0.0
-1
Returns lowerLimit of first element
def lowerLimit(self): if len(self.elements) > 0: return self.elements[0].lowerLimit else: raise KeyError('No elements in Computation object')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_min(self):\n return self.get_first()", "def min(self):\n return self.get_first()", "def min():\n return KeeperOfMinOrMax(int.__gt__)", "def find_min(self):\n return self.min", "def find_min(self):\n return self.min", "def minimum(self):\n return min(self...
[ "0.7316412", "0.7178489", "0.68751484", "0.6844093", "0.6844093", "0.68231964", "0.6786693", "0.67832243", "0.6758008", "0.6709427", "0.6709427", "0.66715294", "0.6655896", "0.66491675", "0.66305906", "0.66046894", "0.66041017", "0.65965027", "0.65590477", "0.65477914", "0.64...
0.7797041
0
test 2 street numbers if the second street number in the first suit of numbers.
def in_suit1(list, entry): text = list.replace("-", "") if ("-" not in entry) and (entry.isdigit() is True) and (text.isdigit() is True): list1 = list.split("-") x = int(list1[0]) suit = set() suit.add(x) while x < int(list1[len(list1) - 1]): x += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cross_street(street1, street2, city):\n if get_google_results(\"geocoding\", [street1, street2, city], return_response_fields=None):\n if \"intersection\" in get_google_results(\"geocoding\", [street1, street2, city], return_response_fields=None)[0][\n \"type\"]:\n return Tru...
[ "0.61335754", "0.5994295", "0.57982147", "0.5796614", "0.5776554", "0.577239", "0.5743518", "0.56935084", "0.56190383", "0.5556794", "0.5533563", "0.55294347", "0.5497245", "0.54913056", "0.54717803", "0.54515034", "0.5447432", "0.5444272", "0.54145133", "0.53839993", "0.5367...
0.5301174
26
Adds experiences to each agent's experience history.
def add_experiences( self, curr_all_info: AllBrainInfo, next_all_info: AllBrainInfo, take_action_outputs: ActionInfoOutputs, ) -> None: self.trainer_metrics.start_experience_collection_timer() if take_action_outputs: self.stats["Policy/Entropy"].append(tak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_experiences(\n self,\n curr_all_info: AllBrainInfo,\n next_all_info: AllBrainInfo,\n take_action_outputs: ActionInfoOutputs,\n ) -> None:\n raise UnityTrainerException(\n \"The process_experiences method was not implemented.\"\n )", "def add_experie...
[ "0.6780885", "0.6708535", "0.63891804", "0.6367637", "0.6343329", "0.6295685", "0.6218456", "0.61876434", "0.61502427", "0.6147631", "0.6035422", "0.60262704", "0.59708136", "0.59177655", "0.5908662", "0.5831165", "0.5742608", "0.57266676", "0.56935716", "0.56664", "0.5655005...
0.5889737
15
Computes discounted sum of future rewards for use in updating value estimate.
def discount_rewards(r, gamma=0.99, value_next=0.0): discounted_r = np.zeros_like(r) running_add = value_next for t in reversed(range(0, r.size)): running_add = running_add * gamma + r[t] discounted_r[t] = running_add return discounted_r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _discounted_cumsum(self, rewards, rate=None):\n # HINT1: note that each entry of the output should now be unique,\n # because the summation happens over [t, T] instead of [0, T]\n # HINT2: it is possible to write a vectorized solution, but a solution\n # using a for loop is also fin...
[ "0.7462175", "0.73983705", "0.71932304", "0.7150695", "0.70557845", "0.6931184", "0.68214566", "0.6785478", "0.6768839", "0.6743024", "0.6694214", "0.668374", "0.6677737", "0.666717", "0.6662684", "0.6659934", "0.66545933", "0.6653859", "0.6636681", "0.6625439", "0.6592249", ...
0.6381669
26
forward pass including input transformation and splitting, model prediction and loss calculation
def forward_pass(self, sample): inputs, targets = self._transform(sample) outputs = self.model(inputs) # cast outputs to float to avoid overflow in loss calculation float_template = pt.ones(1).float().cuda() if self.cuda else pt.ones(1).float() loss = self.criterion(self._cast(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_train(self, *args, **kwargs):\n pass", "def forward(self, x):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n\n x = self.pool1(F.relu(self.batch1(self.conv1(x))))\n x = self.pool2(F.relu(self.batch2(self.conv2(x))))\n x = F.relu(self.batch3a...
[ "0.7382235", "0.7301255", "0.7278421", "0.7190183", "0.7178049", "0.71772987", "0.7130936", "0.7115816", "0.71021324", "0.7047377", "0.7022828", "0.6990766", "0.698745", "0.6975952", "0.6967287", "0.69659674", "0.69559413", "0.69291586", "0.69184726", "0.6912634", "0.6905289"...
0.0
-1