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
Sets the peer of this Dial.
def peer(self, peer): if peer is None: raise ValueError("Invalid value for `peer`, must not be `None`") # noqa: E501 self._peer = peer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPeer (self, peer):\n\t\tself.peer = peer", "def setPeerToPeerNetwork(self, peerToPeerNetwork):\r\n raise NotImplementedError()", "def peer(self, value: Optional[MicrobitPeer]) -> None:\n if self.__peer is not None:\n self.__peer.remove_listener(self.__execute)\n\n if valu...
[ "0.83918417", "0.67424357", "0.6415004", "0.60654163", "0.5945206", "0.5834176", "0.5686866", "0.5547047", "0.54729116", "0.54373324", "0.54167396", "0.53934383", "0.5380653", "0.5360441", "0.5354226", "0.53020024", "0.5296971", "0.5267418", "0.52219296", "0.52138495", "0.517...
0.7684957
1
Provide video codec vcodec = "h264" acodec = "copy" extra = "" split_cmd = "ffmpeg i '%s' vcodec %s acodec %s y %s" % (file_path, vcodec, acodec, extra) s_cmd = " i '%s' vcodec %s acodec %s"%(file_path, vcodec, acodec)
def split_video_random(file_path, start_pos, split_length, out_path): s_cmd = " -i '%s'"%(file_path) #use default CODEC try: fileext = file_path.split(".")[-1] except IndexError as e: raise IndexError("No ext. in filename. Error: " + str(e)) split_start = start_pos split_length = split_length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_manifest(filename, manifest, vcodec=\"copy\", acodec=\"copy\",\n extra=\"\", **kwargs):\n if not os.path.exists(manifest):\n raise SystemExit\n\n with open(manifest) as manifest_file:\n manifest_type = manifest.split(\".\")[-1]\n if manifest_type == \"js...
[ "0.67609626", "0.6545024", "0.64391136", "0.6160051", "0.6078338", "0.60496306", "0.6016545", "0.6010689", "0.5968558", "0.59620136", "0.5842451", "0.583345", "0.5804066", "0.5784901", "0.5773912", "0.5729956", "0.56486654", "0.56443024", "0.5613024", "0.5551656", "0.54755616...
0.6554189
1
Get path to the PubChem template if it exists.
def _get_pubchem_template_path(self, het_id): path = os.path.join(self.pubchem_templates, f"{het_id}.sdf") return path if os.path.isfile(path) else ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template_path(self):\n raise NotImplementedError()", "def template_path(self) -> str:\n return self._values.get(\"template_path\")", "def get_template(self, template):\n\n template_path = aj.config.data['email']['templates'].get(template, 'default')\n\n if template_path == '...
[ "0.6953855", "0.68982375", "0.68708664", "0.67688173", "0.65419143", "0.64124465", "0.63890076", "0.63717955", "0.6362928", "0.63347596", "0.6195259", "0.61605114", "0.61545146", "0.61206657", "0.6091912", "0.60857964", "0.60805887", "0.6065575", "0.60610527", "0.6056612", "0...
0.7834179
0
Counts number of collisions among all bonds. Can be used for estimations of how 'wrong' the depiction is.
def count_bond_collisions(self): errors = 0 for i in range(0, len(self.bonds)): for a in range(i + 1, len(self.bonds)): result = self._intersection(self.bonds[i], self.bonds[a]) if result: errors += 1 return errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_bonds(self):\n n = 0\n for bond in self.iter_bonds():\n n += 1\n return n", "def count_bonds(self):\n n = 0\n for bond in self.iter_bonds():\n n += 1\n return n", "def get_collisions(self) -> int:\n if len(self.obstacles) == 0:\n ...
[ "0.6844145", "0.6844145", "0.68411255", "0.68388706", "0.67286265", "0.66780823", "0.64739144", "0.62883806", "0.6247389", "0.62287146", "0.61868566", "0.617473", "0.6031441", "0.60012114", "0.5952148", "0.5952148", "0.5926391", "0.5919017", "0.5828075", "0.5818269", "0.58110...
0.7136189
0
Get batch generator `batch_generator` must define a `shape` property that returns the shape of generated sequences as a (n_samples, n_features) tuple. `batch_generator` must define a method called `get_steps_per_epoch` with the signature `def get_steps_per_epoch(self, protocol, subset)` that returns the number of batch...
def get_generator(self, file_generator, batch_size=None, **kwargs): raise NotImplementedError('')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_generator(self, generator: \"DataGenerator\", nb_epochs: int = 20, **kwargs) -> None:\n raise NotImplementedError", "def gen_batch(self):\n batch_size = self.batch_size\n shuffle = self.shuffle\n data = np.array(self.sentences)\n\n data_size = len(data)\n num_bat...
[ "0.62859094", "0.627278", "0.6238411", "0.6231443", "0.61449736", "0.6116078", "0.6102709", "0.6071425", "0.6071153", "0.60535413", "0.60365564", "0.6031602", "0.60167223", "0.59738314", "0.5962088", "0.59487414", "0.59423554", "0.5910736", "0.5903543", "0.5894708", "0.586065...
0.6673094
0
Extract embedding from internal Keras model
def extract_embedding(self, from_model): return from_model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gensim_to_keras(model):\n return model.wv.get_keras_embedding()", "def get_embedding(self, model):\n embedding = []\n for node in range(len(self.graph.nodes())):\n embedding.append(list(model[str(node)]))\n embedding = np.array(embedding)\n return embedding", "def ...
[ "0.7617932", "0.7358305", "0.7260656", "0.70529824", "0.70419127", "0.6889344", "0.6849663", "0.681078", "0.6796582", "0.67891294", "0.6745876", "0.66203314", "0.6616796", "0.659487", "0.6581204", "0.65696263", "0.6557681", "0.6531176", "0.649195", "0.6473366", "0.6431787", ...
0.77565044
0
Get a logger that produces reasonable output.
def _get_logger(): logger = logging.getLogger(__name__) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter("%(asctime)s [%(levelname)8s] %(message)s")) logger.addHandler(ch) logger.setLevel(logging.DEBUG) return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger(name=\"unknown_logger\"):\n logger = logging.getLogger(name)\n logger.setLevel(logging.DEBUG)\n handler = logging.StreamHandler(sys.stdout)\n handler.setLevel(logging.DEBUG)\n handler.setFormatter(FORMATTER)\n logger.addHandler(handler)\n logger.propagate = False # to avoid pri...
[ "0.76173455", "0.73903525", "0.7385359", "0.73532313", "0.72620827", "0.7261054", "0.7208833", "0.72087556", "0.7140604", "0.7138828", "0.7128172", "0.71156687", "0.7111992", "0.7104806", "0.70627075", "0.70546305", "0.70511794", "0.7048386", "0.70350707", "0.7021459", "0.699...
0.76066315
1
import count or FPKM table
def import_countOrFPKMTable( self,filename_I): #import and format the data io = base_importData(); io.read_tab(filename_I); countOrFPKMTable = self.format_countOrFPKMTable(io.data); return countOrFPKMTable;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n ans = self.execute(self.commands.table_count(self.name))\n return ans[0][0]", "def count():", "def samples(app, args):\n engine = create_engine(args.datafile)\n meta = MetaData()\n meta.reflect(engine)\n print(\"\\t\".join([str(x).replace('counts.', '')\n ...
[ "0.6216667", "0.59590936", "0.5957887", "0.5952389", "0.5868071", "0.58158195", "0.57693267", "0.57693267", "0.5755721", "0.5700496", "0.56974876", "0.5680915", "0.56658834", "0.5662107", "0.56482613", "0.56469244", "0.5637406", "0.559692", "0.5541019", "0.55354065", "0.55352...
0.7532327
0
reformat attr tables into a dictionary for rapid alignment of attr table with tracking_id
def reformat_attrTable( self): #format into a dictionary of rows for quick aligning with the tracking_id if self.attrTable: attrTable = self.attrTable[:]; else: attrTable = []; attrTable_dict = {}; for row in attrTable: attrTable_dict[row['tracking_id']] = ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_attrs(attrs):\n new_attrs = OrderedDict()\n for attr in attrs:\n col = attr\n if isinstance(attr, tuple):\n col, attr = attr\n # special cases\n if attr == 'class_name':\n attr = '__class__.__name__'\n if attr == 'repr':\n attr ...
[ "0.65014577", "0.60592574", "0.60217834", "0.6018756", "0.6007916", "0.5968255", "0.58305824", "0.58305734", "0.57943606", "0.575547", "0.57497114", "0.574563", "0.5674587", "0.56742924", "0.56551945", "0.565404", "0.56439865", "0.5624873", "0.561691", "0.55270827", "0.551784...
0.8673553
0
reformat count table into a flattened table of sample_names/values
def reformat_countTable( self,analysis_id_I=None,sna2experimentID_I=None, sna2sns_I=None): if self.countTable: countTable = self.countTable[:]; else: countTable = []; countTable_flat = self.reformat_countOrFPKMTable( countOrFPKMTable_I=countTable, analysi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq_table(a):\n Detail_freq = a.loc[:, (a.dtypes == object) | (a.dtypes == long) ].columns.get_values().tolist()\n print(Detail_freq)\n for freq in Detail_freq:\n df1 = pd.DataFrame(a[freq].value_counts(dropna=False).astype(float).map('{:20,.0f}'.format).sort_index()).rename(columns={freq:...
[ "0.57405555", "0.56753397", "0.56595165", "0.56088334", "0.558755", "0.5580088", "0.55345875", "0.55330217", "0.5509548", "0.543421", "0.5379833", "0.5359173", "0.53470004", "0.52842575", "0.52725303", "0.5265805", "0.5256941", "0.52491903", "0.52491903", "0.52352023", "0.521...
0.627885
0
reformat fpkm table into flattened table of sample_names/values
def reformat_fpkmTable( self,analysis_id_I=None,sna2experimentID_I=None, sna2sns_I=None): if self.fpkmTable: fpkmTable = self.fpkmTable[:]; else: fpkmTable = []; fpkmTable_flat = self.reformat_countOrFPKMTable( countOrFPKMTable_I=fpkmTable, analysis_id_I=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_unifrac_sample_mapping(sample_ids, otu_ids, otu_table_array):\r\n out = []\r\n for i, row in enumerate(otu_table_array):\r\n for j, val in enumerate(row):\r\n if val > 0:\r\n line = [otu_ids[i], sample_ids[j], str(val)]\r\n out.append('\\t'.join(line...
[ "0.60229045", "0.5637049", "0.5637049", "0.53095335", "0.53014034", "0.52432746", "0.5227828", "0.51772594", "0.51730895", "0.51567525", "0.51420665", "0.51343006", "0.511792", "0.511474", "0.5104135", "0.5101256", "0.50933254", "0.5086502", "0.5055283", "0.5043328", "0.50231...
0.5961496
1
reformat count or FPKM tables into flattened table of sample_names/values for rapid alignment of attr table with tracking_id
def reformat_countOrFPKMTable( self, countOrFPKMTable_I=None, analysis_id_I=None, sna2experimentID_I=None, sna2sns_I=None, count_or_FPKM = 'count'): #format into a dictionary of rows for quick aligning with the tracking_id countOrFPKMTable_flat = []; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alignAndReformat_countFPKMattrTables(\n self,analysis_id_I=None,sna2experimentID_I=None,\n sna2sns_I=None):\n #reformat\n countTable_flat = self.reformat_countTable(\n analysis_id_I=analysis_id_I,\n sna2experimentID_I=sna2experimentID_I,\n sna2sns_I=...
[ "0.5996871", "0.5834174", "0.56089836", "0.5596423", "0.5548671", "0.554599", "0.5534935", "0.548897", "0.5448419", "0.5394029", "0.537485", "0.5362557", "0.5339601", "0.53235745", "0.52827585", "0.5272961", "0.5233933", "0.522556", "0.52244353", "0.5220203", "0.5207982", "...
0.63312393
0
View for rendering hours as json.
def json_hours(request): current_site = Site.find_for_request(request) if request.method == 'GET': if request.GET.get('fallback'): fallback = request.GET['fallback'] return JsonResponse( { 'llid': get_default_unit().location.libcal_library_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_hours(employee_id):\n\n if not g.user:\n flash(\"Please Login to continue.\", \"danger\")\n return redirect(\"/\")\n \n employee = Employee.query.get_or_404(employee_id)\n\n labels = json.dumps( [\"Completed\", \"Required\"])\n data = json.dumps([employee.completed, employe...
[ "0.6702672", "0.63559496", "0.6134469", "0.60062844", "0.58493066", "0.5845087", "0.5821502", "0.58081955", "0.57617134", "0.5753844", "0.5742273", "0.5733102", "0.57142144", "0.56817853", "0.56517273", "0.5609031", "0.558943", "0.5580721", "0.5514128", "0.549668", "0.5485034...
0.72261083
0
View for rendering events feed data as json.
def json_events(request): if request.method == 'GET': ttrss_url = request.GET['feed'] # need xml for this. university_url = 'http://events.uchicago.edu/widgets/rss.php?key=47866f880d62a4f4517a44381f4a990d&id=48' n = datetime.datetime.now() return JsonResponse( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_events():\n result = get_events_helper(Event)\n return jsonify(result[0]), result[1]", "def get():\n return jsonify({'events': 'Events API'}), 200", "def get_event():\n json_data = request.args or {}\n return make_response(jsonify({ \"data\" : Event.get_events(json_data)}))"...
[ "0.76628214", "0.67185247", "0.6591272", "0.6508852", "0.6443426", "0.62528884", "0.6215547", "0.6096349", "0.60427344", "0.604139", "0.5985696", "0.5972402", "0.5937236", "0.5932184", "0.59189314", "0.58994985", "0.58941627", "0.5889959", "0.58717847", "0.58609265", "0.58606...
0.778918
0
View for rendering news feed data as json.
def json_news(request): if request.method == 'GET': feed = request.GET['feed'] return JsonResponse( { 'news': get_news(feed), } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_news():\n data = get_top_news()\n return jsonify(data)", "def news():\n\n # ensure parameters are present\n # geo = request.args.get(\"geo\")\n geo = '95060'\n if not geo:\n raise RuntimeError(\"missing geo\")\n\n # lookup articles and store them as JSON array\n article_lis...
[ "0.673006", "0.66394603", "0.6454153", "0.6373204", "0.6363174", "0.63411576", "0.6298449", "0.61722803", "0.61526084", "0.60082966", "0.59839356", "0.5969505", "0.5918859", "0.5916364", "0.5914569", "0.5899843", "0.58803356", "0.5869351", "0.58558553", "0.5835319", "0.581607...
0.78444064
0
View for retreiving the chat status for Ask a Librarian pages. Returns json.
def chat_status(request): if request.method == 'GET': ask_name = request.GET['name'] status = get_chat_status_and_css(ask_name) return JsonResponse( { 'chat_status': status[0], 'chat_css': status[1], } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_status(request):\n team = Hunt.objects.get(is_current_hunt=True).team_from_user(request.user)\n if request.method == 'GET' and request.is_ajax():\n if(team is None):\n return render(request, 'access_error.html', {'reason': \"team\"})\n status = team.num_waiting_messages\n ...
[ "0.7056218", "0.58047336", "0.57761455", "0.56156147", "0.56094897", "0.5595043", "0.55575705", "0.5555067", "0.5535522", "0.553365", "0.5530453", "0.55122775", "0.540345", "0.53645366", "0.53573716", "0.53215814", "0.53145057", "0.52810264", "0.5262246", "0.5239236", "0.5229...
0.76308614
0
pour un indice de disque k, la famille des listes de des indices, et l'indice du disque k dans la famille L, renvoie la liste / l'ensemble des indices de disques dont la vitesse va etre modifiee par k
def influence(k,L,n): try: to_check = L[n-1] #set des indices contact_direct=C(k,0) return list(to_check.intersection(contact_direct)) except: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_k_indices(self, ks):\n if self.staticneighs:\n idx_ks = ks\n else:\n idx_ks = [self.ks.index(e) for e in ks]\n return idx_ks", "def generate_L(data_set, k, min_support):\n fptree = FPtree.fptree(data_set, min_support)\n print(\"pre:\",datetime.datetime.no...
[ "0.5962983", "0.57616395", "0.57209855", "0.56889814", "0.567445", "0.5651179", "0.5565496", "0.55339205", "0.5526475", "0.5519671", "0.55177283", "0.55137473", "0.54557353", "0.54334563", "0.5427422", "0.54150856", "0.5399065", "0.5382154", "0.53808355", "0.5375292", "0.5372...
0.57878196
1
Add a new hotel to the system
async def add_hotel_endpoint(request): hotel_name = request.args["hotel_name"][0] hotel_id = model.add_hotel(hotel_name) return json({"hotel_id": hotel_id})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_arrival(self):\n pass", "def addHotspot( self, hotspot ):\n self._hotspots.append(hotspot)", "async def add_reservation_endpoint(request):\n hotel_id = request.args[\"hotel_id\"][0]\n room_type = request.args[\"room_type\"][0]\n arrival_date = request.args[\"arrival_date\"][0...
[ "0.63080275", "0.5862244", "0.58347523", "0.5819879", "0.5525398", "0.5483701", "0.54169357", "0.5386112", "0.5373534", "0.52948624", "0.52928376", "0.5286119", "0.5283983", "0.5268902", "0.5244285", "0.52413", "0.5239886", "0.52386993", "0.5225297", "0.5223356", "0.52185214"...
0.67610687
0
Add inventory to a given hotel
async def add_inventory_endpoint(request): hotel_id = request.args["hotel_id"][0] room_type = request.args["room_type"][0] room_inventory = request.args["room_inventory"][0] model.add_inventory(hotel_id, room_type, room_inventory) return json({"success": True})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_inventory(self, newItem):\n\n if len(self.player_inventory) >= 8:\n print(\"\"\"You already have the maximum of 7 items in your inventory,\n looks like you will need to get rid of an item to get {}\"\"\".format(newItem.name))\n\n print(\"Would you like to get rid ...
[ "0.6268694", "0.6268613", "0.6260081", "0.6259757", "0.6220235", "0.62095225", "0.6174858", "0.6051948", "0.6041582", "0.6013446", "0.5951593", "0.59234303", "0.5922092", "0.5921586", "0.588076", "0.5787859", "0.5782276", "0.576559", "0.5759909", "0.5720281", "0.56820464", ...
0.6929253
0
Cancel an existing reservation
async def cancel_reservation_endpoint(request): reservation_id = request.args["reservation_id"][0] model.cancel_reservation(reservation_id) return json({"success": True})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_reservation(payload, clothes_id):\n selection = Reserve.query.filter_by(clothes_id=clothes_id).all()\n # if the given clothes has not been reserved, abort 404\n if len(selection) == 0:\n abort(404)\n # if two or more user reserved the same clothe, abort umprocessab...
[ "0.7251533", "0.6900359", "0.6353264", "0.63135654", "0.6305536", "0.6305536", "0.6305536", "0.6251353", "0.6242757", "0.6192752", "0.61905634", "0.6167782", "0.6162976", "0.61334383", "0.6130032", "0.6127152", "0.61173344", "0.61173344", "0.6115619", "0.6088514", "0.60856", ...
0.80371726
0
Add a new reservation
async def add_reservation_endpoint(request): hotel_id = request.args["hotel_id"][0] room_type = request.args["room_type"][0] arrival_date = request.args["arrival_date"][0] departure_date = request.args["departure_date"][0] status = request.args["status"][0] reservation_id = model.add_reservation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reservation_add(token_user):\n if not json_param_exists('team_id') or \\\n not json_param_exists('room_id') or \\\n not json_param_exists('start') or \\\n not json_param_exists('end'):\n abort(400, 'one or more required parameter is missing')\n\n team_id = ...
[ "0.75879747", "0.7112902", "0.6949954", "0.6692203", "0.650362", "0.63385224", "0.6337414", "0.62899226", "0.62474537", "0.61857814", "0.6139244", "0.61172265", "0.60497403", "0.60310566", "0.6028615", "0.6002983", "0.596607", "0.58925354", "0.5867518", "0.5861634", "0.582341...
0.75634503
1
Get an existing reservation
async def get_reservation_endpoint(request): reservation_id = request.args["reservation_id"][0] reservation_dict = model.get_reservation(reservation_id) return json(reservation_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reservation(self):\n return self.request.get('reservation', None)", "def reservation(self):\n return self._reservation", "def reservation_read(token_user, res_id):\n res = Reservation.query.get(res_id)\n if res is None:\n abort(404, 'reservation not found')\n\n return json.dum...
[ "0.7379199", "0.71298105", "0.70966446", "0.70289004", "0.6932207", "0.68829936", "0.66138154", "0.65487725", "0.64873415", "0.64082396", "0.6286343", "0.628403", "0.62172484", "0.6214408", "0.61116004", "0.6033761", "0.60133725", "0.5996568", "0.59386927", "0.5936628", "0.59...
0.7394642
0
List the inventory of a hotel in a specific date range
async def list_inventory_endpoint(request): hotel_id = request.args["hotel_id"][0] start_date = request.args["start_date"][0] end_date = request.args["end_date"][0] inventory = model.list_inventory(hotel_id, start_date, end_date) if inventory == model.OPERATION_ERROR_RETURN_CODE: return json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inventory(request, concierge, template=\"concierges/inventory_check.html\"):\n inventory = []\n for x in xrange(0, 2):\n day = date.today() + timedelta(days=x)\n dow = DayOfWeek.objects.get(isoweekday=day.isoweekday())\n day_info = {'day': day, 'times': []}\n schedules = dow.t...
[ "0.5880754", "0.55358046", "0.55146176", "0.54974526", "0.54716426", "0.54641354", "0.5431443", "0.5413283", "0.5400029", "0.53998613", "0.5383372", "0.5372556", "0.5365455", "0.5363467", "0.5363467", "0.5358362", "0.5348541", "0.53345364", "0.5328369", "0.53199214", "0.53068...
0.71391815
0
Best Path Heuristic (consistent) (seems to be a very good heuristic) Gives the roomba the ability to pass through walls and ignore additional cost on carpet 1. Find which dirty tile is best to start from For each dirty tile in state.dirty_locations 1.1 Set it as the start node 1.2 Use Total Manhattan Distance(third heu...
def spotlessroomba_second_heuristic(state : SpotlessRoombaState) -> float: # TODO a nontrivial consistent heuristic if not state.dirty_locations: return 0 best_start = 0 # best dirty tile to start from best_cost = INF # cost of the path from the above start tile for i in range(le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_heuristic(self, state):\n\n def get_manhattan_distance(coord_a, coord_b):\n \"\"\"Returns the manhattan distance between coord_a and coord_b.\"\"\"\n return abs(coord_a.x - coord_b.x) + abs(coord_a.y - coord_b.y)\n\n \n def get_num_obstacles(coord_a, coord_b):\n ...
[ "0.7437132", "0.7243507", "0.7075924", "0.7064572", "0.6833929", "0.6753228", "0.6737725", "0.64962655", "0.6481526", "0.6475066", "0.6400677", "0.63954955", "0.63701344", "0.6343227", "0.63267416", "0.63048136", "0.6302781", "0.6302682", "0.6297269", "0.6265315", "0.62526554...
0.8600155
0
Generate the header string for this description If the description is empty, return an empty string. Otherwise, the raw data is joined together and returned with no '' components.
def to_header(self): if not self.filled: return '' return "\n".join(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _header_string( self, title='title' ): \n return_str = ''\n return_str += '{}\\n\\n'.format( title )\n return_str += '{} atoms\\n'.format( len(self.atoms) )\n if len(self.bonds) != 0:\n return_str += '{} bonds\\n\\n'.format( len(self.bonds) )\n return_str += '...
[ "0.73597187", "0.72831184", "0.71944606", "0.7154044", "0.6919942", "0.6901166", "0.6901166", "0.675267", "0.66368526", "0.66322434", "0.66226566", "0.65845186", "0.658279", "0.658279", "0.6578081", "0.6538257", "0.6538257", "0.6524499", "0.65011746", "0.641547", "0.63942367"...
0.7559777
0
x_max = max(seq) x_min = min(seq) epilson = 1e6 new_seq = [10000 (epilson + x x_min )/(epilson + x_max x_min) for x in seq]
def normalization(seq): new_seq = [6.3578286171 * x for x in seq] return new_seq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geo_seq(val, ratio, length):\n return [val * pow(ratio, i) for i in range(length)]", "def power_e(amount, start, stop, truncated, sequence):\n ratio = .5\n for x in range(start, amount):\n y = abs(round(ratio * math.exp(x)))\n if truncated and y >= stop:\n ...
[ "0.6177466", "0.61661714", "0.5975783", "0.5779353", "0.56950027", "0.56275076", "0.5592511", "0.5567296", "0.5561729", "0.54725146", "0.5414097", "0.5412501", "0.54114294", "0.53760564", "0.5344241", "0.5343695", "0.53412575", "0.53345144", "0.5287912", "0.5285122", "0.52791...
0.6463649
0
Write array to a file as text or binary (default).
def quick_save_array(data, file_name, delimiter=',', ): data.tofile(file_name, sep=delimiter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_txt(data, file_path):\n array = sanitise_array(data)\n\n # If the data is floating then format the values in scientific notation.\n if np.issubdtype(array.dtype, np.floating):\n array = array.astype(np.float32)\n formatter = lambda x: f'{x:.12E}'\n elif np.issubdtype(array.dtype,...
[ "0.7022295", "0.66680944", "0.6556973", "0.65567935", "0.6454246", "0.64344746", "0.6400705", "0.6375197", "0.6342715", "0.62929696", "0.6282288", "0.62203467", "0.61905587", "0.61702776", "0.611481", "0.61135733", "0.6070423", "0.6067515", "0.6062281", "0.60030717", "0.59931...
0.6797532
1
Get the datetimes from the excel file
def get_datetimes(file_name): csv_file = open(file_name, 'rb') file_content = csv.reader(csv_file) # ignore header file_content.next() datetimes = [] for row in file_content: datetimes.append(row[0]) csv_file.close() return datetimes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dates(file,start,end):\r\n \r\n data = format_data(file)\r\n data = data.loc[start:end,:] \r\n dates = list(data.index)\r\n \r\n return dates", "def read_hours_from_worksheet(sheet_name):\n workbook_path = get_workbook_path()\n wb = openpyxl.load_workbook(workbook_path)\n ws = ...
[ "0.6484449", "0.5983393", "0.59567344", "0.5858225", "0.5803949", "0.5792485", "0.5662788", "0.56464463", "0.5638216", "0.5618037", "0.5579476", "0.5578673", "0.55383044", "0.5533895", "0.5525505", "0.55171365", "0.55086786", "0.54955643", "0.54917186", "0.5489937", "0.548516...
0.63838965
1
Return RMSLE from the prediction and the expected answer.
def get_RMSLE(pred, truth): assert len(pred) == len(truth) diff_vect = np.log(pred + 1) - np.log(truth + 1) diff_sum = np.sum(np.power(diff_vect, 2)) return np.sqrt(diff_sum / len(pred))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmsle(actual, predicted, *args, **kwargs):\n return np.sqrt(msle(actual, predicted))", "def RMSLE(prediction, real):\n logarithmic_error = np.log1p(prediction) - np.log1p(real)\n score = np.sqrt(1/len(real) *np.sum(logarithmic_error**2))\n return score", "def rmsle(y_true, y_pred):\n assert ...
[ "0.7609951", "0.7355589", "0.7203462", "0.718389", "0.6820581", "0.64459103", "0.6406715", "0.6388028", "0.6317563", "0.6281459", "0.6191574", "0.60744154", "0.6051396", "0.6048326", "0.60155445", "0.59951115", "0.59895235", "0.5938883", "0.59192955", "0.5914614", "0.5897343"...
0.7670679
0
Return the path of the Bohrium systemwide configuration file
def config_file(self): return join_path(self.prefix.etc.bohrium, "config.ini")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConfigPath():\n if sys.platform == 'linux':\n configpath = os.path.normpath(os.path.expanduser('~/.config/phobos'))\n elif sys.platform == 'darwin':\n configpath = os.path.normpath(os.path.expanduser('~/Library/Application Support/phobos'))\n elif sys.platform == 'win32':\n con...
[ "0.7627292", "0.7395096", "0.73803973", "0.72431105", "0.71532726", "0.7132535", "0.71078205", "0.7089271", "0.70785385", "0.70739216", "0.7015473", "0.7002854", "0.69692624", "0.6962831", "0.6919271", "0.6863968", "0.68277985", "0.6817259", "0.6779527", "0.675732", "0.675009...
0.8231032
0
Generate a list of ranks that get harder to obtain as they approach the maximum
def generate_ranks(maximum: int, steps: int) -> List[int]: ranks = [] for i in range(steps): ranks += [maximum] maximum = int(maximum * 0.75) RANK_CUTOFFS = list(reversed(ranks)) return RANK_CUTOFFS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findRanks(toBeRanked, values):\n\treturn list(map(lambda e: findRank(e, values), toBeRanked))", "def resolveTie(self, hand_ranking, tie_list):\n max_rank_list = [] \n\n for i in range(5):\n \"\"\" Lowest rank card as baseline \"\"\"\n curr_max_rank = 0 \n for pl...
[ "0.673976", "0.67047715", "0.6614033", "0.6538433", "0.6468819", "0.63788843", "0.63333786", "0.63292336", "0.62728506", "0.62722045", "0.62637275", "0.6252744", "0.6246774", "0.6220911", "0.621737", "0.6209077", "0.618397", "0.6162317", "0.6145225", "0.6116494", "0.61029476"...
0.76253545
0
Get the rank for a given number of points
def get_rank(points: int, cutoffs: List[int]) -> int: rank = 0 for i, cutoff in enumerate(cutoffs): if points < cutoff: if i == 0: break else: rank = i - 1 break else: rank = RANK_COUNT - 1 return rank
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rank(self, points):\n sql_command = \"SELECT * FROM points WHERE amount > ?;\"\n cursor, connection = self.execute_command_get_connection(sql_command, [points])\n\n all = cursor.fetchall()\n cursor.close()\n connection.close()\n return len(all) + 1", "def rank():...
[ "0.77205133", "0.7398081", "0.7045258", "0.70051664", "0.6996832", "0.6941575", "0.6934668", "0.6901205", "0.6886502", "0.6873956", "0.68593204", "0.68586534", "0.6857211", "0.684011", "0.68172395", "0.68114007", "0.68016917", "0.6763181", "0.6714917", "0.6704349", "0.6667565...
0.76279044
1
moves the target further out as a % of the screen
def move_target(self, distance_adjustment): self.x = float(self.screen_rect.right - self.width) self.x = self.x * distance_adjustment self.rect.x = self.x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_upLimit():\r\n player.rect.y = 25", "def assign_downLimit():\r\n player.rect.y = 100", "def update_target(self):\n\t\tself.check_top()\n\t\tself.check_bottom()\n\t\tself.update()\n\t\tself.screen.fill(self.target_color, self.rect)", "def move(self):\n if random.random() < 0.5:\n ...
[ "0.66254646", "0.65339065", "0.65005153", "0.64133626", "0.6320612", "0.6276562", "0.6270425", "0.62666744", "0.62145644", "0.6178224", "0.6135446", "0.61301184", "0.6129795", "0.61164856", "0.6073802", "0.6068467", "0.6010894", "0.6008223", "0.5989418", "0.5989335", "0.59844...
0.68412036
0
Checks top to target to see if it hit top of screen
def check_top(self): if self.rect.top <=0: self.target_direction = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_autos_top(self):\n\t\tscreen_rect = self.screen.get_rect()\n\t\tfor auto in self.autos.sprites():\n\t\t\tif auto.rect.top <= screen_rect.top:\n\t\t\t\t# Treat this the same as if the pigeon got hit.\n\t\t\t\tself._pigeon_hit()\n\t\t\t\tbreak", "def hits_top_or_bottom(self):\n if self.y >= self....
[ "0.733528", "0.73351", "0.6623284", "0.6466618", "0.6390728", "0.62321746", "0.6225023", "0.62215257", "0.6199803", "0.61606985", "0.6129186", "0.610839", "0.6086093", "0.6061291", "0.6013783", "0.598041", "0.5974214", "0.5962553", "0.58782667", "0.58218175", "0.58168215", ...
0.8144298
0
Setup strategies to use by the validator. These strategies can be provided
def _using(*args, validator: "DictValidator") -> "DictValidator": def setup_strategy(validator, strategy) -> "DictValidator": if isinstance(strategy, SortingStrategy): validator.sorting = strategy elif isinstance(strategy, FilteringStrategy): validator.filtering = strategy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_strategies(self, fleetmanager_strategy, transport_strategy, customer_strategy, directory_strategy,\n station_strategy):\n self.fleetmanager_strategy = load_class(fleetmanager_strategy)\n self.transport_strategy = load_class(transport_strategy)\n se...
[ "0.6532167", "0.5933181", "0.55383205", "0.5475055", "0.5461148", "0.54593635", "0.54482967", "0.5417319", "0.5391583", "0.53656155", "0.53485143", "0.5343126", "0.5342159", "0.5331955", "0.5308945", "0.53017586", "0.5301568", "0.5298491", "0.5298491", "0.5286031", "0.526086"...
0.60849404
1
This is an ADMM solver for the (Latent variable) Single Graphical Lasso problem (SGL). If ``latent=False``, this function solves
def ADMM_SGL(S, lambda1, Omega_0, Theta_0=np.array([]), X_0=np.array([]), rho=1., max_iter=1000, tol=1e-7, rtol=1e-4, stopping_criterion='boyd',\ update_rho=True, verbose=False, measure=False, latent=False, mu1=None): assert Omega_0.shape == S.shape assert S.shape[0] == S.shape[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solver_mll(X, y, C, S, alpha=0.1, max_iter=1000, tol=1e-4, positive=False):\n n_tasks, n_samples, n_features = X.shape\n lasso = Lasso(alpha=alpha, fit_intercept=False, positive=positive)\n lasso_p = Lasso(alpha=alpha / n_tasks, fit_intercept=False,\n positive=True)\n old_theta =...
[ "0.5904229", "0.56168336", "0.5549464", "0.5510236", "0.54761505", "0.54374045", "0.5416033", "0.53865016", "0.5377905", "0.5372089", "0.53265786", "0.5315447", "0.52730715", "0.5262824", "0.52390164", "0.52042484", "0.5179361", "0.5165328", "0.51650435", "0.5147611", "0.5143...
0.65866923
0
This is a wrapper for solving SGL problems on connected components of the solution and solving each block separately. See Witten, Friedman, Simon "New Insights for the Graphical Lasso" for details. It solves
def block_SGL(S, lambda1, Omega_0, Theta_0=None, X_0=None, rho=1., max_iter=1000, tol=1e-7, rtol=1e-3, stopping_criterion="boyd", update_rho=True, verbose=False, measure=False): assert Omega_0.shape == S.shape assert S.shape[0] == S.shape[1] assert lambda1 > 0 (p, p) = S.sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gel_solve(\n A,\n y,\n l_1,\n l_2,\n ns,\n b_init=None,\n block_solve_fun=block_solve_agd,\n block_solve_kwargs=None,\n max_cd_iters=None,\n rel_tol=1e-6,\n Cs=None,\n Is=None,\n verbose=False,\n):\n p = len(A)\n m = len(y)\n device = A[0].device\n dtype = A[0...
[ "0.6437674", "0.63575566", "0.63160455", "0.6253777", "0.6242397", "0.61891377", "0.6080901", "0.6075275", "0.60319287", "0.6008029", "0.5985438", "0.5956081", "0.5951685", "0.5910511", "0.5889266", "0.588267", "0.5834767", "0.58335656", "0.58294004", "0.5818063", "0.5789487"...
0.66944
0
The argument p is assumed to be some permutation of 0, 1, ..., len(p)1. Returns an array s, where s[i] gives the index of i in p.
def invert_permutation(p): s = np.empty_like(p) s[p] = np.arange(p.size) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perm_invert(p):\n q = [None] * len(p)\n for i, j in enumerate(p):\n q[j] = i\n return q", "def sample_from(self, p):\n return np.searchsorted(np.cumsum(p), np.random.rand())", "def permute_2d(m, p):\r\n return m[p][:, p]\r\n # unused below\r\n m_t = transpose(m)\r\n r_t =...
[ "0.6614275", "0.5957587", "0.58996975", "0.5898854", "0.58252364", "0.574952", "0.57436204", "0.5726088", "0.57004726", "0.5664967", "0.5657052", "0.56268764", "0.55960995", "0.55443096", "0.55430853", "0.5538524", "0.550933", "0.55085063", "0.5503721", "0.5452929", "0.543458...
0.7273526
0
Initialize a HOOMD device given the parse arguments.
def make_hoomd_device(args): if args.device == 'CPU': device = hoomd.device.CPU() elif args.device == 'GPU': device = hoomd.device.GPU() else: raise ValueError(f'Invalid device {args.device}.') if not args.verbose: device.notice_level = 0 return device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n self.ha_url = self.args.get(\"ha_url\", None)\n self.use_current_brightness = self.args.get(\"use_current_brightness\", False)\n self.condition = self.args.get(\"condition\")\n self.lights = self.args[\"lights\"]\n self.listen_state(self.change_lights_color, self.args[\"media...
[ "0.62113965", "0.608058", "0.59696805", "0.5943475", "0.59068257", "0.583213", "0.5805206", "0.5683287", "0.5648386", "0.56437355", "0.56389016", "0.56138045", "0.5604826", "0.5592298", "0.5573388", "0.55678135", "0.55641365", "0.5561535", "0.55565435", "0.5537574", "0.553698...
0.6631796
0
Execute the benchmark and report the performance.
def execute(self): print_verbose_messages = (self.verbose and self.device.communicator.rank == 0) # Ensure that all ops are attached (needed for is_tuning_complete). self.run(0) if print_verbose_messages: print(f'Running {type(self).__name_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def benchmark(self):\n logger.info(self.benchmark.__doc__)\n return self.run(self.benchmark_profile())", "def _run_benchmark(self, params):\n logging.info('Running benchmark [%s]', self._get_name())\n params = benchmark_cnn.setup(params)\n bench = benchmark_cnn.BenchmarkCNN(params)\n be...
[ "0.7920896", "0.68559283", "0.67580193", "0.6716297", "0.66414857", "0.65965855", "0.6546384", "0.65423447", "0.65336007", "0.6459301", "0.6339556", "0.6312379", "0.62926507", "0.6286289", "0.623686", "0.622832", "0.61696357", "0.61670846", "0.6156982", "0.6118324", "0.611785...
0.7640157
1
Make an ArgumentParser instance for benchmark options.
def make_argument_parser(): parser = argparse.ArgumentParser() parser.add_argument('--device', type=str, choices=['CPU', 'GPU'], help='Execution device.', required=True) parser.add_arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_argument_parser():\n parser = Benchmark.make_argument_parser()\n parser.add_argument('--skip-reference',\n action='store_true',\n help='Skip the reference simulation run.')\n return parser", "def arg_parser(cls):\n parser ...
[ "0.7983817", "0.7168031", "0.70897955", "0.70692337", "0.7047852", "0.6983982", "0.693783", "0.6929585", "0.6902446", "0.689302", "0.6882429", "0.6879765", "0.68780637", "0.68780637", "0.6868575", "0.6855423", "0.68533826", "0.6851654", "0.68308103", "0.6825723", "0.678807", ...
0.7317018
1
Make an ArgumentParser instance for comparative benchmark options.
def make_argument_parser(): parser = Benchmark.make_argument_parser() parser.add_argument('--skip-reference', action='store_true', help='Skip the reference simulation run.') return parser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_argument_parser():\n parser = argparse.ArgumentParser()\n parser.add_argument('--device',\n type=str,\n choices=['CPU', 'GPU'],\n help='Execution device.',\n required=True)\n pa...
[ "0.72827846", "0.7190032", "0.7093924", "0.7032623", "0.70229095", "0.69860554", "0.6946884", "0.694275", "0.693303", "0.6930106", "0.69170386", "0.68352914", "0.6832233", "0.68094486", "0.68094486", "0.6783497", "0.6778075", "0.6772473", "0.675373", "0.6753382", "0.6745362",...
0.788973
0
Applies default secthresh & exclusion radius constraints
def apply_default_constraints(self): try: self.apply_secthresh(pipeline_weaksec(self.koi)) except NoWeakSecondaryError: logging.warning('No secondary eclipse threshold set for {}'.format(self.koi)) self.set_maxrad(default_r_exclusion(self.koi))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constraints(self):\n ...", "def _discretize(self, constraints_object):\n pass", "def objects_radius(self, centre, radius):", "def apply_constraint(self):\n\t\tself.angle = self.constraint(self.angle) % 360", "def cutout(self, centre, radius):", "def constraints(self, x):\n pass",...
[ "0.57216144", "0.5593304", "0.5487926", "0.5459716", "0.5433389", "0.5411653", "0.5399157", "0.529492", "0.5289383", "0.528124", "0.52704936", "0.52636516", "0.5226623", "0.52207905", "0.52052534", "0.51941854", "0.51933926", "0.5185518", "0.51653844", "0.51490223", "0.514120...
0.6335594
0
Returns true if provenance of property is SPE or AST
def use_property(kepid, prop): try: prov = kicu.DATA.ix[kepid, '{}_prov'.format(prop)] return any([prov.startswith(s) for s in ['SPE', 'AST']]) except KeyError: raise MissingStellarError('{} not in stellar table?'.format(kepid))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprop(v):\n return isinstance(v, property)", "def isproperty(object):\n return isinstance(object, property)", "def is_simple(self):\n return self.propertyValueType.lower() in ('float', 'double',\n 'int', 'integer',\n ...
[ "0.6570999", "0.6159433", "0.562184", "0.5580678", "0.55424774", "0.54955554", "0.54840237", "0.5463147", "0.5448263", "0.53668535", "0.5354428", "0.53308886", "0.5306961", "0.53069216", "0.5291205", "0.52911955", "0.52770704", "0.52570504", "0.5237203", "0.5223409", "0.51899...
0.6637285
0
returns star config object for given KOI
def star_config(koi, bands=['g','r','i','z','J','H','K'], unc=dict(g=0.05, r=0.05, i=0.05, z=0.05, J=0.02, H=0.02, K=0.02), **kwargs): folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder): os.makedirs(folder) config = ConfigObj(os...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fpp_config(koi, **kwargs):\n folder = os.path.join(KOI_FPPDIR, ku.koiname(koi))\n if not os.path.exists(folder):\n os.makedirs(folder)\n config = ConfigObj(os.path.join(folder,'fpp.ini'))\n\n koi = ku.koiname(koi)\n\n rowefit = jrowe_fit(koi)\n\n config['name'] = koi\n ra,dec = ku.r...
[ "0.60090053", "0.5942401", "0.5920423", "0.5912436", "0.5829198", "0.55174524", "0.55119944", "0.54936326", "0.5490124", "0.5460084", "0.54068804", "0.5390276", "0.5330812", "0.5309186", "0.53012615", "0.52819467", "0.52716434", "0.526362", "0.52570665", "0.52288973", "0.5213...
0.6899527
0
returns config object for given KOI
def fpp_config(koi, **kwargs): folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder): os.makedirs(folder) config = ConfigObj(os.path.join(folder,'fpp.ini')) koi = ku.koiname(koi) rowefit = jrowe_fit(koi) config['name'] = koi ra,dec = ku.radec(koi) co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_confg(self):\n\n ini = ConfigParser()\n self.config_parser = ini\n # if isinstance(cfile, (file, StringIO.StringIO, io.BytesIO)):\n if isinstance(self.config_data, str) and self.config_data:\n fp = io.BytesIO(self.config_data)\n ini.readfp(fp)\n elif...
[ "0.64626646", "0.6120666", "0.6065999", "0.6041188", "0.6032176", "0.599006", "0.5987609", "0.5959099", "0.59461635", "0.59364283", "0.5936055", "0.59172744", "0.59112185", "0.5904476", "0.5904476", "0.5904476", "0.5904476", "0.5904476", "0.5904476", "0.5904476", "0.5904476",...
0.6510853
0
Predict a single batch of images, optionally with augmentation. Augmentations vectorized across the entire batch and predictions averaged.
def predict_batch(self, imgs_batch, augment=False): if augment: aug_funcs = [ lambda x: x, # identity lambda x: x[:, ::-1, ...], # vlip lambda x: x[:, :, ::-1], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, images, batch_size):\n pass", "def warmup_predict(model, imgs, Npred):\n H = augmented_state_matrix(model[:-1], imgs, 0)\n h0 = H[-2]\n y0 = imgs[-1]\n return predict(model, y0, h0, Npred)", "def predict_on_batch(self, input_batch):\n from deeplift.util import run_functi...
[ "0.7239248", "0.7074474", "0.69302636", "0.68597704", "0.6841375", "0.6764959", "0.6649414", "0.6614922", "0.6554689", "0.6516499", "0.64637536", "0.64612246", "0.6373398", "0.63642263", "0.63606596", "0.63237506", "0.6289094", "0.62845325", "0.6273538", "0.62653995", "0.6237...
0.8082307
0
Unstack batch dimension and split into channels and alpha mask.
def unstack_and_split(self, x, batch_size, num_channels=3): unstacked = torch.reshape(x, [batch_size, -1] + list(x.shape)[1:]) channels, masks = torch.split(unstacked, [num_channels, 1], dim=2) return channels, masks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batch_size, h, w, nc)\n return x_t", "def batch_collate_fn(batch):\n images = []\n masks = []\n \n for ...
[ "0.59909207", "0.58123934", "0.5716505", "0.5716326", "0.5704696", "0.5700815", "0.55700964", "0.5564052", "0.55450964", "0.55180305", "0.551707", "0.54962254", "0.5416754", "0.5411667", "0.5395286", "0.5373396", "0.53642625", "0.5344805", "0.5337699", "0.5336697", "0.5332148...
0.7611791
0
Animals that can speak are correctly identified
def test_animals_can_speak(self): self.assertEqual(self.lion, 'roar') self.assertEqual(self.cat, 'meow')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def animals_by_species(self):\n print self.animal()", "def animal_eats(self):\n self.update_fodder()\n self.herbivore_eats()\n self.carnivore_eats()", "def substantiate():", "def speak(self):\n # Speaks randomly to another agent on the same cell\n anticipated_meaning...
[ "0.5804902", "0.5754538", "0.56921846", "0.56177425", "0.55703396", "0.5568995", "0.5478271", "0.5457741", "0.5398982", "0.53391945", "0.5301369", "0.5275877", "0.52202857", "0.51787615", "0.5157603", "0.51495886", "0.5125665", "0.512152", "0.5121497", "0.5117309", "0.5089538...
0.5837831
0
Given a urlsafe version of an Album key, get the actual key
def get_album_key_by_keystr(keystr): attr_err = 'Keystrings must be an instance of base string, recieved: %s' % keystr kind_err = 'Expected urlsafe keystr for kind %s but received keystr for kind %s instead.' if not keystr or not isinstance(keystr, basestring): raise RuntimeError(attr_err) key ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_album_key(slug):\n err = 'Series slug must be defined and of of type basestring'\n\n if not slug or not isinstance(slug, basestring):\n raise RuntimeError(err)\n\n return ndb.Key(PHOTOALBUM_KIND, slug)", "def get_key_from_url(file_url):\t\n\tparts = urlparse(file_url)\n\tbucket_name = get...
[ "0.7271961", "0.64886624", "0.6453254", "0.62893945", "0.6282472", "0.62622005", "0.6248456", "0.62307674", "0.61798584", "0.6131501", "0.60555077", "0.60446566", "0.60090566", "0.59870636", "0.5964662", "0.5961178", "0.59544635", "0.5880653", "0.5861731", "0.58558726", "0.58...
0.76117
0
Create a ndb.Key given an Album slug
def get_album_key(slug): err = 'Series slug must be defined and of of type basestring' if not slug or not isinstance(slug, basestring): raise RuntimeError(err) return ndb.Key(PHOTOALBUM_KIND, slug)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_key(cls, song_id):\n return ndb.Key(cls, song_id)", "def get_album_key_by_keystr(keystr):\n attr_err = 'Keystrings must be an instance of base string, recieved: %s' % keystr\n kind_err = 'Expected urlsafe keystr for kind %s but received keystr for kind %s instead.'\n if not keystr or no...
[ "0.6371879", "0.6166366", "0.5936699", "0.58009845", "0.5732777", "0.55733705", "0.55266577", "0.5525588", "0.5469047", "0.53936213", "0.538625", "0.53846484", "0.5360333", "0.5352547", "0.534155", "0.5337662", "0.5337662", "0.53374225", "0.5337322", "0.53343934", "0.533107",...
0.797927
0
Given an album slug, fetch the album entity
def get_album_by_slug(slug): album_key = get_album_key(slug) album = album_key.get() return album
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_album(album_id):\n return query_single(album_id, Album, album_schema)", "def album(self, q, page=None):\r\n return self.get('album', q, page)", "def album(self, uri, detail=None):\r\n extras = self.ALBUM_DETAIL.get(detail)\r\n return self.get(uri, extras)", "def get_album(self...
[ "0.75652915", "0.70452404", "0.67959744", "0.65954405", "0.65209013", "0.64783317", "0.6462776", "0.6453332", "0.643563", "0.64184994", "0.62658083", "0.6256562", "0.6231396", "0.6121484", "0.6022898", "0.60085446", "0.59636325", "0.5959914", "0.59453434", "0.592426", "0.5915...
0.80606824
0
Fetch a list of Albums
def get_album_list(): # TODO: Paginate this, etc entities = PhotoAlbum.query().order(-PhotoAlbum.title).fetch(1000) return entities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_albums():\n return query_multiple(request.args, album_search, \\\n album_filter, Album, albums_schema)", "def get_albums(self):\n artist = self.get_request_arg(\"artist\")\n if artist:\n lib = self.ctrl.library\n lst = sorted(self.ctrl.library.get_alb...
[ "0.8165235", "0.77157474", "0.7463277", "0.7329539", "0.7285775", "0.7235554", "0.71896297", "0.7168777", "0.71157223", "0.7096026", "0.7090436", "0.70471865", "0.70387936", "0.6880528", "0.68339896", "0.6679008", "0.66074675", "0.6587003", "0.65148", "0.6513741", "0.64734447...
0.81510186
1
Attempts a Redis DB connection and returns the DB Object
def dbConnect(self): r = redis.StrictRedis() try: r = redis.from_url(os.environ.get("REDIS_URL")) print("DB Connection seems okay!") except Exception as error: print ("Oops! An exception has occured:", error) print ("Exception TYPE:", type(error)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_db(self):\n r = redis.Redis(host=self.hostname,\n port=self.portnumber,\n password=self.password)\n try:\n r.ping()\n except redis.ConnectionError:\n sys.exit('ConnectionError: is the redis-server running?')\n ...
[ "0.77405405", "0.77253574", "0.7679741", "0.7658954", "0.7619239", "0.74647945", "0.7445185", "0.74369836", "0.74027646", "0.73723024", "0.73014516", "0.723885", "0.7207661", "0.7056827", "0.70409024", "0.7014019", "0.6989931", "0.6985283", "0.69585145", "0.69442034", "0.6850...
0.8348194
0
Converts short URL to an ID
def shortURLToId(self, shortURL): id = 0 for i in shortURL: val_i = ord(i) if(val_i >= ord('a') and val_i <= ord('z')): id = id*62 + val_i - ord('a') elif(val_i >= ord('A') and val_i <= ord('Z')): id = id*62 + val_i - ord('Z') + 26...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shortenUrl(self, url):\n posturi = \"https://www.googleapis.com/urlshortener/v1/url\"\n headers = {'Content-Type' : 'application/json'}\n data = {'longUrl' : url}\n data = json.dumps(data)\n request = urllib2.Request(posturi,data,headers)\n response = urllib2.urlopen(...
[ "0.76266074", "0.75862736", "0.71807855", "0.71714944", "0.7136487", "0.7108624", "0.70438015", "0.7000727", "0.6966817", "0.69377244", "0.6835616", "0.6831397", "0.6816086", "0.67460054", "0.668461", "0.6674245", "0.6609759", "0.66091233", "0.65995246", "0.65338206", "0.6514...
0.86196995
0
probably the wrost way to parse this captcha
def get_captcha_reply(captcha): def get_char_at(pos, captcha): char_chars = [line[pos-1:pos] for line in captcha.split(b'\n')] key = ''.join([ str(s, 'ascii') for s in char_chars]) if key == ' | ': return get_char_at(pos+2, captcha) if key == ' | .\\ ': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_captcha(self):\n res = self._limited_call(self._requests.get,\n constants.FA_ROOT + \"/captcha.jpg\")\n data = res.content\n return data", "def handle_captcha(self):\n self.webdriver.save_screenshot('./out/captcha.png')\n sleep(20)\n\n ...
[ "0.62265563", "0.6219252", "0.61916035", "0.6096624", "0.60874146", "0.59667766", "0.59021354", "0.58705884", "0.5825633", "0.5809599", "0.57755667", "0.5746426", "0.5594208", "0.5538595", "0.55344874", "0.55010104", "0.5449904", "0.53967845", "0.53909343", "0.5288578", "0.52...
0.67830896
0
The Amazon Resource Name (ARN) of the custom platform to use with the environment.
def platform_arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "platform_arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"platform_arn\")", "def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")", "def platform():\n return \"micaz\"", "def PlatformName():\n if override_platform_name:\n return over...
[ "0.7836344", "0.6630474", "0.66273826", "0.6609992", "0.6324445", "0.6285871", "0.623594", "0.61513615", "0.60816205", "0.60486674", "0.60041595", "0.598996", "0.59880674", "0.596188", "0.59613025", "0.5961109", "0.5934884", "0.5923574", "0.5923574", "0.59224755", "0.59224755...
0.77357316
1
The name of an Elastic Beanstalk solution stack (platform version) to use with the environment.
def solution_stack_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "solution_stack_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution_stack_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"solution_stack_name\")", "def stackname(self):\n return self.BASE_NAME.format(**self.conf)", "def stack_name(self) -> str:\n return jsii.get(self, \"stackName\")", "def env_name(self):\n ret...
[ "0.6850209", "0.6835407", "0.6518939", "0.65049684", "0.64019746", "0.6248095", "0.6167335", "0.615564", "0.6142327", "0.6139697", "0.6102911", "0.6087402", "0.60867625", "0.60640186", "0.6010799", "0.59820807", "0.592273", "0.58995575", "0.5882993", "0.58522046", "0.58299625...
0.68761265
0
Specifies the tier to use in creating this environment. The environment tier that you choose determines whether Elastic Beanstalk provisions resources to support a web application that handles HTTP(S) requests or a web application that handles backgroundprocessing tasks.
def tier(self) -> Optional[pulumi.Input['EnvironmentTierArgs']]: return pulumi.get(self, "tier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tier(self):\n\n if not hasattr(self, \"_tier\"):\n self._tier = self.opts.get(\"tier\")\n return self._tier", "def tier(self) -> pulumi.Output[Optional['outputs.EnvironmentTier']]:\n return pulumi.get(self, \"tier\")", "def set_tier(self, tier):\n self.single_selectio...
[ "0.69780785", "0.68621033", "0.65023184", "0.6452587", "0.6355082", "0.6355082", "0.6355082", "0.62773496", "0.62122846", "0.6167871", "0.6167871", "0.6167871", "0.6167871", "0.6113269", "0.6034399", "0.60080045", "0.598394", "0.5843236", "0.5833414", "0.5829682", "0.5780073"...
0.7524803
0
Get an existing Environment resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = EnvironmentArgs.__new__(EnvironmentArgs) __props__.__dict__["applicat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = EnvironmentArgs.__new__(EnvironmentArgs)\n\n __props__.__dict...
[ "0.6518575", "0.61676663", "0.615199", "0.6109608", "0.6109441", "0.60900664", "0.6072669", "0.5931966", "0.58831435", "0.5837981", "0.5818557", "0.58057237", "0.5786659", "0.5786354", "0.5778798", "0.5712893", "0.56756985", "0.5640747", "0.5597875", "0.5522777", "0.54472834"...
0.6545722
0
The Amazon Resource Name (ARN) of the custom platform to use with the environment.
def platform_arn(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "platform_arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"platform_arn\")", "def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")", "def platform():\n return \"micaz\"", "def PlatformName():\n if override_platform_name:\n return overr...
[ "0.7735306", "0.66278744", "0.6624211", "0.6606932", "0.6323558", "0.6283941", "0.6234539", "0.61513674", "0.6081606", "0.60462385", "0.60026896", "0.5988347", "0.598575", "0.59628206", "0.5962734", "0.59611076", "0.59324396", "0.59225625", "0.59225625", "0.5922316", "0.59223...
0.7835914
0
The name of an Elastic Beanstalk solution stack (platform version) to use with the environment.
def solution_stack_name(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "solution_stack_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution_stack_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"solution_stack_name\")", "def stackname(self):\n return self.BASE_NAME.format(**self.conf)", "def stack_name(self) -> str:\n return jsii.get(self, \"stackName\")", "def env_name(self):\n retu...
[ "0.6874254", "0.68344885", "0.6518337", "0.65035015", "0.6400849", "0.62462306", "0.61668295", "0.6154686", "0.6143118", "0.6137554", "0.61008966", "0.6086461", "0.60863656", "0.60621977", "0.60092354", "0.5980697", "0.5922324", "0.5898759", "0.5881433", "0.58511484", "0.5829...
0.6848552
1
get global ip address
def get_global_ip(): network_info_providers = [ 'http://api.ipify.org/', 'http://myip.dnsomatic.com', 'http://inet-ip.info/ip', 'http://v4.ident.me/', ] random.shuffle(network_info_providers) for url in network_info_providers: try: return requests.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_global_ip() -> str:\n return urllib.request.urlopen(\"https://icanhazip.com\").read().decode().strip()", "def get_ip(self):", "def get_host_ip_addr():\n return nova_conf.my_ip", "def get_local_host_ip(self) -> str:", "def get_IP(): \n \n return socket.gethostbyname(socket.gethostn...
[ "0.8177861", "0.78713524", "0.7836615", "0.7808784", "0.7742288", "0.7727455", "0.7672631", "0.76301765", "0.7592437", "0.7556169", "0.7501851", "0.749981", "0.74838996", "0.7455439", "0.7448763", "0.7436739", "0.74339193", "0.74294287", "0.7428558", "0.73813033", "0.73690134...
0.82571846
0
get global ipv6 address
def get_global_ip_ipv6(): network_info_providers = [ 'http://v6.ipv6-test.com/api/myip.php', 'http://v6.ident.me/', ] random.shuffle(network_info_providers) for url in network_info_providers: try: return requests.get(url).text.lstrip().rstrip() except Exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_main_ipv6():\n try:\n # No data is actually transmitted (UDP)\n s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)\n s.connect( ('2001:4860:4860::8888', 53) )\n real_ip = s.getsockname()[0]\n s.close()\n return real_ip\n except socket.error as e:\n logging.error(\"Cannot retrieve ...
[ "0.8276269", "0.82484275", "0.7695294", "0.7630343", "0.7439502", "0.7352564", "0.7306042", "0.7292912", "0.72007406", "0.7183485", "0.71534765", "0.71408135", "0.7075447", "0.7072936", "0.7067728", "0.700647", "0.6943251", "0.6901189", "0.68371254", "0.68331796", "0.6820401"...
0.8327801
0
Implementation of binary operator between DataFrames on different indices. A new DataFrame representing an inmemory DolphinDB table is returned. It is garenteed that both DataFrames have no where_expr.
def _binary_op_on_different_indices(self, other, func, axis): # TODO: add axis check def merge_columns(self_columns, other_columns): """ Align the input columns, filling the missing columns with None -------- Examples -------- ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where(self, cond, other, **kwargs): # noqa: PR02\n return DataFrameDefault.register(pandas.DataFrame.where)(\n self, cond=cond, other=other, **kwargs\n )", "def union_all(x: DataFrame, y: DataFrame) -> DataFrame:\n _check_xy(x, y)\n return bind_rows(x, y, __calling_env=Calling...
[ "0.5993737", "0.59794873", "0.5897485", "0.5851102", "0.5847667", "0.58340734", "0.57924235", "0.5676979", "0.564678", "0.56334287", "0.54969245", "0.5460089", "0.5447747", "0.544339", "0.5425218", "0.5419818", "0.5405718", "0.5401967", "0.53926265", "0.5366445", "0.5351063",...
0.6160066
0
Open a window to compose an email, with the edi invoice dian template message loaded by default
def action_invoice_dian_resend(self): self.ensure_one() template = self.env.ref('l10n_co_e-invoice.email_template_edi_invoice_dian', False) compose_form = self.env.ref('mail.email_compose_message_wizard_form', False) ctx = dict( default_model='account.invoice', de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_by_email(self):\r\n ir_model_data = self.env['ir.model.data']\r\n try:\r\n template_id = ir_model_data.get_object_reference(\r\n 'ng_church', 'email_template_church_pledge_report')[1]\r\n except ValueError:\r\n template_id = False\r\n try:\r...
[ "0.73784035", "0.647709", "0.6436048", "0.6249949", "0.6230297", "0.61297333", "0.60587174", "0.59738946", "0.5970479", "0.59629035", "0.57741827", "0.5760959", "0.5647457", "0.5546402", "0.55030817", "0.5446904", "0.53914595", "0.536303", "0.5356848", "0.5346636", "0.5345804...
0.6925168
1
Get preditors base on their distance The predictors are selected as following [1,2], [1,3], [1,4], [2,3], [2,4], [2,5], [2,6]
def getpredictors_distance( staname, distance): distfromsta = distance[staname] try: del distfromsta[staname] # remove the station to be fill from the dataframe except: pass distfromsta = distfromsta.sort_values() stations = distfromsta.index sel1 = [(i, e) for i, e in zip(st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getpredictors_distance(self, staname, distance):\n\n distfromsta = distance[staname]\n del distfromsta[staname] # remove the station to be fill from the dataframe\n distfromsta = distfromsta.sort_values()\n\n stations = self.network.getsta(distfromsta.index.values)\n # ...
[ "0.63841313", "0.59920394", "0.5903511", "0.5846713", "0.5797452", "0.5794031", "0.5764465", "0.57157874", "0.57146764", "0.571108", "0.5700389", "0.56553006", "0.5652828", "0.5636438", "0.56238115", "0.5598508", "0.55349874", "0.55291295", "0.55164886", "0.5492974", "0.54692...
0.6556841
0
DESCRIPTION Check every variable of every stations and try to fill them with the variables of the two nearest station for every time. INPUT
def fillstation(self, stanames, all=None, plot=None, summary=None, From=None, To=None, by=None, how='mean', variables=None, distance=None, sort_cor=True, constant=True, cor_lim=None): if all == True: stations = self.network.getsta([], all=True).values() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nearest(self):\n dist = station.nearest(28.43, -81.31)\n stn = dist.pop(\"station\")\n self.assertIsInstance(stn, station.Station)\n self.assertEqual(stn.icao, \"KMCO\")\n for val in dist.values():\n self.assertIsInstance(val, float)\n for *params, coun...
[ "0.6480234", "0.6318352", "0.6269479", "0.6215623", "0.6206157", "0.6110717", "0.60025865", "0.5942108", "0.5934246", "0.5904729", "0.5811288", "0.5711787", "0.57106215", "0.56911725", "0.5684194", "0.5649491", "0.5626808", "0.56212485", "0.55674076", "0.5553363", "0.5552577"...
0.6406745
1
Get preditors base on their distance The predictors are selected as following [1,2], [1,3], [1,4], [2,3], [2,4], [2,5], [2,6]
def __getpredictors_distance(self, staname, distance): distfromsta = distance[staname] del distfromsta[staname] # remove the station to be fill from the dataframe distfromsta = distfromsta.sort_values() stations = self.network.getsta(distfromsta.index.values) # station...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getpredictors_distance( staname, distance):\n\n distfromsta = distance[staname]\n try:\n del distfromsta[staname] # remove the station to be fill from the dataframe\n except:\n pass\n distfromsta = distfromsta.sort_values()\n\n stations = distfromsta.index\n\n sel1 = [(i, e) fo...
[ "0.65554714", "0.59923244", "0.5906513", "0.5849182", "0.5799373", "0.5795326", "0.5768941", "0.5718649", "0.57175404", "0.5713419", "0.5701458", "0.5656988", "0.5656353", "0.56391543", "0.562515", "0.56004006", "0.553719", "0.5531781", "0.55137074", "0.5489938", "0.5472367",...
0.63834083
1
Return a sorted selections by the correlation rsquared scores
def __sort_predictors_by_corr(self, station, selections, var, From, To, by, how, constant=True, selectionsnames=None, sort_cor=True, cor_lim=None): scores_corel = pd.DataFrame(index=np.arange(0, len(selections)), columns=['corel', 'selections', 'params', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corr_list(self):\n c = self.df.corr().abs()\n s = c.unstack()\n so = s.sort_values(ascending=False)\n i = int(len(so) ** (1/2))\n charts = so[i:]\n charts = charts[::2]\n if len(charts) > 3:\n charts = charts[:3]\n return charts.index, charts.v...
[ "0.5838652", "0.55438906", "0.5539825", "0.5511799", "0.5483375", "0.54549277", "0.54273504", "0.5422278", "0.5394091", "0.536099", "0.53258604", "0.53121966", "0.5309838", "0.5289699", "0.52868915", "0.5261606", "0.5250422", "0.52314734", "0.5225502", "0.5213998", "0.5203932...
0.62526226
0
Gets a remote file of a bucket using a connection
def _get(conn, remote_file, bucket_name=BUCKET_NAME): contents = None try: reply = conn.get(bucket_name, remote_file) contents = reply.body if reply.http_response.status != 200: print 'Failed to fetch current_remote metadata' contents = None except: co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_get(url, temp_file):\n s3_resource = boto3.resource(\"s3\")\n bucket_name, s3_path = split_s3_path(url)\n s3_resource.Bucket(bucket_name).download_fileobj(s3_path, temp_file)", "def s3_get(url, temp_file):\n s3_resource = boto3.resource(\"s3\")\n bucket_name, s3_path = split_s3_path(url)\n ...
[ "0.68474334", "0.68474334", "0.6793478", "0.6766179", "0.6609071", "0.6568017", "0.6541442", "0.6517729", "0.6445589", "0.64432293", "0.64367956", "0.6386914", "0.6360486", "0.630485", "0.62856895", "0.62814856", "0.62789845", "0.62708944", "0.62665856", "0.62540734", "0.6238...
0.7393641
0
Put some contents into a remote_file of a bucket usign connection conn. Optionally the headers can be specified.
def _put(conn, remote_file, contents, bucket_name=BUCKET_NAME, headers=None): error_msg = 'Failed to upload to %s' % remote_file try: reply = conn.put(bucket_name, remote_file, S3.S3Object(contents), headers) if reply.http_response.status != 200: print error_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(bucket, local_file_path, remote_destination_path):\n bucket = get_bucket(bucket)\n k = Key(bucket)\n k.key = remote_destination_path\n k.set_contents_from_filename(local_file_path)", "def upload_file(conn, filename_local, filename_s3, gzip=False):\n\n filename_s3 = filename_s3.lstr...
[ "0.6534801", "0.6233578", "0.6144909", "0.6129894", "0.5970255", "0.59591484", "0.59422994", "0.5909662", "0.5902494", "0.58096933", "0.57955354", "0.5794321", "0.57661766", "0.5737979", "0.57304716", "0.5720829", "0.5701128", "0.5676588", "0.56659216", "0.56574786", "0.56344...
0.7733097
0
Guess the content_type, by using its file descriptor
def _get_content_type(file_descriptor): content_type = mimetypes.guess_type(file_descriptor.name)[0] if not content_type: content_type = 'text/plain' return content_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content_type(filename):\n return mimetypes.guess_type(filename)[0] or 'application/octet-stream'", "def guess_content_type ( self, path_info ) :\n _type, _enc = guess_type ( path_info )\n return _type", "def guess_content_type(filename):\n return mimetypes.guess_type(filename)[0...
[ "0.7407128", "0.74055415", "0.7343658", "0.7118253", "0.70626557", "0.7053132", "0.70111525", "0.6947122", "0.68888956", "0.68175477", "0.6781097", "0.67605287", "0.67187476", "0.6655244", "0.6640195", "0.66329396", "0.660614", "0.66005784", "0.65136355", "0.6447863", "0.6439...
0.7975829
0
Asserts if a given file (w/ name filename) can be compressed. content_type is optional and can speed up assertion. Should return True if it is a Text Type (CSS/JS)
def _file_can_be_compressed(filename): content_type = '' with open(filename, 'rb') as f: content_type = _get_content_type(f) return content_type in TEXT_TYPES
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isgzip(filename):\n magic_number = b'\\x1f\\x8b\\x08'\n with open(filename, 'rb') as f:\n file_start = f.read(len(magic_number))\n\n if magic_number == file_start:\n return True\n return False", "def is_archive(afile):\n return file_ext(os.path.basename(afile)) in ARCHIVE_COMPRES...
[ "0.64723974", "0.64621985", "0.6352601", "0.6308476", "0.6298893", "0.62387055", "0.617346", "0.6168313", "0.613196", "0.6075621", "0.6057141", "0.6023388", "0.59639585", "0.59618855", "0.59406054", "0.5932078", "0.5916286", "0.5899778", "0.5892047", "0.5887669", "0.5869888",...
0.8202419
0
Compress the content string passed. Should be called when gzip is enabled to compress text types. There is no real advantage in using this with images, since most are already nicely compressed by some image processing algorithm.
def _compress_string(content): zbuf = StringIO() zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf) zfile.write(content) zfile.close() return zbuf.getvalue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(string):", "def compress(string):", "def _compress_content(self, content):\n zbuf = io.BytesIO()\n zfile = gzip.GzipFile(mode=\"wb\", compresslevel=9, fileobj=zbuf)\n\n try:\n zfile.write(content.read())\n finally:\n zfile.close()\n\n conten...
[ "0.727991", "0.727991", "0.7271702", "0.7243655", "0.72023225", "0.7170906", "0.71320665", "0.6685947", "0.6557357", "0.64971095", "0.6466577", "0.63694817", "0.6278639", "0.624268", "0.6192079", "0.61507696", "0.6118266", "0.59070766", "0.57896465", "0.5700065", "0.5692797",...
0.7453164
0
Build the metadata local file with all sha information about files. File location is computed based on home kwargument.
def _build_local_metadata_file(files, home=''): filepaths = [os.path.join(home, f) for f in files] shas = [_get_sha_metadata(f) for f in filepaths] metadata = dict(zip(files, shas)) with open(LOCAL_METADATA_FILE, 'w') as f: f.write(json.dumps(metadata))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_metadata(self):\n self.metadata = {\n 'title': os.path.basename(self.source_file).rsplit('.', 1)[0],\n 'url': self.relative_destination_file,\n 'full_path': os.path.dirname(self.relative_destination_file),\n 'short_path': self.shorten_path(\n ...
[ "0.61526465", "0.6049966", "0.5853711", "0.5817837", "0.5641126", "0.5638058", "0.5613152", "0.5524916", "0.5511576", "0.5498614", "0.54815716", "0.54704076", "0.5461879", "0.5444722", "0.54036105", "0.53994805", "0.53729725", "0.5360554", "0.53537804", "0.53431183", "0.53139...
0.7596386
0
Uploads a file to S3 bucket. If gzip=True, compress and upload the gzipped version of the file instead of the original one. If gzip=True and it is not possible to compress, then quit the upload process (don't upload at all). So you should always pass the correct gzip info into this function, in order to get a upload.
def upload_file(conn, filename_local, filename_s3, gzip=False): filename_s3 = filename_s3.lstrip('./') file_descriptor = open(filename_local, 'rb') content = file_descriptor.read() content_type = _get_content_type(file_descriptor) headers = _get_headers(content_type) #should compress if the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(file_obj, filename, session, samples_resource, log_to, metadata, tags):\n upload_args = {\n 'filename': filename,\n 'size': 1, # because we don't have the actually uploaded size yet b/c we're gziping it\n 'upload_type': 'standard' # This is multipart form data\n }\n ...
[ "0.695896", "0.68229353", "0.68038195", "0.6781243", "0.67778784", "0.6743604", "0.6743087", "0.67419064", "0.6726084", "0.67161316", "0.6695823", "0.6695823", "0.66937494", "0.66827035", "0.667724", "0.6662698", "0.66604984", "0.6652789", "0.66431695", "0.66219", "0.6605921"...
0.78993046
0
Returns a recursive list of all files inside folder. The list element is a string w/ file path relative to folder. If any file is found with the same name as LOCAL_METADATA_FILE, then do not append it to the list.
def _get_file_list(folder): tree = [x for x in os.walk(folder)] files = [os.path.join(t[0], y) for t in tree for y in t[2]] return [os.path.relpath(x, start=folder) for x in files if x != LOCAL_METADATA_FILE]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_in_folder(folder):\n files = []\n for f in glob.glob(folder):\n if os.path.isdir(f):\n files.extend(files_in_folder(f + os.sep + \"**\"))\n else:\n files.append(f)\n return files", "def ReadFolder(folder: str) -> List[str]:\n\n onlyfiles = [f for f in lis...
[ "0.66013783", "0.6589332", "0.6403268", "0.63590515", "0.6349886", "0.6340192", "0.6325134", "0.62352633", "0.61990255", "0.61880994", "0.618564", "0.61627126", "0.61410564", "0.6138895", "0.6138895", "0.6132723", "0.6122742", "0.610428", "0.60967124", "0.6089745", "0.6074586...
0.81068176
0
Fetches the metadata remote file REMOTE_METADATA_FILE and returns the metadata dict equivalent.
def _fetch_current_remote_metadata(conn): content = _get(conn, REMOTE_METADATA_FILE) metadata = json.loads(content) if content else {} return metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get(conn, remote_file, bucket_name=BUCKET_NAME):\n contents = None\n try:\n reply = conn.get(bucket_name, remote_file)\n contents = reply.body\n if reply.http_response.status != 200:\n print 'Failed to fetch current_remote metadata'\n contents = None\n excep...
[ "0.743946", "0.6923274", "0.638175", "0.6271817", "0.6228844", "0.62113637", "0.6208526", "0.6199531", "0.6125181", "0.61230326", "0.6048329", "0.5846718", "0.5833795", "0.58308524", "0.5800759", "0.57391906", "0.5727758", "0.5712721", "0.5698382", "0.5687096", "0.5684791", ...
0.79775
0
Fetches the metadata local file LOCAL_METADATA_FILE and returns the metadata dict equivalent.
def _fetch_current_local_metadata(): if not os.path.exists(LOCAL_METADATA_FILE): return {} with open(LOCAL_METADATA_FILE) as f: return json.loads(f.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_current_remote_metadata(conn):\n content = _get(conn, REMOTE_METADATA_FILE)\n metadata = json.loads(content) if content else {}\n return metadata", "def get_downloads_metadata():\n global _METADATA\n if _METADATA is None:\n _METADATA = yaml.safe_load(resource_string(__name__, \"d...
[ "0.68818545", "0.6417708", "0.63122565", "0.62646693", "0.62405384", "0.62042487", "0.6080648", "0.6028128", "0.6001734", "0.59823257", "0.5974274", "0.5929091", "0.59028894", "0.5869242", "0.5845099", "0.5817974", "0.5808917", "0.57907844", "0.5776373", "0.5760592", "0.57372...
0.84643173
0
Based on comparison of local and remote metada dictionaries, filter files to retain only the files which doesn't exist on remote metadata dict or have different content and same filename. Also, based on IGNORE_DIRS and IGNORE_EXTENSIONS, filter the net file list.
def _filter_file_list(files, local_metadata, remote_metadata): def _is_tracked(filename, metadata): """ Is the filename tracked in the remote metadata dict. The file may be not even locally tracked yet """ current_local_sha = local_metadata.get(filename, None) current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_raw_remote_files(self, raw_remote_files):\n return [xfile for xfile in raw_remote_files if not xfile.exists()]", "def find_remote_files(product, date, channel, fs, mesoregion=None):\n if 'L1' in product:\n files = [fs.glob('gcp-public-data-goes-16/' + product + '/' + str(date.year...
[ "0.6446468", "0.59767133", "0.5730664", "0.5725296", "0.5656467", "0.5532549", "0.55086225", "0.55084115", "0.5492199", "0.5476868", "0.54651487", "0.5445001", "0.5409476", "0.54082286", "0.53627706", "0.53226095", "0.5322206", "0.53167725", "0.5312311", "0.52992505", "0.5283...
0.74489295
0
Is the filename tracked in the remote metadata dict. The file may be not even locally tracked yet
def _is_tracked(filename, metadata): current_local_sha = local_metadata.get(filename, None) current_remote_sha = metadata.get(filename, None) return current_local_sha is not None \ and current_remote_sha is not None \ and current_local_sha == current_remote_sha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_remote_cached(cls, target_filename):\n is_cached = None\n cache = cls.CACHE_BACKEND()\n for file_name, file_id in cache.search():\n if file_name == os.path.basename(target_filename):\n is_cached = file_id\n logger.debug('File %r already cached at...
[ "0.7122534", "0.6666199", "0.6614642", "0.6477976", "0.6251149", "0.6231352", "0.61951226", "0.6183894", "0.6110177", "0.6092684", "0.6037549", "0.6031686", "0.60248667", "0.6003988", "0.598465", "0.59665877", "0.59620124", "0.594347", "0.5927977", "0.58981687", "0.58882433",...
0.811574
0
Is the filename inside any of the IGNORE_DIRS list
def _is_inside_ignored_dir(filename): ignore_dirs = ['./' + x for x in IGNORE_DIRS] return any([filename.startswith(x) for x in ignore_dirs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore(ignored_dirs, path):\n return any([normpath(path).startswith(ignore_dir) for ignore_dir in ignored_dirs])", "def ignore(directory):\n for pattern in ignore_patterns:\n if pattern in directory:\n return True\n\n return False", "def _is_ignored(self, full_path):\n for...
[ "0.7432789", "0.742647", "0.7269846", "0.7173609", "0.7124053", "0.6995675", "0.69607145", "0.6938394", "0.69038445", "0.68344337", "0.6772172", "0.6730275", "0.6686163", "0.65734845", "0.6516576", "0.6510022", "0.6423632", "0.6392135", "0.637968", "0.6378461", "0.63330704", ...
0.81426775
0
Walks through all the subfolders in static_root, and uploads everything valid found to S3. If Gzip is enabled, also tries to compress and upload the compressed version of the static asset.
def upload_all_to_s3(static_root): conn = _get_connection() files = _get_file_list(static_root) _build_local_metadata_file(files, home=static_root) local_metadata = _fetch_current_local_metadata() remote_metadata = _fetch_current_remote_metadata(conn) files_to_upload = _filter_file_list(files,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_sync(s3_bucket, s3_prefix, sync_path=\".\"):\n # Get bucket\n s3_resource = boto3.resource(\"s3\")\n bucket = s3_resource.Bucket(s3_bucket)\n\n # Walk paths and subdirectories, uploading files\n for path, subdirs, files in os.walk(sync_path):\n # Get relative path prefix\n relpa...
[ "0.6210542", "0.61488205", "0.5865301", "0.585198", "0.58491004", "0.58321655", "0.5650139", "0.5592172", "0.5504334", "0.54761356", "0.5457472", "0.5440076", "0.54384625", "0.5431056", "0.5406941", "0.5380988", "0.5366491", "0.53493273", "0.5324381", "0.53202146", "0.5297198...
0.81745136
0
Returns a |random value| <= SHIFT_MAX_VAL
def get_shift() -> int: return random.randint(low = -1 *SHIFT_MAX_VAL, high = SHIFT_MAX_VAL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_random(value, max_value, min_value, max_delta):\n # Determine if sensor delta should be added or substracted.\n if value == max_value:\n add = False\n elif value == min_value:\n add = True\n else:\n add = random.random() > 0.5\n\n # Calculate a new delta.\n delta...
[ "0.6203564", "0.60628116", "0.600135", "0.59833807", "0.59038484", "0.58453417", "0.58328253", "0.5776378", "0.5762465", "0.575023", "0.5747984", "0.57101095", "0.57073265", "0.57069814", "0.5686693", "0.5646487", "0.5634794", "0.5613866", "0.5598931", "0.559132", "0.55743605...
0.7717284
0
load all of imagenet data as flat vector
def load_imagenet(directory): path_train, path_val = directory + '/ILSVRC2012_img_train', directory + '/ILSVRC2012_img_val' train_labels = os.listdir(path_train) train_data = [] for label in train_labels: imgs_path = os.path.join(path_train, label) imgs = os.listdir(imgs_path) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_imagenet_data(net):\r\n\r\n # get a list of all the images (note that we use networks trained on ImageNet data)\r\n img_list = os.listdir(path_data)\r\n\r\n # throw away files that are not in the allowed format (png or jpg)\r\n for img_file in img_list[:]:\r\n if not (img_file.endswith(\...
[ "0.6885546", "0.6619148", "0.6589122", "0.6569712", "0.65382355", "0.6508243", "0.6401413", "0.6387084", "0.63791114", "0.6374463", "0.6297042", "0.6268717", "0.6249637", "0.6221783", "0.61718935", "0.61413294", "0.6102105", "0.6062337", "0.6045171", "0.60450935", "0.6041338"...
0.6851224
1
Take as input a Keras ImageGen (Iterator) and generate random crops from the image batches generated by the original iterator.
def random_crop_generator(batches, crop_length): while True: batch_x, batch_y = next(batches) batch_crops = np.zeros((batch_x.shape[0], crop_length, crop_length, 3)) for i in range(batch_x.shape[0]): batch_crops[i] = random_crop(batch_x[i], (crop_length, crop_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_generator(batches, crop_length):\n while True:\n batch_x, batch_y = next(batches)\n batch_crops = np.zeros((batch_x.shape[0], crop_length, crop_length, 3))\n for i in range(batch_x.shape[0]):\n batch_crops[i] = random_crop(batch_x[i], (crop_length, crop_length))\n ...
[ "0.75824314", "0.6719259", "0.63412005", "0.6340442", "0.6336577", "0.6271357", "0.62369394", "0.61656475", "0.6124723", "0.61019236", "0.6051693", "0.6036598", "0.59852403", "0.5972355", "0.596388", "0.5952421", "0.5929974", "0.59115386", "0.5901182", "0.5863039", "0.5820809...
0.74894965
1
To be used in conjunction with loss.binary_xentropy_with_sigmoid
def sigmoid_with_binary_xentropy(z): return sigmoid(z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\r\n pred_x = 1.0 / (1.0 + np.exp(-x))\r\n return pred_x\r\n pass", "def test_sigmoid_cross_entropy(self):\n loss_op = pointwise_losses.SigmoidCrossEntropy()\n\n y_pred = loss_op.final_activation_op({\n ...
[ "0.7591269", "0.75822216", "0.7455182", "0.74292374", "0.74232256", "0.74232256", "0.74083984", "0.74083984", "0.74083984", "0.74083984", "0.74083984", "0.74083984", "0.7393072", "0.73908216", "0.73857445", "0.73740834", "0.73655087", "0.73640925", "0.73640925", "0.73588455", ...
0.8279197
0
To be used in conjunction with loss.xentropy_with_softmax
def softmax_with_xentropy(z): return softmax(z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss(params: hk.Params, batch, label) -> jnp.ndarray:\r\n logits = net.apply(params, batch)\r\n labels = jax.nn.one_hot(label, n_classes)\r\n\r\n # Cross Entropy Loss\r\n softmax_xent = -jnp.sum(labels * jax.nn.log_softmax(logits))\r\n softmax_xent /= labels.shape[0]\r\n ...
[ "0.726201", "0.7222704", "0.7183105", "0.7172407", "0.7157092", "0.7130719", "0.7100268", "0.7088628", "0.70864207", "0.7078267", "0.70732236", "0.7006741", "0.7004395", "0.7000175", "0.69368124", "0.6921162", "0.69102913", "0.6891329", "0.6883931", "0.68837404", "0.68784714"...
0.7691633
0
Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card.
def score(hand): max_score = [] for dice in hand: max_score.append(hand.count(dice) * dice) return max(max_score)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(hand):\n if (hand==()):\n return 0\n score_board=[0,0,0,0,0,0,0,0,0,0,0,0]\n for dice in hand:\n score_board[dice-1]+=dice\n max_score=max(score_board)\n return max_score", "def max_score(self):\n return self.raw_possible", "def highCard(self):\n return max(...
[ "0.7198057", "0.69047964", "0.6868163", "0.68407416", "0.68071705", "0.67827207", "0.67775255", "0.6729456", "0.6722615", "0.67012155", "0.66802895", "0.66660815", "0.6656922", "0.6642546", "0.6636847", "0.66343987", "0.66135156", "0.6605659", "0.65514874", "0.6536933", "0.65...
0.6956893
1
Generate all possible choices of dice from hand to hold.
def gen_all_holds(hand): held_dice = [()] for dice in hand: for dummy_dice in held_dice: held_dice = held_dice + [tuple(dummy_dice) + (dice, )] return set(held_dice)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_all_holds(hand):\r\n possible_holds = set([()])\r\n \r\n for dice in hand:\r\n temp_holds = possible_holds.copy()\r\n for hold in temp_holds:\r\n temp_seq = list(hold)\r\n temp_seq.append(dice)\r\n possible_holds.add(tuple(temp_seq))\r\n \r\n re...
[ "0.66850966", "0.6451011", "0.6337711", "0.63297033", "0.63039804", "0.6226844", "0.6226421", "0.62156814", "0.6166249", "0.61634064", "0.61588705", "0.61474586", "0.6074418", "0.60378057", "0.6029834", "0.60106313", "0.598691", "0.59858495", "0.594391", "0.59296936", "0.5920...
0.7070763
0
Compute the hold that maximizes the expected value when the discarded dice are rolled.
def strategy(hand, num_die_sides): best_hold = (0.0, ()) current_score = 0 for held_dice in gen_all_holds(hand): score = expected_value(held_dice, num_die_sides, len(hand) - len(held_dice)) if score > current_score: current_score = score best_hold =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expected_value(held_dice, num_die_sides, num_free_dice):\n outcomes = get_outcomes(num_die_sides)\n print \"outcomes:\", outcomes\n\n # generate all possible sequences of rolls\n all_rolls = list(gen_all_sequences(outcomes, num_free_dice))\n results = [max_repeats(roll) for roll in all_rolls]\n ...
[ "0.7388774", "0.70694953", "0.69726455", "0.696321", "0.69587135", "0.6900279", "0.6876599", "0.6836615", "0.67820185", "0.67149234", "0.67129946", "0.6587366", "0.65404105", "0.6535527", "0.65227497", "0.6499015", "0.62842536", "0.6144699", "0.60962355", "0.6076315", "0.5911...
0.7348299
1
Find names in a sentence based on a FIRST_NAMES file
def find_names(sentence=None, last_names_enabled=True, no_names_enabled=False): if not sentence: raise Exception(ParameterMissing, "This method requires sentence as input") if not isinstance(sentence, str): raise Exception(TypeError, "This method requires string as input") first_names = ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_names(text):\n\n names = []\n\n # spacy doc\n doc = nlp(text)\n\n # pattern\n pattern = [{'LOWER': 'prime'},\n {'LOWER': 'minister'},\n {'POS': 'ADP', 'OP': '?'},\n {'POS': 'PROPN'}]\n\n # Matcher class object\n matcher = Matcher(nlp.vocab)\n ...
[ "0.6360774", "0.6280207", "0.6206798", "0.6189551", "0.6042509", "0.5802803", "0.5793913", "0.5733172", "0.57170224", "0.5716283", "0.56726676", "0.56491053", "0.563351", "0.5597997", "0.5563706", "0.5563537", "0.55441076", "0.55139315", "0.5505184", "0.5496029", "0.54784536"...
0.6673137
0
Find names position in a sentence based on a FIRST_NAMES file
def find_names_position(sentence=None, last_names_enabled=True, no_names_enabled=False): if not sentence: raise Exception(ParameterMissing, "This method requires sentence as input") if not isinstance(sentence, str): raise Exception(TypeError, "This method requires string as input") names_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_names(lines): \n next = False \n names = []\n for line in lines:\n if next:\n if len(line) == 1:\n break\n else:\n tmp = line.split()\n names.append(tmp[1])\n if line.startswith('Sequences loaded ...'):\n n...
[ "0.5892083", "0.58443296", "0.5784747", "0.57840866", "0.5768939", "0.5741232", "0.5701107", "0.5652323", "0.54787356", "0.5471315", "0.53691196", "0.5327336", "0.53244394", "0.5305583", "0.5301656", "0.5268954", "0.5267728", "0.5263014", "0.5252052", "0.5240446", "0.5232655"...
0.70489156
0
Display messages based on the window
def displayMessages(window,messages=['']): # update messages text message_in_line = '' for msg in messages: message_in_line += '\n'+msg window['messages'].update(f'{message_in_line}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showMessage(self):", "def display_message(self, message):\n if self.web_crawler_window is None and self.webpage_classifier_window is None:\n self.machine_learner_window.display_message(message)\n elif self.web_crawler_window is None and self.machine_learner_window is None:\n ...
[ "0.74672174", "0.740839", "0.7318725", "0.7254243", "0.72349834", "0.71429914", "0.6881725", "0.6847033", "0.6815938", "0.6629776", "0.6621973", "0.66084623", "0.6538907", "0.652988", "0.6500956", "0.6434533", "0.64031684", "0.6329774", "0.63157547", "0.630548", "0.62997496",...
0.7462986
1
Normalise an array between a given range.
def normalize_range(array, floor=0, ceil=1): scaler = MinMaxScaler(feature_range=(floor, ceil), copy=True) return scaler.fit_transform(array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(array):\n high = array.max()\n low = array.min()\n rng = high - low\n array[:] = 1.0 - ((high - array) / rng)", "def normalize(arr):\n m = np.min(arr)\n arr = arr - m\n M = np.max(arr)\n arr = arr / M\n return arr", "def _normalize(array):\n\treturn (array - np.min(arra...
[ "0.79416615", "0.78045434", "0.75153875", "0.74919647", "0.74441695", "0.74441695", "0.74232936", "0.7257156", "0.71199733", "0.7106798", "0.7072435", "0.6989358", "0.6980073", "0.6953394", "0.69305813", "0.691604", "0.69146186", "0.68793344", "0.68729293", "0.6854594", "0.68...
0.7987929
0
Normalise an array by its maximum absolute value. Scales and translates each feature individually such that the maximal absolute value of each feature in the array will be 1.0. It does not shift/center the data, and thus does not destroy any sparsity.
def normalize_max_absolute(array): scaler = MaxAbsScaler(copy=True) return scaler.fit_transform(array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_normalization(array):\n return 1/np.max(array) * array.squeeze(axis=1)", "def normalize(array):\n\treturn array/np.max(array)", "def normalize(my_array: np.ndarray) -> np.ndarray:\n\n return np.abs(my_array)/np.max(np.abs(my_array))", "def maxabs_scale(X, *, axis=..., copy=...):\n ...", "d...
[ "0.7536234", "0.71070904", "0.70744723", "0.6854876", "0.6705524", "0.66903067", "0.6577902", "0.6577724", "0.65433544", "0.6540987", "0.63960224", "0.63942844", "0.638665", "0.63782936", "0.6344834", "0.6317285", "0.62940407", "0.62483877", "0.6247812", "0.6247812", "0.61893...
0.8425474
0
Return a diagonal mask computed from an array. Useful when the data is the same if you transpose the array, eg in a heatmap.
def get_diagonal_mask(data): mask = np.zeros_like(data, dtype=np.bool) mask[np.triu_indices_from(mask)] = True return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_diagonal(self, array):\n diags = [array[::-1, :].diagonal(i) for i in range(-array.shape[0] + 1, array.shape[1])]\n\n # Now back to the original array to get the upper-left-to-lower-right diagonals,\n # starting from the right, so the range needed for shape (x,y) was y-1 to -x+1 descen...
[ "0.72953194", "0.61421484", "0.6136961", "0.58667374", "0.5818971", "0.558432", "0.5531007", "0.55216306", "0.5488027", "0.5458054", "0.5457682", "0.5436873", "0.54321617", "0.5413237", "0.54027534", "0.5357985", "0.5352605", "0.53214806", "0.53060347", "0.5296002", "0.528144...
0.706273
1
|coro| Refetches the inventory.
async def update(self) -> None: data = await self._state.http.get_user_inventory(self.owner.id64, self.game.app_id, self.game.context_id) self._update(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_inventory(self):\n for item in self.items:\n self.rooms[int(item.initial_room_id) - 1].inventory.add(item)", "def getitem(self):\n self.inventory += 1", "def inventory(self, time: int) -> Inventory:\n self.refreshDroneStatus(time)\n return self.__inventory", "a...
[ "0.6672313", "0.6481613", "0.64376086", "0.6390931", "0.6384816", "0.63713384", "0.6365049", "0.60815936", "0.6057353", "0.6050127", "0.60095286", "0.59535676", "0.5945936", "0.5925097", "0.5903476", "0.5844133", "0.5825453", "0.58238333", "0.580484", "0.57929665", "0.5770575...
0.65848404
1
Retrieve all instance of OSLicence
def find_all(): return ItopapiPrototype.find_all(ItopapiOSLicence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_soma_objects(self):\n\n msg_store = MessageStoreProxy(database=\"soma2data\", collection=\"soma2\")\n objs = msg_store.query(SOMA2Object._type, message_query={\"map_name\":self.soma_map,\"config\":self.soma_conf})\n print \"queried soma2 objects >> \", objs\n self.soma_objects =...
[ "0.6234363", "0.5961881", "0.595799", "0.59259844", "0.5838429", "0.57797927", "0.5702275", "0.57011425", "0.5666823", "0.5649265", "0.5632733", "0.56231284", "0.5603241", "0.54869276", "0.5477077", "0.5447893", "0.54415894", "0.5405049", "0.540362", "0.5400546", "0.5390554",...
0.60590714
1