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
Verifies the matrices input to the constructor are valid. Namely that they have the correct dimension and are of the correct size.
def __verifyMatrixProperties(self, matrix, order): # Get the shape and number of dimentions of the matrix shape = np.shape(matrix) size = np.size(matrix) dims = len(shape) # Verify that the matrix has two dimensions if dims != 2: errmsg = (f'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_matrix():\n R_list = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\n R = pr.check_matrix(R_list)\n assert_equal(type(R), np.ndarray)\n assert_equal(R.dtype, np.float64)\n\n R_int_array = np.eye(3, dtype=int)\n R = pr.check_matrix(R_int_array)\n assert_equal(type(R), np.ndarray)\n assert_...
[ "0.7092925", "0.7081533", "0.6861642", "0.68299127", "0.66504246", "0.6575466", "0.65492", "0.65021735", "0.6453702", "0.64181834", "0.6350612", "0.63066745", "0.6243306", "0.62196493", "0.6219351", "0.62112993", "0.62034065", "0.61877036", "0.61798847", "0.61647403", "0.6159...
0.62284935
13
Calculate ious between 2 sets of bounding boxes.
def iou(a: np.ndarray, b: np.ndarray) -> np.ndarray: if a.ndim == 1: a = np.expand_dims(a, axis=0) if b.ndim == 1: b = np.expand_dims(b, axis=0) assert a.shape[0] == 1 or a.shape[1] == 1 or a.shape[0] == b.shape[0] intersect = np.array( [ np.maximum(a[:, 0], b[:, 0]),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iou_bbox(bboxes1, bboxes2):\n bboxes1 = np.array(bboxes1, np.float32)\n bboxes2 = np.array(bboxes2, np.float32)\n \n intersection_min_y = np.maximum(bboxes1[:, 0], bboxes2[:, 0])\n intersection_max_y = np.minimum(bboxes1[:, 0] + bboxes1[:, 2] - 1, bboxes2[:, 0] + bboxes2[:, 2] - 1)\n intersec...
[ "0.838403", "0.79358643", "0.78555566", "0.7832804", "0.7827173", "0.7827173", "0.7823096", "0.78191894", "0.77358013", "0.7707601", "0.7689905", "0.765328", "0.7650662", "0.764062", "0.7630192", "0.75576484", "0.75301754", "0.751802", "0.74724", "0.74578667", "0.745178", "...
0.6839707
63
Get one board item
def __getitem__(self, i): if not (isinstance(i, int), 0 < i < 10): raise IndexError('Index should be 0 < int < 10, not %s' % i) return self.__values[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, index):\n return self.board[index]", "def get_item(self, items, y, x):\n if self.maze[y][x] != \" \" and self.maze[y][x] in items:\n return self.maze[y][x]\n else:\n return None", "def getItem(self):\n return self.getItem(0)", "def get_tile(self...
[ "0.7098689", "0.66091263", "0.6552224", "0.64883924", "0.6486414", "0.6442375", "0.6423522", "0.6415295", "0.6415295", "0.63490134", "0.6321418", "0.63005775", "0.627153", "0.62689775", "0.62689775", "0.62665313", "0.62419206", "0.6235657", "0.6232224", "0.62227714", "0.62174...
0.0
-1
Return locators of DashboardContainer.
def _get_locators(self): return locator.DashboardWidget
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboards(self):\r\n return resources.Dashboards(self)", "def dashboards(self) -> dict:\n return Config.get_dashboards()", "def widgets(self) -> WidgetRegistry:\n return self._widgets", "def containers(self):\n return self.__containers", "def components(self):\r\n return...
[ "0.66383785", "0.63376087", "0.5810995", "0.55801463", "0.55237746", "0.54589236", "0.5451895", "0.54436105", "0.5376329", "0.5299837", "0.52755165", "0.5230462", "0.5208505", "0.5191929", "0.51867664", "0.51803154", "0.5110818", "0.5107517", "0.51026326", "0.5087864", "0.508...
0.8140773
0
Called when the user specifies an intent for this skill
def on_intent(intent_request, session): print("on_intent requestId=" + intent_request['requestId'] + ", sessionId=" + session['sessionId']) intent = intent_request['intent'] intent_name = intent_request['intent']['name'] # Dispatch to your skill's intent handlers if intent_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ...
[ "0.71420133", "0.69547683", "0.6947687", "0.6904298", "0.68916833", "0.6762635", "0.67533505", "0.67214155", "0.67193514", "0.6714963", "0.6697724", "0.6691365", "0.66685253", "0.66434884", "0.66413116", "0.6637183", "0.66071934", "0.659293", "0.6574297", "0.65689635", "0.655...
0.65511
22
Returns a 2D list (x,y order) of Color instances forming a rainbow grid.
def rainbowGrid(dimensions, darkness=100, scheme=None): if scheme == None or len(scheme) < 5: scheme = [ colors.firebrick, colors.orangered, colors.darkgoldenrod, colors.olivedrab, colors.ReportLabBlue, colors.purple, ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colors(self):\n\t\treturn [(0, 30, 255),(0, 30, 120)]", "def get_colors(self):\n x = np.linspace(0, 1, self.length)\n y = x**self.gamma\n\n value = np.linspace(0, 1, len(self.colors))\n r = np.interp(y, value, self.colors[:,0])\n g = np.interp(y, value, self.colors[:,1])\n ...
[ "0.71153075", "0.7082364", "0.683329", "0.68308556", "0.67883456", "0.6770876", "0.6768966", "0.6710245", "0.6667389", "0.66423357", "0.6587759", "0.65487933", "0.6524343", "0.65196866", "0.6495592", "0.64787835", "0.64762986", "0.64577943", "0.64474887", "0.6348424", "0.6343...
0.63807166
19
Returns a list of Color instances forming a linear rainbow.
def rainbowRow(length, darkness=100, scheme=None): if scheme == None or len(scheme) < 2: scheme = [ colors.firebrick, colors.orangered, colors.darkgoldenrod, colors.olivedrab, colors.ReportLabBlue, colors.purple, ] sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(n):\n color = cm.rainbow(np.linspace(0, 1, n))\n return color", "def _color_brew(n):\n color_list = []\n\n # Initialize saturation & value; calculate chroma & value shift\n s, v = 0.75, 0.9\n c = s * v\n m = v - c\n\n for h in np.arange(25, 385, 360. / n).astype(int):\n ...
[ "0.7086317", "0.7059586", "0.7009241", "0.6722111", "0.66597915", "0.65825224", "0.6564333", "0.6550826", "0.65156215", "0.6505393", "0.6485287", "0.6483748", "0.6400803", "0.63780415", "0.63561976", "0.6355887", "0.63304996", "0.6277926", "0.62613267", "0.62559", "0.62477225...
0.6399597
13
Calculates the area of a triangle.
def triangleArea(p0, p1, p2): return 0.5 * ( -p1[1] * p2[0] + p0[1] * (-p1[0] + p2[0]) + p0[0] * (p1[1] - p2[1]) + p1[0] * p2[1] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(triangle):\n return 0.5 * length_vector(normal_triangle(triangle, False))", "def triangle_area(triangle):\n # sides of the triangle\n a = great_circle_distance(triangle[0], triangle[1])\n b = great_circle_distance(triangle[0], triangle[2])\n c = great_circle_distance(triangle[1],...
[ "0.85175955", "0.8409884", "0.84009516", "0.83530307", "0.8344421", "0.82872856", "0.8254128", "0.8103333", "0.80790335", "0.8029053", "0.8011744", "0.7903753", "0.78288335", "0.78248346", "0.78085166", "0.77907896", "0.771046", "0.770271", "0.7579557", "0.74689156", "0.73563...
0.7800442
15
Calculate the great circle distance between two points on the earth (specified in decimal degrees) in meters
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) r = 6371000 # Radius of ear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81600857", "0.7973732", "0.7909746", "0.7767874", "0.773428", "0.76952547", "0.7680172", "0.766428", "0.76400167", "0.762264", "0.75921285", "0.7574346", "0.7573492", "0.75550604", "0.7530495", "0.7528566", "0.7525182", "0.7521887", "0.7514674", "0.75053495", "0.7501662", ...
0.0
-1
Find and return an element from list_one that is in list_two, or None otherwise.
def find_in_list(list_one, list_two): for element in list_one: if element in list_two: return element return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(listy, x):\n return listy.index(x) if x in listy else None", "def is_in_list(list_one, list_two):\n \n for element in list_one:\n if element in list_two:\n return True\n return False", "def identical_item(list1, list2):\n for item in list1:\n for part in list2:\n ...
[ "0.7291919", "0.70711523", "0.663474", "0.64640707", "0.6353226", "0.63091815", "0.62511986", "0.620057", "0.6120527", "0.60925275", "0.60792065", "0.6064487", "0.5992774", "0.5981744", "0.59807014", "0.5971388", "0.5941875", "0.5933334", "0.5868476", "0.58389354", "0.5809855...
0.90661705
0
Returns the player at the current_player index.
def __get_current_player(self): return engine.Engine.game_manager.players[self.current_player_index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_player(self) -> Player:\n return self.players[self.player]", "def get_current_player(self):\n return self.in_game_players[self.curr_player_index]", "def get_current_player(self) :\n return self.current_player", "def get_current_player(self):\n return self.current_playe...
[ "0.85247403", "0.84867454", "0.8089613", "0.8042499", "0.7999638", "0.7894455", "0.78784364", "0.7857053", "0.7855146", "0.775659", "0.76662445", "0.76130474", "0.73694444", "0.73577935", "0.73577935", "0.7336021", "0.73230714", "0.71914965", "0.71793675", "0.71743417", "0.71...
0.8460903
2
Returns the player not at the current_player index.
def __get_other_player(self): return engine.Engine.game_manager.players[(self.current_player_index + 1) % 2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __negated_player(self, player):\n\t\treturn self.PLAYER2 if self.current_player == self.PLAYER1 else self.PLAYER1", "def get_current_player(self):\n return self.in_game_players[self.curr_player_index]", "def __get_current_player(self):\n return engine.Engine.game_manager.players[self.current_...
[ "0.737167", "0.7131816", "0.7096614", "0.70372105", "0.68343145", "0.6818243", "0.6818243", "0.6782323", "0.67675865", "0.67497075", "0.6729883", "0.6569479", "0.65664333", "0.654347", "0.6529054", "0.6516115", "0.64820546", "0.64467186", "0.6422826", "0.6398652", "0.6378352"...
0.6998858
4
Returns whether there is too much exposed positivity. When this is True, most gained positivity and negativity will have minimal effect on the final exposed positivity.
def isExposedPositivityOverloaded(): Sentience.getExposedPositivity() #preprocess current positivity, which will update whether positivity overload is in effect return Sentience.__positivity_overload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positive_only(self):\n return True", "def positive_only(self):\n return True", "def positive_only(self):\n return True", "def getExposedPositivity(unlimited=False):\n\n if Sentience.__positivity_overload:\n Sentience.__exposed_positivity = -abs(Sentience.__exposed_p...
[ "0.6964317", "0.6964317", "0.6964317", "0.6766569", "0.6447039", "0.6383533", "0.6247913", "0.6242311", "0.6190138", "0.6129724", "0.6112472", "0.6062943", "0.60620004", "0.6042483", "0.5994696", "0.5980057", "0.59514254", "0.59485793", "0.5940164", "0.59387416", "0.5891779",...
0.6105147
11
Returns first item of Queue
def data_wait(self): return self.get(timeout=self._timeout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Queue is empty')\n\t\treturn self._head._element", "def first(self):\r\n if self.is_empty():\r\n raise Empty(\"Queue is empty\")\r\n return self._head._element", "def first(self):\n if self.head is None:\n ...
[ "0.8646616", "0.85619503", "0.8462579", "0.8446519", "0.83684456", "0.8339236", "0.82566625", "0.82474124", "0.82455635", "0.82194525", "0.82194525", "0.815598", "0.8095108", "0.80591875", "0.8045845", "0.80279404", "0.7963286", "0.793172", "0.7915238", "0.78741187", "0.78522...
0.0
-1
Return a timestamp with timezone + offset from UTC.
def get_timestamp(use_utc=None, ts_format=None): if use_utc is None: use_utc = botconfig.USE_UTC if ts_format is None: ts_format = botconfig.TIMESTAMP_FORMAT if use_utc: tmf = datetime.datetime.utcnow().strftime(ts_format) tz = "UTC" offset = "+0000" else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utctime(stamp):\n return stamp + utc_offset", "def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()", "def get_utc_offset(timestamp: str):\n offset_direction = timestamp[-5] # A plus...
[ "0.7433074", "0.73768806", "0.72411853", "0.70669967", "0.6964763", "0.69542", "0.6848605", "0.68214977", "0.67412233", "0.67288506", "0.67257375", "0.6690586", "0.6689317", "0.66553754", "0.6645071", "0.66416734", "0.66349083", "0.66243285", "0.6573624", "0.6570437", "0.6564...
0.0
-1
Find the area of a squareof length l
def area_square(l): x = l * l return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def squareArea(sidelength):\n sidelength = float(sidelength)\n return sidelength**2", "def area_circle(l):\n a = math.pi * ((l / 2) ** 2)\n return a", "def calculate_area(length: int, width: int) -> int:\n\n # process\n area = length * width\n\n # output\n return area", "def area_squa...
[ "0.722552", "0.7187845", "0.7180649", "0.7022802", "0.6958173", "0.6950832", "0.68668664", "0.6794327", "0.6739669", "0.6708414", "0.669203", "0.6688077", "0.66623485", "0.65867233", "0.6567442", "0.6510015", "0.64988595", "0.64899653", "0.64615846", "0.6446765", "0.644286", ...
0.8211714
0
r"""Inner products Compute inner product of target df with weights defined by df_weights.
def tran_inner(df, df_weights, prefix="dot", name=None, append=True): ## Check invariants if df_weights.shape[0] == 0: raise ValueError("df_weights cannot be empty") if isinstance(name, str): if not (name in df_weights.columns): raise ValueError("name must be column of df_weights...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocate(self,weights, df):\n return df.dot(weights)", "def inner_product(alpha, F, beta):\n return np.dot(alpha, np.dot(F, beta))", "def dot_product(v, w):\n return sum(v_i * w_i for v_i, w_i in zip(v, w))", "def outer_product(x,y):\n\n return x[:,0]*y[:,1] -x[:,1]*y[:,0]", "def apply_...
[ "0.6295097", "0.58483356", "0.58083713", "0.57746404", "0.5707739", "0.55239964", "0.5392665", "0.5383726", "0.53795326", "0.5377908", "0.53418595", "0.53397274", "0.5321953", "0.53100884", "0.52883166", "0.52815783", "0.5267212", "0.52589446", "0.524968", "0.5248345", "0.524...
0.7229548
0
As part of the ONNX export steps, export an ONNX JIT graph from a PyTorch model.
def _onnx_graph_from_model( model: Union[torch.nn.Module, torch.jit.ScriptModule], args: Tuple[Any, ...], kwargs: Mapping[str, Any], export_options: _experimental.ExportOptions, ) -> _C.Graph: # TODO: refactor utils.py to remove duplicated code of context setup. See #78834 opset_version = export...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _traced_graph_from_model(\n model: Union[torch.nn.Module, torch.jit.ScriptModule],\n args: Tuple[Any, ...],\n kwargs: Mapping[str, Any],\n export_options: _experimental.ExportOptions,\n) -> _C.Graph:\n training = export_options.training\n verbose = export_options.verbose\n\n with utils.exp...
[ "0.70717394", "0.7003602", "0.6919874", "0.65289587", "0.6481931", "0.6401786", "0.6372519", "0.6334548", "0.63218355", "0.63095725", "0.61849207", "0.61846924", "0.60905296", "0.6084929", "0.6033109", "0.6025242", "0.6022837", "0.59617805", "0.5839391", "0.5795472", "0.57910...
0.7447055
0
Get the string representation of the graph segment at the given line.
def _graph_segment_str_at_line(self, line: int) -> str: if line == 0: result_str = self._node_count_segment_str() result_str += " " * (self._max_segment_columns() - len(result_str)) return result_str if line == 1: result_str = self._graph_id_segment_str() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _str_at_line(self, line: int) -> str:\n return (\n self._graph_segment_str_at_line(line)\n + self._connector_segment_str_at_line(line)\n + self._children_str_at_line(line)\n )", "def _connector_segment_str_at_line(self, line: int) -> str:\n if self.upper_...
[ "0.84052145", "0.7082392", "0.62768054", "0.6202979", "0.61267936", "0.6089198", "0.60790336", "0.59044695", "0.5781088", "0.5705206", "0.5699645", "0.56802934", "0.56470674", "0.5602683", "0.56013346", "0.5593939", "0.5544465", "0.55049354", "0.55038095", "0.54433304", "0.53...
0.86530006
0
Get the connector segment string at the given line.
def _connector_segment_str_at_line(self, line: int) -> str: if self.upper_printer is None and self.lower_printer is None: return "" upper_total_rows = self.upper_printer._total_rows() if self.upper_printer else 1 lower_total_rows = self.lower_printer._total_rows() if self.lower_print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _str_at_line(self, line: int) -> str:\n return (\n self._graph_segment_str_at_line(line)\n + self._connector_segment_str_at_line(line)\n + self._children_str_at_line(line)\n )", "def _graph_segment_str_at_line(self, line: int) -> str:\n if line == 0:\n ...
[ "0.8142881", "0.77663434", "0.7021813", "0.64705944", "0.643713", "0.594314", "0.59329474", "0.59100515", "0.58801776", "0.58458024", "0.57537276", "0.56640345", "0.5659923", "0.5655234", "0.5621238", "0.5586678", "0.5576753", "0.5563469", "0.5558511", "0.5546472", "0.5496147...
0.8051007
1
Calculates the cumulative average of an integer list (mylist). Returns float list of cumulative averages.
def cum_avg(mylist): cumsum, cum_aves = [0], [] for i, x in enumerate(mylist, 1): cumsum.append(cumsum[i-1] + x) cum_ave = (cumsum[i])/(i) cum_aves.append(cum_ave) return cum_aves
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_avg (mylist, N):\n import numpy as np\n \n cumsum = np.cumsum(np.insert(mylist, 0, 0))\n return (cumsum[N:] - cumsum[:-N]) / float(N)", "def mean(my_list):\n the_mean = sum(my_list) / len(my_list)\n return the_mean", "def compute_average(vec_list):\r\n return np.sum(vec_list, a...
[ "0.74904275", "0.7280376", "0.7020438", "0.6965659", "0.6951529", "0.69461846", "0.691331", "0.6891476", "0.6870263", "0.68657035", "0.6825449", "0.6818536", "0.6778757", "0.6756168", "0.66948974", "0.66550565", "0.6654918", "0.664965", "0.660334", "0.65722626", "0.65722626",...
0.839474
0
Gets all actions actor can execute.
def all_actions(self): actions = self.actions.stream[:] for eq in self.equipment: actions.extend(eq.actions) return actions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_actions(self):\n return self.actions", "def get_available_actions(self):\n return self.actions", "def get_actions(self):\n return self.agent.get_actions()", "def get_actions(self):\n return []", "def actions(self):\n return self._action_list", "def getAl...
[ "0.80402154", "0.7977002", "0.79381967", "0.78552645", "0.76636326", "0.7521305", "0.7518468", "0.7476215", "0.74451894", "0.73561805", "0.7350422", "0.7350422", "0.7350422", "0.7305836", "0.7305836", "0.72430027", "0.72323674", "0.7223573", "0.7128844", "0.70877904", "0.7086...
0.73243445
13
Checks if the actor is in the board.
def is_in_board(self): return self.is_alive()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_board(self,pos : np.ndarray) -> bool:\r\n if 0 > pos[0] or pos[0] >= BOARD_SIZE:\r\n return False\r\n if 0 > pos[1] or pos[1] >= BOARD_SIZE:\r\n return False\r\n\r\n return True", "def inBoard(self, row, col):\n return 0 <= row < self.rows and 0 <= col <...
[ "0.723219", "0.71502286", "0.6948068", "0.6892193", "0.68031263", "0.6802798", "0.6696202", "0.66851825", "0.6680227", "0.66663915", "0.66328514", "0.6597319", "0.65712327", "0.6554115", "0.6549036", "0.653004", "0.6527398", "0.6525062", "0.64564174", "0.64482886", "0.6448205...
0.7708494
0
Parses training set token file captions and builds a Vocabulary object
def build_vocab(cleaned_captions): # QUESTION 1.1 # Here we Build a vocabulary # create a vocab instance vocab = Vocabulary() words = dict() for caption in cleaned_captions: # iterate through all cleaned_caption for word in caption.split(): # iterate over all words in a caption ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vocab(self):\n if self.test_file is None:\n print('test_file is None')\n file_list = [self.train_file, self.dev_file]\n else:\n file_list = [self.train_file, self.dev_file, self.test_file]\n\n examples = []\n for file_name in file_list:\n ...
[ "0.635036", "0.6339905", "0.63299465", "0.62779975", "0.6273613", "0.6209305", "0.6128679", "0.6119946", "0.6114273", "0.61115164", "0.6110889", "0.6106678", "0.6044847", "0.604367", "0.6037272", "0.601951", "0.59479666", "0.5942583", "0.59401524", "0.5939968", "0.5918677", ...
0.6524987
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary id = dictionary.get('id') provider_id = dictionary.get('providerId') server_time = dictionary.get('serverTime') active_fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.74542487
93
If both score and maximum are Numeric and maximum is nonzero, returns (1.0score/maximum)
def getPercent(self): if isinstance(self.score,numbers.Number) and self.getMaximum(): return (1.0*self.score/self.getMaximum()) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NormalizePhenotypeScore(score, max_score):\n return float(score) / float(max_score) * 100", "def calc_score(score):\n if not score:\n return 0\n dbot_score = 1\n if score >= 95:\n dbot_score = 3\n elif score >= 75:\n dbot_score = 2\n return dbot_score", "def pwm_max_s...
[ "0.73041356", "0.645031", "0.64307195", "0.6391435", "0.63274276", "0.6303551", "0.6295152", "0.62238383", "0.61322004", "0.6129875", "0.6124716", "0.6106472", "0.6083808", "0.60755694", "0.6037542", "0.6023888", "0.6018282", "0.6013166", "0.60124177", "0.6008612", "0.5997559...
0.67022604
1
Checks if a Grade OR Grade name is in the gradelist by equality. !!Will return True if gradelist includes a COPY of a Grade, not just the exact instance!! To check for an exact object, use isin() function.
def __contains__(self,x): dbg('_gradelist[..].__contains__(',x,')') nems = self._grades #assuming x is a Grade if not isinstance(x,Grade): #probably looking for a name! nems = [q.name for q in self._grades] dbg('_gradelist[..].__contains__.nems = ',*nems) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isin(self,grade_obj):\n return bool(grade_obj in self._grades)", "def checkIfInList(_addr, _list):\n for item in _list:\n if (_addr.this == item.this):\n return True\n \n return False", "def in_list(verifield, checklist):\n return verifield in checklist", "def con...
[ "0.71633863", "0.59750175", "0.5847662", "0.5823442", "0.5785771", "0.5770725", "0.5709626", "0.5697266", "0.56769514", "0.5666033", "0.5613327", "0.5588519", "0.5577164", "0.5574862", "0.556671", "0.55552155", "0.55417234", "0.55312955", "0.5506754", "0.5459112", "0.542991",...
0.77065367
0
Convert yaml config (dictlike) to list, required by argparse.
def validate(self, config=None): for k, v in config.items(): assert ( k in self.arguments ), f"""{k} is not a valid argument. Support arguments are {self.format_arguments()}.""" if self.arguments[k].type is not None: try: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_to_list(config_name=CONFIG_FILE_NAME):\n result = []\n config = configparser.ConfigParser()\n\n if not config.read([config_name]):\n return []\n\n for section in SECTIONS:\n for name, opts in ((n, o) for n, o in SECTIONS[section].items() if config.has_option(section, n)):\n ...
[ "0.67910606", "0.6375457", "0.6346535", "0.6305611", "0.6206049", "0.61323076", "0.60638773", "0.59130245", "0.5904598", "0.5819104", "0.5808294", "0.58066005", "0.57881504", "0.5753953", "0.57271546", "0.571875", "0.56436217", "0.5635816", "0.55854744", "0.55651987", "0.5530...
0.0
-1
adds a vertex to the segment, but only if the current number of vertices is <2
def add_vertex(self, v, i=None): if len(self) < 2: return LineString.add_vertex(self, v, i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, v):\n v = {'x': v[0], 'y': v[1]}\n if v not in self:\n self.append(v)\n return len(self)-1\n return self.index(v)", "def add_vertex(self, v: str) -> None:\n if self.contains_vertex(v):\n return\n else:\n self.adj_...
[ "0.70420414", "0.69086635", "0.6851704", "0.67827034", "0.67576873", "0.67482436", "0.6734005", "0.6702797", "0.6652426", "0.66287196", "0.66121316", "0.6583922", "0.6581953", "0.65410626", "0.65323913", "0.65196615", "0.6519206", "0.65023625", "0.64565384", "0.64426965", "0....
0.6622369
10
Destroy (DROP) MySQL database according to env's settings.py
def _drop_database_mysql(): # Unless explicitly provided, uses local Django settings to # extract username/password to access remote database database = env.project.get('database', None) if not database: django.settings_module(env.project['settings']) database = django_settings.DATABASES...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_db():\n db.drop_all()", "def db_cleanup(self):\n with self.context():\n meido.db.session.remove()\n meido.db.drop_all()", "def drop_db() -> None:\n \n if os.environ.get('DATABASE_URL').startswith('sqlite:///'):\n sqlite_s, sqlite_f = os.environ.get('DATAB...
[ "0.81514573", "0.80824697", "0.8069935", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.79548544", "0.78579026", "0.78170145", "0.7785647", "0.7748717", "0.7689776", "0.75986856", "0.75589913", "0.7555239", "...
0.79611
3
Path to current project' directory
def _django_project_dir(): return _interpolate(DJANGO_PROJECT_DIR)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_dir():\n path = Path(__file__).parent.parent\n project_dir = path.parent\n return project_dir", "def get_project_dir():\n\n return Path(settings.PROJECT_DIR)", "def get_project_root():\n return Path(__file__).parent.parent", "def get_project_root():\n return str(Path(__file_...
[ "0.81076676", "0.81033856", "0.8071574", "0.8067549", "0.8067549", "0.8053351", "0.8030514", "0.8009783", "0.7962687", "0.79454094", "0.79400474", "0.79400474", "0.79400474", "0.79400474", "0.7917521", "0.79075396", "0.7816699", "0.76604986", "0.76300454", "0.7582095", "0.758...
0.75889593
19
Get root window offset x in pixels value
def offset_x(self) -> int: self.tk_ref.update() return self.tk_ref.winfo_x()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centerx(self):\n return self.left + self.width / 2", "def get_x_position(self):\n return self.rect.x", "def mousePos():\n data = display.Display().screen().root.query_pointer()._data\n return data[\"root_x\"], data[\"root_y\"]", "def _get_viewport_offset(self):\n viewport_geome...
[ "0.7086193", "0.70678", "0.6916751", "0.68929476", "0.68337524", "0.68171316", "0.6795325", "0.6730493", "0.67054427", "0.66988146", "0.6660558", "0.66240424", "0.66141987", "0.661367", "0.65857667", "0.6583111", "0.6569718", "0.656971", "0.6559385", "0.6528468", "0.65105647"...
0.73783016
0
Get root window offset y in pixels value
def offset_y(self) -> int: self.tk_ref.update() return self.tk_ref.winfo_y()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self):\n return self.top", "def y(self) -> int:\n return self.data.y_centre >> 4", "def get_ly(self):\r\n return self.dy * self.ny - self.oy", "def get_offset(tk_window):\n\n width_offset = int(\n (tk_window.winfo_screenwidth() / 2) - (tk_window.winfo_width() / 2)...
[ "0.7093761", "0.678765", "0.67828536", "0.67789066", "0.6717105", "0.66968894", "0.66646636", "0.6645341", "0.6592633", "0.656043", "0.6549996", "0.65466845", "0.64999706", "0.64662504", "0.64648527", "0.64276797", "0.6411839", "0.64024204", "0.63900775", "0.63900775", "0.638...
0.69583344
1
Get background window color code
def background(self) -> str: return self.tk_ref.config()['background'][-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_color(self):\n return Color(self.GetBackground())", "def background_color_value(self) -> int:\n return self.background_color.value", "def GetBackgroundColour(self):\r\n\r\n return self._colBack", "def bg(self):\n return self._bg", "def bg_color(self) -> pg.Color:\...
[ "0.7358467", "0.72067285", "0.7135927", "0.6991623", "0.6970105", "0.69349015", "0.69228125", "0.69082576", "0.6882807", "0.68824273", "0.68249756", "0.67627877", "0.6756248", "0.67287844", "0.66812974", "0.66482306", "0.66292626", "0.64926845", "0.6467775", "0.6464415", "0.6...
0.68817556
10
Get window opacity value
def alpha(self) -> float: return float(self.tk_ref.wm_attributes('-alpha'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opacity(self):\n # type: () -> float\n return self._opacity", "def opacity(self):\n return self._rgba[3]", "def opacity(self) -> int:\n\n return self._opacity", "def opacity( self ):\n if ( self.isIsolateHidden() ):\n return 0.1\n \n opacity = s...
[ "0.776012", "0.7683137", "0.7206621", "0.7165742", "0.71427315", "0.66770184", "0.63506687", "0.6261115", "0.613176", "0.61137563", "0.6068755", "0.60621333", "0.6045102", "0.59971917", "0.5948554", "0.59362876", "0.5923617", "0.590486", "0.5873989", "0.5859798", "0.5859798",...
0.6722343
5
Return a string representing the type of processor this is.
def process_type(self): return 'sentiment Analysys'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"type\")", "def type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"type\")", "def type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"type\")", "def type(self) -> pulumi.Output[str]:\n return pul...
[ "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543", "0.72038543"...
0.0
-1
Tests that an existing username doesn't validate, and that the passwords must match.
def test_invalid_form(self): data = { 'username': self.user.username, 'first_name': 'Fred', 'last_name': 'Bob', 'email': 'fredbob@fakezzzz.com', 'password': 'foobar', 'confirm_password': 'foobar2', 'gender': 'male', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_password_works_with_username(password, username=None):\n if password == username:\n raise errors.AccountPasswordInvalid(accounts.PASSWORD_CANT_EQUAL_USERNAME_MSG) # lint-amnesty, pylint: disable=no-member", "def username_is_valid(username):\n\n if len(username) < MINIMUM_PASSWORD_LENG...
[ "0.78363156", "0.7447824", "0.7357257", "0.7346728", "0.7270943", "0.725259", "0.72039783", "0.71992797", "0.7193521", "0.7193098", "0.71703076", "0.7150465", "0.714641", "0.7134052", "0.7131879", "0.7125677", "0.70975477", "0.7096642", "0.7069448", "0.7062072", "0.7057744", ...
0.0
-1
Test the creation of a genesis block node
def blockchain_test(): init_hash = hashlib.md5('foobarbaz').hexdigest() chain = Chain(genesis=Node(data=None, hash_str=init_hash)) genesis = chain.genesis assert chain assert chain.size == 1 assert init_hash == genesis.hash chain.new_node(data='hello') expected_hash = hashlib.md5(in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_genesis_block(self):\n genesis_block = self.blockchain.last_block[\"index\"]\n self.assertEqual(genesis_block, 1)", "def genesisBlock():\n return Block(0, \"0\", 1465154705, \"my genesis block!!\",\n \"816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7\");"...
[ "0.7819148", "0.7445598", "0.7236912", "0.7189134", "0.71651155", "0.7105297", "0.7028575", "0.69849217", "0.6949131", "0.6949131", "0.6888543", "0.6843824", "0.6669649", "0.66393816", "0.663245", "0.6533989", "0.6400462", "0.6386923", "0.63730156", "0.6323687", "0.63196254",...
0.6808092
12
Return if number is even
def number_is_even(): return lambda number: number%2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_even(number):\n return (number%2)==0", "def is_even(number):\n return number % 2 == 0", "def is_even(num):\n return num % 2 == 0", "def is_even(number: int) -> bool:\n return number % 2 == 0", "def is_even(number):\n if ((number%2) == 0):\n return True\n else:\n retur...
[ "0.92352504", "0.9172888", "0.91108567", "0.9035362", "0.9021767", "0.8954234", "0.89302605", "0.8882825", "0.8877168", "0.88769245", "0.8730764", "0.87288564", "0.8598773", "0.85757196", "0.8555381", "0.85367066", "0.84599614", "0.83930504", "0.8373534", "0.83687836", "0.829...
0.84003925
17
Test review_status is not set to None
def test_update_risk_field_to_null(self, field, field_name): risk = factories.RiskFactory() response = self.api.put(risk, risk.id, { field: None, }) self.assert400(response) self.assertEqual(response.json["message"], field_name + " for the object is not specified") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_review_is_done(self):\n self.assertFalse(processes.review_is_done(None))\n self.assertFalse(processes.review_is_done(0))\n self.assertFalse(processes.review_is_done(models.REVIEW_PENDING))\n self.assertFalse(processes.review_is_done(models.REVIEW_ISSUES_OPEN))\n self.assertTrue(processes.re...
[ "0.6827959", "0.647804", "0.62051964", "0.6155368", "0.6114608", "0.6092222", "0.5962013", "0.59106934", "0.59091425", "0.58898354", "0.58887047", "0.5879549", "0.5879415", "0.5866186", "0.5855767", "0.58552426", "0.5848049", "0.5843173", "0.5831067", "0.5822958", "0.5801428"...
0.0
-1
Test review_status is updated
def test_update_review_status(self): risk = factories.RiskFactory() new_value = all_models.Review.STATES.REVIEWED self.api.put(risk, risk.id, { "review_status": new_value, "review_status_display_name": "some status" }) risk = db.session.query(all_models.Risk).get(risk.id) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_change_review_status(self):\n runid = self._runid\n logging.debug('Get all run results from the db for runid: ' +\n str(runid))\n\n run_results = get_all_run_results(self._cc_client, runid)\n self.assertIsNotNone(run_results)\n self.assertNo...
[ "0.74658114", "0.7328057", "0.7305364", "0.70519245", "0.7044138", "0.6748748", "0.6718127", "0.66477513", "0.65562135", "0.6540447", "0.65403163", "0.648796", "0.648796", "0.648796", "0.6470997", "0.6443893", "0.64409816", "0.6400049", "0.6371026", "0.63256574", "0.6309867",...
0.7885294
0
Return list of allowed actions that can be made in state
def actions(self, state): "*** YOUR CODE HERE ***" if state[2] == 0: state_fw = (state[0], state[1] + 1, 0) state_tr = (state[0], state[1], 3) state_tl = (state[0], state[1], 1) elif state[2] == 1: state_fw = (state[0] - 1, state[1], 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())", "def getLegalActions(self,state):\n return self.actionFn(state)", "def getLegalActions(self, state):\n return self.actionFn(state)", "def get_available_actions(self, state):\n pass", "def get_possible_ac...
[ "0.80085504", "0.79716265", "0.79417676", "0.79149675", "0.77498865", "0.75869966", "0.7553659", "0.73761845", "0.7372146", "0.7369084", "0.7338548", "0.73349386", "0.72808", "0.7274748", "0.7234828", "0.7199594", "0.7196472", "0.7191541", "0.7190196", "0.71601564", "0.710926...
0.0
-1
Return list of allowed actions that can be made in state
def actions(self, state): "*** YOUR CODE HERE ***" if state[2] == 0: # When agent is facing North state_fw = (state[0], state[1] + 1, 0) state_tr = (state[0], state[1], 3) state_tl = (state[0], state[1], 1) elif state[2] == 1: # When agent is facing West ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_actions(self) -> List[str]:\n return list(self.action_map().keys())", "def getLegalActions(self,state):\n return self.actionFn(state)", "def getLegalActions(self, state):\n return self.actionFn(state)", "def get_available_actions(self, state):\n pass", "def get_possible_ac...
[ "0.80080545", "0.79724884", "0.79427665", "0.7915108", "0.77509886", "0.75867707", "0.75549436", "0.7375182", "0.73727214", "0.7369071", "0.73384315", "0.7334771", "0.72818077", "0.7273697", "0.7233691", "0.7200625", "0.71959543", "0.7189994", "0.71897995", "0.7159678", "0.71...
0.0
-1
Clears the token used for authentication, optionally revoking it before doing so
def logout(self, revoke_token=False): if revoke_token: self.revoke_self_token() self.token = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self.token_revoke()", "def revoke(self):\n if self.access_token is None:\n raise InvalidInvocation('no token available to revoke')\n\n self._authenticator.revoke_token(self.access_token, 'access_token')\n self._clear_access_token()", "def revoke_token...
[ "0.699886", "0.6988337", "0.69808465", "0.6736623", "0.67299676", "0.6729785", "0.6695616", "0.6671741", "0.6616997", "0.6612316", "0.6590165", "0.65330905", "0.6531848", "0.65001166", "0.6495223", "0.64951557", "0.6485257", "0.6467337", "0.64505357", "0.64215493", "0.6373636...
0.7287816
0
Extract the radius/number from a gr file name
def get_radius_from_grfile(grfile, default=0): match = re.findall('(\d+)', grfile) if len(match) > 0 and str(grfile).endswith(str(match[-1]) + '.gr'): return int(match[-1]) return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_diameter(self,filename,maxLen=3):\n filename = os.path.splitext(filename)[0] \n filename = os.path.split(filename)[1] \n filename = filename.split(\"_\",3)[2] \n diameter = filename \n return diameter", "def get_num_from_file(file_name):\n basename = file_name.parti...
[ "0.6218466", "0.619093", "0.5922256", "0.5865497", "0.5842589", "0.5825127", "0.5793829", "0.57658607", "0.57283086", "0.5720184", "0.5660492", "0.56551856", "0.5621069", "0.559087", "0.5586727", "0.5586727", "0.5501733", "0.5439403", "0.5438494", "0.54140836", "0.5407844", ...
0.7896371
0
Returns a set of child types for this node.
def get_child_types(self): types = set() for child in self.children: types.add(child.__class__) return types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children_types(self) -> set[FakeAnnotation]:\n result: set[FakeAnnotation] = set()\n for child in self.children:\n result.update(child.iterate_types())\n return result", "def _child_types(self, children):\n\n # Recursively determine types on each child node\n ...
[ "0.802526", "0.77076083", "0.74828744", "0.72904575", "0.7166985", "0.7166286", "0.67760295", "0.6697054", "0.6688063", "0.6539489", "0.6536056", "0.65282494", "0.6519497", "0.64816654", "0.6465576", "0.6446824", "0.6445795", "0.644176", "0.6430468", "0.64127594", "0.6410112"...
0.85920405
0
Yields all views from the default namespace.
def get_views(self): return self._get_types_from_default_ns(View)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def views(self):\r\n return resources.Views(self)", "def views(self):\r\n return Views(self)", "def views(self):\n return self._views", "def generate_views(self):\n # type: (Generator) -> str\n return render_to_string(\n self.backend, \"views.py\", {\n ...
[ "0.6305015", "0.5921781", "0.57997704", "0.5744849", "0.5742531", "0.5710597", "0.5622336", "0.5610357", "0.55628407", "0.55369264", "0.5525779", "0.5492689", "0.5474114", "0.5473362", "0.54466695", "0.54427856", "0.5409916", "0.53552926", "0.53291935", "0.52488995", "0.52387...
0.6071496
1
Returns True if this namespace is a default namespace.
def is_default_namespace(self): return self.db.get_default_namespace() == self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_default(self) -> bool:\n return self._is_default", "def is_default(self):\n return self._tag == 'default'", "def is_default(self) -> bool:\n return pulumi.get(self, \"is_default\")", "def is_default(self):\n # type: () -> bool\n return self._is_default", "def is_de...
[ "0.7529933", "0.74788034", "0.7474201", "0.7359902", "0.7341513", "0.73407036", "0.722246", "0.722246", "0.722246", "0.71842754", "0.7124434", "0.7119654", "0.70840245", "0.7013174", "0.6952865", "0.6849853", "0.6849853", "0.6849853", "0.6849853", "0.6849853", "0.68089837", ...
0.8875803
0
ritorna la lista dei capitoli in formato html
def _epub2thtml(self, filename): book = epub.read_epub(filename) chapters = [] for item in book['get_items'](): if item.get_type() == ebooklib.ITEM_DOCUMENT: chapters.append(item.get_content()) return chapters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_list(self):\n self.print_avec_separateur(\" \")", "def presidente(lst_presidente):\n tmp=''\n tmp+='\\t\\t<para style=\"P3\" spaceAfter=\"35\">\\n'\n tmp+='\\t\\t\\t<font color=\"white\"> </font>\\n'\n tmp+='\\t\\t</para>\\n'\n tmp+='\\t\\t<para style=\"P4\"><b>' + str(lst_pre...
[ "0.61880934", "0.5958886", "0.5889623", "0.5849276", "0.58281255", "0.5794499", "0.5769871", "0.57318735", "0.57087636", "0.569148", "0.5636235", "0.56323564", "0.5631737", "0.56202096", "0.56136453", "0.5577249", "0.5564397", "0.5561009", "0.5560176", "0.555746", "0.5540109"...
0.0
-1
Returns empty string if variable is None.
def get_list(list_var): if list_var: return list_var else: return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nothing():\n return \"\" # intentional non-existent variable", "def get_nonempty_str(arg: Any) -> Optional[str]:\n if isinstance(arg, str):\n if len(arg) > 0:\n return str(arg)\n return None", "def silent_none(value):\n if value is None:\n return ''\n return valu...
[ "0.74008626", "0.7107872", "0.6961987", "0.6845725", "0.6668899", "0.65816134", "0.65009713", "0.6476864", "0.64393395", "0.6369905", "0.6308882", "0.62487453", "0.6243484", "0.62226486", "0.6197948", "0.61903614", "0.6175144", "0.61509717", "0.61348283", "0.60806584", "0.605...
0.0
-1
Get last login details.
def get_login(): try: data = [] details_regex = r"([a-zA-Z]+\s[a-zA-Z]+\s+[0-9]+\s[0-9]+:[0-9]+)\s+(.*)" username_regex = r"^[a-zA-Z0-9]+\s" output = subprocess.check_output("last") output = output.decode("utf-8").split("\n") for line in output: usernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_password(self) -> str:\n return pulumi.get(self, \"last_password\")", "def test_last_login(self, mocked):\n\n # Test it authenticates if Ona User is Logged In\n mocked.get(\n \"https://stage-api.ona.io/api/v1/user\",\n json=self.ona_response,\n )\n\n ...
[ "0.7084093", "0.6472656", "0.6429118", "0.64025444", "0.6307611", "0.620598", "0.6186773", "0.61438644", "0.6132095", "0.61278623", "0.6110024", "0.60809165", "0.6065298", "0.60400856", "0.602912", "0.6025116", "0.60082597", "0.5976135", "0.59363395", "0.59353906", "0.5930701...
0.60996956
11
Return the device state attributes.
def device_state_attributes(self): return self._attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):...
[ "0.93173087", "0.9245708", "0.92147964", "0.92147964", "0.9210798", "0.9210798", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91909975", "0.91441494", ...
0.92207897
2
Convert a scipy sparse matrix to a torch sparse tensor.
def sparse_mx_to_torch_sparse_tensor(sparse_mx): sparse_mx = sparse_mx.tocoo().astype(np.float32) indices = torch.from_numpy( np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)) values = torch.from_numpy(sparse_mx.data) shape = torch.Size(sparse_mx.shape) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu...
[ "0.8300125", "0.8148143", "0.80456305", "0.8032249", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80297565", "0.80130917", "0.79970765", "0.79970765", ...
0.79647905
24
Convert a scipy sparse matrix to a torch sparse tensor.
def sparse_mx_to_torch_sparse_tensor(sparse_mx): sparse_mx = sparse_mx.tocoo().astype(np.float32) indices = torch.from_numpy( np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)) values = torch.from_numpy(sparse_mx.data) shape = torch.Size(sparse_mx.shape) return torch.sparse.FloatTen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu...
[ "0.8301762", "0.8148899", "0.80461955", "0.80328023", "0.80137724", "0.79976094", "0.79976094", "0.79855764", "0.79855764", "0.79855764", "0.7977371", "0.7965371", "0.77549213", "0.771334", "0.74287164", "0.74287164", "0.7353825", "0.7198796", "0.7158548", "0.69889534", "0.69...
0.8030319
16
Compute dot product of vectors A & B
def similarity(centroid_a, centroid_b): vector_a = centroid_a.centroid_vector vector_b = centroid_b.centroid_vector length_a = centroid_a.length length_b = centroid_b.length dotproduct = 0.0 for key, value in vector_a.iteritems(): if key in vector_b: # if both vectors hav...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def dot(a, b):\n return np.vdot(a.arr,b.arr)", "def vdot(a, b):\n return np.vdot(a....
[ "0.8661418", "0.8555408", "0.838249", "0.83734024", "0.8328429", "0.82212085", "0.82144165", "0.8211341", "0.8193126", "0.8183287", "0.815596", "0.8117115", "0.80995876", "0.80624926", "0.8049583", "0.8040964", "0.8017601", "0.797728", "0.7955631", "0.79285604", "0.79197115",...
0.0
-1
Create empty testing trie.
def empty_trie(): from trie import Trie trie = Trie() return trie
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_empty_trie(empty_trie):\n assert empty_trie.root.children == {}\n assert empty_trie._size == 0", "def empty_trie():\n trie = Trie()\n return trie", "def test_create_trienode():\n node = TrieNode(\"h\")\n assert node.value == \"h\"\n assert node.children == {}", "def trave...
[ "0.8069461", "0.8001973", "0.7242687", "0.7125927", "0.7105793", "0.69713306", "0.692341", "0.68773925", "0.68733966", "0.6825118", "0.67627084", "0.675214", "0.675214", "0.67337686", "0.6715608", "0.6680349", "0.6665456", "0.6660182", "0.66541314", "0.66287696", "0.66287696"...
0.7934639
2
Function takes a string, and if it has a `.` assumes it is a float, else it must be an int. We apply proper conversion function to the string making it a number.
def str_to_num(s): method = { "float": string.atof, "int": string.atoi } if not type(s) is StringType: return 0 if "." in s: return method["float"](s) else: return method["int"](s, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parseNumber(self, str):\r\n\t\tif (str.count(\".\") == 0):\r\n\t\t\treturn int(str)\r\n\t\tif (str.count(\".\") == 1):\r\n\t\t\treturn float(str)\r\n\t\treturn str", "def num(s: str):\n try: return int(s)\n except ValueError: return float(s)", "def str2num(s):\r\n try:\r\n return int(s)\r\...
[ "0.81439275", "0.80715656", "0.78507686", "0.77837646", "0.77771693", "0.76121897", "0.7583545", "0.7563765", "0.7524552", "0.75077814", "0.750153", "0.7352278", "0.7350473", "0.7245666", "0.7227321", "0.71945244", "0.717014", "0.716775", "0.71644163", "0.71644163", "0.715081...
0.7922769
2
Function takes a string given back by kstat command and creates a key/value mapping of all items in the string. We split string on newlines `\n`, which is a per metric delimiter. And for each individual metric we split that string on tabs `\t`, since that is what separates key from value.
def convert_kstat_string_to_map(metric_string): mdict = {} kstat_array = metric_string.split("\n") if len(kstat_array) < 1: return {} for entry in kstat_array: try: k, v = entry.split("\t") k = transform_key(k) # Simplify the key, stripping off part of the na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_kms_map(map_string):\n # The one line version:\n # dict({tuple(k.split(':')) for k in [i.strip() for i in m.split(',')]})\n result = dict()\n # split string by comma and strip\n lines = [i.strip() for i in map_string.split(\",\")]\n for line in lines:\n # split into key/value pair...
[ "0.63116443", "0.5993951", "0.53836644", "0.536574", "0.5346141", "0.53166217", "0.52213335", "0.5204446", "0.51734835", "0.51659495", "0.51624554", "0.51586246", "0.5055843", "0.5007188", "0.49962723", "0.4996204", "0.49873018", "0.49569792", "0.49507147", "0.49501076", "0.4...
0.75862825
0
comparator takes two arguments, both being metrics such as `anonfree_0=0`, `anonfree_1=0` and returns a 1 or a 1 depending upon if the number that follows underscore `_` is larger in a or b.
def comparator(a, b): a = re.split("[_=]", a)[-2] b = re.split("[_=]", b)[-2] if a > b: return 1 elif a < b: return -1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmp(a, b): # pylint: disable=invalid-name\n return (a > b) - (a < b)", "def sorter(a, b):\n ret = 0\n if isinstance(a, list):\n for key in args.sort:\n if key >= len(a):\n ret = -1\n break\n elif key >= len(b):\n ret = 1\n break\n elif a[key] != b[key]:\...
[ "0.65495247", "0.6273699", "0.61901987", "0.618433", "0.6111911", "0.61081874", "0.6081195", "0.6067617", "0.6032414", "0.5995582", "0.59620243", "0.58793074", "0.58745986", "0.57829523", "0.56796813", "0.55987024", "0.55398417", "0.55204886", "0.5519674", "0.54581475", "0.54...
0.7609379
0
Set the session description
def setSessionDescription(self, text): self.textEdit.setHtml(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_description(self, description):\r\n self.__description = description", "def set_description(self, description):\n self.description = description", "def set_description(self, descr):\n self._current_test_descr = descr", "def set_description(self, description):\n self.__desc...
[ "0.70972836", "0.7020007", "0.69936186", "0.6963085", "0.69266814", "0.68628764", "0.68568087", "0.68513757", "0.68398005", "0.68225795", "0.68025523", "0.68025523", "0.68025523", "0.68025523", "0.6732479", "0.6732479", "0.6732479", "0.6732479", "0.6732479", "0.6732479", "0.6...
0.74422276
0
Get the session description
def sessionDescription(self): return self.textEdit.toHtml()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SessionInfo(self):\r\n\t\treturn self._get_attribute('sessionInfo')", "def SessionInfo(self):\n return self._get_attribute('sessionInfo')", "def session_info(session, meta, test):\n assert not session.empty, 'Session cannot be empty!'\n session_type = session['type'].iloc[0]\n assessment = ...
[ "0.7459041", "0.72568417", "0.68514824", "0.67624974", "0.67097914", "0.66012126", "0.6560667", "0.64767367", "0.6353673", "0.6353673", "0.6335216", "0.63141453", "0.62628233", "0.62497854", "0.62497854", "0.62497854", "0.62497854", "0.62453496", "0.6221566", "0.6221566", "0....
0.7579908
0
Filename for image instance
def image_base_fn(self): return "{acc}-{ser:04}-{ins:04}".format(acc=self.tags['AccessionNumber'] or self.tags['StudyInstanceUID'], ser=self.tags["SeriesNumber"], ins=self.tags["InstanceNumber"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imagefile(self):\n return os.path.join(self.__folder, self.__name + '.jpg')", "def __str__(self):\n return \"{filename}\".format(filename=self.image.original_filename)", "def image_name(self) -> str:\n return self._image_name", "def get_image_filename(self, filename):\n path = 'im...
[ "0.7939681", "0.7801211", "0.77819073", "0.7525538", "0.75020635", "0.75015986", "0.7480913", "0.7464028", "0.741866", "0.7399048", "0.7381185", "0.7322192", "0.7311984", "0.72855026", "0.724738", "0.72352684", "0.7204876", "0.71969026", "0.71901476", "0.7168529", "0.716194",...
0.0
-1
The Relative Strength Index (RSI) is a momentum indicator which is measures the magnitude of recent price changes to evaluate overbought or oversold conditions. If RSI 70, Coin is exposed to overbought. This case is interpretable as the price of this coin will going up
def RSI(self, window): close = self.df.close delta = close.diff().dropna() self.df["change"] = delta u = delta * 0 d = u.copy() u[delta > 0] = delta[delta > 0] d[delta < 0] = -delta[delta < 0] u[u.index[window - 1]] = np.mean(u[:window]) # first valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RelativeStrengthIndex(self, timeperiod=14):\r\n return ta.RSI(self.data.close,timeperiod)", "def rsi(self, days=14):\n daily_returns = self.daily_returns(self.daily[['Adj Close']]).tail(14)\n green_days = daily_returns[daily_returns > 0].dropna()\n red_days = daily_returns[daily_r...
[ "0.7295669", "0.68439615", "0.6760943", "0.644682", "0.6381766", "0.63246286", "0.6253218", "0.6224118", "0.6209536", "0.60715145", "0.6056572", "0.6036526", "0.5978041", "0.59477395", "0.5930426", "0.59171873", "0.59018606", "0.5891379", "0.58791107", "0.5842883", "0.5807654...
0.66091007
3
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, V1alpha3GoTemplate): 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
Function to hide the code cells in a notebook.
def hide_code(hidden=True): html("""\ <script> code_show=%s; function code_toggle() { if (code_show){ $('div.input').hide(); } else { $('div.input').show(); } code_show = !code...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_hide_code(note):\n txt = open(PATH_UTILS + 'hide_code.py', 'r', encoding='utf-8').read()\n note['cells'] += [nb.v4.new_code_cell(txt)]\n note.cells[-1].metadata = {\"editable\": False, \"deletable\": False, \"tags\": ['run_start']}\n return", "def subnotebook_hide(self):\n if self.s...
[ "0.7112237", "0.68534327", "0.659966", "0.6587749", "0.6468249", "0.6437872", "0.6437872", "0.6403394", "0.6332046", "0.63291913", "0.6174006", "0.6172084", "0.6133993", "0.6122096", "0.6111658", "0.60922164", "0.60807323", "0.60753614", "0.6040076", "0.6039905", "0.60220015"...
0.71274674
0
takes a camera that has had it's position altered (typically by an axis) and bakes it's altered world space into a new camera node
def bakeCameraSpace(self): try: if nuke.selectedNode().Class() == "Camera2": self.__bakeWorldSpace(nuke.selectedNode()) else: nuke.message("Selected node must be a Camera node") except: nuke.message("Error - no node selected.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def world_to_camera(self, X):\n raise NotImplementedError", "def setup_camera(self) -> None:\n self.world.camera.update(\n cam_base_pos=(0, -3, 0),\n cam_dist=1.2*self.world.env_dim,\n cam_yaw=0,\n cam_pitch=-60\n )", "def adjust_camera(self):\n ...
[ "0.6688075", "0.66381145", "0.6591994", "0.65888757", "0.65076095", "0.64004433", "0.63798857", "0.63750744", "0.62982184", "0.6235511", "0.6187716", "0.6187313", "0.61619914", "0.61239475", "0.6119716", "0.6096442", "0.60927886", "0.60667163", "0.6007746", "0.5989382", "0.59...
0.6980743
0
Calculate the IoU(Intersection over Union) for each class
def per_class_iu(hist): np.seterr(divide="ignore", invalid="ignore") res = np.diag(hist) / (hist.sum(1) + hist.sum(0) - np.diag(hist)) np.seterr(divide="warn", invalid="warn") res[np.isnan(res)] = 0. return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_IoU(seg_mask, true_mask):\n eps = 1e-6 # Prevent divide by zeroes\n\n # Convert seg_mask to binary mask with only 1 or 0 values.\n binary_seg = torch.where(seg_mask > 0, torch.ones_like(seg_mask), torch.zeros_like(seg_mask))\n\n # Inclusion-exclusion principle\n intersection = binary_s...
[ "0.68877643", "0.67869514", "0.6752201", "0.6631859", "0.65857345", "0.6425162", "0.6418296", "0.6408841", "0.64022124", "0.63992167", "0.63788486", "0.63663274", "0.6277821", "0.6273821", "0.6273821", "0.61528766", "0.6145444", "0.6142657", "0.6142657", "0.6142657", "0.61324...
0.0
-1
estimate mdegree error for s2
def runge(s1: float, s2: float, L: float, m: float): return (s2 - s1) / (L**m - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmse (lmse) :\n return np.sqrt(2*lmse)", "def compute_RMSE(e):\n \"\"\"Corresponds to sqrt(2*MSE)\"\"\"\n \n return np.sqrt(2*compute_MSE(e))", "def error_metric(phi_1, phi_2, spherical=False, xpts=None):\n if spherical:\n return sum(abs(phi_1-phi_2)*(xpts**2))/(2.0*sum(abs(phi_1)*(xp...
[ "0.6182853", "0.61715615", "0.6012186", "0.59022266", "0.58656794", "0.58440846", "0.5806266", "0.5766214", "0.57342297", "0.5731087", "0.5699197", "0.5680345", "0.5665767", "0.566393", "0.5659827", "0.5639306", "0.5628909", "0.5608101", "0.5607554", "0.5579472", "0.557748", ...
0.0
-1
Calculate the global gradient angle of an Error Grid based on the slope of beta_1 / beta_2 from a linear regression fit.
def calc_angle(da: xr.DataArray, cost_ratio: float=None): reg, SSE = mlcs.utils.error_grids.fit_lin_reg(da, calc_SSE=True) beta_high, beta_low = reg.coef_ ratio = beta_high / beta_low if cost_ratio: ratio *= cost_ratio df = da.size - 3 nhighs = da.coords['n_high'].values var_nhigh ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(img):\n G = np.zeros(img.shape)\n theta = np.zeros(img.shape)\n\n #####################################\n # START YOUR CODE HERE #\n #####################################\n Gx = partial_x(img)\n Gy = partial_y(img)\n G = np.sqrt(np.square(Gx) + np.square(Gy))\n ...
[ "0.59149516", "0.5859289", "0.5844551", "0.5737306", "0.5718493", "0.56655866", "0.5659932", "0.56284887", "0.5601761", "0.5529818", "0.551096", "0.5509079", "0.54673326", "0.5466726", "0.5466726", "0.5444149", "0.5425494", "0.53982365", "0.53951985", "0.53383833", "0.5302447...
0.537984
19
Calculate slope ratio `tau` based on the angle of the EG's gradient
def calculate_tau(EG: xr.DataArray, cost_ratio): reg = fit_lin_reg(EG) coef_high, coef_low = reg.coef_[:2] if coef_high < 0 or coef_low < 0: raise InvalidSlopeError('Error Grid implies improvement from removing samples') coef_low /= cost_ratio # scale coef_low by cost ratio sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n b *= np.log(3 * self.scale ** 2 * np.exp(-2 * theta) + 1)\n return a / b", "def calculate_diff(grad_theta, grad_approx):\n # np.linalg.norm apply for matric equal to Frobenius no...
[ "0.6138993", "0.59789145", "0.5823093", "0.57981944", "0.5776396", "0.5776195", "0.5705586", "0.5691279", "0.56193495", "0.5604529", "0.55807406", "0.55803937", "0.55803937", "0.5576848", "0.55563194", "0.5526826", "0.54907715", "0.5488648", "0.5478156", "0.5473899", "0.54634...
0.55953866
10
Plot gradient descent thetas as line over dataset scatterplot.
def plot_descent(x, y, theta): # Compute prediction for each point in xx range using calculated theta values # h(x) = (theta0 * x0) + (theta1 * x1) xx = np.arange(5, 23) yy = theta[0] + theta[1] * xx plt.figure(figsize=(14, 8), dpi=80) plt.scatter(x[:, 1], y, s=30, c='r', marker='x', linewidths...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cost(self):\n steps = np.arange(len(self.cost_values))\n plt.plot(steps, self.cost_values, '-o')\n plt.xlabel(\"Steps\")\n plt.ylabel(\"Cost value\")\n plt.title(\"Cost value per step using Gradient Descent\")\n plt.show()", "def plotlyPlot():\n # ssr\n ss...
[ "0.64846843", "0.6428969", "0.62900597", "0.6232624", "0.611364", "0.59771335", "0.5971597", "0.5903416", "0.58416146", "0.58318317", "0.5830278", "0.5746247", "0.5720636", "0.5682795", "0.56789297", "0.5666363", "0.5622674", "0.56197906", "0.56176585", "0.5616535", "0.561597...
0.60491
5
Calculates a drawprobability from the given ``draw_margin``.
def calc_draw_probability(draw_margin, size, env=None): if env is None: env = global_env() return 2 * env.cdf(draw_margin / (math.sqrt(size) * env.beta)) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_draw_margin(draw_probability, size, env=None):\n if env is None:\n env = global_env()\n return env.ppf((draw_probability + 1) / 2.) * math.sqrt(size) * env.beta", "def v_draw(self, diff, draw_margin):\n abs_diff = abs(diff)\n a, b = draw_margin - abs_diff, -draw_margin - abs_d...
[ "0.7593655", "0.68792844", "0.67414105", "0.5885246", "0.55345535", "0.52636254", "0.5198962", "0.5196778", "0.5170926", "0.5135531", "0.5047053", "0.5020059", "0.500568", "0.493318", "0.49274144", "0.48958668", "0.48439947", "0.48370042", "0.4830074", "0.48175776", "0.481126...
0.82602787
0
Calculates a drawmargin from the given ``draw_probability``.
def calc_draw_margin(draw_probability, size, env=None): if env is None: env = global_env() return env.ppf((draw_probability + 1) / 2.) * math.sqrt(size) * env.beta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_draw_probability(draw_margin, size, env=None):\n if env is None:\n env = global_env()\n return 2 * env.cdf(draw_margin / (math.sqrt(size) * env.beta)) - 1", "def v_draw(self, diff, draw_margin):\n abs_diff = abs(diff)\n a, b = draw_margin - abs_diff, -draw_margin - abs_diff\n ...
[ "0.7477747", "0.6223534", "0.61708325", "0.56069916", "0.54442436", "0.5376421", "0.53312016", "0.5297077", "0.516239", "0.5148191", "0.51478463", "0.5144056", "0.51400197", "0.51288056", "0.5122004", "0.5095994", "0.50904644", "0.5081961", "0.50438356", "0.4950263", "0.49299...
0.83216906
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ListGlobalValue): 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
Returns a randomly generated short string.
def randomString(): randInt = random.randint(0, 10) randStr = ''.join(random.choice( string.ascii_letters) for _ in range(randInt)) return randStr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def _random_string(shortest, longest):\n length = randint(shortest, longest)\n s = \"\"\n pool = string.ascii_letters + \" \" # inject a few extra spaces, to in...
[ "0.76891124", "0.7688244", "0.74997", "0.7357174", "0.7332623", "0.7164021", "0.7114868", "0.7057856", "0.7044874", "0.7026395", "0.702491", "0.7014001", "0.6987521", "0.69705874", "0.6970573", "0.6966217", "0.6953872", "0.6950722", "0.69503194", "0.6936458", "0.69298416", ...
0.66551876
66
Returns all the protocol classes defined by the schema.
def getProtocolClasses(self): for name, obj in inspect.getmembers(protocol): if inspect.isclass(obj): # We're only interested in sublasses of ProtocolElement pe = protocol.ProtocolElement if issubclass(obj, pe) and obj is not pe: yi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_classes(self):\n classes = list(self.extended_class_only_graph.nodes())\n classes = [SchemaClass(_cls, self) for _cls in classes]\n return classes", "def protocols(self):\n return list(self.query(Protocol))", "def findModuleSchemas(self):\n if self.codebase:\n ...
[ "0.7062367", "0.6723887", "0.6395686", "0.633504", "0.6221008", "0.6120504", "0.60440546", "0.6010665", "0.6001568", "0.5988963", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "0.5941727", "...
0.7551249
0
Returns a new instance with the required values set.
def getDefaultInstance(self, cls): instance = cls() self.setRequiredValues(instance) return instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make(cls, **kwargs):\r\n return cls().fill(**kwargs)", "def copy(self):\n new = object.__new__(type(self))\n new.required = self.required\n new.title = self.title\n new.type = self.type\n values = self.values\n if (values is not None):\n values = (*...
[ "0.68121654", "0.6690383", "0.65534925", "0.65429395", "0.6465763", "0.6300176", "0.624437", "0.6218838", "0.62093496", "0.61966723", "0.6189887", "0.61832947", "0.6104517", "0.60942787", "0.608893", "0.60486805", "0.6022631", "0.6022631", "0.6022631", "0.6022631", "0.6015613...
0.0
-1
Returns the version string of the 'openhtf' package.
def get_version(): try: return pkg_resources.get_distribution('openhtf') except pkg_resources.DistributionNotFound: return 'Unknown - Perhaps openhtf was not installed via setup.py or pip.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versionstring():\n return \"%i.%i.%i\" % __version__", "def versionstring():\n return \"%i.%i.%i\" % __version__", "def version_string():\n git_hash = current_git_hash()\n if git_hash:\n return \"pyhole v%s (%s) - https://github.com/jk0/pyhole\" % (\n __VERSION__, git_hash)\n\...
[ "0.73133636", "0.73133636", "0.72330105", "0.7172031", "0.7097414", "0.70967686", "0.70698535", "0.7027617", "0.70062065", "0.69715357", "0.69603556", "0.6935816", "0.6935816", "0.69340885", "0.68973804", "0.68837523", "0.68592685", "0.6825335", "0.67367655", "0.6730656", "0....
0.8056936
0
Returns the first true value in the iterable. If no true value is found, returns default If pred is not None, returns the first item for which pred(item) is true.
def first_true(cls, iterable, default=None, pred=None): # first_true([a,b,c], x) --> a or b or c or x # first_true([a,b], x, f) --> a if f(a) else b if f(b) else x return next(filter(pred, iterable), default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_true(iterable, default=False, pred=None):\n return next(filter(pred, iterable), default)", "def first(iterable: Iterable[T1], predicate: Callable[[T1], bool]) -> Union[T1, None]:\n for x in iterable:\n if predicate(x):\n return x\n return None", "def FirstTrue(values, defau...
[ "0.87022644", "0.7288942", "0.7259494", "0.69324744", "0.6794274", "0.6624067", "0.6258699", "0.62093365", "0.6182306", "0.61817974", "0.60582894", "0.59692484", "0.593946", "0.5907112", "0.5882776", "0.5742157", "0.5742157", "0.56672215", "0.5650616", "0.56438434", "0.558820...
0.84863067
1
Evaluate the fitness of a state vector.
def evaluate(self, state): fitness = np.sum(state) self.num_evals += 1 #print(self.num_evals) return fitness
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state):\n\n fitness = 0\n\n for i in range(1, len(state)):\n if state[i] != state[i - 1]:\n fitness += 1\n\n return fitness", "def evaluate(self, state):\n\n if len(state) != len(self.weights):\n raise Exception(\"\"\"The state a...
[ "0.75081766", "0.7447023", "0.71910894", "0.6742266", "0.65359807", "0.6515264", "0.63796794", "0.63756007", "0.6305913", "0.6243057", "0.62399966", "0.6224244", "0.6218143", "0.6212684", "0.6119431", "0.61112726", "0.6109357", "0.61066234", "0.6089871", "0.6062419", "0.60015...
0.80098045
0
Return the problem type. Returns
def get_prob_type(self): return self.prob_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_type(self):\n return self._problem_type", "def get_problem_type():\n problem_type = input(\"What type of problem do you want?\")\n return problem_type", "def getprobtype(self): # 3\n res,resargs = self.__obj.getprobtype()\n if res != 0:\n result,msg = self.__getlasterr...
[ "0.9160186", "0.7815036", "0.73731285", "0.72935814", "0.6773175", "0.67403567", "0.6690188", "0.6674199", "0.6661264", "0.6547367", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0....
0.0
-1
Evaluate the fitness of a state vector.
def evaluate(self, state): _n = len(state) _t = np.ceil(self.t_pct*_n) # Calculate head and tail values tail_0 = self.tail(0, state) head_1 = self.head(1, state) # Calculate R(X, T) if (tail_0 > _t and head_1 > _t): _r = _n else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state):\n\n fitness = np.sum(state)\n self.num_evals += 1\n #print(self.num_evals)\n return fitness", "def evaluate(self, state):\n\n fitness = 0\n\n for i in range(1, len(state)):\n if state[i] != state[i - 1]:\n fitness += 1...
[ "0.80098045", "0.75081766", "0.7447023", "0.6742266", "0.65359807", "0.6515264", "0.63796794", "0.63756007", "0.6305913", "0.6243057", "0.62399966", "0.6224244", "0.6218143", "0.6212684", "0.6119431", "0.61112726", "0.6109357", "0.61066234", "0.6089871", "0.6062419", "0.60015...
0.71910894
3
Return the problem type. Returns
def get_prob_type(self): return self.prob_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_type(self):\n return self._problem_type", "def get_problem_type():\n problem_type = input(\"What type of problem do you want?\")\n return problem_type", "def getprobtype(self): # 3\n res,resargs = self.__obj.getprobtype()\n if res != 0:\n result,msg = self.__getlasterr...
[ "0.9160186", "0.7815036", "0.73731285", "0.72935814", "0.6773175", "0.67403567", "0.6690188", "0.6674199", "0.6661264", "0.6547367", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0....
0.0
-1
Evaluate the fitness of a state vector.
def evaluate(self, state): if len(state) != len(self.weights): raise Exception("""The state array must be the same size as the""" + """ weight and values arrays.""") # Calculate total weight and value of knapsack total_weight = np.sum(state*self.weights)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state):\n\n fitness = np.sum(state)\n self.num_evals += 1\n #print(self.num_evals)\n return fitness", "def evaluate(self, state):\n\n fitness = 0\n\n for i in range(1, len(state)):\n if state[i] != state[i - 1]:\n fitness += 1...
[ "0.80098045", "0.75081766", "0.71910894", "0.6742266", "0.65359807", "0.6515264", "0.63796794", "0.63756007", "0.6305913", "0.6243057", "0.62399966", "0.6224244", "0.6218143", "0.6212684", "0.6119431", "0.61112726", "0.6109357", "0.61066234", "0.6089871", "0.6062419", "0.6001...
0.7447023
2
Return the problem type. Returns
def get_prob_type(self): return self.prob_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_type(self):\n return self._problem_type", "def get_problem_type():\n problem_type = input(\"What type of problem do you want?\")\n return problem_type", "def getprobtype(self): # 3\n res,resargs = self.__obj.getprobtype()\n if res != 0:\n result,msg = self.__getlasterr...
[ "0.9160186", "0.7815036", "0.73731285", "0.72935814", "0.6773175", "0.67403567", "0.6690188", "0.6674199", "0.6661264", "0.6547367", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0.65317446", "0....
0.0
-1
Apply one step of gradient descent on the loss function `loss`, with stepsize `step_size`, and returns the updated parameters of the neural network.
def update_params(self, loss, step_size=0.5, first_order=False): grads = torch.autograd.grad(loss, self.parameters(), create_graph=not first_order) updated_params = OrderedDict() for (name, param), grad in zip(self.named_parameters(), grads): updated_params[name] = param ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, loss, step_size=0.5, first_order=False):\n #grads = torch.autograd.grad(loss, self.parameters(),\n # create_graph=not first_order)\n self.optim.zero_grad()\n loss.backward()\n nn.utils.clip_grad_norm(self.parameters(), self.grad_clip_norm)\n self...
[ "0.67761815", "0.66956115", "0.65015525", "0.6250007", "0.62382925", "0.62381643", "0.6238152", "0.6236581", "0.6222566", "0.6208493", "0.6163873", "0.6115026", "0.6065297", "0.6038957", "0.60363066", "0.60363066", "0.6027113", "0.6026331", "0.6010901", "0.60023475", "0.59567...
0.68324673
0
Returns starting state of the board.
def initial_state(): board = [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]] return board
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)", "def start_state():\n return chess.Board()", "def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))...
[ "0.8081514", "0.7890486", "0.7534929", "0.72789717", "0.72789717", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", ...
0.6802382
61
Returns player who has the next turn on a board.
def player(board): count = 0 rows = 3 columns = 3 for i in range(rows): for j in range(columns): if board[i][j] != EMPTY: count += 1 if count % 2 == 0: player = X else: player = O return player #raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None", "def next_player(self,board, prev_player):\r\n...
[ "0.7910555", "0.75213116", "0.74201775", "0.7369738", "0.7194517", "0.6977835", "0.6960541", "0.6925484", "0.69202083", "0.6902865", "0.68449634", "0.68402296", "0.68379575", "0.6823635", "0.6776662", "0.6776662", "0.6771359", "0.67104214", "0.670563", "0.66565573", "0.661637...
0.0
-1
Returns the optimal action for the current player on the board.
def minimax(board): actionset = actions(board) retaction = [] if player(board) == X: v = -10 else: v = 10 for action in actionset: if player(board) == X: retvalue = minvalue(result(board, action)) if retvalue > v: v = retvalue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction", "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min...
[ "0.7766856", "0.76323676", "0.75855315", "0.75285065", "0.75175256", "0.74667144", "0.7460485", "0.74263537", "0.7416421", "0.73943585", "0.7375846", "0.7333894", "0.73147565", "0.7306611", "0.7284639", "0.72650313", "0.72650313", "0.7250975", "0.72331834", "0.7203267", "0.71...
0.0
-1
Split an event log dataframe by time to peform splitvalidation. prefered method time splitting removing incomplete traces. If the testing set is smaller than the 10% of the log size the second method is sort by traces start and split taking the whole traces no matter if they are contained in the timeframe or not
def split_timeline(self, size: float, one_ts: bool) -> None: # Split log data splitter = ls.LogSplitter(self.log) train, test = splitter.split_log('timeline_contained', size, one_ts) total_events = len(self.log) # Check size and change time splitting method if necesary if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_split(X, test_size=0.1):\n split_index = int(len(X)*(1 - test_size))\n return X[:split_index], X[split_index:]", "def split_time_series_by_time_steps_index(df, n_time_steps=None):\n\t\n\ttime_steps = df.index.get_level_values(1).unique()\n\tsplit_time_step = time_steps[-n_time_steps]\n\ttrain = df...
[ "0.64267266", "0.6192035", "0.61151654", "0.58443666", "0.582601", "0.57716763", "0.5668337", "0.56510764", "0.56505275", "0.5618496", "0.5566262", "0.5548292", "0.5527727", "0.5519892", "0.55147856", "0.55078566", "0.55035275", "0.545697", "0.54563254", "0.54225177", "0.5366...
0.71883243
0
Return the action next action selected by the agent. Outputs
def get_next_action(self, epsilon, learning_params): T = learning_params.T if random.random() < epsilon: # With probability epsilon, randomly select an action for each agent. a_selected = np.full(self.num_agents, -1, dtype=int) for i in range(self.num_agents): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action(self):\n next_action = self.strategy.get_next_move(self)\n return next_action", "def get_next_action(self):\n chosen_action = None\n while chosen_action is None:\n choice = input('Action: ')\n chosen_action = KEY_MAP.get(choice)\n\n return chose...
[ "0.77348566", "0.76988024", "0.7441929", "0.74284875", "0.7412045", "0.7385118", "0.714362", "0.70616716", "0.70453864", "0.7011706", "0.70064795", "0.6931277", "0.69082123", "0.68556374", "0.6845028", "0.68296814", "0.68015426", "0.67955905", "0.6794064", "0.6776298", "0.676...
0.68580794
13
Build a Pyspark session Returns A Pyspark object
def create_spark_session(): try: spark = ( SparkSession.builder .config("spark.jars.packages", os.environ['SAS_JAR']) # .config("spark.hadoop.fs.s3a.awsAccessKeyId", os.environ['AWS_ACCESS_KEY_ID']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()", "def get_pyspark_session():\n session_object = SparkSession \\\n .builder \\\n .appName(\"PySpark ...
[ "0.83327085", "0.8046334", "0.79543847", "0.7754394", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.7748665", "0.77421665", "0.7740549", "0.7740549", "0.7740549", "0.7740549", "0.77382874", "0.7731292", "0.7698544",...
0.74778855
26
Create DataFrame from the parsed Data dictionary file
def build_df_from_ref_file(ref_file, start_pos=2, end_pos=7, col_name=None, index_name=None): return ( pd.Series(parse_ref_file(ref_file, start_pos, end_pos)) .to_frame() .rename(columns={0: col_name}) .reset_index() .rename(columns={'index': inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data(self, path_to_file):\n\n line_dict, rel_dict = self.create_dicts(path_to_file)\n \n line_df = self.create_dataframe(line_dict, ['line'])\n rel_df = self.create_dataframe(rel_dict, ['relation'])\n\n line_df['relation'] = rel_df['relation']\n\n return (line_df, rel_df)", "def proce...
[ "0.7004567", "0.69562083", "0.68595755", "0.6774606", "0.6704738", "0.6596856", "0.6540819", "0.6505419", "0.6505325", "0.6492833", "0.64542645", "0.6427116", "0.6425097", "0.6395477", "0.63791543", "0.6372056", "0.63535446", "0.63303703", "0.63155377", "0.62897986", "0.62727...
0.0
-1
Test the MockQueue class.
def test_MockQueue(): bar = tqdm() q = u.MockQueue(bar) q.put(100) assert q.bar.n == 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_enqueue(self):\n queue = Queue()\n self.assertEqual(queue.size(), 0)\n queue.enqueue(1)\n queue.enqueue(2)\n queue.enqueue(3)\n self.assertEqual(queue.size(), 3)", "def run_tests(queue_implementation):\n queue = queue_implementation()\n assert queue.is_empty()\n queue.enqueue(...
[ "0.78922653", "0.77418065", "0.7635926", "0.76101106", "0.7594009", "0.75306976", "0.75189656", "0.751147", "0.7507623", "0.74678576", "0.7400566", "0.73481435", "0.73302376", "0.72987705", "0.72449917", "0.7224505", "0.7149678", "0.71354973", "0.7114766", "0.7086792", "0.707...
0.8438599
0
Return filenames for dataset.
def get_filenames(is_training, data_dir): if is_training: return [ os.path.join(data_dir, 'train-%05d-of-01024' % i) for i in range(_NUM_TRAIN_FILES)] else: return [ os.path.join(data_dir, 'validation-%05d-of-00128' % i) for i in range(_NUM_VAL_FIL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filenames(is_training, data_dir):\n if is_training:\n return [os.path.join(data_dir, 'LIP_train5.record')]\n else:\n return [os.path.join(data_dir, 'LIP_val5.record')]", "def _get_filenames():\n src_dir = os.path.join(FLAGS.dataset_dir, FLAGS.src_dir)\n filenames = [os.path.join(src_dir, f)...
[ "0.7766535", "0.7426739", "0.7408156", "0.7402582", "0.7402582", "0.7394561", "0.73676705", "0.73119813", "0.7289597", "0.727325", "0.72470963", "0.7212114", "0.71790224", "0.7169908", "0.7137002", "0.70765924", "0.7013712", "0.69706774", "0.694884", "0.6901375", "0.68103343"...
0.7420046
2
Creates an evenly spaced interval to use as a range of filtration values.
def create_filtration_range(self, scale=None, max_filtration_value=None) -> np.array: if scale is None: scale = self.scale if max_filtration_value is not None: return np.linspace(0, max_filtration_value, self.filtration_size) if self.homology_dimension == 0: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_range(start, stop, step):\n return np.arange(start, stop+step/2, step)", "def buildIntervalSegs(array, interval: int):\n interSegs = []\n for i in range(interval):\n interSegs.append(array[i::interval])\n return np.array(interSegs)", "def r_style_interval(from_tuple, end_tuple, frequency):\n ...
[ "0.5999482", "0.59812516", "0.5974637", "0.59200054", "0.5787575", "0.5768546", "0.57667994", "0.57047313", "0.5643463", "0.556981", "0.5543695", "0.55368435", "0.5516855", "0.55143434", "0.55001307", "0.54809254", "0.5479813", "0.54748803", "0.54722136", "0.546426", "0.54590...
0.6317225
0
Create a vector from a number LSB FIRST!!!!!!!!!!!!!!!
def number_to_vector(number: int, vector_size=32): s = bin(number)[2:] if len(s) < vector_size: s = "0" * (vector_size - len(s)) + s output = [0] * vector_size for i in range(len(s)): output[i] = int(s[i]) output.reverse() return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intToVec(n):\r\n return [n >> 12, (n >> 4) & 0xf, (n >> 8) & 0xf, n & 0xf]", "def decimal_to_corner_vector(n, number_of_bits):\n s = bin(n).replace(\"0b\", \"\")\n s = s.rjust(number_of_bits, '0')\n c1 = pd.Series(list(s))\n c1 = c1.astype(int)\n return c1.replace(0, -1)", "def get_zero_...
[ "0.7085845", "0.62972724", "0.6276475", "0.6213324", "0.6041432", "0.59361655", "0.5902283", "0.58999306", "0.58699346", "0.58599424", "0.5828952", "0.58046937", "0.57877666", "0.57858515", "0.5780399", "0.57767344", "0.57587343", "0.5728288", "0.5721875", "0.57189244", "0.56...
0.7434745
0
Test if the input is "this" Color, not a subclass.
def _is_this_color(cls, obj: Any) -> bool: return type(obj) is cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_color(cls, obj: Any) -> bool:\n\n return isinstance(obj, Color)", "def is_color(self, color: ColorLike) -> bool:\n\n if isinstance(color, Color):\n return self.color == color\n elif isinstance(color, str):\n return str(self.color) == color\n elif isinstan...
[ "0.776884", "0.7128117", "0.69108284", "0.6559909", "0.647652", "0.6433103", "0.63495064", "0.63337225", "0.6310386", "0.6266546", "0.6242059", "0.61742085", "0.6167546", "0.61622715", "0.61456996", "0.6129218", "0.6100601", "0.6030644", "0.60186315", "0.60119116", "0.6007696...
0.7999573
0