query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Extract a topic from a rosbag.
def main(): parser = argparse.ArgumentParser(description="Extract images from a ROS bag.") parser.add_argument("bag_file", help="Input ROS bag.") parser.add_argument("base_dir", nargs='?', default="./dataset", help="Output directory.") args = parser.parse_args() bag = rosbag.Bag(args.bag_file, "r") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topic(title):\n return Topic.get(Topic.title == title)", "def parse_topic(bot, trigger, from_topic, topic_reset):", "def get_topic(self, label):\n\n for attr in self.parm_list:\n if attr.label == label:\n return attr.topic\n\n return \"\"", "def get_by_topic...
[ "0.63223296", "0.61498904", "0.6101026", "0.585544", "0.575472", "0.5711561", "0.5694415", "0.56792593", "0.5585205", "0.55696535", "0.55628955", "0.55619717", "0.55155903", "0.55102146", "0.5499905", "0.5493042", "0.54647493", "0.5458688", "0.5430225", "0.538919", "0.5358946...
0.0
-1
save image into output directory
def save_image(msg, t, base_dir, output_dir, text): cv_img = bridge.imgmsg_to_cv2(msg, desired_encoding="passthrough") filename = os.path.join(output_dir, "%i.%09i.png" %(t.secs, t.nsecs)) cv2.imwrite(os.path.join(base_dir, filename), cv_img) text.write("%i.%09i\t%s\n" %( t.secs, t.nsecs, filename ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_output_image_to_directory(self):\n curr_directory = os.path.dirname(os.path.abspath(__file__))\n images_dir = curr_directory + \"/images/\"\n if not os.path.exists(images_dir):\n os.makedirs(images_dir)\n self.output_image_name = md5(str(uuid4()).encode()).hexdigest(...
[ "0.8353728", "0.79457355", "0.79134864", "0.76756996", "0.7618711", "0.7548638", "0.7452524", "0.7335832", "0.7323866", "0.72918093", "0.72233313", "0.7212494", "0.7212086", "0.71966475", "0.7180229", "0.7173115", "0.707586", "0.7050138", "0.7029119", "0.7017612", "0.7014905"...
0.0
-1
save image into output directory
def save_depth(msg, t, base_dir, output_dir, text): cv_img = bridge.imgmsg_to_cv2(msg, desired_encoding="passthrough") cv_img = np.uint16(cv_img * 255) filename = os.path.join(output_dir, "%i.%09i.png" %(t.secs, t.nsecs)) cv2.imwrite(os.path.join(base_dir, filename), cv_img) text.write("%i.%09i\t%s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_output_image_to_directory(self):\n curr_directory = os.path.dirname(os.path.abspath(__file__))\n images_dir = curr_directory + \"/images/\"\n if not os.path.exists(images_dir):\n os.makedirs(images_dir)\n self.output_image_name = md5(str(uuid4()).encode()).hexdigest(...
[ "0.8353728", "0.79457355", "0.79134864", "0.76756996", "0.7618711", "0.7548638", "0.7452524", "0.7335832", "0.7323866", "0.72918093", "0.72233313", "0.7212494", "0.7212086", "0.71966475", "0.7180229", "0.7173115", "0.707586", "0.7050138", "0.7029119", "0.7017612", "0.7014905"...
0.0
-1
save events into output directory
def save_event(msg, text): for e in msg.events: text.write("%i.%09i\t%i\t%i\t%i\n" %( e.ts.secs, e.ts.nsecs, e.x, e.y, e.polarity+0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_events_summary(self):\n for name, events in self._events.items():\n dict_events = [event.to_dict() for event in events]\n dump_data(dict_events, self._make_event_filename(name))", "def save(self):\n # Read all events\n origin = WebEvent.get_events(True)\n ...
[ "0.70176524", "0.662514", "0.6571558", "0.6560442", "0.64761347", "0.6189363", "0.6181258", "0.61301005", "0.6119431", "0.6052102", "0.5982005", "0.5980981", "0.5950299", "0.593936", "0.58811724", "0.58645153", "0.58562076", "0.5848039", "0.5824934", "0.5788511", "0.5788511",...
0.62797165
5
save imu into output directory
def save_imu(msg, t, text): text.write("%i.%09i\t%f\t%f\t%f\t%f\t%f\t%f\n" %( t.secs, t.nsecs, msg.linear_acceleration.x, msg.linear_acceleration.y, msg.linear_acceleration.z, msg.angular_velocity.x, msg.angular_velocity.y, msg.angular_velocity.z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_nii(im, filename, outdir=\"\", mode=\"image\", system=\"sitk\"):\n if system == \"sitk\":\n if mode == 'label':\n img = sitk.GetImageFromArray(im.astype(np.uint8))\n else:\n img = sitk.GetImageFromArray(im.astype(np.float32))\n if not os.path.exists(\"./{}\...
[ "0.60919976", "0.6054167", "0.6036927", "0.5982314", "0.59585863", "0.5957395", "0.59007883", "0.5862129", "0.58595175", "0.58398736", "0.58028764", "0.57954615", "0.5754209", "0.5732875", "0.57086265", "0.5667069", "0.56652194", "0.566382", "0.56432384", "0.5638287", "0.5627...
0.0
-1
save pose into output directory
def save_pose(msg, t, text): text.write("%i.%09i\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n" %( t.secs, t.nsecs, msg.pose.position.x, msg.pose.position.y, msg.pose.position.z, msg.pose.orientation.x, msg.pose.orientation.y, msg.pose.orientation.z, msg.pose.orientation.w))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_poses():\n get_marshmallow_pose(should_remember=True)\n get_mouth_pose(should_remember=True)\n rospy.sleep(1)\n print \"Finished saving poses\"", "def __toPoseSpace(self, pose):\n poseSpacePath = pose.replace(\".psd\", \".png\")\n log('copying to pose space')\n FlixNuke(...
[ "0.7113796", "0.68871146", "0.6833833", "0.6745527", "0.65154", "0.65120876", "0.6488357", "0.64231086", "0.63985866", "0.63554776", "0.6262675", "0.623896", "0.62274426", "0.622293", "0.622293", "0.62205935", "0.6216378", "0.61761516", "0.61742705", "0.61639047", "0.6155787"...
0.63479
10
Calculate update to bias
def coordinate_delta_bias(sum_grad, sum_hess): return -sum_grad / sum_hess
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_bias(self):\n self._bias = self._bias + self.update_bias_value", "def update_bias(self):\n self._bias = self._bias + self.update_bias_value\n self.bias_clipping()", "def get_bias(self):", "def update_weights(self):\n\n\n self.w += self.learn_rate * (self.X.T.dot(self.T ...
[ "0.7960511", "0.791884", "0.7336597", "0.68819267", "0.68081605", "0.6794973", "0.6792707", "0.67646414", "0.6758868", "0.6738802", "0.6626478", "0.6605367", "0.64988285", "0.6488368", "0.64426166", "0.6436905", "0.6433913", "0.64327997", "0.63390315", "0.63180614", "0.628760...
0.6490454
13
Registers a (namespace URI, alias) mapping in a global namespace alias map. Raises NamespaceAliasRegistrationError if either the namespace URI or alias has already been registered with a different value. This function is required if you want to use a namespace with an OpenID 1 message.
def registerNamespaceAlias(namespace_uri, alias): global registered_aliases if registered_aliases.get(alias) == namespace_uri: return if namespace_uri in list(registered_aliases.values()): raise NamespaceAliasRegistrationError( 'Namespace uri %r already registered' % (namespace...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAlias(self, namespace_uri, desired_alias, implicit=False):\n if isinstance(namespace_uri, bytes):\n namespace_uri = str(namespace_uri, encoding=\"utf-8\")\n # Check that desired_alias is not an openid protocol field as\n # per the spec.\n assert desired_alias not in OP...
[ "0.7010636", "0.6806219", "0.610108", "0.5974404", "0.57496196", "0.570408", "0.5661323", "0.5641835", "0.55364525", "0.55100685", "0.54919547", "0.5460767", "0.5418688", "0.53622675", "0.53546315", "0.53462195", "0.5308682", "0.527205", "0.5271993", "0.5242364", "0.5229331",...
0.7908426
0
Create an empty Message.
def __init__(self, openid_namespace=None): self.args = {} self.namespaces = NamespaceMap() if openid_namespace is None: self._openid_ns_uri = None else: implicit = openid_namespace in OPENID1_NAMESPACES self.setOpenIDNamespace(openid_namespace, implici...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )", "def Message(self, *args, **kwargs):\n return Message(self, *args, **kwargs)", "def message(self, *args, **kwargs) -> Message:\n return Message(self.handle, *args, **kwargs)", "def createMessage( self, *args, *...
[ "0.73098487", "0.7020393", "0.68267363", "0.6607929", "0.65662277", "0.65537304", "0.6550735", "0.64826477", "0.64555025", "0.6449307", "0.6400586", "0.6335153", "0.6331504", "0.6273631", "0.6228902", "0.61994874", "0.61625075", "0.6162155", "0.6099113", "0.6082046", "0.60644...
0.0
-1
Construct a Message containing a set of POST arguments.
def fromPostArgs(cls, args): self = cls() # Partition into "openid." args and bare args openid_args = {} for key, value in args.items(): if isinstance(value, list): raise TypeError("query dict must have one value for each key, " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toArgs(self):\n # FIXME - undocumented exception\n post_args = self.toPostArgs()\n kvargs = {}\n for k, v in post_args.items():\n if not k.startswith('openid.'):\n raise ValueError(\n 'This message can only be encoded as a POST, because i...
[ "0.62721694", "0.6083221", "0.5995575", "0.5913857", "0.58976674", "0.58652014", "0.5832085", "0.5732163", "0.56640744", "0.56440824", "0.56154937", "0.5566048", "0.55638653", "0.55541164", "0.5524833", "0.5496381", "0.5493451", "0.54856616", "0.54054844", "0.53827393", "0.53...
0.51175976
41
Construct a Message from a parsed KVForm message.
def fromOpenIDArgs(cls, openid_args): self = cls() self._fromOpenIDArgs(openid_args) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromKVForm(cls, kvform_string):\n return cls.fromOpenIDArgs(kvform.kvToDict(kvform_string))", "def parse(cls, message):\r\n if isinstance(message, PlatformMessage):\r\n inst = PlatformMessage.parse(message.serialize())\r\n return inst\r\n inst = PlatformMessage()\r\...
[ "0.6850859", "0.6287498", "0.62155014", "0.6042605", "0.6034049", "0.60106117", "0.59877783", "0.59399116", "0.59232503", "0.5916589", "0.5905514", "0.5882582", "0.585652", "0.5846982", "0.5831558", "0.5818611", "0.5815071", "0.5810257", "0.5788377", "0.5742025", "0.5729603",...
0.0
-1
Set the OpenID namespace URI used in this message.
def setOpenIDNamespace(self, openid_ns_uri, implicit): if isinstance(openid_ns_uri, bytes): openid_ns_uri = str(openid_ns_uri, encoding="utf-8") if openid_ns_uri not in self.allowed_openid_namespaces: raise InvalidOpenIDNamespace(openid_ns_uri) self.namespaces.addAlias(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fixNS(self, namespace):\n if isinstance(namespace, bytes):\n namespace = str(namespace, encoding=\"utf-8\")\n\n if namespace == OPENID_NS:\n if self._openid_ns_uri is None:\n raise UndefinedOpenIDNamespace('OpenID namespace not set')\n else:\n ...
[ "0.6426755", "0.62954724", "0.6164264", "0.6050303", "0.6050303", "0.5984669", "0.59691775", "0.5940983", "0.5940983", "0.5894546", "0.58075154", "0.57805187", "0.576387", "0.576387", "0.5745174", "0.5741338", "0.57310665", "0.57230777", "0.5672933", "0.56456596", "0.56197655...
0.7747692
0
Create a Message from a KVForm string
def fromKVForm(cls, kvform_string): return cls.fromOpenIDArgs(kvform.kvToDict(kvform_string))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromString(line: Union[bytes, str]) -> SBSMessage:\n if isinstance(line, bytes):\n line = line.decode()\n\n values = line.rstrip(DELIMITER).split(\",\")\n\n if len(FieldNames) != len(values):\n raise Exception(\n \"Incorrect number of msg fields. \"\n f\"Expected {l...
[ "0.57645077", "0.5688823", "0.56552196", "0.5643596", "0.5618665", "0.5617855", "0.56144583", "0.5580899", "0.5577902", "0.55517954", "0.5543949", "0.5539514", "0.5533499", "0.55125445", "0.5456577", "0.5455207", "0.54431003", "0.5441704", "0.54322344", "0.54081976", "0.53713...
0.6811829
0
Return all arguments with openid. in front of namespaced arguments. bytes
def toPostArgs(self): args = {} # Add namespace definitions to the output for ns_uri, alias in self.namespaces.items(): if self.namespaces.isImplicit(ns_uri): continue if alias == NULL_NAMESPACE: ns_key = 'openid.ns' else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArgs(self, namespace):\n namespace = self._fixNS(namespace)\n args = []\n for ((pair_ns, ns_key), value) in self.args.items():\n if pair_ns == namespace:\n if isinstance(ns_key, bytes):\n k = str(ns_key, encoding=\"utf-8\")\n e...
[ "0.6365776", "0.59016585", "0.58178616", "0.5766803", "0.5735688", "0.5670085", "0.5667718", "0.56496716", "0.5622981", "0.5534717", "0.5495901", "0.5444868", "0.5425289", "0.5410966", "0.5409317", "0.54073656", "0.5405866", "0.5405073", "0.5404213", "0.5399564", "0.5351973",...
0.6745914
0
Return all namespaced arguments, failing if any nonnamespaced arguments exist.
def toArgs(self): # FIXME - undocumented exception post_args = self.toPostArgs() kvargs = {} for k, v in post_args.items(): if not k.startswith('openid.'): raise ValueError( 'This message can only be encoded as a POST, because it ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetMissingArguments(self):\n return []", "def parse_known_args(self, args=None, namespace=None):\n namespace, unknown_args = argparse.ArgumentParser.parse_known_args(\n self, args=args, namespace=namespace)\n setup_logging(debug=namespace.debug, quiet=namespace.quiet)\n ret...
[ "0.66946495", "0.6426528", "0.625696", "0.62467486", "0.62454754", "0.62058336", "0.62050045", "0.6146733", "0.61381245", "0.61065745", "0.6099868", "0.6079673", "0.6078017", "0.5990949", "0.59454465", "0.5930754", "0.5899386", "0.5899386", "0.5899386", "0.5899386", "0.589938...
0.0
-1
Generate HTML form markup that contains the values in this message, to be HTTP POSTed as xwwwformurlencoded UTF8.
def toFormMarkup(self, action_url, form_tag_attrs=None, submit_text="Continue"): if ElementTree is None: raise RuntimeError('This function requires ElementTree.') assert action_url is not None form = ElementTree.Element...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html(self):\n lbl = escape(self._label)\n dis = ('disabled' if not self._enabled else '')\n typ = ('password' if self._password else 'text')\n nam = escape(self._name)\n val = escape(self._value)\n return '%s <input name=\"%s\" %s type=\"%s\" value=\"%s\" size=\"%i\">' % (lbl, nam, dis, typ, ...
[ "0.67373294", "0.6385482", "0.6325107", "0.6302309", "0.6271072", "0.6244643", "0.62101585", "0.60248107", "0.5974288", "0.586528", "0.5819194", "0.5782784", "0.5709036", "0.56732655", "0.5639069", "0.56299555", "0.56161827", "0.5597698", "0.5597698", "0.5596439", "0.55543435...
0.51578027
52
Generate a GET URL with the parameters in this message attached as query parameters.
def toURL(self, base_url): return oidutil.appendArgs(base_url, self.toPostArgs())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_url(self):\n path = [self.path]\n path.extend([str(x) for x in self.params])\n\n url = self.client.base_url + '/'.join(x for x in path if x)\n query = self.kwargs.get('query')\n\n if query:\n # Dict -> List\n if type(query) is dict:\n ...
[ "0.71801937", "0.711124", "0.68210596", "0.6741495", "0.662647", "0.661882", "0.6581165", "0.645079", "0.64206225", "0.639185", "0.6379292", "0.6324861", "0.63212675", "0.62738764", "0.62738764", "0.6273605", "0.6258357", "0.6232478", "0.6202789", "0.6192478", "0.61918855", ...
0.0
-1
Generate a KVForm string that contains the parameters in this message. This will fail if the message contains arguments outside of the 'openid.' prefix.
def toKVForm(self): return kvform.dictToKV(self.toArgs())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toArgs(self):\n # FIXME - undocumented exception\n post_args = self.toPostArgs()\n kvargs = {}\n for k, v in post_args.items():\n if not k.startswith('openid.'):\n raise ValueError(\n 'This message can only be encoded as a POST, because i...
[ "0.5983378", "0.59280044", "0.57463664", "0.56856304", "0.5508083", "0.54277", "0.5346449", "0.5278368", "0.5178145", "0.5166228", "0.50625527", "0.5047591", "0.50214", "0.50212806", "0.49930903", "0.49577212", "0.49298105", "0.492156", "0.49169794", "0.49047473", "0.48605233...
0.0
-1
Generate an xwwwurlencoded string
def toURLEncoded(self): args = sorted(self.toPostArgs().items()) return urllib.parse.urlencode(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_query_string(self):\n \n query_items = {}\n \n for key, val in self.__dict__.iteritems():\n if not key.startswith('_'):\n query_items[key] = val.encode('utf-8')\n \n return urllib.urlencode(query_items)", "def to_postdata(request):...
[ "0.5808472", "0.57913643", "0.5773916", "0.57650715", "0.57605106", "0.5748529", "0.57311493", "0.56504", "0.55804265", "0.5517981", "0.5515183", "0.5464793", "0.5397268", "0.53861", "0.53720844", "0.5360866", "0.5342282", "0.5324426", "0.5311394", "0.52979195", "0.528327", ...
0.5803152
1
Convert an input value into the internally used values of this object
def _fixNS(self, namespace): if isinstance(namespace, bytes): namespace = str(namespace, encoding="utf-8") if namespace == OPENID_NS: if self._openid_ns_uri is None: raise UndefinedOpenIDNamespace('OpenID namespace not set') else: name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendly_to_internal(self, value):\n return value * self.conversion", "def convert(self, value):\r\n return value", "def convert(self, value):\n return value", "def convert(self, value):\r\n return Converter.convert(self, value)", "def convert(self, value, context):\n ...
[ "0.74256885", "0.74199176", "0.7275704", "0.6979789", "0.6956025", "0.6577008", "0.6417238", "0.6417238", "0.6369521", "0.62665266", "0.624821", "0.624821", "0.6236396", "0.6227514", "0.622635", "0.60285544", "0.60167897", "0.6015987", "0.6015629", "0.59443", "0.59196603", ...
0.0
-1
Get the key for a particular namespaced argument
def getKey(self, namespace, ns_key): namespace = self._fixNS(namespace) if namespace == BARE_NS: return ns_key ns_alias = self.namespaces.getAlias(namespace) # No alias is defined, so no key can exist if ns_alias is None: return None if ns_alias...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_corresponding_key_for_object(arg_schema: Dict[str, Any]) -> str:\n return arg_schema['schema']['new_key_for_argument']", "def getArg(self, namespace, key, default=None):\n namespace = self._fixNS(namespace)\n args_key = (namespace, key)\n try:\n return self.args[args_ke...
[ "0.6990061", "0.6727239", "0.6724652", "0.6566283", "0.65627825", "0.6446762", "0.6391834", "0.63013256", "0.6270743", "0.62667465", "0.6264716", "0.61936885", "0.6190331", "0.607806", "0.6064705", "0.6060848", "0.60452914", "0.6038849", "0.6035953", "0.6026025", "0.601438", ...
0.6781975
1
Get a value for a namespaced key.
def getArg(self, namespace, key, default=None): namespace = self._fixNS(namespace) args_key = (namespace, key) try: return self.args[args_key] except KeyError: if default is no_default: raise KeyError((namespace, key)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self, key):\n return self[key]", "def get(self, key):\r\n if not isinstance(key, str):\r\n raise TypeError(\"Key must be a string\")\r\n\r\n node = self._find_node(key)\r\n if node is None:\r\n return None\r\n else:\r\n return node...
[ "0.7033379", "0.7028903", "0.6942782", "0.6858578", "0.6795415", "0.6716546", "0.6704868", "0.6697092", "0.66865456", "0.6675991", "0.6660689", "0.6648757", "0.66056263", "0.6599573", "0.6575653", "0.6543421", "0.65349764", "0.64875406", "0.6487519", "0.6475189", "0.6459494",...
0.5941067
93
Get the arguments that are defined for this namespace URI
def getArgs(self, namespace): namespace = self._fixNS(namespace) args = [] for ((pair_ns, ns_key), value) in self.args.items(): if pair_ns == namespace: if isinstance(ns_key, bytes): k = str(ns_key, encoding="utf-8") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(self):\n return self._parse_args", "def arguments(self):\n return parse_arguments(self['data'])", "def args(self):\n return self._args", "def args(self):\n return self._args", "def args(self):\n return self._args", "def get_args(self):\r\n return self.ar...
[ "0.72403866", "0.7153542", "0.7080567", "0.7080567", "0.7080567", "0.7073437", "0.702176", "0.7008007", "0.6960663", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69215184", "0.69...
0.6797538
30
Set multiple key/value pairs in one call
def updateArgs(self, namespace, updates): namespace = self._fixNS(namespace) for k, v in updates.items(): self.setArg(namespace, k, v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, *args, **kargs):\n if len(args) == 0:\n for key in kargs.keys():\n self._set_string_value_pair(key, kargs[key])\n else:\n for element in range(0, len(args), 2):\n self._set_string_value_pair(args[element], args[element+1])", "def set...
[ "0.7494135", "0.69999015", "0.6935445", "0.6789301", "0.67862946", "0.6724433", "0.6714417", "0.67065036", "0.66670597", "0.66038805", "0.65362185", "0.6490941", "0.64871806", "0.64631134", "0.64558434", "0.64453274", "0.64101994", "0.6399414", "0.639539", "0.63752866", "0.63...
0.0
-1
Set a single argument in this namespace
def setArg(self, namespace, key, value): assert key is not None assert value is not None namespace = self._fixNS(namespace) # try to ensure that internally it's consistent, at least: str -> str if isinstance(value, bytes): value = str(value, encoding="utf-8") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setParameter(self, name, value):", "def __setitem__(self, arg, value):\n setattr(self.args, arg, value)", "def _set_args(self, args):\n if not args:\n self.arg = None\n elif len(args) == 1:\n self.arg = args[0]\n else:\n self.arg = args", "def ...
[ "0.7103958", "0.70502704", "0.6912513", "0.68511933", "0.6721404", "0.67157024", "0.6668933", "0.66669136", "0.65873015", "0.65809786", "0.65776145", "0.65428585", "0.65428585", "0.65428585", "0.65428585", "0.65428585", "0.6538274", "0.6504318", "0.6490057", "0.6437055", "0.6...
0.7578816
0
Return an iterator over the namespace URIs
def iterNamespaceURIs(self): return iter(self.namespace_to_alias)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterAliases(self):\n return iter(self.alias_to_namespace)", "def namespaces(self):\n return [self._namespace_prefix]", "def all_in_namespace(cls, ns):\n return filter_by_prefix(cls.all(), ns + ':')", "def namespaces(self):\n return list(self._namespace_schemas.keys())", "asy...
[ "0.6870897", "0.6685352", "0.6223801", "0.6188847", "0.6184657", "0.61233354", "0.6122067", "0.6073421", "0.6056552", "0.6017647", "0.5989113", "0.5978699", "0.59674186", "0.5959256", "0.5956481", "0.59479284", "0.58875895", "0.58692926", "0.5852249", "0.57922745", "0.5739497...
0.8632694
0
Return an iterator over the aliases
def iterAliases(self): return iter(self.alias_to_namespace)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases(self):\n return self.__aliases", "def getAliases(self):", "def iterNamespaceURIs(self):\n return iter(self.namespace_to_alias)", "def query_aliases(self):\n\n result = set()\n\n infos = self.es_client.indices.get_alias(\n index='{}-*'.format(self.normalized_...
[ "0.73336315", "0.71978825", "0.7082749", "0.704246", "0.69749415", "0.69117486", "0.68409556", "0.6807005", "0.67619336", "0.67586315", "0.65434766", "0.65251005", "0.64194065", "0.63572776", "0.6298205", "0.6276488", "0.6267333", "0.62299424", "0.61920774", "0.6123602", "0.6...
0.86531883
0
Iterate over the mapping
def items(self): return self.namespace_to_alias.items()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for mapping in self._mappings.values():\n yield mapping", "def _map___iter__(self):\n return self.iterkeys()", "def itermappings(self):\r\n return self.by_target.iteritems()", "def itermappings(self):\n return six.iteritems(self.by_target)", "def _ch...
[ "0.8175727", "0.74806166", "0.73288476", "0.7296036", "0.69954574", "0.69358975", "0.69087964", "0.6880972", "0.67225593", "0.67094326", "0.66545975", "0.6632092", "0.6626034", "0.66190577", "0.66018254", "0.6576663", "0.6561397", "0.6534424", "0.65133727", "0.6513103", "0.65...
0.0
-1
Add an alias from this namespace URI to the desired alias
def addAlias(self, namespace_uri, desired_alias, implicit=False): if isinstance(namespace_uri, bytes): namespace_uri = str(namespace_uri, encoding="utf-8") # Check that desired_alias is not an openid protocol field as # per the spec. assert desired_alias not in OPENID_PROTOCO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAlias(self, alias, node):", "def add(self, namespace_uri):\n # See if this namespace is already mapped to an alias\n alias = self.namespace_to_alias.get(namespace_uri)\n if alias is not None:\n return alias\n\n # Fall back to generating a numerical alias\n i =...
[ "0.7980967", "0.7849719", "0.74037224", "0.73549086", "0.725321", "0.7112388", "0.6914533", "0.6852475", "0.6716943", "0.67104566", "0.6698526", "0.6587664", "0.647376", "0.64254326", "0.63835", "0.6337613", "0.62583625", "0.61442673", "0.61310035", "0.6096607", "0.6034303", ...
0.7694853
2
Add this namespace URI to the mapping, without caring what alias it ends up with
def add(self, namespace_uri): # See if this namespace is already mapped to an alias alias = self.namespace_to_alias.get(namespace_uri) if alias is not None: return alias # Fall back to generating a numerical alias i = 0 while True: alias = 'ext' +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAlias(self, namespace_uri, desired_alias, implicit=False):\n if isinstance(namespace_uri, bytes):\n namespace_uri = str(namespace_uri, encoding=\"utf-8\")\n # Check that desired_alias is not an openid protocol field as\n # per the spec.\n assert desired_alias not in OP...
[ "0.64435095", "0.63750935", "0.6109068", "0.6095447", "0.6022318", "0.5992828", "0.5778283", "0.57767075", "0.5771834", "0.5735369", "0.568554", "0.56455714", "0.56407934", "0.5635236", "0.5556329", "0.5487468", "0.5453782", "0.5439539", "0.5429285", "0.5421573", "0.5385871",...
0.7072294
0
Creates an operation node for the graph.
def __init__(self, name, result, args, kwargs): self.name = name self.result = result self.args = args self.kwargs = kwargs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n new_node = Node()\r\n new_node.op = self\r\n return new_node", "def __call__(self):\n new_node = Node()\n new_node.op = self\n return new_node", "def __call__(self):\r\n new_node = Op.__call__(self)\r\n return new_node", "def cre...
[ "0.7330213", "0.7269197", "0.7099459", "0.70966023", "0.70073915", "0.65345395", "0.64786273", "0.6408109", "0.63892883", "0.6306168", "0.62653774", "0.6140806", "0.6138927", "0.61277574", "0.6124204", "0.61137027", "0.6080934", "0.6067336", "0.60528255", "0.6041355", "0.6020...
0.0
-1
Create a differentiable graph of operations.
def __init__(self): self.operation_map = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_DiGraph(program):\r\n grid = {}\r\n\r\n for idx, op in enumerate(program.operations):\r\n dependencies = set(op['modes'])\r\n\r\n if 'args' in op:\r\n\r\n for a in op['args']:\r\n if isinstance(a, RegRefTransform):\r\n dependencies |= set(a.re...
[ "0.6976105", "0.6777329", "0.67148566", "0.651235", "0.6464008", "0.643832", "0.6438232", "0.64033186", "0.6401101", "0.63732904", "0.6281627", "0.62646765", "0.62411577", "0.62168145", "0.6099838", "0.6074718", "0.60698014", "0.6041636", "0.60414946", "0.6030048", "0.6022884...
0.0
-1
Adds a new tensor to the graph with a new unique identifier.
def register_operation(self, name, result, args, kwargs): if not isinstance(result, autodiff.tensor.Tensor): result = autodiff.tensor.Tensor(result, graph=self) args = [x if isinstance(x, autodiff.tensor.Tensor) else autodiff.tensor.Tensor(x, graph=self) for x in args] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, tensor):\n return self.add(tensor)", "def register(self, tensor: 'NmTensor'):\n\n # Check if object is already in a set.\n if tensor.unique_name in self._nmtensor_uniname_dict:\n pass\n\n # Finally, add object to the set.\n self._nmtensor_uniname_di...
[ "0.6776243", "0.66826296", "0.65882075", "0.63720924", "0.6234419", "0.6147891", "0.6144538", "0.61359835", "0.5976786", "0.5958982", "0.5842618", "0.57457864", "0.57273674", "0.57163733", "0.5707612", "0.5665855", "0.56567496", "0.5631288", "0.5556173", "0.55505794", "0.5516...
0.5013778
83
Fetches the operation and inputs that led to this result.
def lookup_operation(self, result): if (not isinstance(result, autodiff.tensor.Tensor) or result.id not in self.operation_map): return None return self.operation_map[result.id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ops(self):\n return self._read_ops", "def get_data(self):\n return self._fullInput, self._fullOutput", "def _get_inputs(self):\n return self.__inputs", "def _get_inputs(self):\n return self.__inputs", "def _get_inputs(self):\n return self.__inputs", "def retrieve_results(s...
[ "0.63768834", "0.62232274", "0.60717475", "0.60717475", "0.60717475", "0.6006625", "0.59559184", "0.59147286", "0.5856461", "0.5827382", "0.57779646", "0.57779646", "0.57631695", "0.5707673", "0.5707009", "0.56927615", "0.5687642", "0.5683274", "0.5682482", "0.5676296", "0.56...
0.5758431
13
Returns the fastest path from start node to end node by a DFS
def searchII(graph, start, end): return DFSII(graph, start, end, [], 0, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findPathDFS(start, end):\n visited = set()\n visited.add(start)\n return __findPathDFS(start, end, visited)", "def DFS1(graph, start, end, path=[], shortest=None):\n path = path + [start]\n print 'Current DFS path:', printPath(path)\n if start == end:\n return path\n for node in g...
[ "0.79175854", "0.7700684", "0.7665652", "0.76499534", "0.761851", "0.7391959", "0.7370893", "0.7319338", "0.7288487", "0.7236897", "0.7226096", "0.7220927", "0.71544987", "0.71514773", "0.71191835", "0.71063447", "0.70993936", "0.70948446", "0.70606387", "0.70313954", "0.7012...
0.0
-1
move patients from waiting to triage
def callNurse(): triageRoom.append(waitingRoom.pop(0)) #sort(triageRoom,key=patient.triageNumer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def move(self):\n await self.wait(5)\n previous_task = self.miner_task\n self.miner_task = random.choice(\n [candidate for candidate in MinerType if candidate != self.miner_task]\n )\n self.say(f\"Moved from task {previous_task} to task {self.miner_task}\")", "...
[ "0.5807499", "0.57181096", "0.56383467", "0.55233204", "0.52456886", "0.5228011", "0.51831496", "0.51780653", "0.51529205", "0.5146072", "0.5142629", "0.5142618", "0.5128126", "0.512274", "0.51103115", "0.5101565", "0.5060642", "0.5050685", "0.50319284", "0.5019232", "0.50100...
0.5813368
0
representation for debugging purposes
def __repr__(w_self): return "%s(%r)" % (w_self.__class__.__name__, w_self._node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n pass", "def __repr__(self):\n return repr(self.__dict__['_obj'])", "def compute_debug(self):", "def dump(self):\n return", "def __repr__(self):", "def __repr__(self):", "def __repr__(self):", "def pprint(self):\n # just here for defining the i...
[ "0.71541977", "0.7090507", "0.70583075", "0.702443", "0.7012783", "0.7012783", "0.7012783", "0.69671595", "0.693556", "0.68945724", "0.68546486", "0.68232125", "0.68103844", "0.68058145", "0.67931384", "0.67931384", "0.67931384", "0.67931384", "0.67931384", "0.6782036", "0.67...
0.0
-1
Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
def str_isupper__Rope(space, w_self): l = w_self._node.length() if l == 0: return space.w_False cased = False iter = rope.ItemIterator(w_self._node) for idx in range(l): c = iter.nextchar() if c.islower(): return space.w_False elif not cased and c.isu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_all_upper(s):\n return all(c.isupper() for c in s if c.isalpha())", "def all_caps(s):\n alphas = [c for c in s if c.isalpha()]\n if alphas == []:\n return False\n for x in alphas:\n if not x.isupper():\n return False\n return True", "def is_uppercase(character):\n...
[ "0.8084244", "0.78965294", "0.7211257", "0.7151977", "0.7149477", "0.71484476", "0.7127036", "0.7127036", "0.7127036", "0.7127036", "0.71249497", "0.71249497", "0.71243674", "0.71243674", "0.71243674", "0.7049196", "0.6751354", "0.6751354", "0.67188597", "0.66840214", "0.6669...
0.6793571
16
Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
def str_islower__Rope(space, w_self): l = w_self._node.length() if l == 0: return space.w_False cased = False iter = rope.ItemIterator(w_self._node) for idx in range(l): c = iter.nextchar() if c.isupper(): return space.w_False elif not cased and c.isl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_lowercase1(s):\n\tfor c in s:\n\t\tif c.islower():\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False", "def any_lowercase1(s):\n for c in s:\n if c.islower():\n return True\n else:\n return False", "def any_lowercase1(s):\n for c in s:\n if c.islower():\...
[ "0.81960785", "0.8153698", "0.8153698", "0.76614356", "0.76614356", "0.76614356", "0.76614356", "0.7638156", "0.76231164", "0.76231164", "0.76231164", "0.75268894", "0.75268894", "0.7439214", "0.7439214", "0.7439214", "0.7394335", "0.7318649", "0.703328", "0.70134753", "0.698...
0.68719643
22
Return True if S is a titlecased string and there is at least one character in S, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
def str_istitle__Rope(space, w_self): cased = False previous_is_cased = False iter = rope.ItemIterator(w_self._node) for pos in range(0, w_self._node.length()): ch = iter.nextchar() if ch.isupper(): if previous_is_cased: return space.w_False previ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_caps(s):\n alphas = [c for c in s if c.isalpha()]\n if alphas == []:\n return False\n for x in alphas:\n if not x.isupper():\n return False\n return True", "def any_lowercase1(s):\n\tfor c in s:\n\t\tif c.islower():\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False", ...
[ "0.74139804", "0.73939043", "0.72705734", "0.72705734", "0.6856113", "0.6856113", "0.6856113", "0.67674786", "0.6685799", "0.6685799", "0.6685799", "0.6685799", "0.66519403", "0.6586802", "0.65708584", "0.65665394", "0.65664166", "0.65664166", "0.65664166", "0.6558827", "0.65...
0.64228785
25
charfilter unicode handling is not implemented Return a copy of the string where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256
def str_translate__Rope_ANY_ANY(space, w_string, w_table, w_deletechars=''): # XXX CPython accepts buffers, too, not sure what we should do table = space.str_w(w_table) if len(table) != 256: raise OperationError( space.w_ValueError, space.wrap("translation table must be 256 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, s, a=None, d=None):\n if a is None: a = self.allchars\n if d is None: d = self.delchars\n return s.translate(a,d)", "def remove_unicode_diac(text):\n # Replace diacritics with nothing\n text = text.replace(u\"\\u064B\", \"\") # fatHatayn\n text = text.replace(u\"...
[ "0.6729751", "0.64236444", "0.6228008", "0.6178179", "0.6159261", "0.60772485", "0.60772485", "0.6024089", "0.60150146", "0.59795356", "0.59790367", "0.5968116", "0.59179926", "0.5908785", "0.5906587", "0.5893976", "0.58877313", "0.5873513", "0.5872421", "0.58681035", "0.5860...
0.5330533
91
Return all problem names that belong to the specified test set as list
def getTestSetByName(testset : str = TESTSET_MIPLIB2010) -> list: try: return _testsetdict[testset] except IndexError: raise IndexError("Unknown test set specifier {}".format(testset))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_a_list_of_testset_names() -> str:\n message = 'The available test sets are:'\n for testset in sorted(DATASETS.keys(), reverse=True):\n message += '\\n%20s: %s' % (testset, DATASETS[testset].get('description', ''))\n return message", "def get_langpairs_for_testset(testset: str) -> List:\n ...
[ "0.6855921", "0.65782523", "0.6288914", "0.58829206", "0.5865857", "0.5843167", "0.5820474", "0.5791785", "0.57900167", "0.5741455", "0.5688786", "0.564486", "0.56263286", "0.5622542", "0.55753124", "0.55678785", "0.55395573", "0.5508305", "0.547427", "0.54531366", "0.5452073...
0.7205281
0
return all valid test set identifiers
def getTestSets(): return list(_testsetdict.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTestsIds():\n with driver.session() as s:\n ids = s.write_transaction(getTestsId)\n\n tIds = []\n for idEl in ids:\n tIds.append(idEl[\"ID(t)\"])\n\n return tIds", "def test_get_ids(self):\r\n lines = \"\"\">S74_1 E86FECS01CEVAV orig_bc=ACATGTCACGTG new_bc=ACATGTCACGTG bc_...
[ "0.6714933", "0.64470106", "0.6430311", "0.6180012", "0.61729527", "0.613509", "0.6104871", "0.60966504", "0.6089016", "0.6084988", "0.60646206", "0.60646206", "0.6046974", "0.60027915", "0.6000186", "0.59887046", "0.5985557", "0.5958685", "0.59212613", "0.5874063", "0.584645...
0.6758547
0
Returns a list of the possible directions to go in the maze from unit (x, y).
def paths(self, x, y): return [direction for direction in Compass if ~self._grid[y][x] & direction]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directions(self):\n direction_list = []\n for direction in Maze.possible_directions:\n move = Maze.dirs_to_moves[direction]\n if (0 <= (self.location[0]+move[0]) < len(self.grid) and\n 0 <= (self.location[1]+move[1]) < len(self.grid[0]) and\n ...
[ "0.7795333", "0.73840576", "0.69857764", "0.6872226", "0.66806155", "0.6629714", "0.6627283", "0.65961426", "0.65961426", "0.65961426", "0.6561338", "0.6561338", "0.6561338", "0.6561338", "0.6561338", "0.6561338", "0.6561338", "0.6561338", "0.6526868", "0.6526868", "0.6526868...
0.6085769
81
Returns a list of directions with walls from unit (x, y).
def walls(self, x, y): return [direction for direction in Compass if self._grid[y][x] & direction]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_walls(world):\r\n return set(((x,y) for x in range(world.get_width()) for y in range(world.get_height()) if world.is_wall((x,y))))", "def walls (x, y):\n North = True\n West = True\n East = True\n South = True\n if x == 1:\n West = False\n if x == 3:\n East = False\n ...
[ "0.6931096", "0.67324764", "0.6677025", "0.6662643", "0.65038824", "0.64544606", "0.64346147", "0.643258", "0.6403339", "0.6403339", "0.6382812", "0.6378806", "0.63534755", "0.63412195", "0.6326087", "0.6306027", "0.6297865", "0.6296912", "0.62893313", "0.6274893", "0.627132"...
0.7872111
0
Returns the neighbor of unit (x, y) in the given direction, if it exists.
def neighbor(self, x, y, direction): if direction == Compass.NORTH: if y > 0: return (x, y-1) elif direction == Compass.EAST: if x < self.width - 1: return (x+1, y) elif direction == Compass.SOUTH: if y < self.height - 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def see_neighbour(self, x, y, dx, dy):\r\n if self.grid[y][x] == '.' or (dx == 0 and dy == 0): # Makes looping easier\r\n return None\r\n x += dx\r\n y += dy\r\n while 0 <= x < self.width and 0 <= y < self.height:\r\n if self.grid[y][x] != '.':\r\n ...
[ "0.7152461", "0.67528635", "0.67314065", "0.6406822", "0.6211197", "0.6211197", "0.62099123", "0.6173974", "0.61151046", "0.6108432", "0.60893816", "0.60839796", "0.6080536", "0.60654765", "0.60411894", "0.60186845", "0.5971613", "0.59698486", "0.5959896", "0.5959765", "0.593...
0.80897313
0
Removes the wall between the unit (x,y) and its neighbor in the given direction.
def break_wall(self, x, y, direction): self._grid[y][x] &= ~direction nx, ny = self.neighbor(x, y, direction) self._grid[ny][nx] &= ~Compass.reverse(direction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_wall(self, direction):\n assert direction\n if self._walls & direction != 0:\n self.walls &= ~direction", "def remove_wall(self, direction, other):\n\t\td_map = {\n\t\t\t(-1, 0): 3,\n\t\t\t(1 , 0): 0,\n\t\t\t(0 , -1): 1,\n\t\t\t(0 , 1): 2\n\t\t}\n\t\tself.walls[d_map[direct...
[ "0.8012029", "0.789475", "0.685327", "0.6179644", "0.61252105", "0.6024688", "0.59736294", "0.58578277", "0.5823114", "0.5740791", "0.55766904", "0.5508948", "0.5470902", "0.54289025", "0.5405155", "0.53503203", "0.53424186", "0.5322554", "0.5297457", "0.52969927", "0.5236132...
0.7648708
2
Generates a random maze using the recursive backtracking algorithm.
def recursive_backtrack(width=16, height=16) -> Maze: maze = Maze(width=width, height=height, algorithm=None) visited = [[False for _ in range(maze.width)] for _ in range(maze.height)] # ensure only one entrance to the center squares centerx = maze.width // 2 - 1 centery = maze.height // 2 - 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_maze(self):\r\n # reset the grid before generation\r\n self.initialize_grid()\r\n\r\n # choose the first cell to put in the visited list\r\n # see Step 1 of the algorithm.\r\n current = self.unvisited.pop(random.randint(0,len(self.unvisited)-1))\r\n self.visit...
[ "0.74878633", "0.6845463", "0.68291163", "0.67794526", "0.6772866", "0.6768403", "0.66348165", "0.6616029", "0.6605966", "0.6581727", "0.65716815", "0.64793205", "0.6440684", "0.624309", "0.6218164", "0.6157984", "0.6036416", "0.6015916", "0.60098726", "0.6002533", "0.5976529...
0.6860484
1
Generates a maze using a randomized version of Prim's Algorithm.
def randomized_prims(width=16, height=16) -> Maze: maze = Maze(width=width, height=height, algorithm=None) visited = [[False for _ in range(maze.width)] for _ in range(maze.height)] # ensure only one entrance to the center squares centerx = maze.width // 2 - 1 centery = maze.height // 2 - 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_maze(dim, p):\n maze = []\n for i in range(dim):\n maze.append([])\n for j in range(dim):\n if(random.uniform(0, 1) < p):\n maze[i].append(1)\n else:\n maze[i].append(0)\n\n maze[0][0] = 0\n maze[dim - 1][dim - 1] = 0\n return...
[ "0.75691426", "0.7045847", "0.6857781", "0.66844857", "0.64299804", "0.63144267", "0.6273802", "0.62688345", "0.6187559", "0.6180049", "0.614384", "0.61315477", "0.6058598", "0.6057205", "0.60230833", "0.60173345", "0.6015078", "0.60039353", "0.6003372", "0.59754616", "0.5940...
0.72561264
1
Generates a maze using Wilson's looperased random walk algorithm.
def wilsons_maze(width=16, height=16) -> Maze: maze = Maze(width=width, height=height, algorithm=None) visited = [[False for _ in range(maze.width)] for _ in range(maze.height)] visited[0][0] = True def loop_erased_random_walk(x, y): """ Take a random walk from unit (sx,sy) until we ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(width=20, height=20):\n m = Maze(width, height)\n m.randomize()\n return m", "def generate_maze(self):\r\n # reset the grid before generation\r\n self.initialize_grid()\r\n\r\n # choose the first cell to put in the visited list\r\n # see Step 1 of the...
[ "0.67708105", "0.6556104", "0.65384185", "0.65105295", "0.6488578", "0.6312048", "0.62315196", "0.6209019", "0.6135243", "0.610975", "0.6102821", "0.60939026", "0.60924953", "0.60906166", "0.60030806", "0.5971497", "0.5958963", "0.5933859", "0.5922739", "0.5917373", "0.589989...
0.7545776
0
Take a random walk from unit (sx,sy) until we run into a visited unit, and remove any cycles from the path if/when it intersects itself.
def loop_erased_random_walk(x, y): path = [] directions = [] while not visited[y][x]: direction = random.choice(maze.neighbors(x, y)) nx, ny = maze.neighbor(x, y, direction) while (nx, ny) in path: path.pop() directions.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wilsons_maze(width=16, height=16) -> Maze:\n maze = Maze(width=width, height=height, algorithm=None)\n visited = [[False for _ in range(maze.width)] for _ in range(maze.height)]\n\n visited[0][0] = True\n\n def loop_erased_random_walk(x, y):\n \"\"\"\n Take a random walk from unit (sx...
[ "0.5669445", "0.55742264", "0.5537145", "0.5513449", "0.5472112", "0.54696685", "0.5321966", "0.52884585", "0.5284085", "0.5250031", "0.52147436", "0.52095425", "0.52093375", "0.5178389", "0.51754934", "0.51659197", "0.51580596", "0.51013595", "0.5019818", "0.5010896", "0.500...
0.6616399
0
Execute a shell command and return the output
def run_command(cmd): proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for line in iter(proc.stdout.readline, b''): print(">>> " + line.rstrip()) (stdout, stderr) = proc.communicate() return proc.returncode == 0, proc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(command):\n process = subprocess.Popen(command, stdout=subprocess.PIPE)\n return process.communicate()", "def run_command(shell_command, get_output):\n command_ran = subprocess.run(shell_command, capture_output=get_output)\n return command_ran", "def run_shell_command(command, checkRetu...
[ "0.78432935", "0.777082", "0.7757788", "0.76499504", "0.7642089", "0.7640113", "0.759058", "0.75726837", "0.7536435", "0.75319535", "0.75302064", "0.7510379", "0.74822223", "0.7481951", "0.74764496", "0.74249136", "0.74094665", "0.73984706", "0.73686796", "0.7351682", "0.7350...
0.0
-1
Converts an incoming set of bytes into a list of ints. Assuming there are BYTES_IN_INT bytes in an int.
def convert_to_ints(command, start, end): return [raw_bytes_to_int(command[x:x + BYTES_IN_INT]) for x in range(start, end, BYTES_IN_INT)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_list(data: bytes) -> list:\n byte_data = BytesIO(data)\n byte_list = []\n single_byte = byte_data.read(1)\n while single_byte != b\"\" and single_byte != \"\":\n single_int = byte_to_int(single_byte)\n byte_list.append(single_int)\n single_byte = byte_data.read(1)\n retu...
[ "0.7701854", "0.7054435", "0.6819991", "0.68188035", "0.67059046", "0.6655502", "0.6606388", "0.6583832", "0.6568642", "0.63734365", "0.63378155", "0.63364464", "0.6326609", "0.6234568", "0.62214285", "0.6150276", "0.61171114", "0.6110648", "0.6104772", "0.6054408", "0.603953...
0.7051615
2
the function checks, if a permutation p, i.e. a list of colours like p = ['pink', 'yellow', 'green', 'red'] is consistent with the previous colours. Each previous colour permuation guess[0] compared (check()) with p has to return the same amount of blacks (rightly positioned colours) and whites (right colour at wrong p...
def inconsistent(p, guesses): for guess in guesses: res = check(guess[0], p) (rightly_positioned, permutated) = guess[1] if res != [rightly_positioned, permutated]: return True # inconsistent return False # i.e. consistent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_ok(a):\n (rightly_positioned, permutated) = a\n if (rightly_positioned + permutated > number_of_positions) \\\n or (rightly_positioned + permutated < len(colours) - number_of_positions):\n return False\n if rightly_positioned == 3 and permutated == 1:\n return False\n return True...
[ "0.66472465", "0.6064803", "0.6030187", "0.5988332", "0.5928046", "0.5810799", "0.5657002", "0.5475401", "0.5473486", "0.5438479", "0.54351574", "0.5423985", "0.54230165", "0.5383598", "0.5366832", "0.53050816", "0.52952015", "0.5255458", "0.523689", "0.5223979", "0.5222147",...
0.6597506
1
checking of an evaulation given by the human player makes sense. 3 blacks and 1 white make no sense, for example.
def answer_ok(a): (rightly_positioned, permutated) = a if (rightly_positioned + permutated > number_of_positions) \ or (rightly_positioned + permutated < len(colours) - number_of_positions): return False if rightly_positioned == 3 and permutated == 1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_positive_electrode_potential_profile(self):\n\n # TODO: add these when have averages", "def evaluate(self):\n # if player has no move, then player lost, -inf or inf depend on who the player is\n # if player has moves, use heuristics.\n \n #checkColorMoves = self.getAva...
[ "0.6412339", "0.62301224", "0.6056391", "0.6037623", "0.6021691", "0.6000902", "0.59953594", "0.5967505", "0.5945845", "0.5939907", "0.59303045", "0.59173363", "0.5885266", "0.5877942", "0.58603555", "0.58507276", "0.5814539", "0.5804638", "0.58037615", "0.5780013", "0.577634...
0.0
-1
get evaluation from entry fields
def get_evaluation(): rightly_positioned = int(entryWidget_both.get()) permutated = int(entryWidget_only_colours.get()) return (rightly_positioned, permutated)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EvaluateFields(self, *float, **kwargs):\n ...", "def evaluate(self, event):\n self.res.configure(text=\"Result: \" + str(eval(expression_converter(self.entry.get()))))", "def evaluate(self, edict):\n pass", "def eval(self):\n pass", "def eval(self):\n pass", "def eval(s...
[ "0.6557003", "0.64566493", "0.6319317", "0.6222832", "0.6222832", "0.6222832", "0.61477673", "0.61366874", "0.61366874", "0.60586905", "0.6046584", "0.6027692", "0.5973496", "0.5967216", "0.59462696", "0.5759784", "0.57059735", "0.57022566", "0.5701625", "0.56785053", "0.5667...
0.55926913
25
This funtion gets an evaluation of the current guess, checks the consistency of this evaluation, adds the guess together with the evaluation to the list of guesses, shows the previous guesses and creates a ne guess
def new_evaluation(current_colour_choices): rightly_positioned, permutated = get_evaluation() if rightly_positioned == number_of_positions: return(current_colour_choices, (rightly_positioned, permutated)) if not answer_ok((rightly_positioned, permutated)): print("Input Error: Sorry, the input mak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_guess(self, Guess):\n\n\t\t# pulls comparison from win check and assigns peg responses \n\n\t\t# returns a list to be in hint_response\n\n\t\t# displays as part of big display in view.\n\n\t\t\"\"\"Borrow the logic from win_check to implement eval_guess. Use variables right and wrong to \n\t\tevaluate. Ri...
[ "0.7248868", "0.6583188", "0.64794326", "0.64139926", "0.6123071", "0.60716164", "0.6006147", "0.5981178", "0.5953067", "0.59431326", "0.5941986", "0.59280753", "0.5866177", "0.58647215", "0.5862311", "0.5850885", "0.58037716", "0.57967645", "0.57883865", "0.5781944", "0.5733...
0.6815338
1
check() calcualtes the number of bulls (blacks) and cows (whites) of two permutations
def check(p1, p2): blacks = 0 whites = 0 for i in range(len(p1)): if p1[i] == p2[i]: blacks += 1 else: if p1[i] in p2: whites += 1 return [blacks, whites]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(m) :\n #find Connected-component\n lst = find_c(m)\n for e in lst :\n # verify len , 3 is the len of large boat\n if len(e) > 3 :\n return False\n if not is_vert(e) and not is_hori(e):\n return False\n return True", "def bullCowAlternative(self, a...
[ "0.6297616", "0.62693065", "0.6228522", "0.61913663", "0.61387134", "0.608651", "0.6015976", "0.5997838", "0.59834623", "0.5973542", "0.593556", "0.5932817", "0.5919126", "0.591494", "0.5913941", "0.5888193", "0.58555883", "0.5837521", "0.58008456", "0.5799292", "0.57991093",...
0.56941926
31
a new guess is created, which is consistent to the previous guesses
def create_new_guess(): next_choice = next(permutation_iterator) while inconsistent(next_choice, guesses): try: next_choice = next(permutation_iterator) except StopIteration: print("Error: Your answers were inconsistent!") return () return next_choice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_previous_guess(self):\n # relies on the results from check_guess_if_previous() | helper function to incorrect_guess()\n if self.check_guess_if_previous():\n self.past_guesses.append(self.guess) # adds guessed letter to past guesses\n return self.past_guesses\n el...
[ "0.65728897", "0.65353525", "0.6533791", "0.64651126", "0.64275324", "0.64073396", "0.63036734", "0.62810254", "0.62501335", "0.61864054", "0.6165953", "0.6160708", "0.61516625", "0.6126036", "0.60415703", "0.6016846", "0.60050976", "0.59884113", "0.5964809", "0.5883528", "0....
0.6331462
6
Animation function. Takes the current frame number (to select the potion of data to plot) and a line object to update.
def animate(frame, line): # Not strictly neccessary, just so we know we are stealing these from # the global scope global all_x_data, all_y_data # We want up-to and _including_ the frame'th element current_x_data = all_x_data[: frame + 1] current_y_data = all_y_data[: frame + 1] line.set_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def animate1Dframes(x, data):\n plt.ion() # Set the plot to animated. \n ax1 = plt.axes()\n line, = plt.plot(data[-1], x , '-*k')\n\n for u in data:\n line.set_xdata(u)\n plt.draw()\n #tm.sleep(0.25)", "def animate(i):\r\n plot_x.set_data(history_samples[i][:, 0], history_s...
[ "0.77292675", "0.72614247", "0.72505695", "0.6970664", "0.6846777", "0.6800257", "0.66679996", "0.66199565", "0.65524817", "0.6547357", "0.6531983", "0.6420023", "0.6392908", "0.6375818", "0.6330665", "0.6305474", "0.6286024", "0.6248007", "0.6227651", "0.6225863", "0.6205546...
0.76468295
1
Advanced Indexing for Sequences.
def advanced_indexing_op(input, index): batch_size = tf.shape(input)[0] max_length = int(input.get_shape()[1]) dim_size = int(input.get_shape()[2]) index = tf.range(0, batch_size) * max_length + (index - 1) flat = tf.reshape(input, [-1, dim_size]) relevant = tf.gather(flat, index) return rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_object(idxs=None):", "def indexByName(seq, name):\n return indexMatching(seq, lambda x: x.name == name)", "def index(args):\n\n logging.info('Starting indexing sequences in %s' % args.sequences)\n logging.error('TODO: Implement indexing!')", "def objects_to_index_matrix(\n self, obj...
[ "0.64566696", "0.6317357", "0.61205983", "0.60134023", "0.59388006", "0.58753604", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298", "0.5864298"...
0.0
-1
An op to compute the length of a sequence. 0 are masked.
def retrieve_seq_length_op(data): with tf.name_scope('GetLength'): used = tf.sign(tf.reduce_max(tf.abs(data), reduction_indices=2)) length = tf.reduce_sum(used, reduction_indices=1) length = tf.cast(length, tf.int32) return length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self) -> ir.IntegerValue:\n return ops.MapLength(self).to_expr()", "def length(sequence):\r\n populated = tf.sign(tf.abs(sequence))\r\n length = tf.cast(tf.reduce_sum(populated, axis=1), tf.int32)\r\n mask = tf.cast(tf.expand_dims(populated, -1), tf.float32)\r\n return length, mask"...
[ "0.71625274", "0.7082808", "0.70349264", "0.6893778", "0.6871125", "0.6785109", "0.67817247", "0.6643931", "0.66114056", "0.6494078", "0.6493203", "0.6493203", "0.64920545", "0.648977", "0.6474978", "0.6456874", "0.6448589", "0.64314854", "0.64184487", "0.64124024", "0.639237...
0.7716348
0
Simplify a term using the convergent rewrite rules known.
def simplify(cls, x: Term, bound: int = -1) -> Optional[Term]: if not isinstance(x, FuncTerm): raise ValueError("simplify function expects a FuncTerm.") return normal(x, cls.rules, bound)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify(term):\n simplified_term = term\n\n if isinstance(term,StatementTerm):\n simplified_term = StatementTerm(subject_term=simplify(term.get_subject_term()),\n predicate_term=simplify(term.get_predicate_term()),\n copula=term.get_copula()...
[ "0.72734314", "0.6471595", "0.6139479", "0.6090935", "0.6069272", "0.5980187", "0.58624965", "0.5855295", "0.5781", "0.56962633", "0.5640727", "0.561756", "0.55975735", "0.55692387", "0.55635285", "0.55527335", "0.54700464", "0.5453202", "0.54434156", "0.54423153", "0.5435548...
0.5815264
8
List the signature of the system.
def signature(cls) -> List[Term]: el = [] for term in cls.__dict__.values(): if not isinstance(term, (Constant, Function)): continue el.append(deepcopy(term)) return el
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ListSignatureIdentifiers(self):\n if not self._data_location:\n raise errors.BadConfigOption(u'Missing data location.')\n\n path = os.path.join(self._data_location, u'signatures.conf')\n if not os.path.exists(path):\n raise errors.BadConfigOption(\n u'No such format specification fi...
[ "0.7118678", "0.7095944", "0.7046575", "0.68933773", "0.6810617", "0.67768157", "0.6751133", "0.66624224", "0.66439015", "0.6224959", "0.61640984", "0.61640984", "0.61640984", "0.616311", "0.6114267", "0.61002797", "0.59774226", "0.59688073", "0.59640473", "0.5955598", "0.588...
0.54019827
49
Return the number of elements.
def __len__(cls) -> int: return len(filter(lambda x: isinstance(x, Constant)), cls.__dict__.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements_count(self):\n return self.__elements_count", "def getNumElements(self):\n return 0", "def getNumElements(self):\n return 1", "def count(self):\n return len(self._elements)", "def getNumElements(self):\n raise Exception(\"Didn't expect this to get called.\")"...
[ "0.8541591", "0.84852606", "0.83888865", "0.83879197", "0.83357567", "0.8297605", "0.82252634", "0.8192186", "0.81655276", "0.8150713", "0.8125031", "0.8102018", "0.8014803", "0.79979974", "0.776293", "0.7626823", "0.7580849", "0.7571407", "0.75608665", "0.75247896", "0.75177...
0.0
-1
Add a rule to the system.
def add_rule(cls, rule: RewriteRule) -> None: if not isinstance(rule, RewriteRule): raise ValueError(f"add_rule expected a RewriteRule not a '{type(rule)}'.") cls.rules.append(rule)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rule(self, rule):\n self.rule.append(rule)", "def add_rule(self, rule):\n \n self.rules.append(rule)", "def add_rule(self, rule) -> None:\n self.add_rules([rule])", "def add_rule(self, rule: Rule):\n self.rules.append(rule)", "def add_rule(self, rule):\n as...
[ "0.886977", "0.8846586", "0.87176096", "0.87110645", "0.86188036", "0.8133329", "0.80970997", "0.78499293", "0.7669347", "0.76533055", "0.7589117", "0.75833124", "0.7580608", "0.7580369", "0.735333", "0.73481494", "0.73328394", "0.7302598", "0.72996336", "0.7238394", "0.72311...
0.7704391
8
Define a function by a rewrite system.
def define(cls, function: Function, rules: RewriteSystem): setattr(cls, function.symbol, function) # TODO: Make sure RewriteSystem terminates # TODO: Does composition of terminating rewrite systems terminate? for rule in rules: cls.add_rule(rule) cls.definitions[funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_function(self, func):\n func.name = self.function_rewrites.get(func.name, func.name)\n return super(AccessCompiler, self).visit_function(func)", "def __def_function__():\n pass", "def wrapped(func):\n self.routes.append((path, {\n 'regex': re.compile('^' + r...
[ "0.70453715", "0.62984306", "0.61714536", "0.585374", "0.57631445", "0.5763008", "0.5754764", "0.5739049", "0.572244", "0.571211", "0.5690703", "0.5689855", "0.56534237", "0.5652263", "0.56320566", "0.56306136", "0.5609298", "0.55959314", "0.5584421", "0.55726177", "0.5551964...
0.6912517
1
Decorator that takes a TheorySystem and adds sorts to Constants and Functions defined.
def Inductive(cls=None): if cls is not None and not issubclass(cls, TheorySystem): raise ValueError( "Inductive decorator only works \ on classes that inherit TheorySystem." ) @functools.wraps(cls) def wrap(cls): cls.sort = Sort(cls.__name__) cls.rul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortby(self):\n ...", "def orderby():\n pass", "def _sort_definitions(orig_defs: List[Definition]) -> List[Definition]:\n definitions: List[Definition] = [definition for definition in orig_defs\n if isinstance(definition, Parameter)]\n definitions.extend(...
[ "0.5738267", "0.5639993", "0.5537029", "0.54026973", "0.5303816", "0.52853185", "0.5183392", "0.51713866", "0.5165641", "0.5165641", "0.5158325", "0.5089632", "0.5045029", "0.5007571", "0.49622414", "0.4937734", "0.49376684", "0.49207813", "0.49004227", "0.48765743", "0.48592...
0.5885771
0
Obtain a TheorySystem from a sort.
def system_from_sort(s: Sort) -> Optional[TheorySystem]: return _system_sort_map.get(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sort_query(self, kind, order, is_number):\n pass", "def test_parse_sort(self):\n old_type = Sort('sort', [\n Relationship('student', PersonSchema(), None),\n Relationship('school', StudentSchema(), None)],\n Attribute('title', SchoolSchema(), None), '+')\n ...
[ "0.48315117", "0.48127127", "0.4773293", "0.46906564", "0.46676126", "0.4642743", "0.4556032", "0.4537334", "0.45276597", "0.45251364", "0.4523657", "0.45113435", "0.45026153", "0.4460235", "0.44248357", "0.44154066", "0.43651977", "0.43445125", "0.4328574", "0.4328547", "0.4...
0.72192395
0
returns boolean for observations with feature data
def obs_with_data(x): num_toks = np.sum(x,axis=1) has_data = num_toks > 0 return has_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, feature):\n return feature in self.features", "def check_featuring(self):\n existing_featuring = pd.read_csv(self.path_checkpoint)\n array_to_check = [float(self.radious), self.type_feature, self.type_filtering, self.h_filterig]\n bool_answer = (existing_featuri...
[ "0.72230685", "0.688153", "0.67309886", "0.665077", "0.66334534", "0.6592376", "0.64213926", "0.63026077", "0.62014043", "0.6140752", "0.6113812", "0.6066943", "0.6057996", "0.6048582", "0.6027378", "0.5988774", "0.5965094", "0.5959162", "0.5953881", "0.5937341", "0.59346825"...
0.6457501
6
gives a formatted timestamp, useful for longer analyses
def timestamp(): return datetime.now().strftime('%H:%M:%S %m-%d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))", "def _timestamp():\n moment = time.time()\n moment_us = repr(moment).split(\".\")[1]\n return time.strftime(\"%Y-%m-%d-%H-%M-%S-{}\".format(moment_us), time.gmtime(moment))", "def timestamp():\n return d...
[ "0.8038685", "0.80155486", "0.79429066", "0.7932328", "0.7925151", "0.78806007", "0.7856388", "0.78220636", "0.78073436", "0.7796272", "0.7789196", "0.77795273", "0.77354836", "0.7732207", "0.7729519", "0.76911116", "0.7683758", "0.76836175", "0.76213574", "0.7598116", "0.754...
0.7882292
5
Iteratively loads csv file to a numpy array. This is needed for larger datafiles.
def load_csv(fn): def iter_func(): with open(fn, 'r') as infile: for line in infile: line = line.rstrip().split(',') for item in line: yield float(item) load_csv.rowlength = len(line) data = np.fromiter(iter_func(), dtype=float) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(csv_filename):\n data = np.genfromtxt(csv_filename, delimiter=\";\", skip_header=1, usecols=range(11))\n return data", "def csvread(file):\r\n thisfile = open(file)\r\n thisreader = csv.reader(thisfile)\r\n filelist = np.array(list(thisreader))\r\n return filelist", "def csvRead...
[ "0.7361541", "0.73365295", "0.7148837", "0.71070653", "0.7028156", "0.6969728", "0.69023275", "0.684551", "0.6845063", "0.68199563", "0.6818269", "0.67796904", "0.67439044", "0.67175865", "0.6709933", "0.6691081", "0.6661623", "0.66350704", "0.66302836", "0.6610326", "0.65636...
0.73180866
2
Use Lanczos Algorthmn to generate eigenvector associated with the highest eigenvalue
def get_max_eigenpair(self, images, labels, max_iter = int(1e4)): # Evaluation Tools criterion = torch.nn.CrossEntropyLoss() indv_criterion = torch.nn.CrossEntropyLoss(reduction = 'none') soft_max = torch.nn.Softmax(dim = 1) # Declare Similarity Metric mse_sim = torch.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(mat, otp):\n prd = mat*otp\n eigval = prd[0]/otp[0]\n print 'computed eigenvalue :' , eigval\n [eigs, vecs] = np.linalg.eig(mat)\n abseigs = list(abs(eigs))\n ind = abseigs.index(max(abseigs))\n print ' largest eigenvalue :', eigs[ind]", "def eigCent(A):\n lam,V = np.linalg.eig(...
[ "0.6958779", "0.6893795", "0.6860697", "0.6718844", "0.66598517", "0.6546638", "0.65372884", "0.6504995", "0.6452308", "0.64376295", "0.63886344", "0.6382738", "0.6339041", "0.63187814", "0.63100576", "0.62977475", "0.6296093", "0.6256996", "0.6234607", "0.620414", "0.6177291...
0.59286463
42
Determine the accuracy of the network after it is attacked by OSSA
def get_OSSA_attack_accuracy(self, inputs, labels, epsilons = [1], transfer_network = None, return_attacks_only = False): # Test images in test loader attack_accuracies = np.zeros(len(eps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(self):", "def get_accuracy(self) -> float:\n self.network.load_data()\n self.network.train()\n\n n = len(self.network.y_test)\n correct = 0\n for i in range(n):\n # Predict by running forward pass through the neural network\n pred = self.netwo...
[ "0.75176555", "0.73008245", "0.70634544", "0.68887526", "0.6849899", "0.684478", "0.6833848", "0.6824195", "0.67518044", "0.67070526", "0.66893107", "0.6686855", "0.6637969", "0.66281044", "0.6590452", "0.6583261", "0.6547129", "0.6523093", "0.6504942", "0.64617795", "0.64489...
0.6451236
20
Calculate the gradients of an image
def get_gradients(self, images, labels): # Push to gpu images = Variable(images, requires_grad = True) if self.gpu == False else Variable(images.cuda(), requires_grad = True) labels = labels if self.gpu == False else labels.cuda() # Make images require gradients images.requires_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(img):\n nx, ny = np.gradient(unshape(img))\n return reshape(nx), reshape(ny)", "def calculate_gradients(img, height, width):\r\n X = np.sum((img[1:height, 0:width]-img[0:height-1, 0:width])**2, axis=2)\r\n Y = np.sum((img[0:height, 1:width]-img[0:height, 0:width-1])**2, axis=2)\r\n XY...
[ "0.8109446", "0.8042782", "0.748469", "0.7435649", "0.73165005", "0.72472817", "0.7187212", "0.71663785", "0.707765", "0.7062803", "0.7013484", "0.69568413", "0.6945811", "0.6935763", "0.6930312", "0.6823912", "0.68180174", "0.6799227", "0.67419916", "0.6722943", "0.6716792",...
0.64911956
29
Generate attacks with FGSM
def get_FGSM_attack_accuracy(self, epsilons = [1], transfer_network = None, return_attacks_only = False, attack_images = None, attack_labels = None): # Pus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiattack(self, sentence, attacks_with_severity):\n for i,(attack, severity) in enumerate(attacks_with_severity):\n if attack==\"rand\":\n attack = random.choice(self.methods)\n while attack==\"intrude\" and i!=len(attacks_with_severity)-1:\n ...
[ "0.5527392", "0.54200405", "0.541527", "0.534583", "0.5293449", "0.5216743", "0.5211149", "0.5173683", "0.5139502", "0.51250684", "0.511482", "0.5100324", "0.50834215", "0.5068059", "0.5049849", "0.50107443", "0.50102943", "0.50101006", "0.49969074", "0.49936926", "0.499319",...
0.0
-1
Calculate the fooling ratio of attacks
def get_fool_ratio(self, test_acc, attack_accs): return [round(100*((test_acc - attack_acc) / test_acc), 2) for attack_acc in attack_accs]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_damage(self) -> float:\n sum = 0\n for operator in self.__operators:\n if operator.is_alive:\n operator.experience += 1\n sum += operator.experience / 100\n return 0.1 + sum", "def golden_ratio():\n return 1.61803398875", "def set_defensiv...
[ "0.6468844", "0.6419701", "0.64027065", "0.6392309", "0.6361716", "0.6286705", "0.62861675", "0.62798226", "0.62680507", "0.62259054", "0.62143505", "0.6197033", "0.61885077", "0.61466205", "0.61228234", "0.611322", "0.61100066", "0.61087966", "0.6108751", "0.60977983", "0.60...
0.65534633
0
Prints table with data.
def print_table(table, title_list): # your goes code cols = len(title_list) table.insert(0,title_list) for sublist in range(len(table)): if cols != len(table[sublist]): print('dataset does not match number of cols') quit() max_lenghts = [] maxi = -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_table(self):\n print(\"%-12s%-12s%-12s%-12s%-12s\" % (\"index\",\"balance\",\"payment\",\"interest\",\"amortization\"))\n print(\"-------------------------------------------------------------\")\n for i in self.table[\"index\"]:\n print(\"%-12i%-12i%-12i%-12i%-12i\" % (sel...
[ "0.79354167", "0.78433746", "0.7669655", "0.76323706", "0.75875294", "0.75875294", "0.75735617", "0.7517537", "0.74056464", "0.73554194", "0.7263573", "0.716292", "0.7143901", "0.71304375", "0.71241987", "0.7123968", "0.708182", "0.708182", "0.70593745", "0.7057104", "0.70499...
0.0
-1
Displays results of the special functions.
def print_result(result, label): # your code if label != '': print(label) if result is None: print('None') elif type(result) == list: if type(result[FIRST_ELEM]) == list: for elem in range(len(result)): common.print_list_in_list(result[elem]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_results():\n pass", "def print_results(self):\n pass", "def _display_results(self):\n self._display_summary()\n self._display_domain_record()\n self._display_ip_record()\n self._display_cert_details()\n self._display_ti_data()\n self._display_scre...
[ "0.82839465", "0.72250754", "0.71960866", "0.6903502", "0.66711", "0.66711", "0.66262454", "0.6599327", "0.6559055", "0.65502775", "0.6519642", "0.6499578", "0.64939415", "0.6485232", "0.64556634", "0.64556634", "0.64556634", "0.64556634", "0.64315575", "0.6410784", "0.640172...
0.0
-1
Gets list of inputs from the user.
def get_inputs(list_labels, title): inputs = [] # your code months = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31} if len(title) > 0: print(title) for elem in list_labels: if elem in CHECK_NUMS: possible_int = input('{} '.format(elem)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inputs(title, list_labels):\n print(f\"{title}\")\n # list which holds the input answers from user\n user_inputs = []\n for item in list_labels:\n user_inputs.append(input(f\"{item}: \"))\n return user_inputs", "def get_user_inputs():\n print('Enter the path to the loan applicati...
[ "0.7965897", "0.7343768", "0.72597", "0.7224725", "0.71539277", "0.7111505", "0.71001077", "0.70580584", "0.70286834", "0.6996967", "0.6819265", "0.6777629", "0.6748795", "0.67256755", "0.6707518", "0.6675262", "0.6654772", "0.6628879", "0.6595166", "0.65912956", "0.65732163"...
0.58878934
95
Dispatches a hook dictionary on a given piece of data.
def dispatch_hook(key, hooks, hook_data): hooks = hooks or dict() if key in hooks: try: return hooks.get(key).__call__(hook_data) or hook_data except Exception: traceback.print_exc() return hook_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_hook(key, hooks, hook_data=None, **kwargs):\n # like requests.hooks.dispatch_hook\n hooks = hooks or dict()\n hooks = hooks.get(key)\n if hooks:\n if hasattr(hooks, '__call__'):\n hooks = [hooks]\n for hook in hooks:\n _hook_data = hook(hook_data, **kwar...
[ "0.74481755", "0.6829305", "0.61280715", "0.61210513", "0.59819674", "0.59323394", "0.57483125", "0.5704683", "0.5689838", "0.5676677", "0.55818295", "0.5570244", "0.55370414", "0.5528388", "0.54710704", "0.54467523", "0.5406375", "0.5363602", "0.53232306", "0.5319977", "0.52...
0.7467904
0
Gets biospecimen data for PPMI subjects
def get_data(fpath): visits = ['SC', 'BL', 'V01', 'V02', 'V03', 'V04', 'V05', 'V06', 'V07', 'V08', 'V09', 'V10', 'V11', 'V12', 'V13', 'V14', 'V15'] dtype = dict(PATNO=str, CLINICAL_EVENT=cdtype(visits, ordered=True), TESTNAME=str, TESTVALUE=str) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _spm_auditory_subject_data():\n subject_data = fetch_spm_auditory()\n subject_data['func'] = None\n base_dir = os.path.dirname(subject_data['anat'])\n subject_data.output_dir = os.path.join(base_dir, OUTPUT_DIR)\n return SubjectData(**subject_data)", "def get_subject_data(self, subj, action):\...
[ "0.61578834", "0.60951537", "0.6037695", "0.5906589", "0.5861933", "0.58611345", "0.57219815", "0.56807053", "0.56540686", "0.5616336", "0.55671686", "0.5508162", "0.5457546", "0.54227096", "0.5403324", "0.5391528", "0.5345498", "0.53403705", "0.53396285", "0.5275341", "0.527...
0.0
-1
Get the model name.
def model_name(self) -> str: return "mock-model-name"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_name(self) -> str:\n return self._model_name", "def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)", "def get_model_name(self) -> str:\n raise NotImplementedError", "def model_name(self):\n setting = self.get_setting_definition...
[ "0.88881665", "0.883052", "0.87915975", "0.84520155", "0.8416848", "0.8376444", "0.83522457", "0.8329777", "0.82505643", "0.8224384", "0.81623787", "0.80150056", "0.7973438", "0.78287315", "0.77966535", "0.77646977", "0.7711224", "0.76936203", "0.76847035", "0.76512337", "0.7...
0.7388494
26
Get the device type.
def device_type(self) -> str: return "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_type(self):\n return self._meta['device_type']", "def device_type(self):\n return self._device_type", "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type(self):\n return Context.devtype2str[self.device_typeid]", "def device_type...
[ "0.873117", "0.87166053", "0.86315507", "0.86315507", "0.8574871", "0.8475947", "0.8429184", "0.82709247", "0.82565933", "0.82565933", "0.82565933", "0.82303095", "0.8115598", "0.8061328", "0.8059209", "0.80492264", "0.7943201", "0.79121757", "0.78333235", "0.7829751", "0.782...
0.72745216
44
Add a port mapping.
async def _async_add_port_mapping( self, external_port: int, local_ip: str, internal_port: int ) -> None: entry = [external_port, local_ip, internal_port] self.added_port_mappings.append(entry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port_mapping(self, port_mapping):\n\n self._port_mapping = port_mapping", "def add_port_gnmap(self, port_string):\n parts = port_string.split('/')\n port = parts[0]\n port_status = parts[1]\n protocol = parts[2]\n name = parts[4]\n service = parts[6]\n ...
[ "0.7490857", "0.7266673", "0.7083891", "0.7012829", "0.69441885", "0.6719463", "0.65730137", "0.6556639", "0.6530411", "0.6514047", "0.6406017", "0.6303215", "0.62523997", "0.61982155", "0.6185722", "0.61799246", "0.61799246", "0.6176545", "0.6130247", "0.60711175", "0.603177...
0.77418405
0
Remove a port mapping.
async def _async_delete_port_mapping(self, external_port: int) -> None: entry = external_port self.removed_port_mappings.append(entry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_port(self, port):\n if port not in self.ports:\n return False\n del self.ports[port]\n return True", "def port_delete(switch, port):\n client.port.delete(switch, port)", "def delete_port(self, port):\r\n return self.delete(self.port_path % (port))", "def r...
[ "0.7012401", "0.68919563", "0.6826929", "0.68267936", "0.66106075", "0.6606275", "0.65267193", "0.64824533", "0.6224275", "0.6186114", "0.61091745", "0.60663605", "0.6027865", "0.602024", "0.5986824", "0.59401715", "0.59329814", "0.58928317", "0.58843046", "0.5880846", "0.586...
0.80357164
0
possible currency values = EUR, USD, GBP
def change_currency(self, currency): self.browser.find_element(*self.CURRENCY_PICKER).click() self.browser.find_element(By.CSS_SELECTOR, self.CURRENCY_CHOICE + f"[name='{currency}']").click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def currency(self, currency):\n allowed_values = [\"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\...
[ "0.75896716", "0.7546367", "0.7351109", "0.72703207", "0.721749", "0.7210779", "0.7138813", "0.70198745", "0.6779263", "0.67230505", "0.6667662", "0.66584957", "0.66478217", "0.6645746", "0.64829624", "0.64789456", "0.64008117", "0.6363952", "0.6360627", "0.63582736", "0.6256...
0.0
-1
changes currency to the user choice and checks if currency symbols changed
def currency_symbol_should_change_with_currency(self, currency, symbol): self.change_currency(currency) assert self.wait_for_element(*self.CURRENCY_SYMBOL).text == symbol, "Currency symbol haven't changed"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_currency(self, currency):\n self.browser.find_element(*self.CURRENCY_PICKER).click()\n self.browser.find_element(By.CSS_SELECTOR, self.CURRENCY_CHOICE + f\"[name='{currency}']\").click()", "def updateCurrency(self, currency: str, value: str) -> None:\n\n if currency == \"USDT\":\n...
[ "0.7762783", "0.68542826", "0.6782774", "0.67133313", "0.66576195", "0.65601677", "0.65410864", "0.65389025", "0.6477757", "0.6396191", "0.6315273", "0.63026214", "0.624808", "0.62271553", "0.61471874", "0.61383265", "0.6062019", "0.60420394", "0.60325086", "0.60032094", "0.6...
0.68829626
1
Make sure we can provide a valid cmiles for a molecule with an atom_map and ensure the map is not removed.
def test_attributes_from_openff_with_map(): mol = Molecule.from_smiles("CC") atom_map = {0: 0, 1: 1, 2: 2, 3: 3} mol.properties["atom_map"] = atom_map cmiles = MoleculeAttributes.from_openff_molecule(molecule=mol) assert "atom_map" in mol.properties _ = cmiles.to_openff_molecule()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_from_mapped_smiles(self):\n\n # there should be no undefined sterochmeistry error when making the molecule\n mol = Molecule.from_mapped_smiles(\n \"[H:14][c:1]1[c:3]([c:7]([c:11]([c:8]([c:4]1[H:17])[H:21])[C:13]([H:24])\"\n \"([H:25])[c:12]2[c:9]([c:5]([c:2]([c:6]([c:10...
[ "0.6560622", "0.65044427", "0.58718204", "0.5691088", "0.56504214", "0.5645589", "0.5581442", "0.55715156", "0.5549983", "0.5480091", "0.54751635", "0.5405781", "0.5360335", "0.53282654", "0.5272228", "0.52662605", "0.52388394", "0.5236123", "0.52229375", "0.5217082", "0.5204...
0.5145051
24
Make sure the unique inchi keys are updated correctly.
def test_attributes_from_openff_multi_component(): mol = Molecule.from_smiles( "CC1=C(C=C(C=C1)NC(=O)C2=CC=C(C=C2)CN3CCN(CC3)C)NC4=NC=CC(=N4)C5=CN=CC=C5.CS(=O)(=O)O" ) attributes = MoleculeAttributes.from_openff_molecule(mol) assert len(attributes.unique_fixed_hydrogen_inchi_keys) == 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_consistent(self):\r\n\r\n for key in self.get_keys():\r\n self.eliminate_key(key)\r\n\r\n for i_temp in self.indexes(): #i will be a note index\r\n for j_temp in self.get_keys_from_note(i_temp):\r\n if self.key_dict_contains(j_temp):\r\n ...
[ "0.67608744", "0.6456984", "0.6159649", "0.6095656", "0.5903145", "0.57885367", "0.5783531", "0.5725799", "0.5720788", "0.5710586", "0.5710586", "0.56716746", "0.56621134", "0.5630219", "0.5574399", "0.5559914", "0.55169225", "0.54881155", "0.54778874", "0.5466725", "0.546591...
0.0
-1
Round trip a molecule to and from its attributes.
def test_attributes_to_openff_molecule(): mol: Molecule = Molecule.from_smiles("CC") attributes = MoleculeAttributes.from_openff_molecule(molecule=mol) mol2 = attributes.to_openff_molecule() isomorphic, atom_map = Molecule.are_isomorphic(mol, mol2, return_atom_map=True) assert isomorphic is True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_from_topology(self, molecule):\n topology = molecule.to_topology()\n molecule_copy = Molecule.from_topology(topology)\n assert molecule == molecule_copy", "def test_to_from_topology(self, molecule):\n topology = molecule.to_topology()\n molecule_copy = Molecule.from...
[ "0.49963441", "0.49963441", "0.4897128", "0.48742855", "0.4872785", "0.4872785", "0.4825054", "0.48211458", "0.48048207", "0.47521615", "0.47101173", "0.46881822", "0.46784806", "0.46585247", "0.4654701", "0.46520424", "0.4611299", "0.4603264", "0.45798853", "0.45765886", "0....
0.5613074
0
Make sure unsupported scf properties are not allowed into a QCSpec.
def test_scf_prop_validation(): with pytest.raises(QCSpecificationError): QCSpec(scf_properties=["ddec_charges"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_001_validate_with_bad_properties(self):\n m = schematics_flexible.BaseFlexible(\n {'code': '06',\n 'properties': {\"a\": \"this is test\"}},\n store_handler=get_mock())\n try:\n m.validate()\n except schematicsValidationError:\n ...
[ "0.59834945", "0.59595454", "0.5902257", "0.5851644", "0.56773376", "0.5638241", "0.5558134", "0.5544284", "0.55137223", "0.5493592", "0.5489752", "0.5465729", "0.54608876", "0.54575515", "0.54447865", "0.54230374", "0.541588", "0.5413103", "0.5401667", "0.5390509", "0.536294...
0.6854959
0
Find the nearest positivedefinite matrix to input A Python/Numpy port of John D'Errico's `nearestSPD` MATLAB code [1], which credits [2].
def nearestPD(A): B = (A + A.T) / 2 _, s, V = np.linalg.svd(B) H = np.dot(V.T, np.dot(np.diag(s), V)) A2 = (B + H) / 2 A3 = (A2 + A2.T) / 2 if isPD(A3): return A3 spacing = np.spacing(np.linalg.norm(A)) # The above is different from [1]. It appears that MATLAB's `chol` Chol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_nearest(a, a0):\n idx = np.abs(a - a0).argmin()\n return a.flat[idx]", "def nearest_neighbour(matrix, start=0):\n path = [start]\n while len(matrix) != len(path):\n matrix[:, start] = numpy.inf\n start = numpy.argmin(matrix[start])\n path.append(start)\n return path",...
[ "0.64279723", "0.6390816", "0.63794404", "0.6369756", "0.62929606", "0.6278435", "0.61763453", "0.6163529", "0.6116127", "0.60932505", "0.59658027", "0.59433377", "0.591896", "0.59085405", "0.5890697", "0.5849047", "0.5847796", "0.584322", "0.5802292", "0.5802292", "0.5800049...
0.66940665
0
Returns true when input is positivedefinite, via Cholesky
def isPD(B): try: _ = np.linalg.cholesky(B) return True except np.linalg.LinAlgError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cholesky(input):\n is_input_dparray = isinstance(input, dparray)\n\n if not use_origin_backend(input) and is_input_dparray and input.ndim == 2 and \\\n input.shape[0] == input.shape[1] and input.shape[0] > 0:\n result = dpnp_cholesky(input)\n\n return result\n\n return call_or...
[ "0.73108524", "0.6807363", "0.6455392", "0.64142925", "0.63329035", "0.6126949", "0.6060659", "0.6055392", "0.60113", "0.5990908", "0.59505236", "0.59163946", "0.58567715", "0.57977915", "0.5740988", "0.57332236", "0.56930864", "0.5677257", "0.56721145", "0.5648033", "0.56475...
0.6100079
6
Calculates the clusters based on the averagelinkage hierarchical clustering. The calculation happens only if something has been changed from the previous calculation.
def calculate_clusters(study_id): with current_app.app_context(): cur = conn.cursor() cur.execute("""SELECT * FROM STATS WHERE STUDY_ID=%s""", (str(study_id),)) study = fetchoneClean(cur) clusters_calculating = study[4] clusters_changed = study[5] if clusters_changed: if cluste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hierarchical_clustering(self):\n eps = 0.01\n logger.info(\"computing hierarchical clustering with distance \" +\n \"%s and method %s\" % (self.distance, self.method))\n lnk = self.compute_linkage()\n thresholds = self.choose_thresholds(lnk)\n\n # TODO: Try...
[ "0.76628166", "0.7195229", "0.7086005", "0.70631444", "0.66210294", "0.66190356", "0.66052926", "0.65885484", "0.6573702", "0.6549832", "0.6544667", "0.64811957", "0.6447256", "0.6445526", "0.64220095", "0.63908845", "0.6356587", "0.6353318", "0.63011247", "0.62897223", "0.62...
0.66054946
6
Takes a diagonal matrix converts it to it's full form
def calculate_square_form(diagonal_matrix, total_sorts): n = len(diagonal_matrix) matrix = np.ndarray(shape=(n,n)) for i in range(n): for j in range(len(diagonal_matrix[i])): # Also calculate the dissimilarity matrix matrix[i][j] = 100 - 100 * diagonal_matrix[i][j] / total_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(matrix):\n if sp.sparse.issparse(matrix):\n diag = np.array(matrix.diagonal())\n else:\n diag = np.diagonal(matrix).copy()\n return diag", "def get_diagonal(matrix):\n\tdegree_vector = tf.reduce_sum(matrix, 1)\n\tdiagonal = tf.diag(degree_vector, name = 'diagonal')\n\treturn d...
[ "0.6925748", "0.67492604", "0.654779", "0.647712", "0.6455163", "0.6417544", "0.64102775", "0.6368405", "0.6294395", "0.6290919", "0.6213763", "0.61852396", "0.61554545", "0.61394686", "0.6138866", "0.607023", "0.60410553", "0.6021352", "0.6013913", "0.6009137", "0.60088104",...
0.553977
63
Create a nested dictionary from the ClusterNode's returned by SciPy
def add_node(node, parent, card_names): # First create the new node and append it to its parent's children new_node = dict(children=[], hierarchy=1, distance=node.dist) # Append the name only if the node is a leaf if node.id < len(card_names): new_node.update(name=card_names[node.id]) paren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_info(self) -> Dict[str, Any]:\n pass", "def get_cluster_entry(self):\n\n cert_data = self.cluster_description.get(\"certificateAuthority\", {}).get(\"data\", \"\")\n endpoint = self.cluster_description.get(\"endpoint\")\n arn = self.cluster_description.get(\"arn\")\n\n...
[ "0.70219177", "0.6576782", "0.6346641", "0.62429565", "0.6126421", "0.6092149", "0.6071028", "0.6069776", "0.60663944", "0.6057981", "0.604104", "0.6020272", "0.60144657", "0.5987959", "0.59831035", "0.5933868", "0.5931194", "0.5917806", "0.5873789", "0.58625007", "0.58289576...
0.0
-1
Renders the home page.
def home(): return render_template( 'index.html', title='Home Page', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.8061255
42
Renders the contact page.
def contact(): return render_template( 'contact.html', title='Contact', year=datetime.now().year, img_tichonet = '/static/pics/tichonet.png', message='Your contact page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact():\n return render_template('contact.html')", "def contact():\n\n\treturn render_template('contact.html', title='Contact',\n\t\t\t\t\t\t year=datetime.now().year,\n\t\t\t\t\t\t message='Your contact page.')", "def contact():\n return render_template(\n 'contact.html',\n nav=...
[ "0.8343477", "0.83071643", "0.8217564", "0.8212342", "0.8212342", "0.8208706", "0.8185291", "0.8185291", "0.8185291", "0.8185291", "0.8185291", "0.8185291", "0.8185291", "0.8185291", "0.81841487", "0.8170303", "0.7832755", "0.7826334", "0.78097415", "0.779785", "0.77798384", ...
0.806876
16
Renders the about page.
def about(): return render_template( 'about.html', title='About', year=datetime.now().year, message='Your application description page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85651284", "0.85034347", "0.844895", "0.84050864", "0.8394327", "0.82936406", "0.82678735", "0.82434386", "0.8239326", "0.8224289", "0.8208038", "0.820477", "0.81737614", "0.81729555", "0.8096616", "0.8050326", "0.8050326", "0.8050326", "0.8050326", "0.8050326", "0.8050326...
0.827099
17