query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
To Crop Resizes the current dimension so that they completely fill the boundary area, cropping off the parts on the longer dimension
def toCrop(curr_width, curr_height, bounds_width, bounds_height): # Return lRet = [0,0] # Convert current width/height to floats curr_width = float(curr_width) curr_height = float(curr_height) # If either width or height is smaller than the boundary box, resize up if curr_width < bounds_width or curr_height...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_and_resize(input):\r\n\r\n # Locate the last Relu node of the first backbone (pre 1st NMS). Relu node contains feature maps\r\n # necessary for CropAndResize plugin.\r\n relu_name = \"StatefulPartitionedCall/model/\"\r\n relu_node = [node for node in self.graph....
[ "0.6635083", "0.65216154", "0.6502443", "0.6447552", "0.64440733", "0.6416515", "0.6416515", "0.63198686", "0.63018787", "0.62967235", "0.62936974", "0.62776333", "0.6266111", "0.623935", "0.6221247", "0.6186056", "0.61804765", "0.6178057", "0.6173915", "0.6139715", "0.613687...
0.6678301
0
To Fit Resizes the current dimensions so that they are no bigger than the boundary
def toFit(curr_width, curr_height, bounds_width, bounds_height): # Return lRet = [0,0] # Convert current width/height to floats curr_width = float(curr_width) curr_height = float(curr_height) # If either width or height is smaller than the boundary box, resize up if curr_width < bounds_width and curr_height...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(self):\n e = self.e\n if abs(self.dnp) * ( self.np-self.np_req) > 0:\n e = self.er\n self.dsize = numpy.clip((self.np_req/self.np)**(1./e), 1/self.r, self.r)\n self.size *= self.dsize", "def resize_to_fit(self, bbox_lower, bbox_upper, padding=0.0):\n lower...
[ "0.6665422", "0.64229167", "0.6385279", "0.62772876", "0.6203286", "0.619745", "0.6178194", "0.6178194", "0.6157073", "0.61371046", "0.6133289", "0.59698606", "0.594408", "0.59336007", "0.59152037", "0.5913919", "0.59034175", "0.58898044", "0.5865145", "0.5844353", "0.5831071...
0.6974561
0
Update the full tree. Notice that it is speeder to update only some Nodes (with Node.update() or Node.updatetree() and then tree.draw()), if you know which Nodes have changed.
def updatetree(self): if self.node: self.node.update() self.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTree(self):\n self.reset()\n self.resetTree() \n self.read()", "def update(self):\n diff = self._diff()\n if not diff:\n # Nothing to do!\n return\n self.parent.update_node(self, diff)", "def update(self) -> None:\n\t\t# Clear attributes...
[ "0.7556701", "0.6912794", "0.66137767", "0.6601793", "0.6581151", "0.6340923", "0.6322804", "0.6247771", "0.62420785", "0.6138897", "0.6127056", "0.61090595", "0.60929275", "0.6082139", "0.6079269", "0.6013786", "0.5984058", "0.5980842", "0.59513277", "0.59459203", "0.5945920...
0.8456314
0
Deselect all selected Nodes.
def deselectall(self): if self.selection: for node in self.selection[:]: node.deselect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unselectAll(self):\n\t\tself.tree.UnselectAll()", "def deactivate_all(self):\n\t self.active_nodes = [False for i in range(self.nodes)]", "def deselect_all(self):\n if not self.is_multiple:\n raise NotImplementedError(\"You may only deselect all options of a multi-select\")\n\n ...
[ "0.75965494", "0.7326561", "0.7177937", "0.70517176", "0.6998259", "0.6998208", "0.69236964", "0.68393564", "0.666252", "0.66200733", "0.65448684", "0.6528691", "0.65248185", "0.65188646", "0.64383274", "0.64297384", "0.63814723", "0.6304904", "0.628075", "0.6259888", "0.6243...
0.8953032
0
Computes the area of predicted ellipses Arguments
def ellipse_area(preds, target): # unpack target = (target, mask) target, mask = target if preds.size(2) != 4: raise ValueError('Prediction must be 4-dimensional (x, y, r1, r2), ' f'but got preds.shape[2] = {preds.size(2)}') areas = preds[:, :, 2] * preds[:, :, 3] * math...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mae(y_true: np.ndarray, y_pred: np.ndarray):\n return np.mean(np.abs(y_true - y_pred))", "def area(self) -> npt.NDArray[np.float_]:\n points = self._normalized_projection()\n a = sum(det(points[..., [0, i, i + 1], :]) for i in range(1, points.shape[-2] - 1))\n return 1 / 2 * np.abs(a)...
[ "0.6463271", "0.6365041", "0.60898095", "0.6083765", "0.597409", "0.5937458", "0.5883098", "0.58727354", "0.58173394", "0.57917994", "0.5785702", "0.57829523", "0.575938", "0.57468635", "0.57391137", "0.57208997", "0.5710786", "0.57058716", "0.56917363", "0.56765014", "0.5660...
0.7421895
0
Wrapper of fit method, keep track of index of in self.task list where the results will be put back to
def wrap_fit(task, data, index): result_queue.put((task.fit(data), index))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def fit(self):\n raise NotImplementedError", "def fit(self):\n raise NotImplementedError # pragma: no cover", "def fit(self):\n raise NotImplementedError('')", "def run_iteration(self, task, x, x_fit, best_x, best_fitness, **params):\n current_candid...
[ "0.6582492", "0.64478344", "0.6395146", "0.62083113", "0.6088464", "0.5980931", "0.5980931", "0.5980931", "0.5930443", "0.5925915", "0.59008825", "0.58879286", "0.58710545", "0.5856652", "0.58554256", "0.5847153", "0.57874924", "0.5775599", "0.57755387", "0.5771941", "0.57719...
0.7965852
0
Fit a prediction task using previously saved task file and data file
def fit_from_files(task_file, data_file, verbose=True): print_fitting_time = 1 if verbose: print '[FitFromFile] Called with \n\ttask: {}\n\tdata: {}'.format(task_file, data_file) assert os.path.exists(task_file) assert os.path.exists(data_file) task = Predictor.pickle_load(task_file) data = Mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, datafile):", "def fit(self):\n # Iterate and train.\n step_file = self.checkpointer.get_step_file()\n start_step = Pickle.load(open(step_file, 'rb'))\n for step in xrange(start_step, self.train_size // self.train_batch_size):\n print 'Step No.:', step\n ...
[ "0.6933549", "0.65414155", "0.6481138", "0.6473284", "0.6416944", "0.6401692", "0.63794595", "0.63716877", "0.632911", "0.6281491", "0.62027", "0.6199611", "0.6180592", "0.61765254", "0.61615336", "0.61461294", "0.61428756", "0.6140193", "0.61125225", "0.6075052", "0.60743606...
0.7075277
0
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: if key not in self.map: return -1 return self.map[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if self.map[sh] == None:\n return -1\n for i in range(len(self.map[sh])):\n kv = self.map[sh][i]\...
[ "0.79098475", "0.762993", "0.75650334", "0.7556994", "0.7529803", "0.75259614", "0.7493149", "0.73738897", "0.7294419", "0.72940016", "0.72216845", "0.72175443", "0.7181078", "0.71774393", "0.71633786", "0.6980779", "0.69289523", "0.67850846", "0.6757027", "0.6734023", "0.661...
0.800388
0
Removes the mapping of the specified value key if this map contains a mapping for the key
def remove(self, key: int) -> None: if key in self.map: del self.map[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, key):\n self.map.pop(key, None)", "def discard(m: MutableMapping[KT, VT], key: KT) -> None:\n try:\n del m[key]\n except KeyError:\n pass", "def remove(self, key: int) -> None:\n if key in self.hashmap.keys():del self.hashmap[key]", "def remove(self, key: in...
[ "0.7535688", "0.741463", "0.72709954", "0.72703135", "0.72555333", "0.72331554", "0.7204898", "0.7164102", "0.7153649", "0.7055848", "0.7026221", "0.6985074", "0.68906015", "0.6870792", "0.68690383", "0.6858692", "0.68494064", "0.680187", "0.67693096", "0.6671611", "0.6671606...
0.755179
0
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: if key in self.hashmap.keys():return self.hashmap[key] else:return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n sh = key % 37\n if self.map[sh] == None:\n return -1\n for i in range(len(self.map[sh])):\n kv = self.map[sh][i]\n ...
[ "0.800388", "0.762993", "0.75650334", "0.7556994", "0.7529803", "0.75259614", "0.7493149", "0.73738897", "0.7294419", "0.72940016", "0.72216845", "0.72175443", "0.7181078", "0.71774393", "0.71633786", "0.6980779", "0.69289523", "0.67850846", "0.6757027", "0.6734023", "0.66126...
0.79098475
1
Retrieve an existing timed role for a member
async def get(cls, member: discord.Member, role: discord.Role) -> Optional["TempRole"]: data = await config.member(member).get_raw(str(role.id), default=None) if data is None: return None return cls(member, role=role, **data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_role(self):\n return self.__role", "def get_requested_role(role_id: str, grant_type: str, duration: int = None) -> object:\n duration = 1 if not duration else abs(int(duration))\n start = datetime.datetime.utcnow()\n end = start + datetime.timedelta(hours=duration)\n\n roles = {\n ...
[ "0.6369326", "0.617486", "0.6106377", "0.60803705", "0.6052439", "0.6035084", "0.5995821", "0.5970582", "0.59705627", "0.59542656", "0.5938069", "0.5923725", "0.59169495", "0.59132004", "0.5907858", "0.58617985", "0.58348566", "0.5830382", "0.58300865", "0.582536", "0.5814863...
0.67559046
0
Save any changes made to the given role
async def save(self): await config.member(self.member).set_raw(str(self.role.id), value=self.as_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n body = {}\n body[\"permissions\"] = dict(self.permissions)\n body[\"name\"] = self.name\n body[\"description\"] = self.description\n _, role = self._requestor.patch('/roles/' + self._id, json=body)\n self._data = role\n self.name = role[\"name\"]\n...
[ "0.7449376", "0.69202137", "0.6706893", "0.6628437", "0.65997726", "0.65707296", "0.65323365", "0.6509429", "0.6508951", "0.6404279", "0.63896096", "0.63896096", "0.63462675", "0.6343299", "0.6334521", "0.62895924", "0.6227726", "0.6210612", "0.61825967", "0.61669636", "0.616...
0.7792488
0
Apply this timed role to the assigned member
async def apply_role(self, *, reason: str = None): if self.role not in self.member.roles: try: await self.member.add_roles(self.role, reason=reason) except discord.HTTPException: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def apply_to(self, target: discord.Member, updatedb: bool = True) -> None:\n role = await self.get_role(target.guild, create=True, updatedb=updatedb)\n await target.add_roles(role)", "async def mute(self, ctx, member: discord.Member, *, time:TimeConverter = None):\r\n\r\n if member.top...
[ "0.65342677", "0.6421293", "0.6120938", "0.61156404", "0.59957504", "0.5966998", "0.5924353", "0.58847696", "0.5799881", "0.5798736", "0.57629937", "0.57432574", "0.56938565", "0.56376094", "0.562925", "0.56228966", "0.56089085", "0.5596772", "0.55905795", "0.5571378", "0.554...
0.65985787
0
If the email address and password match a row in the people table, insert a new session and return it.
def maybe_start_new_session_after_checking_email_and_password(cls, pgconn, email_address, password): cursor = pgconn.cursor() cursor.execute(textwrap.dedent(""" insert into webapp_sessions (person_uuid) select person_uuid from people ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_user_in_database():\n if 'email' in login_session:\n user_exists = session.query(exists().where(User.email == login_session['email'])).scalar()\n if not user_exists:\n user = User(\n id=login_session['userid'],\n picture=login_session['picture'],...
[ "0.6367763", "0.6356234", "0.63516515", "0.6347383", "0.61005265", "0.6089295", "0.5976637", "0.59710795", "0.59075147", "0.5886865", "0.586351", "0.5853693", "0.584547", "0.58428913", "0.5831545", "0.58136314", "0.57720864", "0.5761474", "0.57587177", "0.5747093", "0.5745432...
0.7251301
0
If the email address and confirmation_code match a row in the people table, and the confirmation_code_set field isn't too far in the past, then insert a new session and return it. The max_age_confirmation_code should be a datetime.timedelta. Also, update the confirmation_code to NULL and the confirmation_code_set to NU...
def maybe_start_new_session_after_checking_email_and_confirmation_code( cls, pgconn, email_address, confirmation_code, max_age_confirmation_code): qry = textwrap.dedent(""" with updated_person as ( update people set confirmation_code = NULL, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maybe_start_new_session_after_checking_email_and_password(cls,\n pgconn, email_address, password):\n\n cursor = pgconn.cursor()\n\n cursor.execute(textwrap.dedent(\"\"\"\n insert into webapp_sessions\n (person_uuid)\n select person_uuid\n from pe...
[ "0.60392874", "0.5681908", "0.5451615", "0.5417981", "0.5366344", "0.5240246", "0.5230094", "0.5170933", "0.51691353", "0.51681817", "0.5118041", "0.51156867", "0.5023955", "0.5006434", "0.49894702", "0.49657902", "0.49437103", "0.48913294", "0.4865624", "0.48327735", "0.4811...
0.8278633
0
Add a nickname to the task.
def add_nickname(self, name): if not(name in self.nicknames): self.nicknames.append(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_nickname(self, nickname):\n if 'Nicknames' not in self.properties:\n self.properties['Nicknames'] = []\n if (len(self.properties['Nicknames']) == 1 and self.properties['Nicknames'][0].startswith('Temp')):\n self.properties['Nicknames'][0] = nickname.title()\n else...
[ "0.7166683", "0.6610402", "0.6424392", "0.63084996", "0.6216642", "0.614925", "0.6031415", "0.6024327", "0.59892935", "0.59892935", "0.59892935", "0.59892935", "0.59829175", "0.5977808", "0.5967903", "0.5950989", "0.5821063", "0.58103204", "0.57808167", "0.57796466", "0.57638...
0.66925246
1
Choose which reward to use as the icon.
def set_icon(self, icon): icon = icon.title() if icon in self.rewards: self.icon = icon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EventContentMissionExcelAddRewardIcon(builder, RewardIcon):\n return AddRewardIcon(builder, RewardIcon)", "def AttendanceRewardExcelAddRewardIcon(builder, RewardIcon):\n return AddRewardIcon(builder, RewardIcon)", "def getIcon():\n\treturn \"Animator.png\"", "def get_icon(self):\n if self.ve...
[ "0.63309723", "0.6280875", "0.6142465", "0.5935322", "0.5868202", "0.58387834", "0.56607616", "0.5626153", "0.55662286", "0.5536797", "0.5513505", "0.5512918", "0.5501038", "0.5501038", "0.5490013", "0.5487131", "0.5487109", "0.5484825", "0.54813075", "0.54810375", "0.5454107...
0.65526587
0
Remove a task from the list.
def remove_task(self, task): for i, item in enumerate(self.tasks): if item is task: del self.tasks[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, task):\n pass", "def remove(self, task):\r\n entry = self.entry_finder.pop(task)\r\n entry[-1] = self.REMOVED", "def remove(self, task: Task) -> None:\n try:\n self._tasks.remove(task)\n except ValueError as e:\n raise e", "def remove_...
[ "0.8366099", "0.804203", "0.79969305", "0.79408187", "0.7797873", "0.77370054", "0.7600005", "0.7515373", "0.7495914", "0.741135", "0.7340697", "0.7301807", "0.71651155", "0.7074437", "0.70502657", "0.698965", "0.6934339", "0.6833106", "0.6814616", "0.68143123", "0.68027705",...
0.85500264
0
Add a nickname to a stop.
def add_nickname(self, nickname): if 'Nicknames' not in self.properties: self.properties['Nicknames'] = [] if (len(self.properties['Nicknames']) == 1 and self.properties['Nicknames'][0].startswith('Temp')): self.properties['Nicknames'][0] = nickname.title() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_nickname(self, name):\n if not(name in self.nicknames):\n self.nicknames.append(name)", "def nickname(self, new_nickname):\r\n self.set({\"nickname\": new_nickname})", "def set_nickname(self, nickname):\n self.nickname = nickname\n self.tweets_list = TweetsLinkedL...
[ "0.63616055", "0.60162795", "0.5845446", "0.5380511", "0.53378636", "0.5321518", "0.5233507", "0.5233074", "0.5226208", "0.5186924", "0.5168599", "0.51670945", "0.51329494", "0.51309067", "0.51309067", "0.51309067", "0.51309067", "0.51108277", "0.51108277", "0.51108277", "0.5...
0.6344765
1
r""" Add a given feature. If obj isn't specified, geometry and properties can be set as arguments directly.
def add_stop(self, obj=None, geometry=None, properties=None): properties = properties or {} if isinstance(obj, Stop): # instead of creating copy, the original feat should reference the same one that was added here feat = obj._data elif isinstance(obj, dict): f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_features(self, obj, annotation):\n if annotation['problem']:\n obj.add(folia.Feature, subset='problem', cls=annotation['problem'])\n if annotation['pos']:\n obj.add(folia.Feature, subset='pos', cls=annotation['pos'])", "def add(self, obj):\n raise NotImplemented...
[ "0.71973425", "0.6726176", "0.666246", "0.6623734", "0.6482071", "0.6279744", "0.6178764", "0.6170526", "0.6140268", "0.6119209", "0.6102508", "0.60878605", "0.60603964", "0.603245", "0.5992006", "0.5945918", "0.5939789", "0.5939428", "0.5929172", "0.59012157", "0.58699185", ...
0.68658715
1
Find a stop within the map by its name or nickname.
def find_stop(self, stop_name): stops_found = [] stop_name = stop_name.replace('’', "'") if '\n' in stop_name: raise StopNotFound for stop in self: if (stop.properties['Stop Name'].title() == stop_name.title()) or (stop_name.title() in stop.properties['Nicknames']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __find_workplace (label):\n from data import workplace as mod\n workplaces = mod.load ( )\n \n for workplace in workplaces.get_all ( ):\n if label == workplace.label:\n return workplace\n else:\n raise Exception ('Aplikacija ne pozna delovisca: ' + label)", "def getStop(self, k: str) -> any:\...
[ "0.609793", "0.6031988", "0.59837115", "0.59405416", "0.590691", "0.5766553", "0.5766042", "0.55926585", "0.55489075", "0.5530096", "0.55070347", "0.5356893", "0.5332892", "0.5322414", "0.529583", "0.52051175", "0.5175208", "0.51211953", "0.5101846", "0.5077861", "0.5046739",...
0.81227684
0
Add a new stop to the map.
def new_stop(self, coordinates, name): # TODO Add check for being in the map range name = name.replace('’', "'") if ((self._data['bounds'][0] < coordinates[1] < self._data['bounds'][2]) and (self._data['bounds'][1] < coordinates[0] < self._data['bounds'][3])) or ((self._data['bounds'][2] < coordinates...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_stop(self, obj=None, geometry=None, properties=None):\n properties = properties or {}\n if isinstance(obj, Stop):\n # instead of creating copy, the original feat should reference the same one that was added here\n feat = obj._data\n elif isinstance(obj, dict):\n ...
[ "0.7011924", "0.6350245", "0.6214531", "0.58791035", "0.57479805", "0.56939363", "0.55513483", "0.55153453", "0.5514459", "0.54971707", "0.549099", "0.54645514", "0.5451237", "0.5421387", "0.53967774", "0.53198665", "0.53184986", "0.5293935", "0.52768016", "0.5258625", "0.519...
0.65903795
1
Check for and reset only old stops in the map. This should get deprecated by moving the last edit to the map properties.
def reset_old(self): stops_reset = False for stop in self: if stop.properties['Last Edit'] != int(self.now().strftime("%j")): stop._map = self stop.reset() stops_reset = True else: try: if stop.pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_all(self):\n for i, stop in enumerate(self):\n stop._map = self\n stop.reset()", "def stop_updating():\n data.stop_updating.set()", "def _on_hass_stop(_: Event) -> None:\n cancel_update_stale()", "def reset_loc_changes(self) -> None:\n raise NotImplemen...
[ "0.6026896", "0.5841777", "0.5622818", "0.5618265", "0.5419846", "0.5327718", "0.53150094", "0.5309506", "0.5303692", "0.52971876", "0.527437", "0.5255029", "0.52275604", "0.5201025", "0.5199152", "0.5180177", "0.51493436", "0.5132357", "0.5117004", "0.5109831", "0.5108305", ...
0.77067006
0
Reset all the stops in the map.
def reset_all(self): for i, stop in enumerate(self): stop._map = self stop.reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self._maps = {}", "def reset(self):\n for tlight in self.trafficLights:\n self.trafficLights[tlight].reset()", "def reset_map(self):\n self.x = None\n self.X = None\n self.y = None\n self.Y = None\n self.data = None\n self.sa...
[ "0.7579285", "0.7383751", "0.6917179", "0.67725736", "0.67357904", "0.67316675", "0.6722733", "0.6713646", "0.669224", "0.6676841", "0.65809566", "0.6558982", "0.6555627", "0.6545753", "0.65353453", "0.65285087", "0.64875877", "0.6479432", "0.64679015", "0.64321417", "0.64129...
0.87820536
0
Remove a stop from the map.
def remove_stop(self, stop): for i, item in enumerate(self): if item.properties == stop.properties: del self[i] break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, start, stop):\n # delete from our map structure\n if start in self.map:\n del self.map[start]\n # delete any of these coordinates in our all_coords data structure\n for i in range(start, stop + 1):\n if i in self.all_coords:\n del se...
[ "0.6917365", "0.6512443", "0.6281414", "0.6272541", "0.6110733", "0.60639244", "0.6048657", "0.6019557", "0.5888762", "0.5782012", "0.57464355", "0.56604165", "0.5650751", "0.5643921", "0.56396884", "0.56365234", "0.56305784", "0.5627915", "0.56137204", "0.5597633", "0.559690...
0.7504355
0
Modification of pygeoj.load to work with the ResearchMap class.
def load(filepath=None, data=None, **kwargs): return ResearchMap(filepath, data, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_geojson(self, filename_or_url):", "def load():\n\n # To run this command type: 'python manage.py shell'\n # 'from map.views import load; load()'\n\n mapping = {\"productivi\": \"productivi\", \"mpoly\": \"MULTIPOLYGON\"}\n map_path = os.path.abspath('gis_django/fields_test/test_fields.s...
[ "0.66758156", "0.61005783", "0.6040845", "0.5837486", "0.5826588", "0.56962967", "0.5683825", "0.5683825", "0.5661501", "0.565528", "0.56059337", "0.5602915", "0.5588601", "0.5588601", "0.55830115", "0.5581639", "0.55658966", "0.55638754", "0.5549857", "0.5549857", "0.5549857...
0.6819126
0
Modification of pygeoj.new to work with the ResearchMap class.
def new(): return ResearchMap()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, georecord, domain, GEOS_point=None, place=None):\n\n self.georecord = georecord\n self.domain = domain\n\tself.markers = []\n\n if GeoLevel.objects.filter(parent=georecord.level).count() == 0:\n # display siblings\n mapped_records = GeoRecord.objects.fi...
[ "0.61895937", "0.5941574", "0.58524776", "0.5815662", "0.58145124", "0.58045", "0.5790222", "0.5746375", "0.57427603", "0.56929517", "0.56556016", "0.5638557", "0.56347907", "0.5591927", "0.55907476", "0.55859154", "0.55857617", "0.55675983", "0.5544486", "0.55331653", "0.550...
0.7807737
0
Convert the np.ndarray `values` into a complete balanced tree. Assumes `values` is sorted ascending. Returns a list `t` of the same length in which t[i] > t[2i+1] and t[i] < t[2i+2] for all i.
def _treeify(values): if len(values) == 1: # this case causes problems later return values tree = np.empty_like(values) # Tree indices work as follows: # 0 is the root # 2n+1 is the left child of n # 2n+2 is the right child of n # So we now rearrange ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _treeify(values):\n if len(values) == 1: # this case causes problems later\n return values\n tree = np.empty_like(values)\n\n # The first step is to remove the bottom row of leaves, which might not be exactly full\n last_full_row = int(np.log2(len(values) + 1) - 1)\n ...
[ "0.7801052", "0.57195985", "0.55123526", "0.5424306", "0.5389832", "0.5373046", "0.5355127", "0.5301832", "0.51680654", "0.5150086", "0.51034987", "0.51034707", "0.506261", "0.50591046", "0.50411254", "0.5034182", "0.5029048", "0.49787155", "0.497168", "0.4945456", "0.4939354...
0.77550435
1
Insert an occurrence of `value` into the btree.
def insert(self, value): i = 0 n = len(self._tree) while i < n: cur = self._tree[i] self._counts[i] += 1 if value < cur: i = 2 * i + 1 elif value > cur: i = 2 * i + 2 else: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, value):\n i = 0\n n = len(self._tree)\n while i < n:\n cur = self._tree[i]\n self._counts[i] += 1\n if value < cur:\n i = 2 * i + 1\n elif value > cur:\n i = 2 * i + 2\n else:\n ...
[ "0.7604135", "0.7268192", "0.7042234", "0.7035678", "0.7007105", "0.69658357", "0.69498754", "0.6931812", "0.69190675", "0.69014573", "0.6873634", "0.6860856", "0.68312144", "0.6791731", "0.6774295", "0.6774295", "0.674912", "0.67077285", "0.6705742", "0.6698419", "0.66521275...
0.76122075
0
Returns the rank and count of the value in the btree.
def rank(self, value): i = 0 n = len(self._tree) rank = 0 count = 0 while i < n: cur = self._tree[i] if value < cur: i = 2 * i + 1 continue elif value > cur: rank += self._counts[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank():\n return 0", "def rank(self, current_order_by_value: Comparable, current_row_number: int) -> int:", "def node_count(self):\n if self.value:\n cnt = 0\n else:\n left_cnt = self.left.node_count()\n right_cnt = self.right.node_count()\n cnt ...
[ "0.64718026", "0.6376531", "0.62661344", "0.6251001", "0.62472457", "0.6177838", "0.6175234", "0.61612415", "0.6157682", "0.6150016", "0.6146312", "0.6140942", "0.6087851", "0.6080309", "0.599433", "0.597126", "0.5961027", "0.5933076", "0.5933076", "0.5933076", "0.5933076", ...
0.7412696
1
Calculates the concordance index (Cindex) between two series of event times. The first is the real survival times from the experimental data, and the other is the predicted survival times from a model of some kind. The concordance index is a value between 0 and 1 where, 0.5 is the expected result from random prediction...
def concordance_index(event_times, predicted_event_times, event_observed=None): event_times = np.array(event_times, dtype=float) predicted_event_times = np.array(predicted_event_times, dtype=float) # Allow for (n, 1) or (1, n) arrays if event_times.ndim == 2 and (event_times.shape[0] == 1 or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _concordance_index_internal(event_times, predicted_event_times, event_observed):\n # Here's how this works.\n #\n # It would be pretty easy to do if we had no censored data and no ties. There, the basic idea\n # would be to iterate over the cases in order of their true event time (f...
[ "0.68782127", "0.6560208", "0.65157455", "0.5941009", "0.5820733", "0.578104", "0.5720066", "0.56759304", "0.5571581", "0.544712", "0.54142314", "0.5382748", "0.53767824", "0.5348387", "0.52754855", "0.52130246", "0.5201001", "0.519445", "0.5149959", "0.51352996", "0.5118567"...
0.77787304
0
Handle all pairs that exited at the same time as truth[first_ix].
def handle_pairs(truth, pred, first_ix): next_ix = first_ix while next_ix < len(truth) and truth[next_ix] == truth[first_ix]: next_ix += 1 pairs = len(times_to_compare) * (next_ix - first_ix) correct = 0 tied = 0 for i in range(firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_pairs(self, idx0, idx1):\n pass", "def _handle_pairs(truth, pred, first_ix, times_to_compare):\n next_ix = first_ix\n while next_ix < len(truth) and truth[next_ix] == truth[first_ix]:\n next_ix += 1\n pairs = len(times_to_compare) * (next_ix - first_ix)\n correct = np.int64(0)...
[ "0.6000304", "0.599807", "0.5622511", "0.53194445", "0.5263816", "0.5217458", "0.5169835", "0.5141272", "0.50960326", "0.5094933", "0.5018173", "0.4972723", "0.49674848", "0.4926433", "0.49177805", "0.49161157", "0.49122337", "0.49041182", "0.4875801", "0.48746818", "0.486466...
0.61505073
0
Read a region from the slide Return a numpy RBG array
def read_slide(slide, x, y, level, width, height, as_float=False): im = slide.read_region((x, y), level, (width, height)) im = im.convert('RGB') # drop the alpha channel if as_float: im = np.asarray(im, dtype=np.float32) else: im = np.asarray(im) assert im.shape == (height, width, 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(path):\n img = ndimage.imread(path, mode=\"RGB\") \n return img", "def readArray(input):\n data = gdal.Open(input)\n band = data.GetRasterBand(1)\n \n return band.ReadAsArray()", "def read_seaice_mask(file=r'C:\\Users\\apbarret\\Documents\\data\\sea_ice_index\\Arctic_region_...
[ "0.6137207", "0.6081156", "0.5954759", "0.59467417", "0.58537626", "0.585075", "0.58096814", "0.57787454", "0.57738674", "0.57671803", "0.57629335", "0.5732902", "0.57281566", "0.5724582", "0.5722498", "0.57152057", "0.56987375", "0.5697461", "0.5692051", "0.56838703", "0.567...
0.71298647
0
Return tissue pixels for an image
def find_tissue_pixels(image): img_RGB = np.array(image) img_HSV = rgb2hsv(img_RGB) background_R = img_RGB[:, :, 0] > 203 background_G = img_RGB[:, :, 1] > 191 background_B = img_RGB[:, :, 2] > 201 tissue_RGB = np.logical_not(background_R & background_G & background_B) tissue_S = img_HSV[:, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tiled():\n size = [25, 25]\n img = Image.new('RGB', (10, 10))\n img.putpixel((5, 5), (0, 255, 0))\n\n parameters = {'data': [img], 'size': size}\n\n tiled = images.tiled(parameters)\n\n assert_equal(tiled.size, tuple(size))\n assert_equal(tiled.getpixel((5, 5)), (0, 255, 0))\n asse...
[ "0.66996914", "0.64593065", "0.6245002", "0.61495245", "0.6072552", "0.6058825", "0.60522234", "0.6007884", "0.5999242", "0.59418654", "0.59273815", "0.59195167", "0.59195167", "0.59195167", "0.586243", "0.5834007", "0.579263", "0.5776404", "0.57694805", "0.5768418", "0.57567...
0.77183205
0
Check if there is any tumor pixel in the 128x128 centre
def check_patch_centre(patch_mask, patch_centre): # get patch size patch_size = patch_mask.shape[0] # get the offset to check the 128x128 centre offset = int((patch_size - patch_centre) / 2) # sum the pixels in the 128x128 centre for the tumor mask sum_cancers = np.sum(patch_mask[offset:offse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_masked_pixel(skymap):\n return len(skymap[skymap == 1.0])", "def _is_blank(im):\n \n # Take the r% center\n r = 0.2\n h1 = int(float(im.shape[0]) * r)\n h2 = im.shape[0] - h1\n w1 = int(float(im.shape[1]) * r) \n w2 = im.shape[1] - w1\n #\n im_center = im[h1:h2, w1:w...
[ "0.6556071", "0.6453187", "0.64141357", "0.6248083", "0.60984486", "0.60729784", "0.60699326", "0.60250354", "0.6017506", "0.60110915", "0.5996027", "0.5944368", "0.590568", "0.58757156", "0.5827182", "0.5797616", "0.5777248", "0.57528126", "0.5751849", "0.57406026", "0.57346...
0.66155726
0
Selects the right resource bundles for learner workers based off of cf.
def _get_learner_bundles(cf: AlgorithmConfig) -> List[Dict[str, int]]: if cf.num_learner_workers > 0: if cf.num_gpus_per_learner_worker: learner_bundles = [ {"GPU": cf.num_learner_workers * cf.num_gpus_per_learner_worker} ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bundle_is_feasible(self, bundle):\n is_feasible = True\n reason = ''\n # 1. Build a mapping from resource-specific info to resource record\n res_to_record_mapping = self._res_man.get_res_to_record_mapping()\n # 2. Check feasibility of zones\n zones = bundle.copy_zones...
[ "0.5283212", "0.49517307", "0.48904753", "0.48725748", "0.484185", "0.47813", "0.47143027", "0.4696883", "0.46917877", "0.4671904", "0.4623539", "0.45685965", "0.4554992", "0.4552142", "0.4541203", "0.44991034", "0.4483796", "0.4479369", "0.44746587", "0.44655508", "0.4453388...
0.6340499
0
Creates a new algorithm instance from a given checkpoint.
def from_checkpoint( checkpoint: Union[str, Checkpoint], policy_ids: Optional[Container[PolicyID]] = None, policy_mapping_fn: Optional[Callable[[AgentID, EpisodeID], PolicyID]] = None, policies_to_train: Optional[ Union[ Container[PolicyID], Ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_state(state: Dict) -> \"Algorithm\":\n algorithm_class: Type[Algorithm] = state.get(\"algorithm_class\")\n if algorithm_class is None:\n raise ValueError(\n \"No `algorithm_class` key was found in given `state`! \"\n \"Cannot create new Algorithm.\"\n...
[ "0.60580355", "0.5922679", "0.57412124", "0.57294875", "0.5714067", "0.5704997", "0.5688258", "0.558459", "0.5575919", "0.55728", "0.55728", "0.55430925", "0.5500146", "0.5423515", "0.54214823", "0.54176", "0.54162467", "0.54071987", "0.5402835", "0.54023486", "0.5385185", ...
0.71065736
0
Recovers an Algorithm from a state object. The `state` of an instantiated Algorithm can be retrieved by calling its `get_state` method. It contains all information necessary to create the Algorithm from scratch. No access to the original code (e.g. configs, knowledge of the Algorithm's class, etc..) is needed.
def from_state(state: Dict) -> "Algorithm": algorithm_class: Type[Algorithm] = state.get("algorithm_class") if algorithm_class is None: raise ValueError( "No `algorithm_class` key was found in given `state`! " "Cannot create new Algorithm." ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self) -> Dict:\n # Add config to state so complete Algorithm can be reproduced w/o it.\n state = {\n \"algorithm_class\": type(self),\n \"config\": self.config,\n }\n\n if hasattr(self, \"workers\"):\n state[\"worker\"] = self.workers.lo...
[ "0.65648293", "0.6265358", "0.5723833", "0.56687695", "0.5581094", "0.5546532", "0.5545131", "0.55277354", "0.5521117", "0.53974736", "0.53949416", "0.53683275", "0.53660685", "0.53271914", "0.5263764", "0.52525544", "0.5216412", "0.5150498", "0.51367056", "0.51292443", "0.51...
0.75385344
0
Creates a Unified logger with the default prefix.
def default_logger_creator(config): return UnifiedLogger(config, logdir, loggers=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_logger_creator(config):\n cfg = config[\"logger_config\"].copy()\n cls = cfg.pop(\"type\")\n # Provide default for logdir, in case the user does\n # not specify this in the \"logger_config\" dict.\n logdir_ =...
[ "0.654645", "0.65222156", "0.6451335", "0.63397074", "0.61835676", "0.6131267", "0.60762876", "0.607544", "0.6075404", "0.604897", "0.6018711", "0.59936255", "0.5960949", "0.5954406", "0.5914896", "0.5913804", "0.590452", "0.5901428", "0.5888489", "0.58815527", "0.58797795", ...
0.80221665
0
Returns a list of remote worker IDs to fetch metrics from. Specific Algorithm implementations can override this method to use a subset of the workers for metrics collection.
def _remote_worker_ids_for_metrics(self) -> List[int]: return self.workers.healthy_worker_ids()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_worker_id_list(self):\r\n return self._workers_id", "def workers(self):\n return self.worker_list", "def give_workers_list(self):\n return self._workers", "def get_worker_addresses(self) -> List[str]:", "def getWorkers(self):\n return self.workers", "def workers(self):...
[ "0.7247312", "0.7082295", "0.6919173", "0.6706466", "0.6648086", "0.6619906", "0.6394205", "0.63148564", "0.63108754", "0.61203814", "0.60810524", "0.60372555", "0.60333896", "0.5938574", "0.5914327", "0.58949035", "0.5858089", "0.5852716", "0.5835345", "0.5817406", "0.571194...
0.7845629
0
Returns a default Policy class to use, given a config. This class will be used by an Algorithm in case the policy class is not provided by the user in any single or multiagent PolicySpec.
def get_default_policy_class( cls, config: AlgorithmConfig, ) -> Optional[Type[Policy]]: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_policy(worker_type, policy_name):\n default_policies = {\n 'assignment_policy': {'policy': 'anyone_certified'},\n 'review_policy': {'policy': 'sampled_review',\n 'rate': 1,\n 'max_reviews': 1}\n }\n if worker_type == Step.Work...
[ "0.6311315", "0.5729347", "0.56618005", "0.5506984", "0.54978967", "0.5444962", "0.5404679", "0.5362682", "0.5354706", "0.53364164", "0.5313896", "0.53083", "0.5271808", "0.526701", "0.5238172", "0.52150375", "0.52150375", "0.5179932", "0.5179932", "0.5179932", "0.5176115", ...
0.876256
0
Evaluates current policy under `evaluation_config` settings. Uses the AsyncParallelRequests manager to send frequent `sample.remote()` requests to the evaluation RolloutWorkers and collect the results of these calls. Handles worker failures (or slowdowns) gracefully due to the asynch'ness and the fact that other eval R...
def _evaluate_async( self, duration_fn: Optional[Callable[[int], int]] = None, ) -> dict: # How many episodes/timesteps do we need to run? # In "auto" mode (only for parallel eval + training): Run as long # as training lasts. unit = self.config.evaluation_duration_uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_one_evaluation(\n self,\n train_future: Optional[concurrent.futures.ThreadPoolExecutor] = None,\n ) -> ResultDict:\n eval_func_to_use = (\n self._evaluate_async\n if self.config.enable_async_evaluation\n else self.evaluate\n )\n\n if s...
[ "0.5813639", "0.58045", "0.57971877", "0.5755697", "0.5625209", "0.5608912", "0.55746895", "0.5540653", "0.54266375", "0.54119104", "0.53644294", "0.5355636", "0.5317944", "0.52854425", "0.519721", "0.51439524", "0.50785995", "0.5068997", "0.5056099", "0.50542724", "0.5014212...
0.6179771
0
Try to restore failed workers if necessary. Algorithms that use custom RolloutWorkers may override this method to disable default, and create custom restoration logics.
def restore_workers(self, workers: WorkerSet): # If `workers` is None, or # 1. `workers` (WorkerSet) does not have a local worker, and # 2. `self.workers` (WorkerSet used for training) does not have a local worker # -> we don't have a local worker to get state from, so we can't recover ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n # For multi-worker training, it should not restore a model in certain\n # worker setting (e.g. non-chief worker in ParameterServerStrategy).\n # pylint: disable=protected-access\n if self._model._in_multi_worker_mode() and not multi_worker_util.should_load_checkpoin...
[ "0.6456512", "0.59843993", "0.5946099", "0.5877889", "0.5867566", "0.57724214", "0.57724214", "0.5769944", "0.5756066", "0.57331985", "0.5720903", "0.5692932", "0.5690044", "0.5687317", "0.56331205", "0.55565757", "0.5536968", "0.5534465", "0.54775685", "0.54709214", "0.54297...
0.66637325
0
Return policy for the specified id, or None.
def get_policy(self, policy_id: PolicyID = DEFAULT_POLICY_ID) -> Policy: return self.workers.local_worker().get_policy(policy_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_policy_by_id(self, id):\n for service, policy_list in self.remote_store.get_policy_list().items():\n for policy in policy_list:\n if policy.id == id:\n return policy", "def get_sp_policy(self, context, id):\n # handling policy method in RPC\n ...
[ "0.8195919", "0.77299577", "0.75044537", "0.6999399", "0.6937139", "0.6846598", "0.68390167", "0.67756456", "0.67569816", "0.67055607", "0.6670871", "0.6530853", "0.6530853", "0.65043503", "0.6430231", "0.6430231", "0.6430231", "0.6392584", "0.6322479", "0.6291166", "0.628162...
0.8019719
1
Return a dictionary of policy ids to weights.
def get_weights(self, policies: Optional[List[PolicyID]] = None) -> dict: return self.workers.local_worker().get_weights(policies)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weights(self) -> Dict[str, DLTypes.WeightType]:\n return self._weights", "def init_weights(rule, voters):\n if (rule == \"per_multiplication_offset\" or\n rule == \"per_nash\" or\n rule == \"per_equality\" or\n rule == \"per_phragmen\"):\n return dict.fromkey...
[ "0.65954274", "0.648527", "0.64462084", "0.6444034", "0.62996584", "0.62273353", "0.6195578", "0.6184155", "0.6102017", "0.60933137", "0.60933137", "0.60933137", "0.60933137", "0.6090674", "0.60716987", "0.60716987", "0.6070435", "0.6054641", "0.6054641", "0.6036368", "0.6001...
0.737706
0
Set policy weights by policy id.
def set_weights(self, weights: Dict[PolicyID, dict]): self.workers.local_worker().set_weights(weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_id(self, policy_id):\n\n self._policy_id = policy_id", "def policy_id(self, policy_id):\n\n self._policy_id = policy_id", "def policyid(self, policyid):\n self._policyid = policyid", "def setWeights(self, w):\n raise NotImplementedError", "def set_weights(self, weight...
[ "0.68662626", "0.68662626", "0.6860867", "0.637945", "0.63608426", "0.6348865", "0.6243755", "0.6243755", "0.61576957", "0.6086072", "0.59518033", "0.59284127", "0.59218895", "0.5912795", "0.58891964", "0.5882354", "0.58819467", "0.5869715", "0.58561563", "0.5831857", "0.5811...
0.7319886
0
Exports policy model with given policy_id to a local directory.
def export_policy_model( self, export_dir: str, policy_id: PolicyID = DEFAULT_POLICY_ID, onnx: Optional[int] = None, ) -> None: self.get_policy(policy_id).export_model(export_dir, onnx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_policy_checkpoint(\n self,\n export_dir: str,\n policy_id: PolicyID = DEFAULT_POLICY_ID,\n ) -> None:\n policy = self.get_policy(policy_id)\n if policy is None:\n raise KeyError(f\"Policy with ID {policy_id} not found in Algorithm!\")\n policy.expo...
[ "0.7340196", "0.64887977", "0.5945618", "0.59079003", "0.5807794", "0.5711292", "0.5689572", "0.5611215", "0.5568656", "0.5514392", "0.54993343", "0.54247177", "0.5363567", "0.53448284", "0.53322864", "0.5314936", "0.52926165", "0.52683485", "0.52606726", "0.5259195", "0.5255...
0.8638034
0
Exports Policy checkpoint to a local directory and returns an AIR Checkpoint.
def export_policy_checkpoint( self, export_dir: str, policy_id: PolicyID = DEFAULT_POLICY_ID, ) -> None: policy = self.get_policy(policy_id) if policy is None: raise KeyError(f"Policy with ID {policy_id} not found in Algorithm!") policy.export_checkpoint(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_policy_model(\n self,\n export_dir: str,\n policy_id: PolicyID = DEFAULT_POLICY_ID,\n onnx: Optional[int] = None,\n ) -> None:\n self.get_policy(policy_id).export_model(export_dir, onnx)", "def save_checkpoint(self, checkpoint_dir: str) -> None:\n state = s...
[ "0.5646019", "0.55445075", "0.54664534", "0.5434", "0.5431048", "0.5391124", "0.53819376", "0.5355442", "0.533281", "0.5321804", "0.52714145", "0.52360433", "0.52148193", "0.5211072", "0.52044326", "0.519995", "0.51711464", "0.5161859", "0.5137465", "0.5121578", "0.5098831", ...
0.69049734
0
Imports a policy's model with given policy_id from a local h5 file.
def import_policy_model_from_h5( self, import_file: str, policy_id: PolicyID = DEFAULT_POLICY_ID, ) -> None: self.get_policy(policy_id).import_model_from_h5(import_file) # Sync new weights to remote workers. self._sync_weights_to_workers(worker_set=self.workers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_policy(self, source, templatefile, key):\n self._logger.info(\n f\"Loading policy model from {source} and templates from {templatefile} to {key}\"\n )\n model = self._load_model(source)\n templates = pd.read_hdf(templatefile, \"table\")\n self._policies[key] =...
[ "0.6561426", "0.6369742", "0.61652553", "0.60312986", "0.6031192", "0.5998441", "0.59718686", "0.59072006", "0.5875465", "0.5854056", "0.58236283", "0.5793976", "0.5772576", "0.57176065", "0.5700056", "0.5666517", "0.56649214", "0.5612048", "0.5603546", "0.55644804", "0.55625...
0.8420177
0
Returns env_id and creator callable given original env id from config.
def _get_env_id_and_creator( env_specifier: Union[str, EnvType, None], config: AlgorithmConfig ) -> Tuple[Optional[str], EnvCreator]: # Environment is specified via a string. if isinstance(env_specifier, str): # An already registered env. if _global_registry.contains(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_env(env_id, **kwargs):\n if env_id in ENV_BUILDER_REGISTRY:\n return ENV_BUILDER_REGISTRY[env_id](env_id, **kwargs)\n else:\n return base_env(env_id, **kwargs)", "def _create_environment(config):\n if isinstance(config.env, str):\n env = gym.make(config.env)\n else:\n env = c...
[ "0.61861086", "0.53655535", "0.5316504", "0.5147301", "0.4986139", "0.49841616", "0.4971597", "0.4944298", "0.48942113", "0.48867854", "0.48841232", "0.48758242", "0.48431137", "0.48215553", "0.4801537", "0.47988972", "0.47826302", "0.47499278", "0.47136348", "0.46998423", "0...
0.6649853
0
Synchronizes the filter stats from `workers` to `central_worker`. .. and broadcasts the central_worker's filter stats back to all `workers` (if configured).
def _sync_filters_if_needed( self, *, central_worker: RolloutWorker, workers: WorkerSet, config: AlgorithmConfig, ) -> None: if central_worker and config.observation_filter != "NoFilter": FilterManager.synchronize( central_worker.filters, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sync_weights_to_workers(\n self,\n *,\n worker_set: WorkerSet,\n ) -> None:\n # Broadcast the new policy weights to all remote workers in worker_set.\n logger.info(\"Synchronizing weights to workers.\")\n worker_set.sync_weights()", "def finalize_worker():\n i...
[ "0.6361807", "0.51709026", "0.49638477", "0.49100637", "0.49032515", "0.48396093", "0.48272035", "0.47979033", "0.47940895", "0.47775602", "0.4697951", "0.46921125", "0.46776554", "0.46733034", "0.4656876", "0.46519685", "0.46506476", "0.4646899", "0.46214274", "0.46203867", ...
0.77384406
0
Sync "main" weights to given WorkerSet or list of workers.
def _sync_weights_to_workers( self, *, worker_set: WorkerSet, ) -> None: # Broadcast the new policy weights to all remote workers in worker_set. logger.info("Synchronizing weights to workers.") worker_set.sync_weights()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_weights(self, weights: Dict[PolicyID, dict]):\n self.workers.local_worker().set_weights(weights)", "def set_weight(self):\n\n for _, s in self.servers.items():\n self._set_server_weight(s)\n\n for _, g in self.groups.items():\n self._set_server_weight(g)\n\n ...
[ "0.7415235", "0.62137634", "0.60029346", "0.5975668", "0.5956228", "0.5927176", "0.5906956", "0.58806175", "0.5873325", "0.5845702", "0.5845702", "0.58380777", "0.5835373", "0.57719904", "0.5764665", "0.5748021", "0.57451636", "0.5717775", "0.5690156", "0.5668649", "0.5667609...
0.87334454
0
Merges a complete Algorithm config dict with a partial override dict. Respects nested structures within the config dicts. The values in the partial override dict take priority.
def merge_algorithm_configs( cls, config1: AlgorithmConfigDict, config2: PartialAlgorithmConfigDict, _allow_unknown_configs: Optional[bool] = None, ) -> AlgorithmConfigDict: config1 = copy.deepcopy(config1) if "callbacks" in config2 and type(config2["callbacks"]) is d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_config(self_config, indict):\n\n self_config.merge(indict)\n patch_config(self_config, indict)", "def override_options(\n config: DictLike,\n selected_options: Tuple[Any, ...],\n set_of_possible_options: Tuple[Iterable[Tuple[str, Any]], ...],\n config_containing_override: Optional[Dic...
[ "0.65590477", "0.6557356", "0.6484285", "0.62188035", "0.6170036", "0.61332023", "0.60254616", "0.602316", "0.5976932", "0.59520906", "0.5918881", "0.58701956", "0.5857687", "0.58490413", "0.5804036", "0.5798185", "0.57981306", "0.57928306", "0.5788247", "0.5761453", "0.57403...
0.72609735
0
Env validator function for this Algorithm class. Override this in child classes to define custom validation behavior.
def validate_env(env: EnvType, env_context: EnvContext) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __validate():\n # TODO: implement", "def _validate_environment():\n if G.Env is None:\n raise EnvironmentInactiveError()\n if G.Env.current_task is None:\n G.log_(f'Validated Environment with key: \"{G.Env.cross_experiment_key}\"')\n else:\n raise Envi...
[ "0.62865967", "0.6171567", "0.61665124", "0.605828", "0.6055743", "0.5966445", "0.59108573", "0.5880532", "0.5880532", "0.5880532", "0.5880532", "0.5880532", "0.5880532", "0.5880532", "0.5880532", "0.58641005", "0.5844692", "0.58442414", "0.5841312", "0.58325046", "0.578855",...
0.69138074
0
Imports a model from import_file.
def import_model(self, import_file: str): # Check for existence. if not os.path.exists(import_file): raise FileNotFoundError( "`import_file` '{}' does not exist! Can't import Model.".format( import_file ) ) # Get the for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importModel(model_name):\n module_path = os.path.join(path, \"models\")\n module_path = os.path.join(module_path, model_name + \".py\")\n model = importClass(model_name, model_name, module_path)\n return model", "def import_model(filename, instance_options):\n model = _import_from_file(filenam...
[ "0.75490636", "0.752571", "0.70787066", "0.70328206", "0.701704", "0.69173276", "0.6906721", "0.6884528", "0.66710514", "0.6619182", "0.6584914", "0.6511387", "0.64960235", "0.6466813", "0.64414066", "0.64304227", "0.63900286", "0.6328612", "0.6317923", "0.63094306", "0.62756...
0.8269803
0
Returns current state of Algorithm, sufficient to restore it from scratch.
def __getstate__(self) -> Dict: # Add config to state so complete Algorithm can be reproduced w/o it. state = { "algorithm_class": type(self), "config": self.config, } if hasattr(self, "workers"): state["worker"] = self.workers.local_worker().get_stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self):\n result = self.__dict__.copy()\n result[\"get_esoh_solver\"] = None # Exclude LRU cache\n return result", "def __getstate__(self):\n state = self.__dict__.copy()\n self.__cleanState__(state)\n return state", "def getstate(self):\r\n ret...
[ "0.69849235", "0.69704705", "0.6888649", "0.6753661", "0.67194057", "0.6708699", "0.6647814", "0.6584078", "0.6562353", "0.65215945", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0.65051794", "0...
0.7720324
0
Converts a checkpoint info or object to a proper Algorithm state dict. The returned state dict can be used inside self.__setstate__().
def _checkpoint_info_to_algorithm_state( checkpoint_info: dict, policy_ids: Optional[Container[PolicyID]] = None, policy_mapping_fn: Optional[Callable[[AgentID, EpisodeID], PolicyID]] = None, policies_to_train: Optional[ Union[ Container[PolicyID], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self) -> Dict:\n # Add config to state so complete Algorithm can be reproduced w/o it.\n state = {\n \"algorithm_class\": type(self),\n \"config\": self.config,\n }\n\n if hasattr(self, \"workers\"):\n state[\"worker\"] = self.workers.lo...
[ "0.73579645", "0.6852199", "0.65121615", "0.6360954", "0.63067204", "0.6257731", "0.6253615", "0.62468445", "0.6211929", "0.61752445", "0.61459166", "0.61280316", "0.61112505", "0.61112505", "0.59541464", "0.5920748", "0.59147984", "0.5913727", "0.5910857", "0.59009296", "0.5...
0.7420277
0
Create a MultiAgentReplayBuffer instance if necessary.
def _create_local_replay_buffer_if_necessary( self, config: PartialAlgorithmConfigDict ) -> Optional[MultiAgentReplayBuffer]: if not config.get("replay_buffer_config") or config["replay_buffer_config"].get( "no_local_replay_buffer" ): return return from_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_replay_buffer(agent, batch_size, steps_per_loop):\n buf = tf_uniform_replay_buffer.TFUniformReplayBuffer(\n data_spec=agent.policy.trajectory_spec,\n batch_size=batch_size,\n max_length=steps_per_loop)\n return buf", "def _build_replay_buffer(self):\n if self._replay_scheme not in [...
[ "0.6733952", "0.64813566", "0.6332253", "0.63191354", "0.590758", "0.5553774", "0.543935", "0.54043156", "0.53811353", "0.53551626", "0.53451353", "0.53451353", "0.53095436", "0.5291312", "0.52849096", "0.52737296", "0.5269071", "0.5261892", "0.52494013", "0.52226555", "0.517...
0.6819166
0
Runs one training iteration (self.iteration will be +1 after this). Calls `self.training_step()` repeatedly until the minimum time (sec), sample or training steps have been reached.
def _run_one_training_iteration(self) -> Tuple[ResultDict, "TrainIterCtx"]: # In case we are training (in a thread) parallel to evaluation, # we may have to re-enable eager mode here (gets disabled in the # thread). if self.config.get("framework") == "tf2" and not tf.executing_eagerly():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_training(self):\n i = 0\n for _ in range(self.train_steps):\n print(f\"Start Training Step {i + 1}\")\n self.model.learn(total_timesteps=self.total_time_steps)\n self.model.save(self.save_path)\n print(f\"Finished Training Step {i + 1}\")\n ...
[ "0.7139436", "0.69826037", "0.6959382", "0.68843913", "0.6862716", "0.6820979", "0.678877", "0.6776115", "0.67050314", "0.67011297", "0.67007095", "0.6699574", "0.667219", "0.6661109", "0.66071045", "0.66046166", "0.6598718", "0.65945536", "0.65836364", "0.656211", "0.6552976...
0.74962825
0
Runs one training iteration and one evaluation step in parallel. First starts the training iteration (via `self._run_one_training_iteration()`) within a ThreadPoolExecutor, then runs the evaluation step in parallel. In autoduration mode (config.evaluation_duration=auto), makes sure the evaluation step takes roughly the...
def _run_one_training_iteration_and_evaluation_in_parallel( self, ) -> Tuple[ResultDict, "TrainIterCtx"]: with concurrent.futures.ThreadPoolExecutor() as executor: train_future = executor.submit(lambda: self._run_one_training_iteration()) # Pass the train_future into `self._r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self) -> ResultDict:\n # Do we have to run `self.evaluate()` this iteration?\n # `self.iteration` gets incremented after this function returns,\n # meaning that e. g. the first time this function is called,\n # self.iteration will be 0.\n evaluate_this_iter = (\n ...
[ "0.72965753", "0.7292789", "0.7270334", "0.6832226", "0.6794943", "0.67360246", "0.6439207", "0.6370821", "0.63472307", "0.624661", "0.6184667", "0.60790974", "0.6050094", "0.60464525", "0.59828645", "0.5875633", "0.58593863", "0.58549035", "0.58360803", "0.58288187", "0.5828...
0.79038095
0
Runs offline evaluation via `OfflineEvaluator.estimate_on_dataset()` API. This method will be used when `evaluation_dataset` is provided.
def _run_offline_evaluation(self): assert len(self.workers.local_worker().policy_map) == 1 parallelism = self.evaluation_config.evaluation_num_workers or 1 offline_eval_results = {"off_policy_estimator": {}} for evaluator_name, offline_evaluator in self.reward_estimators.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(\n self,\n duration_fn: Optional[Callable[[int], int]] = None,\n ) -> dict:\n # Call the `_before_evaluate` hook.\n self._before_evaluate()\n\n if self.evaluation_dataset is not None:\n return {\"evaluation\": self._run_offline_evaluation()}\n\n ...
[ "0.6325125", "0.60647374", "0.5971233", "0.5947724", "0.5909626", "0.5881782", "0.5871726", "0.57794243", "0.5767774", "0.57380193", "0.572336", "0.57048434", "0.5660222", "0.5586678", "0.5585328", "0.5583388", "0.55336004", "0.5516337", "0.5513025", "0.5497438", "0.54654974"...
0.69987756
0
Determines whether we need to create evaluation workers. Returns False if we need to run offline evaluation (with ope.estimate_on_dastaset API) or when local worker is to be used for
def _should_create_evaluation_rollout_workers(cls, eval_config: "AlgorithmConfig"): run_offline_evaluation = ( eval_config.off_policy_estimation_methods and not eval_config.ope_split_batch_by_episode ) return not run_offline_evaluation and ( eval_config.evalua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _workers_available(self) -> bool:\n total_compute_power = sum(self.client.nthreads().values())\n if len(self.futures) < total_compute_power:\n return True\n return False", "def evaluationManagerExists():\n\n pass", "def _in_multi_worker_mode(self):\n return False", "...
[ "0.69867367", "0.6750227", "0.65190905", "0.6204362", "0.60276794", "0.6008399", "0.60004455", "0.59838545", "0.5982903", "0.5968737", "0.5966784", "0.59494275", "0.5947787", "0.5880935", "0.5866724", "0.58357304", "0.5815615", "0.5801928", "0.57745457", "0.5712537", "0.56984...
0.80267185
0
Record the framework and algorithm used.
def _record_usage(self, config): record_extra_usage_tag(TagKey.RLLIB_FRAMEWORK, config["framework"]) record_extra_usage_tag(TagKey.RLLIB_NUM_WORKERS, str(config["num_workers"])) alg = self.__class__.__name__ # We do not want to collect user defined algorithm names. if alg not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train():\n import trace\n trace.train()", "def setup(self):\n pass # pragma: no cover", "def dump_core(self):\n raise AssertionError(\"Core Dump function not implemented\")", "def setup(self):\n\t\tpass", "def describe():", "def support(self):", "def setup(self):\n pass", ...
[ "0.56450415", "0.55978405", "0.5522048", "0.5513811", "0.545556", "0.54327315", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.54091066", "0.5388964", "0.5374467", "0...
0.61975557
0
Take features and labels and expand them into labelled examples for the model.
def expand_features_and_labels(x_feat, y_labels): x_expanded = [] y_expanded = [] for x, y in zip(x_feat, y_labels): for segment in x: x_expanded.append(segment) y_expanded.append(y) return x_expanded, y_expanded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, features, labels):\n pass", "def batch_features_labels(features, labels, batch_size):\n for start in range(0, len(features), batch_size):\n end = min(start + batch_size, len(features))\n #print(labels[start:end])\n yield features[start:end], labels[start:end]", "d...
[ "0.70349824", "0.68972695", "0.6896075", "0.6843909", "0.6753165", "0.6723895", "0.6698124", "0.6696624", "0.6696624", "0.6696624", "0.66622084", "0.66512835", "0.66372955", "0.66372955", "0.6585688", "0.65664846", "0.6552065", "0.6544043", "0.6524538", "0.6518095", "0.651359...
0.738075
0
Given units, return the number of days as a float.
def __get_number_of_day(units): multiplier = DAYS_IN_A_YEAR if units: if units.lower().startswith("w"): multiplier = DAYS_IN_A_WEEK elif units.lower().startswith("m"): multiplier = DAYS_IN_A_MONTH return multiplier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_seconds_in_days(days):\n return int(days * 86400)", "def get_number_days(self):\r\n return 1", "def daysinunit(self, unit):\n\t\treturn float(self.daysinbase)/self.unitsize(unit)", "def get_total_days(x):\n if not isinstance(x, dt.timedelta):\n raise TypeError(str(type(x)))\...
[ "0.6842742", "0.66279376", "0.65096146", "0.64563215", "0.6441921", "0.6411838", "0.6360568", "0.63437134", "0.6317742", "0.6294341", "0.62746185", "0.61432064", "0.6067217", "0.6014479", "0.5979685", "0.59133446", "0.59019345", "0.58854306", "0.5880806", "0.5880806", "0.5880...
0.7700852
0
Draw N samples for the discrete probability mass function PM that is defined over the support X. X ... Support of RV np.array([...]) PM ... P(X) np.array([...]) N ... number of samples scalar
def sample_discrete_pmf(X, PM, N): assert np.isclose(np.sum(PM), 1.0) assert all(0.0 <= p <= 1.0 for p in PM) y = np.zeros(N) cumulativePM = np.cumsum(PM) # build CDF based on PMF offsetRand = np.random.uniform(0, 1) * (1 / N) # offset to circumvent numerical issues with cumulativePM comb ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob4():\n\n\n N = 500000\n random_draws = np.random.multivariate_normal(mean = [-1,1], cov =[[1,0],[0,1]], size = N)\n\n h = lambda x: x[0] < -1 and x[1] > 1\n f = lambda x: stats.multivariate_normal(mean = [ 0, 0]).pdf(x)\n g = lambda x: stats.multivariate_normal(mean = [-1, 1]).pdf(x)\n\n ...
[ "0.6814683", "0.6641542", "0.63271695", "0.6082206", "0.6009787", "0.5970818", "0.5969266", "0.5960734", "0.59228325", "0.5902998", "0.58631736", "0.5857052", "0.58411586", "0.58106774", "0.5798816", "0.57788235", "0.57788235", "0.5743618", "0.5735939", "0.57295287", "0.56964...
0.7242047
0
Show contour plot for bivariate Gaussian with given mu and cov in the range specified. mu ... mean [mu1, mu2] cov ... covariance matrix [[cov_00, cov_01], [cov_10, cov_11]] xmin, xmax, ymin, ymax ... range for plotting
def plot_gauss_contour(mu, cov, xmin, xmax, ymin, ymax, title): npts = 500 deltaX = (xmax - xmin) / npts deltaY = (ymax - ymin) / npts stdev = [0, 0] stdev[0] = np.sqrt(cov[0][0]) stdev[1] = np.sqrt(cov[1][1]) x = np.arange(xmin, xmax, deltaX) y = np.arange(ymin, ymax, deltaY) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotCov(mu, C, axis):\n xx1 = [mu[0,0]-0.2,mu[0,0]+0.2]\n xx2 = [mu[1,0]-0.2,mu[1,0]+0.2]\n X1,X2 = meshgrid(linspace(xx1[0],xx1[1],50), linspace(xx2[0],xx2[1],50))\n f = zeros(shape(X1))\n Cinv = linalg.inv(C)\n CinvDet = linalg.det(Cinv)\n if CinvDet > 10**15:\n print \"The follow...
[ "0.71781987", "0.66781443", "0.65202135", "0.608351", "0.6049695", "0.60352194", "0.60240513", "0.5901718", "0.58632463", "0.5672323", "0.5625327", "0.5518208", "0.5379786", "0.5352699", "0.5276187", "0.5194954", "0.51469177", "0.5145228", "0.5135627", "0.51242274", "0.510131...
0.8186874
0
Returns the likelihood of X for bivariate Gaussian specified with mu and cov. X ... vector to be evaluated np.array([[x_00, x_01], ..., [x_n0, x_n1]]) mu ... mean [mu1, mu2] cov ... covariance matrix [[cov_00, cov_01],[cov_10, cov_11]]
def likelihood_bivariate_normal(X, mu, cov): dist = multivariate_normal(mu, cov) P = dist.pdf(X) return P
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_multi_gaussian(X):\n m, n = X.shape\n mu = mean(X, axis=0)\n sigma = cov_matrix(X, mu)\n\n return mu, sigma", "def correlated_gaussian_loglikelihood(xs, means, cov):\n lu,piv=sl.lu_factor(cov)\n\n lambdas=np.diag(lu)\n\n ndim=xs.shape[0]\n \n ds=(xs-means)*sl.lu_solve((lu,...
[ "0.68252563", "0.6792381", "0.6640293", "0.6522097", "0.6462739", "0.64208096", "0.6385412", "0.6375017", "0.63249886", "0.6319324", "0.6310858", "0.62738365", "0.6266777", "0.6238181", "0.6228707", "0.62279505", "0.6208555", "0.6207846", "0.62000704", "0.6067542", "0.6017924...
0.75714517
0
Load the end of day stock CSV data into cuDF dataframe Arguments
def process(self, inputs): df = cudf.read_csv(self.conf['path']) # extract the year, month, day ymd = df['DTE'].astype('str').str.extract(r'(\d\d\d\d)(\d\d)(\d\d)') # construct the standard datetime str df['DTE'] = ymd[0].str.cat(ymd[1], '-').st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_all_data(self,tickr):\n self.__csvurl=f\"https://query1.finance.yahoo.com/v7/finance/download/{tickr}?period1=1092873600&period2={int(datetime.now().timestamp())}&interval=1d&events=history&includeAdjustedClose=true\"\n s=get_historic_data(self.__csvurl)\n\n \"\"\"you should not be a...
[ "0.618389", "0.6067585", "0.60030985", "0.5923332", "0.5885714", "0.5864793", "0.5840937", "0.5825499", "0.58034205", "0.5801878", "0.5797317", "0.5797252", "0.57860386", "0.5774849", "0.57509583", "0.5742278", "0.57356733", "0.5726865", "0.57052344", "0.5692069", "0.56782544...
0.632179
0
Find all combinations of the specified length from a sequence.
def combinations(sequence, length, NULL=object()): if length <= 0: combos = [NULL] else: combos = [] for i, item in enumerate(sequence, 1): rem_items = sequence[i:] rem_combos = combinations(rem_items, length-1) combos.extend(item if combo is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AllCombinations(data, comblength):\n return [c for c in itertools.combinations(data, comblength)]", "def possible_motifs_by_length(length, base_set=\"ACGU\"):\n args = [base_set for i in xrange(length)]\n for permutation in itertools.product(*args):\n yield \"\".join(permutation)", "def gen...
[ "0.7391799", "0.70883393", "0.69501454", "0.6638645", "0.6519996", "0.6389565", "0.6222641", "0.622135", "0.62064344", "0.6199533", "0.6183746", "0.6153947", "0.6153947", "0.6097807", "0.6096363", "0.6095496", "0.6082044", "0.6075121", "0.6075121", "0.6026864", "0.59938115", ...
0.77634394
0
takes a Binary String Tree and returns the sum of the lengths of all the leaves. BST > num
def total_len(BST): if isinstance(BST,tuple): return total_len(BST[0]) + total_len(BST[1]) else: return len(BST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bst_count_leaves(tree):\n leaves = 0\n\n def _walk(node=None):\n nonlocal leaves\n if node is None:\n return\n\n if node.left is not None:\n _walk(node.left)\n\n if node.left is None and node.right is None:\n leaves += 1\n\n if node.righ...
[ "0.7068906", "0.67276716", "0.6592653", "0.6562969", "0.6536931", "0.65101594", "0.6485907", "0.648363", "0.64446527", "0.63749784", "0.6345081", "0.6339996", "0.6286512", "0.6281552", "0.6275853", "0.6275338", "0.6256959", "0.62358624", "0.6233116", "0.6224606", "0.6214529",...
0.7558169
0
takes a BST and returns a single long tuple whose items are the leaves of the tree. BST > str
def flatten(BST): leaves = () if isinstance(BST,tuple): return flatten(BST[0]) + flatten(BST[1]) else: leaves = leaves + (BST,) return leaves
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat_leaves(BST):\r\n leaves = \"\"\r\n if isinstance(BST,tuple):\r\n return concat_leaves(BST[0]) + concat_leaves(BST[1])\r\n else:\r\n leaves = leaves + BST\r\n return leaves", "def get_leaves(tree):\n tree = Tree(tree, format=1)\n midpoint = tree.get_midpoint_outgroup...
[ "0.72466344", "0.65499896", "0.6366722", "0.6262221", "0.62470675", "0.62371546", "0.62266874", "0.61697483", "0.6141943", "0.6126574", "0.6120714", "0.61182", "0.6111112", "0.60832244", "0.6082673", "0.6075954", "0.60585374", "0.60557777", "0.6050837", "0.6044776", "0.604260...
0.6803897
1
Given a selection, return the resulting record's PK field's value
async def get_pk_value(self, selection): record = await self.get_one(selection) return record[self.primary_key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_one(cls, pk):\n with sqlite3.connect(cls.dbpath) as conn:\n conn.row_factory = sqlite3.Row\n curs = conn.cursor()\n sql = f\"\"\"SELECT * FROM {cls.tablename} WHERE pk =?;\"\"\"\n curs.execute(sql, (pk,)) #don't forget to put a comma after single value ...
[ "0.6245229", "0.6140845", "0.61204755", "0.6096608", "0.6072123", "0.60388494", "0.6023633", "0.5992066", "0.59334964", "0.5836377", "0.57651424", "0.5740068", "0.5731107", "0.56568587", "0.56291384", "0.5591357", "0.5590894", "0.5588863", "0.5585854", "0.55595994", "0.554507...
0.8450336
0
Get object id by str or Condition Immediately return if value is str.
async def get_object_id(self, value): if isinstance(value, str): return value elif isinstance(value, Condition): return await self.get_pk_value(value) else: raise SelectError(f"Selection must be of type {Condition} or {str}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getid(obj):\n\n try:\n return obj.id\n except AttributeError:\n return obj", "def getid(obj):\n try:\n return obj.id\n except AttributeError:\n return obj", "def _retrieve_object_id(obj: Optional[Union[\"Base\", str]]) -> Optional[str]:\n # Check whether the obj i...
[ "0.6084104", "0.60756594", "0.5955591", "0.5909663", "0.5868297", "0.58613926", "0.5850734", "0.5805439", "0.57735723", "0.5770992", "0.5770992", "0.5759597", "0.57384765", "0.5671734", "0.5565313", "0.55317", "0.5495924", "0.54944843", "0.54808575", "0.54263973", "0.54219717...
0.7796754
0
return true if string contains a char that appears exactly x times
def has_n_same(string, n): all_chars = {} for char in string: # sum up count of each char all_chars.setdefault(char, 0) all_chars[char] += 1 for char, count in all_chars.items(): # check how many appeared n times if count == n: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _spaceEfficientHasRepeatCharacters(check_string):\n for i in range(len(check_string)):\n for j in range(len(check_string)):\n if check_string[i] == check_string[j] and i != j:\n return True\n return False", "def new_property_1(string):\n length = ...
[ "0.72399765", "0.6968274", "0.6786331", "0.6770791", "0.6738388", "0.66060555", "0.65523666", "0.6501186", "0.6494693", "0.6488712", "0.6431084", "0.64301133", "0.64002985", "0.6397329", "0.63910824", "0.6380138", "0.63788074", "0.6377411", "0.63640183", "0.6342549", "0.63265...
0.73955303
0
return product of boxes with 2 same chars and boxes with 3 same chars
def get_checksum(boxlist): twosames = threesames = 0 for boxname in boxlist: if has_n_same(boxname, 2): twosames += 1 if has_n_same(boxname, 3): threesames += 1 return twosames * threesames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eul59():\n cipher = [c.rstrip('\\n') for c in open('resources/p059_cipher.txt')]\n cipher = [int(c) for c in cipher[0].split(\",\")]\n for key in itertools.product(range(97, 123), repeat=3):\n msg = [x ^ y for x, y in zip(cipher, itertools.cycle(key))]\n if ' the ' in ''.join(map(chr, ms...
[ "0.57937187", "0.56487954", "0.5515939", "0.55061495", "0.5496701", "0.5411774", "0.5410049", "0.5380982", "0.5358863", "0.53190464", "0.53108805", "0.53101975", "0.52967083", "0.51887906", "0.51774186", "0.51597285", "0.5157517", "0.515686", "0.51566386", "0.5156006", "0.513...
0.58462465
0
return the string of shared characters between the correct boxes
def find_shared_chars_of_neighbours(boxlist): for b1_pos, b1_name in enumerate(boxlist): for b2_name in boxlist[b1_pos:]: # skip boxes that have been compared already shared_chars = [] misses = 0 for pos, char in enumerate(b1_name): if b2_name[pos] == cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def differByOneChar(boxid1, boxid2):\n index = 0\n diffChars = 0\n result = \"\"\n while index < len(boxid1):\n if boxid1[index] != boxid2[index]:\n diffChars += 1\n if diffChars > 1: \n break\n else:\n result += boxid1[index]\n index...
[ "0.6122533", "0.6045863", "0.6033045", "0.598028", "0.5799882", "0.57708365", "0.5744262", "0.5725621", "0.57076174", "0.56657827", "0.5664604", "0.5662185", "0.56548166", "0.5614188", "0.5556256", "0.5550368", "0.5547879", "0.55433726", "0.5525835", "0.54800826", "0.5459981"...
0.7027004
0
check first 4 bytes of file to see if they are '0x7f''E''L''F' check to see if 32bit check to see if little endian return True if all conditions hold return False if any do not
def should_i_even_bother(file_bytes): if file_bytes[E_MAG[0]:E_MAG[1]] == (str(0x7f) + "ELF"): if file_bytes[E_BIT[0]] == 1: if file_bytes[E_END[0]] == 1: return True #this is a 32-bit little-endian ELF file return False #this is not a 32-bit little-endian ELF file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autodetect_endian_and_sanity_check_su(file):\n pos = file.tell()\n if isinstance(file, io.BytesIO):\n file.seek(0, 2)\n size = file.tell()\n file.seek(pos, 0)\n else:\n size = os.fstat(file.fileno())[6]\n if size < 244:\n return False\n # Also has to be a multi...
[ "0.6607864", "0.64858663", "0.6392429", "0.638193", "0.63319147", "0.62828004", "0.62763053", "0.61157817", "0.6001656", "0.596569", "0.59518063", "0.5925782", "0.5901564", "0.58987194", "0.58831275", "0.5856002", "0.58347356", "0.5811504", "0.574723", "0.57332706", "0.571997...
0.73270434
0
It does not check if the user is validated so we suposse that we already did that step. Creates (in case it does not exist) a new user by using google login.
def create_google_user(self, payload, user_data): if not User.objects.filter(email=payload['email']).exists(): u = User() u.generate_token() u.email = payload['email'] u.name = payload['given_name'] or '' u.surname = payload['family_name'] or '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user():\n new_user = User(id=login_session['gplus_id'],\n name=login_session['username'],\n email=login_session['email'],\n picture=login_session['picture'])\n session.add(new_user)\n session.flush()\n session.commit()\n user = sess...
[ "0.73112833", "0.71384114", "0.7078604", "0.70634305", "0.70135295", "0.7000864", "0.69825053", "0.696681", "0.69575864", "0.6952113", "0.6950262", "0.69217247", "0.6919828", "0.6913842", "0.6907432", "0.68911934", "0.6885999", "0.68851775", "0.6885023", "0.6879858", "0.68777...
0.73813224
0
Validates if the request actually comes from Google.
def google_validate(self, token): try: payload = client.verify_id_token(token, GOOGLE_USER_ID) if payload['iss'] not in ['accounts.google.com', 'https://accounts.google.com'] or payload['aud'] != GOOGLE_USER_ID: return False else: return payloa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_verify(request):\n return {}", "def _is_valid(self):\n # TODO: Query Google to validate credentials\n return True", "def ask_google():\n\n request = \"GET / HTTP/1.1\\nHost: www.google.com\\n\\n\"\n client_port = randint(10000, 65535)\n client = start_client(server=\"www.goog...
[ "0.68654954", "0.6380371", "0.6165708", "0.6160145", "0.61040455", "0.60911405", "0.6075991", "0.6016797", "0.5954596", "0.5774562", "0.5752863", "0.5690273", "0.56508154", "0.5637624", "0.5611246", "0.5593597", "0.5576995", "0.557405", "0.5506325", "0.54942524", "0.5489857",...
0.6866687
0
Builds a pipeline from a string list of augmentations.
def build_augmentation_pipeline(aug_list): AUGMENTATIONS = { 'leadlag': LeadLag(), 'penoff': PenOff(), 'addtime': AddTime(), 'cumsum': CumulativeSum(), 'basepoint': Basepoint() } pipeline = Pipeline([ (tfm_str, AUGMENTATIONS[tfm_str]) for tfm_str in aug_list ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_augmentation_list(data, aug_list):\n pipeline = build_augmentation_pipeline(aug_list)\n\n # Transform\n data_tfmd = pipeline.fit_transform(data)\n\n return data_tfmd", "def _make_pipeline(preprocessors, classifier):\n if isinstance(preprocessors, list):\n # support only preprocess...
[ "0.57427645", "0.5548762", "0.5349026", "0.5337194", "0.53116095", "0.5305027", "0.52407354", "0.5197978", "0.5139765", "0.5134769", "0.5105749", "0.50101733", "0.49554354", "0.49478212", "0.4943492", "0.49272734", "0.49036598", "0.48217702", "0.4788314", "0.4784447", "0.4775...
0.78027004
0
Applies augmentations to the data if specified in list format with keys corresponding to AUGMENTATIONS.keys(). This will build a sklearn pipeline from the augmentation list, as such, each augmentation must operate a fit and a transform method.
def apply_augmentation_list(data, aug_list): pipeline = build_augmentation_pipeline(aug_list) # Transform data_tfmd = pipeline.fit_transform(data) return data_tfmd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_augmentation_pipeline(aug_list):\n AUGMENTATIONS = {\n 'leadlag': LeadLag(),\n 'penoff': PenOff(),\n 'addtime': AddTime(),\n 'cumsum': CumulativeSum(),\n 'basepoint': Basepoint()\n }\n\n pipeline = Pipeline([\n (tfm_str, AUGMENTATIONS[tfm_str]) for tfm_s...
[ "0.6866594", "0.6430017", "0.6388156", "0.6318513", "0.61158645", "0.60924715", "0.6058854", "0.573213", "0.5674961", "0.5611524", "0.5596335", "0.55637026", "0.5559639", "0.5532383", "0.5525116", "0.5512109", "0.54994994", "0.54822004", "0.54808426", "0.5477426", "0.544567",...
0.7728719
0
return the sum for all inputs multiplied by its weight
def weighted_sum(self, inputs): weighted_sum = 0 for i in range(self.num_inputs): weighted_sum += self.weights[i]*inputs[i] return weighted_sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _input(self, inputs):\n return sum([w*i for w,i in zip(self._weights, inputs)])", "def weighted_sum(W, X):\n\n if len(W) != len(X):\n print(\"Dimension of weight vector should be same as input vector.\")\n return\n\n else:\n H = 0\n\n for i in range(len(W)):\n ...
[ "0.81508034", "0.7388956", "0.73437566", "0.73270863", "0.7079421", "0.70078295", "0.6999789", "0.6996185", "0.6971512", "0.6942725", "0.6942288", "0.6936163", "0.68125653", "0.6768396", "0.6743924", "0.6729408", "0.6727259", "0.66790026", "0.6670569", "0.6656775", "0.6644984...
0.862976
0
Return a classification threshold of either 0 or 1 we use 0.5 as a threshold here for ease of understanding
def threshold(self, value): threshold = 0.5 if value >= threshold: return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjusted_classes(pred_prob, threshold):\n return [1 if y >= threshold else 0 for y in pred_prob]", "def threshold(activation):\n if activation >= 0.0:\n return 1\n else:\n return 0", "def classify(self, img, threshold=2.5):\n return (img-self.mu)/numpy.sqrt(sel...
[ "0.7607788", "0.74181265", "0.73255897", "0.7302343", "0.72729796", "0.7198345", "0.7178722", "0.7146021", "0.71100205", "0.71099883", "0.7075837", "0.69827133", "0.6963441", "0.6963441", "0.6963441", "0.6963441", "0.6963441", "0.6950873", "0.6933344", "0.6909209", "0.6887803...
0.76229095
0
Check if link between nodes u and v is eligible Eligibility allows us to ignore some nodes/links for link prediction.
def eligible(self, u, v): return self.eligible_node(u) and self.eligible_node(v) and u != v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible_node(self, v):\n if self.eligible_attr is None:\n return True\n return self.G.nodes[v][self.eligible_attr]", "def check_triplets(anchors_id, positives_id, negatives_id, labels):\r\n\r\n # calculate labels of anchors, positives and negatives\r\n anchors_label = labels[a...
[ "0.6220041", "0.5479193", "0.541795", "0.54021317", "0.53760755", "0.5322491", "0.5283826", "0.52638954", "0.52638954", "0.52623576", "0.5254341", "0.52430797", "0.5241802", "0.5234832", "0.52139294", "0.51694167", "0.5166031", "0.5121419", "0.50902706", "0.5089218", "0.50808...
0.71311
0
Check if node v is eligible Eligibility allows us to ignore some nodes/links for link prediction.
def eligible_node(self, v): if self.eligible_attr is None: return True return self.G.nodes[v][self.eligible_attr]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible(self, u, v):\n return self.eligible_node(u) and self.eligible_node(v) and u != v", "def make_eligible(self):\n pass", "def is_eligible(self) -> Optional[bool]:\n return pulumi.get(self, \"is_eligible\")", "def eligible_nodes(self):\n return [v for v in self.G if self....
[ "0.7254655", "0.6058454", "0.5948671", "0.5434981", "0.53767216", "0.5344005", "0.51179814", "0.5067771", "0.5059233", "0.5036925", "0.50322914", "0.50300103", "0.49895108", "0.49720985", "0.49715447", "0.49693823", "0.49678475", "0.49637932", "0.49615553", "0.49429572", "0.4...
0.7479026
0
Get list of eligible nodes Eligibility allows us to ignore some nodes/links for link prediction.
def eligible_nodes(self): return [v for v in self.G if self.eligible_node(v)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible_edges(self):\n if len(self.edges) == 4:\n return [self.edges[0], self.edges[2]]\n return []", "def eligible_edges(self):\n return self.edges", "def get_eligibility_state(self):\n ec = EligibilityChecker(self.to_case_data())\n\n try:\n if ec....
[ "0.61214733", "0.6083447", "0.5747758", "0.55628824", "0.55478865", "0.5435323", "0.54278237", "0.5410997", "0.5368904", "0.5313326", "0.52837807", "0.52363235", "0.522822", "0.5221616", "0.52122986", "0.51732886", "0.51487964", "0.51378757", "0.51208705", "0.50940776", "0.50...
0.7162007
0
Return a list of available parsing modules
def list_parsers(self, *args): print('==== Available parsing modules: ====\n') for parser in sorted(self.parse_modules): print(self.parse_modules[parser].name.ljust(16) + \ ': ' + self.parse_modules[parser].desc) sys.exit(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_list(self):\r\n return get_module_list()", "def parse_modules(self) -> None:\n mods: Dict[str, str] = {}\n matches = self.find_dir(\"LoadModule\")\n iterator = iter(matches)\n # Make sure prev_size != cur_size for do: while: iteration\n prev_size = -1\n\n ...
[ "0.637209", "0.63088214", "0.6292778", "0.6189748", "0.61843383", "0.6150408", "0.615018", "0.612759", "0.6103165", "0.6084755", "0.60738045", "0.6039044", "0.6020933", "0.59958196", "0.5980766", "0.59572107", "0.59423083", "0.5941487", "0.59333986", "0.58959115", "0.5892899"...
0.7719078
0
test shifting translation to and from the center of coordinates of the master ncs copy
def test_center_of_coordinates_shift(): # print sys._getframe().f_code.co_name # c = commons() pdb_inp = iotbx.pdb.input(source_info=None, lines=test_pdb_str_2) ncs_obj_phil = ncs.input( hierarchy=pdb_inp.construct_hierarchy()) ncs_restraints_group_list = ncs_obj_phil.get_ncs_restraints_group_list() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pose_shifter(self):\n self.dyn_client.update_configuration({\"linear_offset_x\":0.1, \"linear_offset_y\":0.0, \"linear_offset_z\":0.05})\n pose_in = geometry_msgs.msg.PoseStamped()\n expected = geometry_msgs.msg.PoseStamped()\n pose_in.header.frame_id = \"base_link\"\n e...
[ "0.6257119", "0.59288025", "0.58908606", "0.5881198", "0.5877748", "0.58339727", "0.5829475", "0.582809", "0.5812057", "0.58055425", "0.578972", "0.5765716", "0.5740614", "0.5737785", "0.5715512", "0.5702274", "0.57008284", "0.5694033", "0.5680752", "0.56617993", "0.562996", ...
0.7729069
0
verify that extended_ncs_selection, which include the master ncs copy and the portion of the protein we want to refine.
def test_ncs_selection(): pdb_inp = iotbx.pdb.input(source_info=None, lines=test_pdb_str_2) ncs_obj_phil = ncs.input( hierarchy=pdb_inp.construct_hierarchy()) ncs_restraints_group_list = ncs_obj_phil.get_ncs_restraints_group_list() # ncs_restraints_group_list._show() refine_selection = flex.size_t(range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_selection():\n pdb_inp = iotbx.pdb.input(source_info=None, lines=pdb_answer_0)\n ncs_obj_phil = ncs.input(\n hierarchy=pdb_inp.construct_hierarchy())\n nrg = ncs_obj_phil.get_ncs_restraints_group_list()\n\n m1 = list(nrg[0].master_iselection)\n c1 = list(nrg[0].copies[0].iselection)\n c2 = list...
[ "0.66677123", "0.59005964", "0.5783926", "0.57621074", "0.56725574", "0.5621668", "0.56033003", "0.5600859", "0.5581437", "0.5549812", "0.5529869", "0.5514876", "0.5511986", "0.5499625", "0.5493505", "0.54790294", "0.5462845", "0.5452194", "0.5422322", "0.54019374", "0.534369...
0.6963384
0
test that a atom selection propagates correctly to ncs_restraints_group_list
def test_selection(): pdb_inp = iotbx.pdb.input(source_info=None, lines=pdb_answer_0) ncs_obj_phil = ncs.input( hierarchy=pdb_inp.construct_hierarchy()) nrg = ncs_obj_phil.get_ncs_restraints_group_list() m1 = list(nrg[0].master_iselection) c1 = list(nrg[0].copies[0].iselection) c2 = list(nrg[0].copie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ncs_selection():\n pdb_inp = iotbx.pdb.input(source_info=None, lines=test_pdb_str_2)\n ncs_obj_phil = ncs.input(\n hierarchy=pdb_inp.construct_hierarchy())\n ncs_restraints_group_list = ncs_obj_phil.get_ncs_restraints_group_list()\n # ncs_restraints_group_list._show()\n refine_selection = flex.s...
[ "0.689222", "0.651206", "0.6450643", "0.62224257", "0.61812073", "0.5928913", "0.5490005", "0.5421499", "0.53324443", "0.5284058", "0.52533066", "0.5239139", "0.522347", "0.5212741", "0.5194514", "0.5163641", "0.5159723", "0.51392025", "0.5129952", "0.51071346", "0.5106937", ...
0.7462518
0
Test of split_by_chains where chains are splitted, e.g. protein and ligand are separated by TER
def test_split_by_chain_2(): pdb_str = """\ CRYST1 174.866 238.091 243.466 90.00 90.00 90.00 P 21 21 21 SCALE1 0.005719 0.000000 0.000000 0.00000 SCALE2 0.000000 0.004200 0.000000 0.00000 SCALE3 0.000000 0.000000 0.004107 0.00000 ATOM 15295 N SER D 74 59.475 -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_chains(self):\n pass", "def detect_chains(input_pdb):\n opened_pdb = open(input_pdb, \"r\").readlines()\n chains = []\n for value in opened_pdb[1:]:\n try:\n if value[21] not in chains:\n chains.append(value[21])\n except:\n continue...
[ "0.6408603", "0.58561546", "0.57033074", "0.5683343", "0.5636348", "0.54884017", "0.54795426", "0.5459941", "0.5418595", "0.5415326", "0.5413339", "0.5398173", "0.53324294", "0.532725", "0.5324694", "0.5323937", "0.5316425", "0.53159606", "0.529541", "0.52660215", "0.52175987...
0.6944304
0
Query the google api for the given address and try to receive latitude and longitude information. The result is a dictionary with keys latitude and longitude where each value is set according to the response of the request. If the request was not successful because no or more than one address were returned or any other...
def fetch_address(address): geo_location = {"latitude": None, "longitude": None} logger.info("Querying for address '%s'", address) response = requests.get(GOOGLE_URL, params={'address': address}) time.sleep(1) try: body = response.json() except: logger.error(response.status_cod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_google_results(address, api_key=None, return_full_response=False):\n # Set up your Geocoding url\n geocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address={}\".format(address) + \"&sensor=false\"\n # if api_key is not None:\n # geocode_url = geocode_url + \"&key={}\".forma...
[ "0.74228853", "0.7409463", "0.7398897", "0.7288822", "0.71374464", "0.7102032", "0.7060365", "0.70283234", "0.7027795", "0.69642717", "0.6960493", "0.6902834", "0.68361545", "0.664368", "0.65990245", "0.6581291", "0.6553107", "0.6552429", "0.65462655", "0.65244776", "0.651753...
0.77975553
0
load files to kv
def load_files(self, flist, key_count, in_mem): #change a filename to a list. if not isinstance(flist, list): flist = [flist] fcnt = len(flist) c_kvdict.load_files(self.__dict_handle, fcnt, flist, key_count, in_mem)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_kv_from_py(f):\n filename = os.path.basename(os.path.splitext(f)[0])\n Builder.load_file(\n os.path.join(\n os.path.dirname(os.path.abspath(f)),\n filename + '.kv'\n )\n )", "def __loadKeys(self):\n key_image_file_names = os.listdir(self.key_image_full...
[ "0.71027243", "0.6280158", "0.61979014", "0.61979014", "0.61727554", "0.616632", "0.6094693", "0.60710967", "0.60222054", "0.6001708", "0.60012287", "0.59980994", "0.5971605", "0.5956317", "0.5947879", "0.59445876", "0.5908502", "0.58600605", "0.5784175", "0.5772415", "0.5766...
0.6286079
1
Will count the length of your name
def length_of_name(self, name): length = len(name) if length > 10: self.show_message_when_name_very_long() return length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tester(name):\n return len(name)", "def namelength(self):\n return self[\"namelength\"]", "def test_check_name_is_3_parts():\n check_name_length()", "def count(word):\n\n return len(word)", "def size(name):", "def getLength(message):\r\n length = 0\r\n for char in message:\r\n ...
[ "0.82554317", "0.7766648", "0.7093339", "0.6850232", "0.6783995", "0.67714405", "0.67670214", "0.67600083", "0.6708405", "0.6702306", "0.6700154", "0.66744", "0.6647696", "0.66138977", "0.66138977", "0.6556391", "0.65475285", "0.65173954", "0.6507074", "0.6495807", "0.6494629...
0.8263303
0
Will sleep based on the length of your name.
def sleep_based_on_name_length(self, name): length = int(self.length_of_name(name)) time.sleep(length + 0.001) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay(self, length):\n self.log_info(f\"Browser.delay: Sleeping for {length} seconds\")\n return sleep(length)", "def sleep_for(timeToSleep):\r\n time.sleep(timeToSleep)", "def do_sleep(self, str_arg):\n # printLog(self.threadName + \"[running command 'sleep %s']\" % str_arg)\n ...
[ "0.6339326", "0.6060922", "0.5883729", "0.58400875", "0.58343124", "0.5810612", "0.5799127", "0.57948107", "0.57827336", "0.5757591", "0.5755684", "0.57486933", "0.5741928", "0.57242405", "0.57242405", "0.572368", "0.5717862", "0.5685846", "0.5678933", "0.5671579", "0.5668537...
0.8677898
0
Converts your name to all lower case.
def lowercase_name(name): return name.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower(self) -> str:", "def name_to_snake_case(name: str) -> str:\n\n # From COBOL entity\n if '-' in name or name.isupper():\n return name.strip().lower().replace('-', '_')\n\n # From camelCase\n return re.sub(r'(?<!^)(?=[A-Z])', '_', name.strip()).lower()", "def name...
[ "0.7861166", "0.7802307", "0.77933496", "0.777291", "0.77340627", "0.77340627", "0.77340627", "0.7681445", "0.7618421", "0.7533393", "0.7501871", "0.7483941", "0.74642164", "0.7387158", "0.73826", "0.7367207", "0.7348251", "0.7324015", "0.73232645", "0.7321344", "0.7316896", ...
0.88906676
0
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
def zigzagLevelOrder(self, root): if not root: return [] # create direction variable going_right = False # initialize a level stack level_stack = [root] # initialize a result array result = [] # loop while level stack is not empry w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zig_zag_traversal(root):\n return", "def zigzak_using_bfs(root):\n current_level = [root]\n next_level = []\n while current_level:\n node = current_level.pop()\n print(node.data, end=\" \")\n if node.right:\n next_level.append(node.right)\n if node.left:\n ...
[ "0.76472515", "0.6974045", "0.6966052", "0.69008505", "0.6631278", "0.65696484", "0.6472859", "0.64711165", "0.6433989", "0.63938385", "0.6313777", "0.6285579", "0.6284691", "0.627963", "0.6279272", "0.6256373", "0.62071615", "0.61616915", "0.61511487", "0.6136975", "0.613019...
0.81539404
0
Detect if we are done. Either all cells are open or the mine field is unsolvable.
def done(self): return not self.get_all_closed_cells() or self.unsolvable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def done(self):\n return self.goal == (0, 0)", "def is_solved(self):\n self.solved = self.current_pos == self.finish_pos\n return self.solved", "def update_status(self):\n if len(self.invalid) != 0:\n return False\n for row in self.grid:\n for num in row...
[ "0.65538126", "0.6534941", "0.6439068", "0.642563", "0.64131963", "0.63998014", "0.6339206", "0.6274", "0.62422884", "0.62325275", "0.621136", "0.6197106", "0.61957866", "0.61947244", "0.61912817", "0.61394846", "0.61388344", "0.60960335", "0.6089256", "0.6073771", "0.6057279...
0.8196751
0
Get all closed cells that are adjacent to a list of cells given as input.
def get_adjacent_closed_cells(self, numbered_cells): adjacent_closed_cells = [] for row, col in numbered_cells: _, closed_cells, _, _ = self.get_cells(row, col) adjacent_closed_cells += closed_cells return list(set(adjacent_closed_cells))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_numbered_cells_adjacent_closed_cells(self):\r\n numbered_cells_adjacent_closed_cells = []\r\n numbered_cells = self.get_all_numbered_cells()\r\n for row, col in numbered_cells:\r\n _, closed_cells, _, _ = self.get_cells(row, col)\r\n if closed_cells:\r\n ...
[ "0.7206826", "0.6720315", "0.6644409", "0.6553842", "0.6180239", "0.61778057", "0.61559206", "0.6149346", "0.61288583", "0.6104711", "0.6068151", "0.6066169", "0.60591185", "0.60176474", "0.5977809", "0.59594345", "0.5943861", "0.5943323", "0.59072965", "0.5894321", "0.587561...
0.7390419
0