query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Search the shallowest nodes in the search tree first.
def breadthFirstSearch(problem): # Initialization startState = problem.getStartState() #print "Start:", startState if problem.isGoalState(startState): return [] # No action needed route = util.Stack() closed = set([startState]) queue = util.Queue() # BFS use queue #print probl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_first_search(self):\r\n queue = [self.root]\r\n ordered = []\r\n while queue:\r\n node = queue.pop()\r\n ordered.append(node)\r\n queue.extend(node.children)\r\n \r\n while ordered:\r\n yield ordered.pop()", "def depth_first...
[ "0.69212437", "0.6735283", "0.65919083", "0.6531888", "0.65225047", "0.6516331", "0.64351237", "0.63715476", "0.6349844", "0.63109314", "0.6268638", "0.6257352", "0.6188826", "0.61808306", "0.61757225", "0.60988986", "0.6075095", "0.60709614", "0.6029654", "0.60286295", "0.60...
0.0
-1
Search the node of least total cost first.
def uniformCostSearch(problem): # Initialization startState = problem.getStartState() if problem.isGoalState(startState): return [] # No action needed closedSet = set() queue = util.PriorityQueue() queue.push((startState, None, 0), 0) cameFrom = dict() # Stores most efficient previ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cost and node not in self.closed_nodes:\n lowest_cost = cost\n lowest_cos...
[ "0.7481386", "0.6694703", "0.6617916", "0.66044676", "0.65461653", "0.6504626", "0.64884573", "0.647909", "0.6447552", "0.6389625", "0.6388501", "0.63831747", "0.63667625", "0.63632995", "0.6247147", "0.62458867", "0.6236465", "0.62307185", "0.6224366", "0.6224366", "0.620009...
0.0
-1
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def nullHeuristic(state, problem=None): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.7426833", "0.74019325", "0.7289642", "0.7283483", "0.725888", "0.7187531", "0.71825695", "0.71577257", "0.7100921", "0.7079827", "0.70684016", "0.70438904", "0.7041257", "0.70360833", "0.70249933", "0.70163226", "0.7000325", "0.6999366", "0.6981361", "0.696439", "0.6958896...
0.0
-1
Search the node that has the lowest combined cost and heuristic first.
def aStarSearch(problem, heuristic=nullHeuristic): # Initialization startState = problem.getStartState() if problem.isGoalState(startState): return [] # No action needed closedSet = set() queue = util.PriorityQueue() queue.push((startState, None, 0), heuristic(startState, problem)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cost and node not in self.closed_nodes:\n lowest_cost = cost\n lowest_cos...
[ "0.74892557", "0.73000836", "0.71319556", "0.6932297", "0.69006664", "0.68994766", "0.6878126", "0.6841432", "0.68067044", "0.6788856", "0.6784744", "0.6753299", "0.6739961", "0.6634752", "0.66336495", "0.66227347", "0.6616595", "0.65899295", "0.65704364", "0.65478617", "0.65...
0.59718484
98
If the lowered text is 'true' or 'false' the appropriate boolean is returned
def load(text: str, options: Dict[str, str]) -> bool: text = text.strip().lower() if text in {"true", "yes", "on"}: return True if text in {"false", "no", "off"}: return False raise LoadingError("Can't determine boolean value")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def booleanize(text):\n ltext = text.lower()\n if ltext == 'true':\n booleanized = True\n elif ltext == 'false':\n booleanized = False\n else:\n raise ValueError('A monk asked: Is \"{}\" true or false.'.format(text))\n return booleanized", "def convertStringToBool(nodeText):\n...
[ "0.7524646", "0.6901851", "0.66677165", "0.6506218", "0.6444906", "0.64205945", "0.63552976", "0.6349662", "0.63489693", "0.6329074", "0.6318621", "0.63013846", "0.6268736", "0.62516916", "0.62137383", "0.6187557", "0.61653936", "0.61290747", "0.6118757", "0.6102744", "0.6065...
0.59432244
26
Helper function to print a summary of a classifier performance
def print_summary(accuracies, group, df): p_ids = np.unique(group) print("Accuracies: ") for accuracy, p_id in zip(accuracies, p_ids): print(f"Participant {p_id}: accuracy = {accuracy}") num_window_baseline = len(df[(df['id'] == p_id) & (df['is_hot'] == 0)].to_numpy()) num_window_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_brief_summary(self):\n print (\"Model {}\".format(self.modelName))\n print (\"Precision {}\".format(self.precision))\n print (\"Recall {}\".format(self.recall))\n print (\"f1 score {}\".format(self.f1))\n \n # work here\n print (\"\\nGold NER label...
[ "0.7270726", "0.70429623", "0.69756776", "0.69746333", "0.69292647", "0.68630636", "0.68172073", "0.67152035", "0.6708259", "0.6703403", "0.66761726", "0.666146", "0.6644447", "0.6610819", "0.65767056", "0.6573381", "0.6570995", "0.65342104", "0.65081817", "0.64916724", "0.64...
0.61948866
51
Takes a text file of filenames and makes a list of filenames
def files_to_list(filename): with open(filename, encoding='utf-8') as f: files = f.readlines() files = [f.rstrip() for f in files] return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_to_list(filename):\n curdir = Path(filename).parent\n outs = []\n with open(filename, encoding=\"utf-8\") as fin:\n for line in fin:\n if line.strip():\n fname = Path(line.strip().split(\"\\t\")[0])\n if fname.exists():\n outs.ap...
[ "0.7637841", "0.7474673", "0.7343156", "0.7303888", "0.7272115", "0.7217177", "0.72108996", "0.720633", "0.7137104", "0.70621216", "0.7039949", "0.7039732", "0.70373243", "0.69536304", "0.69348955", "0.6909082", "0.68814677", "0.6870362", "0.6851389", "0.68349504", "0.6805668...
0.7483208
1
Loads wavdata into torch array
def load_wav_to_torch(full_path): sampling_rate, data = read(full_path) return torch.from_numpy(data).float(), sampling_rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_wav_to_torch(self, full_path):\n data, sampling_rate = load(full_path, sr=self.sampling_rate)\n data = 0.95 * normalize(data)\n\n if self.augment:\n amplitude = np.random.uniform(low=0.3, high=1.0)\n data = data * amplitude\n\n return torch.from_numpy(data...
[ "0.71620315", "0.66123015", "0.63704735", "0.6138623", "0.61151135", "0.6111932", "0.6079597", "0.6057111", "0.6023101", "0.6000103", "0.5971272", "0.594401", "0.59429103", "0.5886555", "0.58604324", "0.5857195", "0.58190787", "0.58040625", "0.5787966", "0.57829833", "0.57731...
0.7503719
0
Clears all of the tables that will be populated.
def clear_tables(cursor): cursor.execute("delete from Review_Votes") cursor.execute("delete from Review")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_tables(self):\n for table in self.modified_tables:\n self.api.do_table_clear(table)\n self.modified_tables = []", "def empty_tables(self):\n for table in TABLES_TO_EMPTY:\n self.empty_table(table)", "def empty_tables():\n Wordform.objects.all().delete()\n...
[ "0.860994", "0.8198014", "0.8091217", "0.80763143", "0.8029768", "0.79402643", "0.78967285", "0.78723335", "0.78344613", "0.7790497", "0.7782716", "0.77736187", "0.7606922", "0.75869834", "0.74377674", "0.73800296", "0.73114467", "0.729961", "0.7238571", "0.7226146", "0.71941...
0.76389
12
Drops indexes from all of the tables that will be populated
def drop_indexes(cursor): try: cursor.execute("DROP INDEX Review_Business_id_index ON review") cursor.execute("DROP INDEX Review_date_index ON review") cursor.execute("DROP INDEX Review_stars_index ON review") cursor.execute("DROP INDEX Review_user_id_index ON review") cursor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_non_unique_indexes(self):\n for idx in self.droppable_indexes:\n log.info(\"Dropping index '{}' on intermediate table\".format(idx.name))\n self.ddl_guard()\n self.execute_sql(sql.drop_index(idx.name, self.new_table_name))", "def setup():\n with get_session() a...
[ "0.75803274", "0.7347539", "0.72600216", "0.72363985", "0.7221425", "0.7056768", "0.70466244", "0.68622136", "0.68118054", "0.6661401", "0.6569707", "0.656742", "0.6566741", "0.6531738", "0.6496841", "0.64940965", "0.6480109", "0.6465053", "0.64434534", "0.6427655", "0.639116...
0.74130267
1
Creates indexes on all of the tables that will be (have been) populated
def create_indexes(cursor): try: cursor.execute("CREATE INDEX Review_Business_id_index ON review (business_id)") cursor.execute("CREATE INDEX Review_date_index ON review (review_date)") cursor.execute("CREATE INDEX Review_stars_index ON review (stars)") cursor.execute("CREATE INDEX R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index_tables(self):\n # List of urls that have been indexed\n self.con.execute('create table urllist(url)')\n # List of words\n self.con.execute('create table wordlist(word)')\n # What doc the word is and where it is in the doc\n self.con.execute('create table w...
[ "0.7511958", "0.74734473", "0.74729383", "0.74468094", "0.7099334", "0.70934683", "0.703564", "0.697659", "0.69103444", "0.686805", "0.6862599", "0.68624216", "0.68158984", "0.67738", "0.6735264", "0.67322457", "0.67276037", "0.6716077", "0.66908944", "0.6667861", "0.6622081"...
0.6693698
18
Read in the json data set file and load into database
def parse_file(file_path, batch_size=100, how_many=-1): db = MySQLdb.connect(**login_info) # From http://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character db.set_character_set('utf8') cursor = db.cursor() # From http://stackoverflow.com/questions/3942888/u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_db(self):\n with open(self.filename, 'r') as database:\n data = json.load(database)\n self.data = data", "def load_from_json(path_to_db):\r\n with open(path_to_db, 'r') as fproc:\r\n data_ = json.load(fproc)\r\n \r\n return data_", "def import_local_jso...
[ "0.77956593", "0.7332696", "0.73022217", "0.6952608", "0.6949045", "0.6850796", "0.66739786", "0.6601182", "0.65837497", "0.6536796", "0.6525358", "0.65125436", "0.64937377", "0.64803547", "0.6470408", "0.6457074", "0.6454217", "0.6452688", "0.63827", "0.63395876", "0.6338714...
0.0
-1
This function persists a list of YelpReview objects. Original implementations persisted each one individually, which performed slowly. This one accepts a collection and takes advantage of parameterized queries to persist in batches
def persist_list_o_review_objects(list_o_yros, cursor): review_data = [] review_set_count = 0 review_votes_data = [] review_votes_set_count = 0 for yro in list_o_yros: review_data += [yro.review_id, yro.business_id, yro.user_id, yro.stars, yro.review_text, yro.review_date] review_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all(self, obj_list):\n\n for obj in obj_list:\n self.save(obj)", "def save_many(self, values, expires_in=None):\n raise NotImplementedError()", "def save_all(self):\r\n for index in range(self.count()):\r\n self.save(index)", "def save_all(objs: List[ModelB...
[ "0.6075593", "0.584283", "0.5832359", "0.58084935", "0.5804483", "0.57376075", "0.5726918", "0.5712181", "0.56696975", "0.55989873", "0.55971265", "0.557263", "0.54924774", "0.5456378", "0.5439148", "0.5396648", "0.5394186", "0.53573656", "0.53533447", "0.53365165", "0.528779...
0.69471145
0
Saves a single YelpReview object to database. This is the original implementation but it turns out that this was poorly performing, so I scrapped it in favor of persist_list_o_business_objects
def persist_review_object(yro, cursor): try: # Review sql = " INSERT INTO Review " \ " (review_id, business_id, user_id, stars, review_text, review_date) " \ " VALUES " \ " (%s, %s, %s, %s, %s, %s) " cursor.execute(sql, [yro.review_id, yro.business_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persist_list_o_review_objects(list_o_yros, cursor):\n\n review_data = []\n review_set_count = 0\n review_votes_data = []\n review_votes_set_count = 0\n for yro in list_o_yros:\n review_data += [yro.review_id, yro.business_id, yro.user_id, yro.stars, yro.review_text, yro.review_date]\n ...
[ "0.62934196", "0.57796127", "0.5716861", "0.553972", "0.54539156", "0.5425099", "0.5403932", "0.5344349", "0.52043295", "0.52019465", "0.5195939", "0.51627856", "0.5155536", "0.5154143", "0.5138815", "0.5138815", "0.5138815", "0.5138815", "0.5138815", "0.5138815", "0.5138815"...
0.674485
0
Draw heatmaps of GT or prediction.
def draw_instance_xy_heatmap(self, heatmap: torch.Tensor, overlaid_image: Optional[np.ndarray], n: int = 20, mix: bool = True, weight: float = 0.5): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_heatmap(self, y_pred: np.ndarray, output_dir: Path) -> None:\n df = pd.crosstab(\n pd.Series(self.y_test),\n pd.Series(y_pred),\n rownames=[\"True:\"],\n colnames=[\"Predicted:\"],\n margins=True,\n )\n plt.figure()\n sns.h...
[ "0.63661927", "0.6329287", "0.62715816", "0.62563485", "0.62451196", "0.6241104", "0.6234506", "0.6222076", "0.62010497", "0.61973405", "0.61956346", "0.61879754", "0.6177805", "0.6177805", "0.6175374", "0.6162437", "0.60854924", "0.6061174", "0.6035436", "0.6029675", "0.5990...
0.0
-1
Extract onedimensional heatmap from twodimensional heatmap and calculate the number of keypoint.
def split_simcc_xy(self, heatmap: Union[np.ndarray, torch.Tensor]): size = heatmap.size() k = size[0] if size[0] <= 20 else 20 maps = [] for _ in range(k): xy_dict = {} single_heatmap = heatmap[_] xy_dict['x'], xy_dict['y'] = self.merge_maps(single_hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nb_vals(i, pnts, dem, top_left_cor, cellsize, rows, cols):\n nb_x = np.zeros((5,5)) # this 5 by 5 max would contain the x coordinate of 16 neighbor pixels of a sample point\n nb_y = np.zeros((5,5)) # this 5 by 5 matrix would contain the y coordinate of 16 neighbor pixels of a sample point\n nb_z =...
[ "0.5875513", "0.57561564", "0.5722097", "0.56651795", "0.56617665", "0.5555297", "0.55204695", "0.55097175", "0.54291666", "0.5423284", "0.5420427", "0.54138064", "0.5410358", "0.5395294", "0.53594035", "0.5349509", "0.5343586", "0.5334859", "0.53226465", "0.53174984", "0.530...
0.5741452
2
Synthesis of onedimensional heatmap.
def merge_maps(self, map_2d): x = map_2d.data.max(0, keepdim=True)[0] y = map_2d.data.max(1, keepdim=True)[0] return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manipulate_heat_data(self): \n self.exh.T_array = ( 0.5 * (self.exh.T_inlet_array +\n self.exh.T_outlet_array) + 273.15)\n self.exh.delta_T_array = ( self.exh.T_inlet_array -\n self.exh.T_outlet_array )\n \n self.cool.delta_T_array = ( self.cool.T_inlet_array -...
[ "0.6389852", "0.62525254", "0.6004237", "0.59933597", "0.58478814", "0.5792686", "0.5781802", "0.5777574", "0.574419", "0.57376945", "0.57200783", "0.5710218", "0.56996936", "0.56954104", "0.566794", "0.5607255", "0.5584501", "0.5583896", "0.5573592", "0.5570283", "0.55618614...
0.0
-1
Draw a twodimensional heatmap fused with the original image.
def draw_2d_heatmaps(self, heatmap_2d): np_heatmap = ToPILImage()(heatmap_2d).convert('RGB') cv_img = cv.cvtColor(np.asarray(np_heatmap), cv.COLOR_RGB2BGR) map_2d = cv.applyColorMap(cv_img, cv.COLORMAP_JET) return map_2d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_heat_map(image, heat_map):\n return image", "def heat_map(path):\r\n x, y= np.loadtxt(fname=path, delimiter='\\t',dtype=int,\r\n usecols = (1,2), skiprows=100, unpack = True)\r\n\r\n fig, (ax,ax2) = plt.subplots(nrows=2, sharex=True, figsize=(20,10))\r\n\r\n extent = [x[0...
[ "0.74944293", "0.6625564", "0.6494976", "0.6417634", "0.6353444", "0.60608757", "0.6025617", "0.59894353", "0.59773195", "0.59464633", "0.5894591", "0.58209354", "0.581542", "0.58102053", "0.580214", "0.580186", "0.5799282", "0.57984924", "0.5793625", "0.57743084", "0.5765347...
0.7041537
1
Paste the foreground on the background.
def image_cover(self, background: np.ndarray, foreground: np.ndarray, x: int, y: int): fore_size = foreground.shape background[y:y + fore_size[0], x:x + fore_size[1]] = foreground return background
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_foreground(self):\n \n # crop, resize, color quantize\n self.crop_to_gridline()\n self.crop_title()\n self.set_size()\n self.color_quantization()\n self.display()\n img_and_pix = self.separate_colors()\n colors, images, pixels = zip(*img_and_pi...
[ "0.65060604", "0.6462951", "0.619184", "0.6119588", "0.600456", "0.5852422", "0.5847824", "0.5837442", "0.5816989", "0.5773358", "0.57702744", "0.57267535", "0.57213074", "0.56553453", "0.559615", "0.5578791", "0.5566179", "0.5562031", "0.5551797", "0.5535956", "0.54598844", ...
0.5635058
14
Paste onedimensional heatmaps onto the background in turn.
def add_1d_heatmaps(self, maps: dict, background: np.ndarray, map2d_size: Union[tuple, list], K: int, interval: int = 10): y_startpoint, x_startpoint = [int(1.1*map2d_size[1]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmd_heatmap(args):\n cnarrs = []\n for fname in args.filenames:\n cnarr = read_cna(fname)\n if args.adjust_xy:\n is_sample_female = verify_sample_sex(\n cnarr, args.sample_sex, args.male_reference, args.diploid_parx_genome\n )\n cnarr = cnarr...
[ "0.6045487", "0.59562194", "0.58167315", "0.57513165", "0.56921065", "0.5689646", "0.5628119", "0.5594635", "0.5566843", "0.5559819", "0.5533765", "0.55296916", "0.5498906", "0.5494224", "0.5464383", "0.5461347", "0.54449046", "0.5444866", "0.54397726", "0.54291356", "0.54224...
0.68941486
0
Wrapper of the command line tool sed to change variable values. Please note that some characters like / must be escaped to work.
def changeConfVar(varName, varValue, file="config/scipion.conf", escapeSlash=False): if escapeSlash: varValue = varValue.replace('/', '\/') command = ['bash', '-c', 'sed -i -e ' '"s/%s = .*/%s = %s/" ' '%s' % (varName, varName, varValue, file)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sed_like_thing(pattern, repl, path):\n\n with codecs.open(path, 'rb', 'utf8') as inf:\n data = inf.read()\n\n data = re.sub(pattern, repl, data)\n\n with codecs.open(path, 'wb+', 'utf8') as outf:\n outf.write(data)", "def bs_set(self, cmd, arg):\n\t\tif arg:\n\t\t\tfor x in self.split(...
[ "0.56367666", "0.56140023", "0.56025064", "0.55010325", "0.5443878", "0.5441514", "0.5424399", "0.52970827", "0.5294301", "0.52636224", "0.52600396", "0.5246227", "0.52333087", "0.52145934", "0.52100545", "0.51816446", "0.5165895", "0.5081385", "0.50499505", "0.5047105", "0.5...
0.6695324
0
Applies one linear downprojection layer, then softmax.
def build_graph(self, inputs, masks): with vs.variable_scope("SimpleSoftmaxLayer"): # Linear downprojection layer logits = tf.contrib.layers.fully_connected(inputs, num_outputs=1, activation_fn=None) # shape (batch_size, seq_len, 1) logits = tf.squeeze(logits, axis=[2]) # sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inputs):\n x_wrd = self.lookup(inputs)\n\n # bilinear attention\n x_avg = x_wrd.mean(dim=1)\n x = x_wrd.matmul(self.M)\n x = x.matmul(x_avg.unsqueeze(1).transpose(1, 2))\n if self.b is not None:\n x += self.b\n\n x = F.tanh(x) \n ...
[ "0.6428857", "0.6281456", "0.62317896", "0.61771274", "0.61514837", "0.61489147", "0.6069403", "0.6053344", "0.6052496", "0.6032014", "0.60229355", "0.6014218", "0.600776", "0.60007215", "0.5996227", "0.5970958", "0.59685767", "0.5956204", "0.59428155", "0.5934878", "0.593083...
0.0
-1
Keys attend to values. For each key, return an attention distribution and an attention output vector.
def build_graph(self, values, values_mask, keys): with vs.variable_scope("BasicAttn"): # Calculate attention distribution values_t = tf.transpose(values, perm=[0, 2, 1]) # (batch_size, value_vec_size, num_values) attn_logits = tf.matmul(keys, values_t) # shape (batch_size, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_attention(\n self, query_tensor, key_tensor, value_tensor, attention_mask=None\n ):\n # Take the dot product between \"query\" and \"key\" to get the raw\n # attention scores.\n attention_scores = tf.einsum( # pragma: no cover\n self._dot_product_equation, ke...
[ "0.64202654", "0.5826104", "0.5797294", "0.5704355", "0.57004243", "0.56263703", "0.5615481", "0.5609999", "0.5568032", "0.55614036", "0.555588", "0.55433214", "0.55367774", "0.55298233", "0.54890084", "0.5437827", "0.5414771", "0.539568", "0.5339974", "0.5238919", "0.5231451...
0.5771328
3
Keys attend to values. For each key, return an attention distribution and an attention output vector.
def build_graph(self, values, values_mask, keys, keys_mask): with vs.variable_scope("CrossAttn"): # Calculate attention distribution values_t = tf.transpose(values, perm=[0, 2, 1]) # (batch_size, value_vec_size, num_values) attn_matrix = tf.matmul(keys, values_t) # shape (ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_attention(\n self, query_tensor, key_tensor, value_tensor, attention_mask=None\n ):\n # Take the dot product between \"query\" and \"key\" to get the raw\n # attention scores.\n attention_scores = tf.einsum( # pragma: no cover\n self._dot_product_equation, ke...
[ "0.642035", "0.5826609", "0.57973295", "0.577184", "0.5703602", "0.5700191", "0.5626382", "0.5615878", "0.5609656", "0.55687195", "0.5560532", "0.5555562", "0.5543729", "0.5535787", "0.55293334", "0.54884267", "0.5436761", "0.54138774", "0.5395364", "0.5339128", "0.5238084", ...
0.51390535
27
Keys attend to values. For each key, return an attention distribution and an attention output vector.
def build_graph(self, values, values_mask, keys, keys_mask): with vs.variable_scope("BidirectionalAttn"): # Divide the weight matrix in 3 parts weights_sim1 = tf.get_variable(name = "weights_sim1", shape = [self.key_vec_size, 1], dtype = tf.float32, initializer = tf.random_normal_initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_attention(\n self, query_tensor, key_tensor, value_tensor, attention_mask=None\n ):\n # Take the dot product between \"query\" and \"key\" to get the raw\n # attention scores.\n attention_scores = tf.einsum( # pragma: no cover\n self._dot_product_equation, ke...
[ "0.6419863", "0.58255297", "0.5794626", "0.57707596", "0.5703138", "0.5698814", "0.5624967", "0.56137186", "0.560936", "0.55668586", "0.5561049", "0.5554973", "0.5542148", "0.5534193", "0.55285573", "0.54866225", "0.54355294", "0.54146504", "0.53954834", "0.5339041", "0.52375...
0.0
-1
Keys attend to values. For each key, return an attention distribution and an attention output vector.
def build_graph(self, values, values_mask, keys): with vs.variable_scope("CoAttn"): ######################################################################### # Introduce a non-linear projection layer on top of the question encoding # to allow f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_attention(\n self, query_tensor, key_tensor, value_tensor, attention_mask=None\n ):\n # Take the dot product between \"query\" and \"key\" to get the raw\n # attention scores.\n attention_scores = tf.einsum( # pragma: no cover\n self._dot_product_equation, ke...
[ "0.642035", "0.5826609", "0.57973295", "0.577184", "0.5703602", "0.5700191", "0.5626382", "0.5615878", "0.5609656", "0.55687195", "0.5560532", "0.5555562", "0.5543729", "0.5535787", "0.55293334", "0.54884267", "0.5436761", "0.54138774", "0.5395364", "0.5339128", "0.5238084", ...
0.49701777
48
Applies one linear downprojection layer, then softmax.
def build_graph(self, char_embeddings): with vs.variable_scope("CharLevelCNN"): batch_size = tf.shape(char_embeddings)[0] phrase_len = tf.shape(char_embeddings)[1] word_len = tf.shape(char_embeddings)[2] char_embedding_size = tf.shape(char_embeddings)[3] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inputs):\n x_wrd = self.lookup(inputs)\n\n # bilinear attention\n x_avg = x_wrd.mean(dim=1)\n x = x_wrd.matmul(self.M)\n x = x.matmul(x_avg.unsqueeze(1).transpose(1, 2))\n if self.b is not None:\n x += self.b\n\n x = F.tanh(x) \n ...
[ "0.6429836", "0.62832594", "0.6231738", "0.61789125", "0.6153917", "0.61492455", "0.6071372", "0.6055186", "0.6054922", "0.6033591", "0.60238487", "0.6013732", "0.60089844", "0.60023093", "0.59976494", "0.5972523", "0.59712166", "0.59581536", "0.594444", "0.5935604", "0.59327...
0.0
-1
Takes masked softmax over given dimension of logits.
def masked_softmax(logits, mask, dim): exp_mask = (1 - tf.cast(mask, 'float')) * (-1e30) # -large where there's padding, 0 elsewhere masked_logits = tf.add(logits, exp_mask) # where there's padding, set logits to -large prob_dist = tf.nn.softmax(masked_logits, dim) return masked_logits, prob_dist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_softmax(logits, mask, dim=-1, log_softmax=False):\n mask = mask.type(torch.float32)\n masked_logits = mask * logits + (1 - mask) * -1e30\n softmax_fn = F.log_softmax if log_softmax else F.softmax\n probs = softmax_fn(masked_logits, dim)\n\n return probs", "def masked_softmax(tensor, mas...
[ "0.80401665", "0.7654991", "0.761089", "0.75716364", "0.7517807", "0.74387515", "0.7438501", "0.7347286", "0.7323559", "0.73165834", "0.7309688", "0.73022497", "0.7278672", "0.72193605", "0.7214303", "0.71653897", "0.7160705", "0.7139164", "0.70996326", "0.70656717", "0.70488...
0.8118963
1
create a kdtree on data X.
def create(self, X, dimensions=None): n_samples, n_features = X.shape self.X = X if not dimensions: dimensions = n_features self.root = KdNode(depth=0, splitting_feature=0, splitting_value=np.median(X[:, 0]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_kdtree(self):\n if self.method==2:\n coordinates = self.unassigned_data[0:3,:]\n else:\n coordinates = self.unassigned_data[0:2,:]\n tree = cKDTree(coordinates.T)\n\n return tree", "def build_kdtree(points, depth=0):\n n = len(points) - 1\n\n if n <= 0:\n retur...
[ "0.76762074", "0.66742635", "0.66742635", "0.665417", "0.65665555", "0.6538967", "0.64309573", "0.63635075", "0.6318616", "0.6176345", "0.6175313", "0.60938823", "0.6080377", "0.60334706", "0.59839034", "0.5976341", "0.59736675", "0.59532875", "0.5938413", "0.58962005", "0.58...
0.694763
1
el input es la cuenta, se scrapea las urls de los 25 ultimos posteos
def recent_25_posts(username): url = "https://www.instagram.com/" + username + "/" #la ubicacion del chromedriver.exe browser = webdriver.Chrome(executable_path=r"C:\Users\pablo\Downloads\chromedriver.exe") #browser = Chrome() browser.get(url) post = 'https://www.instagram.com/p/' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urls(*params: str, num_of_links: int = 1) -> list:\n urls = []\n try:\n for i in range(num_of_links):\n url = \"https://finviz.com/screener.ashx?v=111\"\n codes = ','.join(rts_codes[len(rts_codes)*(num_of_links - i - 1)//num_of_links:(len(rts_codes)*(num_of_links - i)//nu...
[ "0.62636787", "0.625272", "0.6234339", "0.6171161", "0.6116975", "0.6103526", "0.60449106", "0.60208243", "0.598695", "0.59798187", "0.596747", "0.5944079", "0.5834039", "0.5832724", "0.58214533", "0.5794802", "0.57335097", "0.5716157", "0.5706557", "0.5690079", "0.5687363", ...
0.58384776
12
para cada url extraemos los detalles
def insta_details(urls): #la ubicacion del chromedriver.exe #browser = Chrome() browser = webdriver.Chrome(executable_path=r"C:\Users\pablo\Downloads\chromedriver.exe") post_details = [] for link in urls: browser.get(link) try: # extraemos los likes, si tu navegado...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def getVotacion(self, url):", "def data_collector(self, n, url, ret):\n try:\n html = urllib2.urlopen(url).read()\n soup = BeautifulSoup(html)\n ret[n] = [soup.title.string, url, html[0:100]]\n except:\n ret[n] = [\"Error\", url, \"Err...
[ "0.6954483", "0.69486177", "0.6624388", "0.66198707", "0.65335274", "0.62732834", "0.6233779", "0.61924917", "0.6190488", "0.61417556", "0.6139774", "0.6111866", "0.6100832", "0.6083687", "0.6059383", "0.6056347", "0.601275", "0.59806997", "0.59611386", "0.59448546", "0.59428...
0.5743172
44
This function should return a list of two agents that will form the team, initialized using firstIndex and secondIndex as their agent index numbers. isRed is True if the red team is being created, and will be False if the blue team is being created. As a potentially helpful development aid, this function can take addit...
def createTeam(firstIndex, secondIndex, isRed, first = 'danielAgent2', second = 'danielAgent2'): return [eval(first)(firstIndex), eval(second)(secondIndex)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createTeam(firstIndex, secondIndex, isRed,\n first = 'ReflexCaptureAgent', second = 'DefensiveReflexAgent'):\n return [eval(first)(firstIndex), eval(second)(secondIndex)]", "def createTeam(firstIndex, secondIndex, isRed,\n first = 'OffensiveReflexAgent', second = 'DefensiveReflex...
[ "0.8381065", "0.81612027", "0.81612027", "0.8137621", "0.81249464", "0.8116331", "0.81150866", "0.81116426", "0.80987436", "0.8088097", "0.8085381", "0.8085381", "0.8085381", "0.8033649", "0.79911155", "0.7974004", "0.79596937", "0.79452187", "0.79083234", "0.79005665", "0.78...
0.7831062
20
Get distance between two points going only through the defense land
def getMazeDistanceDefense(self, p1, p2): try: return self.distancerDefense.getDistance(p1, p2) except Exception: return self.getMazeDistance(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, other_pt, is_lla=True):\n return 0.0", "def get_distance(first: Point, second: Point) -> Float:\n\n return sqrt(\n (second.x - first.x) ** 2\n +\n (second.y - first.y) ** 2\n )", "def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n ...
[ "0.744277", "0.71968544", "0.7164096", "0.7129097", "0.707927", "0.7068014", "0.7024101", "0.7008225", "0.698951", "0.6964147", "0.693927", "0.6936985", "0.69191873", "0.6912923", "0.687099", "0.68569434", "0.68446594", "0.6841914", "0.68375", "0.68300796", "0.6805769", "0....
0.72054726
1
Examine map and create doors and rooms structure
def examineMaze(self, gameState): w = self.walls.width h = self.walls.height walls = self.walls.deepCopy() food1 = self.getFoodYouAreDefending(gameState) food2 = self.getFood(gameState) # Save map as 0, 1, 2 and 3 (0:walls, 1:spaces, 2:babies, 3:food) for x in range(w): for y in range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_map(json_game_map):\n room_hash = {}\n\n for room in constants.ROOMS:\n # Set name, description, and neighbors\n room_hash[room] = Room.Room()\n room_hash[room].set_name(room)\n room_hash[room].set_short_description(constants.ROOMS[room]['short_description'])\n r...
[ "0.68635213", "0.6726352", "0.65176284", "0.63991296", "0.6356377", "0.6259297", "0.61154157", "0.60060495", "0.5971213", "0.59510726", "0.5897919", "0.5805058", "0.5741392", "0.5700978", "0.56676257", "0.56442124", "0.56310874", "0.5589932", "0.55891556", "0.55738705", "0.55...
0.56462735
15
Get centroid (average point) of beliefs for an opponent
def getBeliefsCentroid(self, idx): x = 0.0 y = 0.0 total = 0.0 for p in self.beliefs[idx]: x += p[0] y += p[1] total += 1.0 return (round(x / total), round(y / total))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_centroid(self):\n num = 0\n centroid = numpy.zeros(3, float)\n for atm in self:\n if atm.position is not None:\n centroid += atm.position\n num += 1\n return centroid / num", "def centroid(self) -> Point:\n points = self.no...
[ "0.7214463", "0.6820861", "0.67982733", "0.67874646", "0.67413944", "0.6737949", "0.6652046", "0.6643116", "0.6635537", "0.6628157", "0.65908074", "0.65682214", "0.65392566", "0.65339446", "0.6527422", "0.6517385", "0.6476208", "0.6454607", "0.64542395", "0.6439064", "0.64369...
0.78195196
0
Get closest possible position of the opponent according to beliefs (if more than one possible, picks one randomly)
def getClosestPositionOpponent(self, idx, pos, defense=False): minD = 10000 opponentPos = [pos] for p in self.beliefs[idx]: if defense: d = self.getMazeDistanceDefense(pos, p) else: d = self.getMazeDistance(pos, p) if minD > d: minD = d opponentPos = [p] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _closest_front_opponent(self, raw_obs, o, target):\n delta = target - o\n min_d = None\n closest = None\n for p in raw_obs['right_team']:\n delta_opp = p - o\n if np.dot(delta, delta_opp) <= 0:\n continue\n d = self._object_distance(o,...
[ "0.7216672", "0.7017943", "0.68256783", "0.68243515", "0.67419386", "0.665059", "0.66476333", "0.6628106", "0.6597398", "0.6581693", "0.6525909", "0.6463664", "0.64581263", "0.64473104", "0.64380753", "0.6420585", "0.6400714", "0.63967943", "0.63782734", "0.6370442", "0.63704...
0.7711962
0
Get minimum possible distance to opponent
def getMinimumDistanceOpponent(self, idx, pos, defense=False): minD = 10000 if defense: for p in self.beliefs[idx]: minD = min(minD, self.getMazeDistanceDefense(pos, p)) else: for p in self.beliefs[idx]: minD = min(minD, self.getMazeDistance(pos, p)) return minD
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min_distance(self):\n return round(min(self.combined_euclidian_distance))", "def min_distance(self, target):\n difference = self.pivot - target\n return max(math.sqrt(np.dot(difference, difference)) - self.radius, 0)", "def _kings_distance(self, piece):\n min_distance = cons...
[ "0.72254676", "0.68654174", "0.686012", "0.6761133", "0.65992033", "0.65834254", "0.65676284", "0.65481323", "0.64017946", "0.6369925", "0.6305183", "0.62864286", "0.62798434", "0.62714386", "0.62629676", "0.62517095", "0.6235636", "0.6219681", "0.6214266", "0.6207137", "0.62...
0.75307536
0
Get minimum distance to middle of the board (my pacmanLand, opponents ghostLand)
def getMinimumDistancePacmanLand(self, pos): minD = 10000 for p in self.ghostLandPositions: minD = min(minD, self.getMazeDistance(pos, p)) return minD
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _kings_distance(self, piece):\n min_distance = constant.BOARD_DIMENSION - 1\n opponent_pieces = self.get_all_pieces(piece.get_player().other)\n for opp_piece in opponent_pieces:\n distance = abs(piece.row - opp_piece.row) + abs(piece.col - opp_piece.col) / 2\n if dist...
[ "0.68152446", "0.6605605", "0.650739", "0.64382017", "0.6427428", "0.63290226", "0.6286821", "0.6265279", "0.62342113", "0.61676383", "0.6067976", "0.6067287", "0.6066152", "0.60641265", "0.6040633", "0.6036753", "0.6031766", "0.600847", "0.5970721", "0.5944521", "0.593572", ...
0.72644186
0
Split food in top and bottom food, separated by median
def getSplitFoodList(self, gameState, margin=1): foodList = self.getFood(gameState).asList() foodListY = [p[1] for p in foodList] med = median(foodListY) splitList = [[], []] for i, p in enumerate(foodList): if p[1] <= med - margin: splitList[0].append(p) elif p[1] > med + margin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_median(numbers):\n middle_index = len(numbers) // 2\n return sorted(numbers[middle_index]) # sorted returns the numbers sorted without changing", "def _split_medians( medians, cutoff ):\n five_prime = []\n three_prime = []\n for key, median in medians.iteritems():\n if median <...
[ "0.6657142", "0.6612814", "0.6509927", "0.64185447", "0.63596123", "0.623155", "0.62060475", "0.61511374", "0.61496574", "0.61215526", "0.608347", "0.60135335", "0.6012894", "0.6006112", "0.59933764", "0.5985323", "0.59740883", "0.5955984", "0.5941399", "0.5927735", "0.590135...
0.67823243
0
The opponent died, update its belief to its starting position
def setOpponentToZeroPos(self, idx): self.beliefs[idx] = util.Counter() for pos in self.opponentZeroPos: self.beliefs[idx][pos] = 1.0 / len(self.opponentZeroPos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_knock_back_state(self):\n if self.name == 'player':\n self.x_vel = 4\n else:\n self.x_vel = -4\n\n self.state = c.KNOCK_BACK\n self.origin_pos = self.rect.topleft", "def set_eaten(self):\n self.state['return'] = True\n self.state['blue'] =...
[ "0.6459408", "0.6303483", "0.62613565", "0.61890364", "0.61888254", "0.6181082", "0.6180529", "0.61471343", "0.6126692", "0.6061175", "0.60561824", "0.605579", "0.6021284", "0.598978", "0.59865355", "0.59644526", "0.5958022", "0.5945965", "0.59203374", "0.5912217", "0.591127"...
0.0
-1
Set all legal positions with equal probability
def initializeBeliefsUniformly(self, gameState, idx): self.beliefs[idx] = util.Counter() for p in self.legalPositions: self.beliefs[idx][p] = 1.0 self.beliefs[idx].normalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance_generation(self):\n # Todo: implement\n for particle in self.particles:\n if particle.value > particle.best_value:\n particle.best_position = particle.x\n particle.best_value = particle.value\n rp = random.uniform(0.0, 1.0)\n ...
[ "0.6410945", "0.6389048", "0.6353788", "0.62320787", "0.6200577", "0.61826175", "0.6122533", "0.6099427", "0.60831887", "0.60590976", "0.60477996", "0.59618634", "0.5942169", "0.59254664", "0.59145194", "0.5910171", "0.585056", "0.5843743", "0.5838484", "0.58381385", "0.58333...
0.6138709
6
Set beliefs of one opponent to one single position
def setBeliefs(self, position, idx): self.beliefs[idx] = util.Counter() self.beliefs[idx][position] = 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOpponentToZeroPos(self, idx):\n self.beliefs[idx] = util.Counter()\n for pos in self.opponentZeroPos:\n self.beliefs[idx][pos] = 1.0 / len(self.opponentZeroPos)", "def updateEatenOpponents2(self, gameState, chosenAction):\n myNewPos = self.getSuccessor(gameState, chosenAction).getAgentState(...
[ "0.6645985", "0.62803483", "0.62631357", "0.60880804", "0.59455585", "0.58821756", "0.5861061", "0.575506", "0.5748615", "0.5737099", "0.5726178", "0.5698866", "0.56927747", "0.5685124", "0.5672717", "0.56487983", "0.5603451", "0.5589098", "0.5574924", "0.55408394", "0.552870...
0.6230174
3
Observe noisy distance for opponent and update beliefs according to them
def observe(self, observation, gameState, myPosition, idx): noisyDistance = observation noZero = False for p in self.legalPositions: if self.beliefs[idx][p] <= 0: self.beliefs[idx].pop(p, None) continue trueDistance = util.manhattanDistance(p, myPosition) prob = gameState.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observe(self, observation, gameState):\n noisyDistance = observation\n pacmanPosition = gameState.getPacmanPosition()\n\n \"*** YOUR CODE HERE ***\"\n\n # Replace this code with a correct observation update\n # Be sure to handle the \"jail\" edge case where the ghost is eaten...
[ "0.7071808", "0.65330017", "0.6131267", "0.6055183", "0.59546125", "0.58331645", "0.5822836", "0.57872796", "0.57719946", "0.57357174", "0.5674904", "0.5614523", "0.56074476", "0.5586609", "0.5580293", "0.55711126", "0.55707365", "0.5560386", "0.5550653", "0.5536806", "0.5532...
0.6566999
1
Update beliefs knowing that the opponent has mad a move
def elapseTime(self, idx): newBeliefs = util.Counter() for oldPos in self.legalPositions: if self.beliefs[idx][oldPos] <= 0: continue newPosDist = self.getPositionDistribution(oldPos) for newPos, prob in newPosDist.items(): newBeliefs[newPos] += prob * self.beliefs[idx][oldPos]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, is_my_turn, clue_word, clue_num_guesses, guesses):\r\n pass", "def updateEatenOpponents1(self, gameState, idx):\n teammatePos = gameState.getAgentState((self.index + 2) % 4).getPosition()\n pos = gameState.getAgentState(idx).getPosition()\n if pos is None and len(self.beliefs[idx...
[ "0.6580274", "0.65605146", "0.63730043", "0.63291717", "0.6262298", "0.6249394", "0.62343293", "0.61137736", "0.6058033", "0.60558474", "0.6041198", "0.5981814", "0.5868395", "0.582787", "0.58258116", "0.5741464", "0.57372504", "0.57355183", "0.5731516", "0.57227194", "0.5681...
0.54553366
65
From a position, return all the possible new positions after a move of the opponent with an equal probability distribution
def getPositionDistribution(self, position): dist = util.Counter() (x, y) = position total = 1.0 dist[position] = 1.0 if not self.walls[x + 1][y]: dist[(x + 1, y)] = 1.0 total += 1.0 if not self.walls[x - 1][y]: dist[(x - 1, y)] = 1.0 total += 1.0 if not self.walls[x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateMoves(position):\n return [move for move in POSSIBLE_MOVES if move <= position]", "def evaluate_position(num_items):\n comp_wins = 0\n player_wins = 0\n\n initial_move = random.randrange(MAX_REMOVE + 1)\n num_items -= initial_move\n next_move = random.randrange(MAX_REMOVE + 1)\n ...
[ "0.65959424", "0.6590027", "0.65190655", "0.64605963", "0.63720465", "0.626335", "0.62120914", "0.619868", "0.61953133", "0.6146514", "0.6142938", "0.6122146", "0.6102404", "0.60923314", "0.6071721", "0.59913236", "0.59494513", "0.5934421", "0.59281343", "0.5920294", "0.59020...
0.5599773
44
Get the positions of the babies (the food we are protecting) that are gone (aka have been eaten by the opponent) and save them in eaten
def getEatenBabies(self, gameState): eaten = [] newFood = self.getFoodYouAreDefending(gameState) for pos in self.babies: if not newFood[pos[0]][pos[1]]: eaten.append(pos) return eaten
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trackGhosts(self, gameState):\n\n # Get some values that we will use later\n myState = gameState.getAgentState(self.index)\n myPos = myState.getPosition()\n noisyDistances = gameState.getAgentDistances()\n eatenBabies = self.getEatenBabies(gameState)\n\n # Track each opponent\n opponentFo...
[ "0.6153549", "0.6146357", "0.6052339", "0.5816061", "0.5764447", "0.57265055", "0.5720799", "0.57053065", "0.5586472", "0.5576027", "0.5562706", "0.553079", "0.5517852", "0.55137324", "0.54935753", "0.54551", "0.5438007", "0.5432379", "0.5397186", "0.53894365", "0.5360449", ...
0.7700618
0
Detect if teammate has eaten an opponent, and update beliefs accordingly
def updateEatenOpponents1(self, gameState, idx): teammatePos = gameState.getAgentState((self.index + 2) % 4).getPosition() pos = gameState.getAgentState(idx).getPosition() if pos is None and len(self.beliefs[idx]) == 1 and self.beliefs[idx].keys()[0] == teammatePos: self.setOpponentToZeroPos(idx) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateEatenOpponents2(self, gameState, chosenAction):\n myNewPos = self.getSuccessor(gameState, chosenAction).getAgentState(self.index).getPosition()\n for idx in self.getOpponents(gameState):\n pos = gameState.getAgentState(idx).getPosition()\n if pos is not None and pos == myNewPos:\n ...
[ "0.66890574", "0.6368508", "0.61436534", "0.61104083", "0.6092847", "0.592126", "0.59061474", "0.5894191", "0.5868768", "0.58523476", "0.5842589", "0.5804285", "0.58025306", "0.5802247", "0.5759558", "0.57070696", "0.5706069", "0.56675106", "0.5637546", "0.5619569", "0.561879...
0.72929925
0
Detect if the agent has eaten an opponent after taking choseAction, and update beliefs accordingly
def updateEatenOpponents2(self, gameState, chosenAction): myNewPos = self.getSuccessor(gameState, chosenAction).getAgentState(self.index).getPosition() for idx in self.getOpponents(gameState): pos = gameState.getAgentState(idx).getPosition() if pos is not None and pos == myNewPos: self.setOp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chooseAction(self, gameState):\n actions = gameState.getLegalActions(self.index)\n\n # You can profile your evaluation time by uncommenting these lines\n # start = time.time()\n opIndices = self.getOpponents(gameState)\n opStates = [gameState.getAgentState(i) for i in opIndic...
[ "0.6729112", "0.6670614", "0.66492426", "0.6632579", "0.660503", "0.6600719", "0.6590416", "0.65770644", "0.6573669", "0.65158534", "0.6472443", "0.646066", "0.6408163", "0.64000434", "0.6376658", "0.6342673", "0.6341901", "0.6238633", "0.6162677", "0.6136566", "0.6121612", ...
0.6999971
0
Takes care of the beliefs of the opponents (updates our beliefs for every opponent)
def trackGhosts(self, gameState): # Get some values that we will use later myState = gameState.getAgentState(self.index) myPos = myState.getPosition() noisyDistances = gameState.getAgentDistances() eatenBabies = self.getEatenBabies(gameState) # Track each opponent opponentFound = [False] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_beliefs(self, features,\n beliefs):\n raise NotImplementedError", "def updateEatenOpponents1(self, gameState, idx):\n teammatePos = gameState.getAgentState((self.index + 2) % 4).getPosition()\n pos = gameState.getAgentState(idx).getPosition()\n if pos is None and len(...
[ "0.64550847", "0.619645", "0.61560863", "0.5892248", "0.5866587", "0.5861313", "0.5817298", "0.5783986", "0.57212657", "0.5699778", "0.5691566", "0.5670923", "0.5643945", "0.560926", "0.5593857", "0.55895865", "0.55704576", "0.55554897", "0.55401003", "0.55354905", "0.5532957...
0.5608274
14
Picks among the actions with the highest Q(s,a).
def chooseAction(self, gameState): # Track opponents position self.trackGhosts(gameState) actions = gameState.getLegalActions(self.index) # actions.remove(Directions.STOP) # You can profile your evaluation time by uncommenting these lines values = [self.evaluate(gameState, a) for a in actions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxQ(self,state):\r\n \r\n maxQ = float('-inf')\r\n maxA = 0\r\n \r\n for a in self.actions:\r\n q = self.Q(state,a)\r\n #print(q,a)\r\n if q > maxQ:\r\n maxQ = q\r\n maxA = a\r\n return(maxQ,maxA)", "def...
[ "0.7763381", "0.77043587", "0.76056725", "0.755616", "0.73318", "0.7316181", "0.71344316", "0.71120584", "0.6966468", "0.6956663", "0.6948445", "0.69366306", "0.6920287", "0.6893597", "0.68934804", "0.68932414", "0.6878565", "0.6877915", "0.68764764", "0.6848047", "0.6837404"...
0.0
-1
Finds the next successor which is a grid position (location tuple).
def getSuccessor(self, gameState, action): successor = gameState.generateSuccessor(self.index, action) pos = successor.getAgentState(self.index).getPosition() if pos != nearestPoint(pos): # Only half a grid position was covered return successor.generateSuccessor(self.index, action) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_next_empty_cell(grid):\n for i, row in enumerate(grid):\n for j, col in enumerate(row):\n if col == 0:\n return (i, j)\n return None", "def findNextMove(curHVal):\n minHCalc = curHVal; #Initializing to curHVal\n minNewPosition = (0,0); #Initializing it\n\n ...
[ "0.6865463", "0.6577259", "0.65367836", "0.63662726", "0.63535637", "0.6322907", "0.6322907", "0.6322907", "0.6322907", "0.6313924", "0.6313924", "0.6313924", "0.6308633", "0.6286739", "0.6271493", "0.6265178", "0.6261508", "0.6254691", "0.6224646", "0.6223371", "0.6201753", ...
0.625926
23
Computes a linear combination of features and feature weights
def evaluate(self, gameState, action): self.updateCurrentBehavior(gameState, action) features = self.getFeatures(gameState, action) weights = self.getWeights(gameState, action) # print "Ghost: ", self.index # print "Behavior:", self.behavior # print "Action: ", action # for f in features:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_weights(self):\n return self.X.dot(self.get_weights())", "def test_feature_computation(self):\n k = [2, 3, 4, 5, 6]\n mn = self.create_chain_model(k)\n d = 4\n\n for i in range(len(k)):\n mn.set_unary_weights(i, np.random.randn(k[i], d))", "def _update_sa...
[ "0.6412511", "0.63885987", "0.6331432", "0.6307596", "0.62957096", "0.6278508", "0.62640095", "0.6231558", "0.6230448", "0.6221143", "0.61972445", "0.61786664", "0.61722106", "0.6153286", "0.61511993", "0.6127169", "0.6098815", "0.6063193", "0.6059293", "0.60585326", "0.60457...
0.0
-1
Chooses the bahavior of the agent depending on the game state
def updateCurrentBehavior(self, gameState, action): self.behavior = "attack"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_agent(self, state):\n\t\trndint = random.randint\n\t\treturn self.state[state][rndint(0, len(self.state[state]))]", "def choose(self):\n # pick agent A\n keys = list(self._agents.keys())\n keyA = random.choice(keys)\n agentA = self.model.schedule.agents[keyA]\n\n # p...
[ "0.64281553", "0.61350286", "0.59930456", "0.59657705", "0.5951671", "0.5935685", "0.5917523", "0.58895385", "0.5866359", "0.58634853", "0.5859631", "0.58510923", "0.5799187", "0.5787101", "0.5779855", "0.5767384", "0.5765602", "0.5759769", "0.57395715", "0.573207", "0.571422...
0.0
-1
Returns a counter of features for the state
def getFeatures(self, gameState, action): features = util.Counter() successor = self.getSuccessor(gameState, action) features['successorScore'] = self.getScore(successor) return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFeatures(self, gameState, action):\n features = util.Counter()\n successor = self.getSuccessor(gameState)\n features['successorScore'] = self.getScore(successor)\n return features", "def getFeatures(self, gameState, action):\n features = util.Counter()\n successor = self.getSuccessor(gam...
[ "0.75101334", "0.74563867", "0.7398609", "0.7374521", "0.7282197", "0.6932936", "0.68492305", "0.68008125", "0.6752222", "0.6714029", "0.6711698", "0.67100084", "0.66294867", "0.6587385", "0.6538587", "0.6513832", "0.64583915", "0.6438229", "0.6429208", "0.641838", "0.6405082...
0.7463647
4
Normally, weights do not depend on the gamestate. They can be either a counter or a dictionary.
def getWeights(self, gameState, action): return {'successorScore': 1.0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeights(self, gameState, actton):\n\t\treturn {'successorScore': 1.0}", "def weight(self):", "def getWeights(self, gameState, action):\n return {'successorScore': 1.0}", "def getWeights(self, gameState, action):\n # return {'successorScore': 1.0}\n if self.isOffensive:\n ...
[ "0.71871144", "0.70065325", "0.689758", "0.68833196", "0.68198305", "0.68198305", "0.6802522", "0.6791841", "0.6781377", "0.6764985", "0.6690768", "0.6690768", "0.6690768", "0.6690768", "0.6690768", "0.6690768", "0.6690768", "0.6690768", "0.6655643", "0.6637496", "0.65772384"...
0.7246131
5
The idea is to avoid dead ends (paths that can make you get trapped) when we are being chased
def getFeaturesEscape(self, gameState, action): features = util.Counter() successor = self.getSuccessor(gameState, action) features['successorScore'] = self.getScore(successor) myState = successor.getAgentState(self.index) myPos = myState.getPosition() teammateState = successor.getAgentState((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _perturbInPlaceHard(self):\n die", "def solve(self):\n while self.character.path[-1] != 88:\n n = self.next_move()\n if n is None:\n self.character.path += ['Error: Could not find full path (budget does not suffice or unreachable).']\n break\n...
[ "0.5883941", "0.57382286", "0.5662084", "0.5626856", "0.560686", "0.5590391", "0.5552893", "0.55336696", "0.549596", "0.5457089", "0.5429637", "0.5426103", "0.5414072", "0.5394398", "0.53816", "0.5381497", "0.5381497", "0.53670853", "0.53554404", "0.53365237", "0.53141695", ...
0.0
-1
Serialize compatible dictionary to bytes. Copies entire dictionary in the process.
def encode(cls, dictionary: Dict[str, Any]) -> bytes: if not isinstance(dictionary, dict): raise TypeError( # pragma: nocover "dictionary must be of dict type, got type {}".format(type(dictionary)) ) patched_dict = copy.deepcopy(dictionary) cls._patch_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bytes(_dict, enc='utf-8'):\n return bytes(json.dumps(_dict), enc)", "def _encode_dict(source: dict) -> bytes:\n result_data = b\"d\"\n\n for key, value in source.items():\n result_data += encode(key) + encode(value)\n\n return result_data + b\"e\"", "def recursive_force_bytes(d):\r\n ...
[ "0.7369727", "0.67605", "0.66103524", "0.6496112", "0.6161774", "0.6155406", "0.6106692", "0.6106692", "0.6106692", "0.60654813", "0.60654813", "0.60654813", "0.5975645", "0.5975645", "0.59424126", "0.59424126", "0.59202325", "0.5919495", "0.59118193", "0.5903205", "0.5845758...
0.7491539
0
Deserialize a compatible dictionary
def decode(cls, buffer: bytes) -> Dict[str, Any]: pstruct = Struct() pstruct.ParseFromString(buffer) dictionary = dict(pstruct) cls._patch_dict_restore(dictionary) return dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'Data':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> 'BundleData':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt):\n return deserialize_model(dikt, cls)", "def from_dict(cls, dikt):\n return deseriali...
[ "0.69509226", "0.6912338", "0.6808362", "0.6808362", "0.67847705", "0.67847705", "0.67847705", "0.67847705", "0.67847705", "0.67847705", "0.67701757", "0.6746996", "0.6732208", "0.6703498", "0.66005915", "0.6502228", "0.64887947", "0.6456437", "0.64193887", "0.6401303", "0.63...
0.60870665
69
Configura la ventana base de la aplicacion
def widgetSetup(self): self.master.resizable(0, 0) self.master.iconbitmap('logo.ico') self.master.title("Ejercicio POO") self.master.bind("<Return>", lambda e: self.create()) self.master.bind("<Delete>", lambda e: self.delete())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config():\n config_django()\n config_svisor()", "def config():", "def config():", "def configure(self):", "def configure(self):", "def configure(self):", "def configure(self):", "def configuration():", "def config(self):\n pass", "def config(self):\n pass", "def configur...
[ "0.7150946", "0.69282407", "0.69282407", "0.6809258", "0.6809258", "0.6809258", "0.6809258", "0.67006826", "0.66206926", "0.66206926", "0.65607136", "0.6530743", "0.6530743", "0.6480236", "0.6359279", "0.63244313", "0.6270004", "0.612241", "0.61017054", "0.604313", "0.5991318...
0.0
-1
Metodo para crear las etiquetas principales
def crearEtiqueta(self, texto, fuente, fila, columna, color): etiqueta = Label(self.master, text=texto, font=fuente) etiqueta.grid(row=fila, column=columna,sticky=W, padx=10) etiqueta.configure(bg=color) return etiqueta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):", "def create():", "def create():", "def create(self):\n ...", "def _create_td(self):\n raise NotImplementedError", "def __init__(self, altura, peso, edad):\n\t\tself.altura = altura # OJO TODAS LAS VARIABLES SON PUBLICAS \n\t\tself.peso = peso \n\t\tself.edad = edad\n\t\t...
[ "0.65900284", "0.6451826", "0.6451826", "0.62090474", "0.6074923", "0.6064894", "0.60394955", "0.59705216", "0.59705216", "0.59705216", "0.5963673", "0.5912172", "0.588354", "0.5746422", "0.5710383", "0.5701193", "0.5692463", "0.5659934", "0.5643292", "0.56388277", "0.5593089...
0.0
-1
Inicializa las etiquetas llamando al metodo crearEtiquetas usando los parametros correspondientes
def iniciarEtiquetas(self): self.ingrese = Label(self.master, text="Ingrese sus datos", font="Arial 12", width=45) self.ingrese.grid(row=0, column=0, sticky=N, columnspan=5, pady=10) self.ingrese.configure(bg="#9a32cd") self.tituloLabel = self.crearEtiqueta("Título", "Arial 12", 1, 0, "#...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self, parameters):\n pass", "def __init__(self, periodo, reunion, sesion, tipo_sesion, fecha):\n self.periodo = periodo\n self.reunion = reunion\n self.sesion = sesion\n self.tipo_sesion = tipo_sesion\n self.fecha = fecha\n\n self.html_version_taquigrafic...
[ "0.609267", "0.5903246", "0.58946306", "0.5880777", "0.5836138", "0.5729836", "0.5700392", "0.56584805", "0.56492573", "0.56484693", "0.5626518", "0.5626206", "0.5621491", "0.5573241", "0.55474275", "0.5540638", "0.55209315", "0.55170137", "0.55021054", "0.5498434", "0.549363...
0.5844404
4
Crea los cheks del final para elegir temas
def crearChecks(self): check1 = Checkbutton(self.master, text="Tema 1", variable=self.checkStatus1, command= self.updateCheck) check1.grid(row=7, column=1) check2 = Checkbutton(self.master, text="Tema 2", variable=self.checkStatus2, command= self.updateCheck) check2.grid(row=8, column=1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strt_now():\r\n \r\n tbdstryed = [a, ps, asso, web, welframe,creator]\r\n for e in range(len(tbdstryed)):\r\n tbdstryed[e].destroy()\r\n \r\n root.geometry('590x700')\r\n root.resizable(False,False)\r\n \r\n Generator(root).place()", "def _build_em_dirs(self):\n for ...
[ "0.5500215", "0.5353049", "0.53220683", "0.5288207", "0.5216976", "0.52123725", "0.517569", "0.51338184", "0.50983876", "0.5093755", "0.5079386", "0.5031075", "0.5024734", "0.502358", "0.5019019", "0.5013016", "0.5008696", "0.50014335", "0.4996971", "0.49944517", "0.4922818",...
0.0
-1
Actualiza los checks segun el clic que haga el usuario para cambiar el tema
def updateCheck(self): if (self.checkStatus1.get() == True): self.master.configure(background='#f5f5f0') self.checkStatus2.set(False) self.checkStatus3.set(False) elif (self.checkStatus2.get() == True): self.master.configure(background='#ff99ff') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_inputs(self):\n\n self._check_resident_prefs()\n self._check_hospital_prefs()", "def set_user_inputs(self):\n com_util.send_to(self.driver, element['clickOnEmail'], self.email)\n com_util.send_to(self.driver, element['clickOnPassword'], self.password)\n com_util.tap_...
[ "0.58495677", "0.5720982", "0.5639392", "0.563029", "0.5596402", "0.5578114", "0.5577288", "0.5559616", "0.5500324", "0.5477476", "0.5410121", "0.53707904", "0.53696257", "0.536456", "0.5351729", "0.5326439", "0.53194314", "0.5306327", "0.53050387", "0.5297544", "0.52928156",...
0.0
-1
Metodo para crear los entrys necesarios
def crearEntrada(self, master, valueForm, ancho, fila, columna): return Entry(self.master, width=ancho, textvariable=valueForm).grid(row=fila, column=columna, pady=10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_entry(entry):\n Entry.create(**entry)\n return entry", "def create_entry(number, name, type_1, type_2, health_points, attack, defense, special_attack, special_defense, speed,\n generation, is_legendary):\n battle_stats = {'HP': health_points, 'Attack': attack, 'Defense': defen...
[ "0.7037715", "0.668965", "0.65381885", "0.6488124", "0.64373475", "0.63334", "0.61468595", "0.60944563", "0.6050023", "0.60440207", "0.60156155", "0.59940416", "0.59843445", "0.59843445", "0.5930455", "0.5886901", "0.5883002", "0.5862357", "0.5852909", "0.5843249", "0.5841745...
0.5515448
40
Inicializa las entradas principales de carga del formulario
def iniciarEntradas(self): tituloEntry = self.crearEntrada(self.master, self.tituloString, 30, 1, 1) descripcionEntry = self.crearEntrada(self.master, self.descripcionString, 30, 2, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.user = User.objects.get(username='Aslan')\n self.user.save()\n self.setUpFormData()\n self.form = CompoundForm(self.user, self.formData)", "def __init__(self, corp_app, field_objs, *args, **kwargs):\n self.corp_app = corp_app\n self.field_objs = f...
[ "0.60940665", "0.5666006", "0.55598676", "0.5470787", "0.5469469", "0.5435855", "0.5424151", "0.5399974", "0.53901106", "0.53865784", "0.5367861", "0.5339532", "0.5334651", "0.53280663", "0.53130263", "0.53030586", "0.5268036", "0.525582", "0.52500373", "0.52249557", "0.52124...
0.5676018
1
Muestra el estado de la base de datos
def iniciarTreeView(self): self.verDatos.configure(height=10, columns=3) self.verDatos["columns"] = ("idbase","titulo", "descripcion") self.verDatos.column("#0", width=80, minwidth=20, anchor=E) self.verDatos.column("idbase", width=60, minwidth=20, anchor=W) self.verDatos.column(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_from_db(self):\n pass", "def fetch_data(self):", "def _database(self):\n ...", "def insert_data(self):\n # Make a connexion with a mock database\n self.generate_data_collection()", "def _get_db_data(self) -> None:\n if self._db_data:\n return\n ...
[ "0.6352631", "0.61261106", "0.6058513", "0.58711433", "0.58188546", "0.5707736", "0.56725967", "0.56422293", "0.5641166", "0.56061065", "0.56004846", "0.558248", "0.5577022", "0.5545722", "0.5523512", "0.5523512", "0.55162567", "0.55161726", "0.55157053", "0.55157053", "0.549...
0.0
-1
Inicializa los botones para ABM tambien crear base y tabla en caso de no existir
def iniciarBotones(self): alta = Button(self.master, text="Alta", font="Arial 10", command= self.create) alta.grid(row=6, column=0, pady=15) modificar = Button(self.master,text="Modificar", font="Arial 10",command= self.update, width="8") modificar.grid(row=1, column=2, rowspan=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setup(bot):\r\n await bot.add_cog(Tables(bot))", "def _bots_initialization(self) -> None:\n\n assert isinstance(self.bots_configs, list), f\"Incorrect bot_farm config file. bot_farm_config['bots'] \" \\\n f\"must be dict, but now: {type(self....
[ "0.67972714", "0.64946496", "0.6441267", "0.6308263", "0.61106575", "0.60673463", "0.6015159", "0.59536266", "0.59439516", "0.5892423", "0.58683693", "0.5814385", "0.5802463", "0.57986337", "0.5793498", "0.57770497", "0.5773846", "0.5769958", "0.57306194", "0.5730383", "0.572...
0.6335093
3
Borra el formulario cuando sea necesario para una nueva carga o para evitar repeticiones
def reset(self): self.descripcionString.set("") self.tituloString.set("")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buscarFactura(self):\n\n if not self.lineNumero.isEnabled() and self.facturaSeleccionada != None:\n QtGui.QMessageBox.information(self,\"Aviso\",\"Ya se ha seleccionado una factura\")\n elif not self.lineNumero.isEnabled():\n self.lineNumero.setEnabled(True)\n sel...
[ "0.6147121", "0.6094942", "0.6081782", "0.6065424", "0.605813", "0.605813", "0.60315925", "0.5945697", "0.58566546", "0.576516", "0.57575446", "0.5739197", "0.56512237", "0.56397307", "0.56377494", "0.5607466", "0.5599807", "0.55913407", "0.55809695", "0.55348605", "0.5534168...
0.0
-1
Borra el arbol completo para actualizar las entradas
def resetTree(self): for fila in self.verDatos.get_children(): self.verDatos.delete(fila)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit(self):", "def actualizar_velocidad(self):\r\n pass", "def actualizar_puntaje(self):\r\n pass", "def save():", "def updateAll(self):\n \tself.idToUpdate=''\n \tself.newState=''\n \tself.save()", "def actualizar_valores(self,valores): \n self.__valores.update(valore...
[ "0.6122221", "0.6036619", "0.6020295", "0.59620243", "0.58875334", "0.5807845", "0.57788527", "0.5673862", "0.5673862", "0.56692386", "0.5656522", "0.5656522", "0.5656522", "0.5656522", "0.5656522", "0.5628181", "0.56140774", "0.56119204", "0.55775714", "0.55766964", "0.55766...
0.0
-1
Metodo para actualizar el arbol junto al formulario y carga de nuevo con los datos actualizados
def updateTree(self): self.reset() self.resetTree() self.read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actualizar(self):\n if self.obraSocialSeleccionada!=None:\n self.cargar_productos(self.obraSocialSeleccionada)\n else:\n self.cargarProductosSinObra()", "def actualizar_puntaje(self):\r\n pass", "def actualizar_tabla(self):\n self.ajustar_tabla()\n s...
[ "0.63073975", "0.62418467", "0.59441423", "0.5581971", "0.5581573", "0.55443275", "0.550863", "0.5449518", "0.5426941", "0.5420971", "0.53737736", "0.5362197", "0.5340136", "0.5321031", "0.5316212", "0.5314762", "0.5310911", "0.52641654", "0.5248064", "0.5235256", "0.52185756...
0.0
-1
Permite elegir un dato de la base para cambiar o borrar
def selectTree(self, event): item = self.verDatos.selection() self.idInteger.set(self.verDatos.item(item)['values'][0]) self.tituloString.set(self.verDatos.item(item)['values'][1]) self.descripcionString.set(self.verDatos.item(item)['values'][2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SaveData(self, conn):\n t = time.process_time()\n log = Logger()\n cursor = conn.cursor()\n sqlQuery = \"insert into old_data \" \\\n \"select * from new_data\"\n cursor.execute(sqlQuery)\n conn.commit()\n conn.close()\n elapsed_t = time...
[ "0.57277966", "0.5657513", "0.5653637", "0.56170994", "0.54800206", "0.5394856", "0.5384301", "0.53081447", "0.5278276", "0.5271337", "0.52682054", "0.52480567", "0.5191209", "0.5181496", "0.5179283", "0.5169548", "0.5168879", "0.51631016", "0.51624215", "0.514839", "0.512611...
0.0
-1
Lee los registros existentes en la base abierta y en la tabla productos
def read(self): try: datos = self.base.readData() for i in range(len(datos)): self.verDatos.insert('', i+1, text = i+1, values = (datos[i][0], datos[i][1], datos[i][2])) except: showerror("Error", exc_info()[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buscarProd(self):\n medicamento = str(self.lineMedicamento.text())\n monodroga = str(self.lineMonodroga.text())\n data = self.getAllTabla(self.tableProductos)\n\n if medicamento != \"\":\n dataMedic = filter(lambda x: x[1].upper() == medicamento.upper(), data.values())\n ...
[ "0.7017241", "0.68887484", "0.64854866", "0.6218559", "0.61975086", "0.6082025", "0.60445845", "0.59041625", "0.58877075", "0.5804047", "0.5794914", "0.5783742", "0.576173", "0.56790864", "0.56208664", "0.5607758", "0.5550904", "0.5536961", "0.548066", "0.5475638", "0.5454109...
0.0
-1
Crea la tabla si no existe
def crearTabla(self): mensaje = self.base.createTable() showinfo('Resultado', mensaje)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.info(\"table %s already exists.\", table.full_table_id)\n return table", ...
[ "0.7952568", "0.7628907", "0.75765896", "0.7453806", "0.7421533", "0.7417688", "0.73947656", "0.7391235", "0.73709404", "0.7370457", "0.73420954", "0.7339442", "0.7294078", "0.72117263", "0.7173514", "0.71690124", "0.7127797", "0.71181244", "0.710121", "0.70358473", "0.702753...
0.71380335
16
Crea la base si no existe
def crearBD(self): if self.base.isConnected(): mensaje = "Usted ya se encuentra conectado a la base " + self.base.getDbName() + ", ¿Desea Crear una nueva?" if askyesno("Atención", mensaje): nombre = tkinter.simpledialog.askstring("Elija el Nombre de la Base", prompt="Nomb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_base(self):\r\n self.mycursor.execute(\r\n 'CREATE DATABASE IF NOT EXISTS purbeurre CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci')\r\n self.mycursor.execute('USE purbeurre')", "def create():\n\tcreate_db()", "def create_db(self, path: str) -> None:\n if os.path.is...
[ "0.7140915", "0.6911187", "0.67524874", "0.6660668", "0.6562868", "0.6482472", "0.64741087", "0.64741087", "0.6414927", "0.6377228", "0.6242515", "0.6120511", "0.61106586", "0.6092203", "0.6079177", "0.6060785", "0.604896", "0.6047035", "0.603988", "0.6019423", "0.60109794", ...
0.62442166
10
Valida cada registro segun los criterios
def validarRE(self, datoAValidar): return validarTitulo(datoAValidar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate():", "def validadores(self):\n\n camposRequeridos = [getattr(self,\"lineRazon\")]\n ValidarDatos.setValidador(camposRequeridos)\n\n camposRequeridos = [getattr(self,\"lineCuit\")]\n ValidarDatos.setValidador(camposRequeridos)\n\n camposRequeridos = [getattr(self,\"...
[ "0.6289605", "0.62867755", "0.6256649", "0.6026372", "0.60167295", "0.6007827", "0.5972027", "0.59138054", "0.59136087", "0.5894613", "0.5884084", "0.5839058", "0.58008385", "0.5777286", "0.5777286", "0.5755494", "0.57548887", "0.57548887", "0.57548887", "0.5723866", "0.57150...
0.5682032
23
Main hook entry point
def execute(self, operation, file_path, context, parent_action, file_version, read_only, **kwargs): # AARDMAN ADDITION # adds short cuts to file browser aaNukeUtils.aaSetupShortCuts() if file_path: file_path = file_path.replace("/", os.path.sep) if operation == "cu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entry_point():", "def entry_point():", "def entry_point():", "def _hook(self):", "def on_hook(self) -> None:", "def setup_hooks(self):\n pass", "def main():\n pass", "def main(self):\r\n pass", "def _post_hooks(self):", "def main():\n PLUGIN_ENTRY().run(\"\")", "def ...
[ "0.7423908", "0.7423908", "0.7423908", "0.73854935", "0.7256732", "0.7225447", "0.7175162", "0.71340764", "0.7110802", "0.7008554", "0.7006415", "0.6989436", "0.6963864", "0.6871478", "0.6857729", "0.67905015", "0.67806673", "0.6760804", "0.6760804", "0.6760804", "0.6760804",...
0.0
-1
Use the tknukewritenode app interface to find and reset the render path of any Tank write nodes in the current script
def _reset_write_node_render_paths(self): write_node_app = self.parent.engine.apps.get("tk-nuke-writenode") if not write_node_app: return False # only need to forceably reset the write node render paths if the app version # is less than or equal to v0.1.11 from distu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTree(self):\n self.reset()\n self.resetTree() \n self.read()", "def changeNodeLib(ned, createNodeWin):\n pass", "def updatetree(self):\n if self.node:\n self.node.update()\n self.draw()", "def fRenderTargetBackupTab():\n node = nuke.thisNode()\n # create t...
[ "0.5345771", "0.5233489", "0.5084201", "0.49955806", "0.49239224", "0.4833652", "0.48127708", "0.4807053", "0.48013398", "0.4722902", "0.47158727", "0.47130924", "0.47050682", "0.4693489", "0.46925712", "0.4680197", "0.46643654", "0.46602747", "0.46585917", "0.46569446", "0.4...
0.65005773
0
Initialisation, where df is a pandas DataFrame and var is the name of the column to study and init_pars is a dictionary with initial values
def __init__(self,df, init_pars, var='dep_var', var_name='Volume of Nile'): self.df = df self.var = var self.var_name = var_name self.y = np.array(df[var].values.flatten()) self.times = df.index self.pardict = init_pars self.options = {'eps':1e-09, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(param):\n MODULE_HELPER.check_parameter(param, key='featureCount_exec', dtype=str)\n MODULE_HELPER.check_parameter(param, key='featureCount_t', dtype=str)\n MODULE_HELPER.check_parameter(param, key='featureCount_id', dtype=str)\n MODULE_HELPER.check_parameter(param, key='featureCount_by_meta',...
[ "0.5726554", "0.55129045", "0.5489595", "0.5355379", "0.52944136", "0.5286923", "0.5284127", "0.5245464", "0.52217746", "0.52201474", "0.52157134", "0.52084327", "0.5173756", "0.5162606", "0.5160928", "0.51536846", "0.513594", "0.51033354", "0.5099015", "0.5089083", "0.508381...
0.7033673
0
Iterate over the observations and update the filtered values after each iteration
def iterate(self, plot=True, estimate=False, init_params=None): # Create empty arrays to store values F = np.zeros(len(self.y)) a = np.zeros(len(self.y)) v = np.zeros(len(self.y)) P = np.zeros(len(self.y)) # Initialize at the initial values parsed to the class P[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, other):\n for filter, value in other.items():\n self.__setitem__(filter, value)", "def update(self):\n for filter in self.filters:\n filter.update(self.learning_rate)", "def filter(self):\n self.filter_means = [self.m_0]\n self.filter_covs = [self.P_0]\n...
[ "0.6360926", "0.6218109", "0.6081106", "0.6078264", "0.6032189", "0.5884993", "0.5883774", "0.58139133", "0.5798917", "0.57884675", "0.5541844", "0.5534231", "0.55329645", "0.55150574", "0.5511411", "0.55061525", "0.54159504", "0.54150975", "0.54017776", "0.539216", "0.538981...
0.0
-1
Iterate over the observations and update the filtered values after each iteration
def missing_data(self, plot=True): # Set some of the observations to missing self.remove_data() # Create empty arrays to store values F = np.zeros(len(self.y)) a = np.zeros(len(self.y)) v = np.zeros(len(self.y)) P = np.zeros(len(self.y)) # Initialize at th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, other):\n for filter, value in other.items():\n self.__setitem__(filter, value)", "def update(self):\n for filter in self.filters:\n filter.update(self.learning_rate)", "def update(self, updates, predicate):\n for row in self.rows:\n if predicate(row...
[ "0.63613224", "0.62198365", "0.6080035", "0.60798997", "0.60306054", "0.58865666", "0.5883915", "0.58141124", "0.5800074", "0.5787996", "0.5541149", "0.5536493", "0.55307084", "0.5513393", "0.55123764", "0.5507698", "0.54158753", "0.5414475", "0.5403888", "0.53936756", "0.538...
0.0
-1
Execute the resize_data.sh package script.
def AddUnifiedUserDataAssertion(self, input_zip): subprocess.call([os.path.join(DEVICE_RELEASE_TOOLS, 'resize_userdata.sh'), str(TARGET_PRODUCT)]) """Include the required binaries in the output zip.""" self.output_zip.write(os.path.join(OUT_DIR, 'resize_userdata.zip'), os.path.join(INSTALL_UNIFY_USERDATA_PATH, 'r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script(arch, version, variant, packages, mirror, disk_size, swap_size, image_format, root_password, hostname, no_confirm, output):\n\n # Checking validity of the command-line arguments.\n check_arguments(locals())\n\n # Checking if dependencies for this script are installed.\n check_dependencies(ar...
[ "0.58786595", "0.58316845", "0.5807729", "0.5498334", "0.5434105", "0.54233754", "0.54066753", "0.5386028", "0.5220113", "0.52190685", "0.5190704", "0.51890326", "0.51768124", "0.5113704", "0.5107601", "0.5094947", "0.5084976", "0.50797784", "0.50737107", "0.50622976", "0.501...
0.0
-1
Overskriver metoden i en subklasse kun en dummyversjon
def encode(self, text):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def regular(self):", "def subectIsSelf():", "def lassh():", "def setup_class(self):\n\n class SubFLRW(FLRW):\n def w(self, z):\n return super().w(z)\n\n self.cls = SubFLRW\n # H0, Om0, Ode0\n self.cls_args = (70 * u.km / u.s ...
[ "0.6570687", "0.63065004", "0.60361695", "0.6011499", "0.59461576", "0.5945843", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5942525", "0.5895928", "0.5890295", "0.5882326", "0.58123356", "0.58123356"...
0.0
-1
Overskriver metoden i en subklasse kun en dummyversjon
def decode(self, crypto):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def regular(self):", "def subectIsSelf():", "def lassh():", "def __init__(self):\n super(Hardswish, self).__init__()", "def setup_class(self):\n\n class SubFLRW(FLRW):\n def w(self, z):\n return super().w(z)\n\n self.cls = SubFLRW...
[ "0.6569991", "0.63043004", "0.6036007", "0.6010795", "0.59454274", "0.594468", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5941208", "0.5896316", "0.588907", "0.58811665", "0.581134", "0.581134", "0...
0.0
-1
klartekst > koder denne > dekoder cipherteksten og sjekker at de er lik
def verify(self): # tekstlig testing om koden fungerer text = self.klar_tekst_start + " ble sendt til mottaker som krypteringen " + \ self.crypto + ".\nMottaker dekrypterte dette til " + self.klar_tekst_slutt return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operate_cipher(self):", "def cipher_feedback(self):", "def encrypt():\n\tnull = 0", "def decrypt_vigenere(ciphertext: str, keyword: str) -> str:\n plaintext = \"\"\n # PUT YOUR CODE HERE\n key_lenght = len(keyword)\n text_lenght = len(ciphertext)\n\n while key_lenght != text_lenght:\n ...
[ "0.74144083", "0.7249195", "0.6612421", "0.65690863", "0.65647596", "0.6559704", "0.6540644", "0.65369374", "0.651486", "0.6376439", "0.62908095", "0.6285373", "0.6259204", "0.6240055", "0.62363446", "0.6201683", "0.6181846", "0.6151049", "0.6124505", "0.60732675", "0.6069720...
0.5520573
82
multiplying a number by 5 function
def five_mult(x): return 5 * x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_numbers(first_number, second_number):", "def multiply(value, multiplier):\n return value*multiplier", "def helper(num):\r\n \r\n return lambda x: num * product(x)", "def mod_5(x):\r\n return x%5", "def multiplier(self) -> global___Expression:", "def multiply_by_4(x):\n\t...
[ "0.7047754", "0.6995963", "0.69738007", "0.69666034", "0.6825088", "0.6717752", "0.66833895", "0.66504025", "0.66504025", "0.657937", "0.6422854", "0.6368382", "0.6347893", "0.63396317", "0.63196534", "0.62954944", "0.6254306", "0.6249496", "0.62182474", "0.62080914", "0.6205...
0.8823891
0
recursion of a value
def tri_recursion(k): if(k>0): result = k + tri_recursion(k-1) # print(result) else: result = 0 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recur(number):\n if number == 1 or number == 0:\n return number\n else:\n check = recur(max(number - 1, 0))+recur(max(number - 2, 0))\n return check", "def recursive(input):\n\n # Base Case: Argument input greater than 0.\n if input <= 0:\n return 0\n else:\n ...
[ "0.6645191", "0.6535834", "0.6381994", "0.63048947", "0.6251828", "0.6248429", "0.61911374", "0.6188937", "0.6067438", "0.60306674", "0.5995112", "0.59597176", "0.594877", "0.59247464", "0.5921001", "0.5912498", "0.5909545", "0.58961886", "0.5894752", "0.5893231", "0.58901757...
0.686639
0
returns a list of all lines encountered in start, stop, start, stop form distances are from self.center_of_mass along angle
def find_points(self, angle): angle_rads = angle * 1.0 / 360 * 2 * pi points = [] self.pic.setPenColor(255, 0, 0) cur_pos_x = self.xcenter cur_pos_y = self.ycenter in_line = False while self.in_bounds(cur_pos_x, cur_pos_y): if in_line: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vary_distance_lines(self, n_lines,\n start_theta=-180.0, end_theta=+180.0):\n delta_theta = end_theta - start_theta\n thetas = [start_theta + ((float(i) / (n_lines - 1)) * delta_theta)\n for i in range(n_lines)]\n thetas = list(map(np.radians, th...
[ "0.6329989", "0.6249319", "0.62350285", "0.5960659", "0.582981", "0.5782247", "0.57550585", "0.5716322", "0.5686487", "0.56017864", "0.5553188", "0.5502591", "0.5473933", "0.54706573", "0.5465637", "0.54402316", "0.54249376", "0.5414995", "0.5412383", "0.54076225", "0.5404326...
0.56110704
9
Perform a simple key validation. In case key is invalid raises exception.
def validate_key(key): try: secret.Secret(key) except secret.Secret.InvalidSecret as e: raise KeyIsInvalid(e.message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidKey(key):\n return True", "def validate_key_throw(*args):\n validation_result = validate_key(*args)\n if not validation_result:\n raise ValueError(str(validation_result))\n return validation_result", "def _check_key(self, key):\n raise NotImplementedError", "def validate_ke...
[ "0.7987643", "0.7463676", "0.73541176", "0.71353656", "0.69899154", "0.69897455", "0.69897455", "0.69758594", "0.6815677", "0.6798602", "0.6623998", "0.65970945", "0.65419054", "0.6538826", "0.6535715", "0.65314674", "0.64951634", "0.64704937", "0.64693004", "0.6450726", "0.6...
0.7446105
2
Allows to set key only once
def key(self, key_val): if self.key_exists(): raise EncryptedField.KeyAlreadyExists() validate_key(key_val) if self.model_class not in self._keys: EncryptedField._keys[self.model_class] = {} EncryptedField._keys[self.model_class][id(self)] = key_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self, key):\n return self.__key.set(key)", "def set_key(self, key):\n self.key = key", "def _newKey(self, key):\n pass", "def set_key(self, key):\n\t\tif key in self.control_map:\n\t\t\tindex = self.control_map.index(key)\n\t\t\tcurrent_key = self.control_map[self.option_index]\n...
[ "0.7539311", "0.74440265", "0.74026906", "0.7250793", "0.723817", "0.723817", "0.70751673", "0.70751673", "0.7062565", "0.7028014", "0.7028014", "0.6877834", "0.67624867", "0.67489475", "0.66592693", "0.6637476", "0.6608595", "0.6566029", "0.65246844", "0.6480407", "0.6471509...
0.0
-1
create a qos policy bandwidth limit rules client
def get_client(client_mgr, set_property=False, with_name="qos_dscp_marking_rules_client"): manager = getattr(client_mgr, 'manager', client_mgr) net_client = getattr(manager, 'networks_client') try: _params = manager.default_params_with_timeout_values.copy() except E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandwidth_limit_rule_create(request, policy_id, **kwargs):\n body = {'bandwidth_limit_rule': kwargs}\n if 'tenant_id' not in kwargs:\n kwargs['tenant_id'] = request.user.project_id\n body = {'bandwidth_limit_rule': kwargs}\n rule = 'bandwidth_limit_rule'\n bandwidth_limit_rule = neutroncl...
[ "0.6386853", "0.63850254", "0.6247085", "0.6161535", "0.6106285", "0.60777605", "0.5950055", "0.5935536", "0.590857", "0.5905467", "0.5810064", "0.5765103", "0.56232476", "0.5616136", "0.558902", "0.5584673", "0.5562813", "0.55526304", "0.5522369", "0.5482483", "0.54449725", ...
0.0
-1
generates XML I/O mapping for package ACCO, adding it to globalMap
def makeMapping(globalMap): from memops.xml.Implementation import bool2str, str2bool # Set up top level dictionaries loadMaps = globalMap.get('loadMaps') mapsByGuid = globalMap.get('mapsByGuid') abstractTypes = globalMap.get('ACCO').get('abstractTypes') exolinks = globalMap.get('ACCO').get('exolinks') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeMapping(globalMap):\n \n from memops.xml.Implementation import bool2str, str2bool\n\n # Set up top level dictionaries\n loadMaps = globalMap.get('loadMaps')\n mapsByGuid = globalMap.get('mapsByGuid')\n\n abstractTypes = globalMap.get('ANAP').get('abstractTypes')\n exolinks = globalMap.get('ANAP').ge...
[ "0.64070976", "0.6367374", "0.62000525", "0.6076145", "0.56269336", "0.540561", "0.54037416", "0.5370882", "0.53047323", "0.51571155", "0.5128653", "0.5097843", "0.50681853", "0.5067503", "0.5059321", "0.50549144", "0.5013462", "0.50095636", "0.50081456", "0.49879944", "0.498...
0.65873575
0
Performs Encoding and Decoding at once
def img_recolor(self, args, input_image_path): ec = encoder.Encoder(output_path=args.intermediate_representation, method=args.method, size=args.size, p=args.p, grid_size=args.grid_size, plot=args.plot, quantize=args.quantize) dc = decoder.Decoder(output_path=args.ou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, encoded):", "def encode(self, decoded):", "def handle_encode(self, results):\n \n config.COD_PROMPT = config.ENC_PROMPT\n print config.ENC_PROMPT + \" encoding results...\"\n \n # while there is another decoder, run each item through the next decoder\n ...
[ "0.70250314", "0.692117", "0.6498695", "0.636545", "0.61599547", "0.6076334", "0.60151535", "0.60063004", "0.5958467", "0.5958467", "0.5940094", "0.59077394", "0.58827055", "0.58827055", "0.58725035", "0.58725035", "0.5870088", "0.583431", "0.58002776", "0.5792148", "0.576668...
0.0
-1
Generates a sample transition probability matrix given the count matrix C using dirichlet distributions
def sample_nonrev(C, nsample=1): # copy C C = np.array(C) if nsample==1: return _sample_nonrev_single(C) elif nsample > 1: res = np.empty((nsample), dtype=object) for i in range(nsample): res[i] = _sample_nonrev_single(C) return res else: raise Val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy_permutation_test(ordered_pitch_types, single_pitch_pdf, conditional_joint_probabilities, total_transitions,\n n=1000):\n pitch_types, pitch_probabilities = zip(*single_pitch_pdf.items())\n permutation_entropies = []\n progress = progressbar.ProgressBar()\n\n for ...
[ "0.60476565", "0.59997904", "0.58673024", "0.58671576", "0.5793469", "0.5774345", "0.5758262", "0.5752579", "0.57467324", "0.5681701", "0.5671376", "0.5654487", "0.56216985", "0.5615002", "0.56125927", "0.56113505", "0.56080693", "0.55988497", "0.55925566", "0.5580419", "0.55...
0.0
-1
Return true if this term and other are strictly syntactically equivalent. This would tipically be in the magic method `__eq__`, but we use `__eq__` for a different purpose, namely, to be able to use Python expressions such as "loc(b1)==table" in order to construct a FOL atom.
def is_syntactically_equal(self, other): raise NotImplementedError() # To be subclassed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if other is self:\n return True\n if isinstance(other, CoordFunctionSymb):\n if other.parent() != self.parent():\n return False\n else:\n return bool(other._express == self._express)\n else:\n ...
[ "0.73922414", "0.72952706", "0.7224389", "0.7203774", "0.6997577", "0.6990958", "0.6936724", "0.6910764", "0.6866715", "0.68585664", "0.6852991", "0.6825722", "0.68223184", "0.67959416", "0.6793662", "0.67728335", "0.67344457", "0.673216", "0.667139", "0.66642874", "0.6662836...
0.7148483
4
Return a hash of the current object. Meant to be used by TermReference objects to wrap Terms appropriately for use within associative containers.
def hash(self): raise NotImplementedError() # To be subclassed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __Hash(self):\n return self._Hash()", "def hash(self):\n return self.__hash__()", "def hash(self):\n return self.hash_by_id(self.id)", "def current_hash(self):", "def hash(self):\n return hashlib.sha1(str(self._dict))", "def get_hash(self):\n return self.__hash", "def...
[ "0.7544915", "0.745015", "0.74020696", "0.7351971", "0.73146653", "0.7294813", "0.7268655", "0.7268655", "0.7268655", "0.7268655", "0.726741", "0.7251138", "0.7248584", "0.72445667", "0.7236863", "0.7205611", "0.7174264", "0.7149143", "0.7121638", "0.7120802", "0.71172434", ...
0.70241517
32
Creates a folder if it does not exists
def create_folder(folder_name): if not os.path.exists(folder_name): os.makedirs(folder_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_folder_if_needed(path):\n if os.path.exists(path):\n print(\"{} dir exists\".format(path))\n else:\n print(\"{} dir does not exist. Creating dir.\".format(path))\n os.mkdir(path)", "def create_folder(path):\n if not exists(path):\n os.makedirs(path)", "def create...
[ "0.85329485", "0.85087234", "0.842846", "0.8422511", "0.83173305", "0.8302552", "0.82762134", "0.82187194", "0.8175441", "0.8163295", "0.814333", "0.814166", "0.8140945", "0.8131764", "0.8117364", "0.81125724", "0.80800235", "0.80615175", "0.8053969", "0.80054647", "0.8000349...
0.8088543
17
Given a file returns the number of lines where a certain pattern appears.
def count_patterns(pattern, file): count = 0 with open(file, 'r') as f: for line in f: if re.search(pattern, line): count += 1 print("The pattern '{}' appears {} times.".format(pattern, count))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_count(file):\n with open(file, \"r\") as f:\n return sum(1 for line in f)", "def count_lines(filename):\n with open(filename, 'rb') as f:\n return sum(1 for line in f)", "def count_lines(filename):\r\n with open(filename, 'rb') as f:\r\n return sum(1 for line in f)", "d...
[ "0.79906595", "0.7601465", "0.7589926", "0.7400159", "0.7400159", "0.7367526", "0.7361509", "0.7314271", "0.7307912", "0.7246522", "0.72217196", "0.71740115", "0.7155738", "0.7092855", "0.7072881", "0.7064458", "0.70398235", "0.7038543", "0.7035276", "0.7028555", "0.7019521",...
0.79991657
0
Function to clean the datasets following the given instructions
def clean_dataset(dataset, pollsters, output_name): # No banned pollsters no_banned = pollsters[pollsters['Banned by 538'] == 'no'].Pollster # Interviews with no banned pollster dataset = dataset[dataset.pollster.isin(no_banned)] # Non tracked interviews dataset = dataset[dataset.tracking == Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(args):\n with_dataset(args, Dataset._clean)", "def cleaning (data):", "def _clean_data(self, dataset):\n dataset.dropna(inplace=True)\n # Problem: handle missing data (in a different way), noisy data, inconsistent data", "def clean():\n filter_phase_data()\n combine_phase_dat...
[ "0.7972246", "0.78305405", "0.770086", "0.7358835", "0.7004315", "0.6960603", "0.6881473", "0.68532133", "0.67468274", "0.6705054", "0.6648155", "0.66471887", "0.66403866", "0.6639197", "0.6567839", "0.6521795", "0.64767987", "0.6475485", "0.64592075", "0.63912", "0.63877296"...
0.63390654
25
Given a dataset with a string column , filter rows containing a certain pattern.
def pattern_search(pattern, dataset, column): # Filter dataset = dataset[dataset[column].str.contains(pattern, regex=True)] # Reset index dataset = dataset.reset_index(drop=True) # Return return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, filter_strings):\n if filter_strings is None:\n filter_strings = []\n\n result = RowSet()\n for row in self.rows:\n match = True\n for s in filter_strings:\n if not row.filter(s):\n match = False\n ...
[ "0.6799201", "0.59878045", "0.5795762", "0.5779332", "0.5757394", "0.574811", "0.5722822", "0.57140815", "0.56623626", "0.56492823", "0.5607389", "0.5594936", "0.5588069", "0.5576866", "0.5554488", "0.5542753", "0.55349904", "0.5508957", "0.54967576", "0.546392", "0.5438134",...
0.7813946
0
Given a dataset with pollsters column and the pollsters grade in traditional format, it merges the columns and floors the grade.
def grade_cleaning(dataset, pollsters): # Merge grades dataset_grades = pd.merge(dataset, pollsters[["Pollster", "538 Grade", "Predictive Plus-Minus"]], how='inner', left_on='pollster', right_on='Pollster') dataset_grades = dataset_grades.drop(['Pollster'], axis=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organize_data(scores, stds):\n\n scores = pd.Series(list(scores.values()),\n index=map(str, scores.keys()),\n name=\"SCORE MEAN\")\n scores.index.name = \"AUXILIARY LOSS WEIGHTS\"\n stds = pd.Series(list(stds.values()),\n ...
[ "0.5142071", "0.5063618", "0.49147916", "0.48610595", "0.4855685", "0.48401833", "0.48022565", "0.47576785", "0.47571915", "0.47113907", "0.4704346", "0.46972775", "0.46791285", "0.465144", "0.46333814", "0.46222302", "0.46004865", "0.45951855", "0.45889464", "0.45674625", "0...
0.7066124
0