query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns True if the given image or disk has a Windows license. | def HasWindowsLicense(resource, resource_parser):
for license_uri in resource.licenses:
license_ref = resource_parser.Parse(
license_uri, collection='compute.licenses')
if license_ref.project in constants.WINDOWS_IMAGE_PROJECTS:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isLicensed(self):\n try:\n if arcpy.CheckExtension(\"Spatial\") != \"Available\":\n raise Exception\n except Exception:\n return False # tool cannot be executed \n return True",
"def isLicensed(self):\n try:\n if arcpy.CheckE... | [
"0.6812045",
"0.6812045",
"0.6812045",
"0.6812045",
"0.6812045",
"0.6812045",
"0.6812045",
"0.6812045",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6788769",
"0.6634563",
"0.6634563",
"0.65396327",
"0.6213425",
... | 0.80964303 | 0 |
Removes some environment variables that may have been set by some tests working with dummy.env file. | def clean_env():
for key in ['FOO', 'THOR', 'IRON', 'NAME', 'PERSONAL_DIR']:
os.environ.pop(key, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_envvar():\n client = TestClient()\n client.run('config set env.MY_VAR=MY_VALUE')\n conf_file = load(client.cache.conan_conf_path)\n assert 'MY_VAR = MY_VALUE' in conf_file\n client.run('config rm env.MY_VAR')\n conf_file = load(client.cache.conan_conf_path)\n assert 'MY_VAR' no... | [
"0.7516241",
"0.74711895",
"0.7470057",
"0.73549575",
"0.7346493",
"0.7085409",
"0.69522",
"0.68867636",
"0.68684715",
"0.67897797",
"0.6758799",
"0.6749574",
"0.67310214",
"0.6709094",
"0.6656914",
"0.6639338",
"0.66048056",
"0.65810215",
"0.6567067",
"0.65668",
"0.6565293",... | 0.84053886 | 0 |
Gets the user_id of this UserPrivacyPolicy. The unique operando id of the user this policy is about. Each OPERANDO user has one and only one UPP. | def user_id(self):
return self._user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_id(self):\n return self.id_user",
"def user_id(self):\n return self.status.user[\"id\"]",
"def user_id(self) -> str:\n return self._user_id",
"def user_id(self) -> str:\n return self._user_id",
"def user_id(self) -> pulumi.Output[Optional[int]]:\n return pulu... | [
"0.74874014",
"0.7011583",
"0.6981925",
"0.6981925",
"0.6968895",
"0.69461477",
"0.6782773",
"0.67788815",
"0.6732571",
"0.6691692",
"0.6691692",
"0.66914207",
"0.6686023",
"0.66707844",
"0.6567365",
"0.6551061",
"0.6384881",
"0.6384881",
"0.6384881",
"0.6372794",
"0.63414097... | 0.730377 | 2 |
Sets the user_id of this UserPrivacyPolicy. The unique operando id of the user this policy is about. Each OPERANDO user has one and only one UPP. | def user_id(self, user_id):
self._user_id = user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id(self, user_id):\n if user_id is None:\n raise ValueError(\"Invalid value for `user_id`, must not be `None`\") # noqa: E501\n\n self._user_id = user_id",
"def user_id(self, user_id):\n if user_id is None:\n raise ValueError(\"Invalid value for `user_id`, mus... | [
"0.75240916",
"0.75240916",
"0.7453542",
"0.74234027",
"0.7297017",
"0.70381796",
"0.64454323",
"0.63446003",
"0.6242966",
"0.624032",
"0.6145095",
"0.61222726",
"0.61222726",
"0.60300714",
"0.60129154",
"0.6002719",
"0.5996533",
"0.5996533",
"0.5996533",
"0.5996533",
"0.5996... | 0.7403672 | 8 |
Sets the subscribed_osp_settings of this UserPrivacyPolicy. The user settings for each of their services | def subscribed_osp_settings(self, subscribed_osp_settings):
self._subscribed_osp_settings = subscribed_osp_settings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed_osp_policies(self, subscribed_osp_policies):\n\n self._subscribed_osp_policies = subscribed_osp_policies",
"def subscribed_osp_settings(self):\n return self._subscribed_osp_settings",
"def user_settings(self, user_settings):\n\n self._user_settings = user_settings",
"def s... | [
"0.7176021",
"0.67845",
"0.57487446",
"0.5607944",
"0.5326334",
"0.48205468",
"0.48046985",
"0.47708622",
"0.47686264",
"0.47648266",
"0.47522086",
"0.46644986",
"0.466369",
"0.4661086",
"0.46341112",
"0.4630436",
"0.46136698",
"0.45617533",
"0.45441678",
"0.44992924",
"0.449... | 0.84474635 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 26 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Generate output tensors from latent vectors. + denormalize and reshape to image. | def generate(self, z):
x = super().generate(z)
return tf.clip_by_value(x, -1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_latent_images(model, n, digit_size=28, latent_dim=2):\n\n norm = tfp.distributions.Normal(0, 1)\n# grid_x = norm.quantile(np.linspace(0.05, 0.95, n))\n grid_x = norm.sample(n)\n grid_x = tf.reshape(grid_x, [grid_x.shape[0], 1])\n grid_x = tf.broadcast_to(grid_x, [grid_x.shape[0], \n tf.dt... | [
"0.59722716",
"0.5829268",
"0.57491696",
"0.5671274",
"0.56400526",
"0.5568986",
"0.551922",
"0.5515251",
"0.5504995",
"0.5488593",
"0.5455062",
"0.5421683",
"0.5413294",
"0.5400099",
"0.53871864",
"0.5372106",
"0.53533477",
"0.53433055",
"0.53339124",
"0.52780825",
"0.527223... | 0.0 | -1 |
Find histogram (aka sum of pixel values) of binary image from bottom half of image | def hist(img):
bottom_half = img[img.shape[0]//2:,:] # 0:img.shape[0]//2 is the top half
histogram = bottom_half.sum(axis=0)
return histogram | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_histogram(self, image):\n hist = [0] * 256\n [h, w] = image.shape\n print(h,w)\n i = 0\n while i < 256:\n for row in range(h):\n for col in range(w):\n if image[row, col] == i:\n hist[i] += 1\n ... | [
"0.7683918",
"0.7596744",
"0.7529263",
"0.75286657",
"0.7266414",
"0.6962601",
"0.69547415",
"0.6934033",
"0.6903494",
"0.6886947",
"0.6799654",
"0.67286015",
"0.6701031",
"0.6647667",
"0.6616632",
"0.65651983",
"0.6552715",
"0.6535426",
"0.6513144",
"0.6486218",
"0.6475662",... | 0.8278621 | 0 |
Calculates offset from center of image from positions of left and right lane lines | def measure_offset(left_fitx, right_fitx, midpoint=640):
return (midpoint-(right_fitx[-1]+left_fitx[-1])/2)*3.7/700 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_laneOffset(self):\n center_line = np.poly1d(np.mean([self.line_l.get_LinePoly().coeffs, self.line_r.get_LinePoly().coeffs], axis=0))\n # store the center line polynomial\n self.center_poly = center_line\n center_point = IMAGE_WIDTH/2 - center_line(709)\n offset_from_c... | [
"0.75871277",
"0.7075664",
"0.6850252",
"0.64962924",
"0.6325847",
"0.6321708",
"0.63156474",
"0.627973",
"0.6270199",
"0.62627685",
"0.6247269",
"0.6143758",
"0.610155",
"0.6099495",
"0.6073773",
"0.6060132",
"0.6040921",
"0.6022891",
"0.5999389",
"0.59937394",
"0.5986001",
... | 0.6186136 | 11 |
Returns the timestamp after this event. | def timeAfter(self):
return self.timeStamp + self.duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_event_time(self) -> str:\n return pulumi.get(self, \"last_event_time\")",
"def last_time(self) -> datetime:\n return self.activities[-1].timestamp",
"def lastEventTime(self):\n return self._lastEventTime",
"def last_timestamp(self):\n return self._last_timestamp",
"def ... | [
"0.7284306",
"0.70153904",
"0.6898311",
"0.65987784",
"0.6594205",
"0.65911716",
"0.6567492",
"0.6566142",
"0.6539415",
"0.6422397",
"0.63824993",
"0.63629216",
"0.6335207",
"0.6273555",
"0.6249977",
"0.6247712",
"0.6159156",
"0.6147131",
"0.6106904",
"0.60793495",
"0.6039334... | 0.7471332 | 0 |
Generate the relative path to the folder of the data files | def get_data_folder(self, mode='absolute'):
path = Path(f'sub-{self.sub_id}', f'ses-{self.ses_id}', self.modality)
if mode == 'absolute':
if self.basedir is None:
raise ValueError('No base directory set.')
path = self.basedir / path
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def data_dir():\n #data_path = os.path.dirname(intervene.__file__)\n #data_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'example_data')\n #print(data_pat... | [
"0.7991179",
"0.7860133",
"0.7724192",
"0.7549404",
"0.74804217",
"0.7479518",
"0.7409065",
"0.7384057",
"0.73806155",
"0.7355847",
"0.73273855",
"0.73098594",
"0.72629607",
"0.7245827",
"0.7227545",
"0.7219804",
"0.72025096",
"0.7201408",
"0.7200347",
"0.71962565",
"0.718351... | 0.0 | -1 |
Returns a JSON response to the client. | def respond(self,result):
callback = self.request.get('callback')
self.response.headers['Content-Type'] = 'application/json'
#self.response.headers['Content-Type'] = '%s; charset=%s' % (config.CONTENT_TYPE, config.CHARSET)
self.response.headers['Access-Control-Allow-Origin'] = '*'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_response(self, request, *args, **kwargs):\n\n return HttpResponse(self.construct_json(),\n content_type='application/json',\n mimetype='application/json', status=self.status)",
"def JSONResponse(payload):\n return HttpResponse(json.dumps(pa... | [
"0.74213153",
"0.7239869",
"0.7196132",
"0.71936554",
"0.7174075",
"0.71691984",
"0.71408135",
"0.71338433",
"0.71234107",
"0.7092062",
"0.7085877",
"0.70201045",
"0.7003619",
"0.69971204",
"0.69966644",
"0.698836",
"0.6968623",
"0.6957357",
"0.6920268",
"0.6920268",
"0.69195... | 0.65449774 | 49 |
Parse filename to get display | def getDisplay(self):
m = _Regexps.pidFile.match(os.path.basename(self.filename))
if m:
return m.group(1)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseFileName(filename):\n entry = DataEntry(\"\",0,{},{},0,0)\n wordArray = filename.split(\".\")\n entry.publication_name = wordArray[1]\n entry.year = wordArray[0]\n return entry",
"def get_label(filename:str) -> str:\n label = filename.split(\"/\")[-2]\n return label",
"def parse_f... | [
"0.65355515",
"0.6511513",
"0.6499432",
"0.64687425",
"0.6458109",
"0.6450578",
"0.64319724",
"0.6405297",
"0.63900006",
"0.63860756",
"0.6347543",
"0.6310917",
"0.63018453",
"0.62366563",
"0.6227497",
"0.62227196",
"0.6217268",
"0.617236",
"0.61484396",
"0.61459374",
"0.6143... | 0.57823974 | 71 |
Get the raw content of the multistore file. The multistore must be locked when this is called. | def _locked_json_read(self):
assert self._thread_lock.locked()
self._file.file_handle().seek(0)
return json.load(self._file.file_handle()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contents(self):\n with closing(self.open()) as handle:\n return handle.read()",
"def current_content(self):\n return self.host.open(self.remote_path, 'rb', use_sudo=self.use_sudo).read()",
"def read_content(self):\n return self.file.read()",
"def contents(self):\n ... | [
"0.68853045",
"0.6466672",
"0.6381288",
"0.63684165",
"0.63195676",
"0.6319419",
"0.62850505",
"0.61999816",
"0.6159397",
"0.6095078",
"0.6094636",
"0.6088044",
"0.6068557",
"0.60474557",
"0.60223436",
"0.6021917",
"0.6007878",
"0.59964836",
"0.5987752",
"0.59482956",
"0.5935... | 0.0 | -1 |
setName sets the name property of QViewer | def setName(self, name):
self.name = str(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setObjectName( self, name ):\n scene = self.scene()\n if ( scene ):\n name = scene.uniqueNodeName(name)\n self._objectName = name\n self._titleFont = None\n self.update()",
"def setName(self, name):\n self.name = name",
"def setName(self, name):\n ... | [
"0.7397718",
"0.71702164",
"0.71702164",
"0.71702164",
"0.71702164",
"0.7170036",
"0.71217513",
"0.71217513",
"0.7115815",
"0.70973563",
"0.70533395",
"0.7049261",
"0.70143396",
"0.70143396",
"0.70143396",
"0.70143396",
"0.70143396",
"0.69717354",
"0.6962505",
"0.69539356",
"... | 0.7003149 | 17 |
Add an arbitrary line to the scene. verts (list) A list of [x,y] pairs or a list of QPointF objects color (list) A 3 element list or tuple containing the RGB triplet specifying the color of the text. thickness (float) A float specifying the line thickness. Note that thickness is related to scale. The larger your scene ... | def addLine(self, verts, color=[220,0,0], thickness=1.0, alpha=255,
linestyle='=', selectable=True, movable=True, isCosmetic=False):
# addLine is just a simplified interface to addPolygon
return QViewerBase.addPolygon(self, verts, color=color, thickness=thickness, alpha=alpha,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, vertices, **kwargs):\n super(Line, self).__init__(vertices, **kwargs)\n self._geotype = \"Line\"\n return",
"def addPolygon(self, verts, color=[220,0,0], thickness=1.0, alpha=255,\n linestyle='=', fill=None, selectable=True, movable=False,\n selectThi... | [
"0.6559477",
"0.6467367",
"0.60930943",
"0.60471463",
"0.6045645",
"0.59958607",
"0.59866875",
"0.5977127",
"0.5813922",
"0.5807925",
"0.57683593",
"0.57467806",
"0.5716844",
"0.57078946",
"0.5694296",
"0.5694296",
"0.5686446",
"0.56738085",
"0.5666389",
"0.5646803",
"0.56209... | 0.8625835 | 0 |
Remove all items in the scene. | def removeAllItems(self):
if self.sceneItems:
# clear all the marks in the scene
self.scene.clear()
# add our background pixmap back to the scene
self.imgPixmapItem = self.scene.addPixmap(self.imgPixmap)
# clear the scene items list
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\n for pathItem in self.pathItem_list:\n self.scene.removeItem(pathItem)",
"def removeScene(self):\n del self.scene, self.imgPixmapItem",
"def deleteAllNeedlesFromScene(self):\n #productive #onButton\n profprint()\n while slicer.util.getNodes('python-catch-roun... | [
"0.7696933",
"0.76028687",
"0.74391615",
"0.738752",
"0.73732656",
"0.7209585",
"0.7179277",
"0.715927",
"0.7056335",
"0.7046395",
"0.6957749",
"0.69220996",
"0.68937904",
"0.688155",
"0.6863809",
"0.68326753",
"0.676891",
"0.6705885",
"0.6667579",
"0.6605474",
"0.65874285",
... | 0.834966 | 0 |
Centers the view on the provided mark. | def centerOnMark(self, mark):
# get the center of the mark
point = mark.mapToScene(mark.pos())
# and center the view on it
self.centerOnPoint(point) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMarkCenter(self, mark):\n\n return mark.mapToScene(mark.boundingRect().center())",
"def setCenter(self, value):\r\n self._viewCenter = b2.b2Vec2(*value)\r\n self._viewCenter *= self._viewZoom\r\n self._viewOffset = self._viewCenter - self.screenSize/2",
"def centerOn(self, po... | [
"0.71750766",
"0.67826235",
"0.6622132",
"0.6603214",
"0.64802176",
"0.6398629",
"0.63136923",
"0.6299449",
"0.6296784",
"0.62123936",
"0.62095195",
"0.61892307",
"0.61355144",
"0.61102027",
"0.6078111",
"0.6059613",
"0.60536647",
"0.60497016",
"0.6039633",
"0.6038022",
"0.60... | 0.87251776 | 0 |
Centers the view on the provided point. Point can be a list containing the [x,y] location or a Point2f object. | def centerOnPoint(self, point):
inClass = point.__class__.__name__.lower()
# check if we've been passed an OpenCV Point2f object
if inClass == 'point2f':
# convert the Point2f object to a simple list
point = QPointF(point.x, point.y)
# check if we've been pas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centerOn(self, point):\n rect = self.rect()\n x = point.x() - rect.width() / 2.0\n y = point.y() - rect.height() / 2.0\n \n self.setPos(x, y)",
"def recenter(self, point=(0, 0)):\n self.center = Point(*point)",
"def centre(self):\n n = len(self.point)\n ... | [
"0.7596532",
"0.7023588",
"0.6342297",
"0.63199675",
"0.6205452",
"0.61682177",
"0.6121445",
"0.60109407",
"0.5933314",
"0.5932",
"0.58980656",
"0.58571",
"0.58157516",
"0.5811948",
"0.57596827",
"0.5718011",
"0.5684492",
"0.5677989",
"0.5625354",
"0.5577901",
"0.55406547",
... | 0.8060218 | 0 |
Returns the relative, formatted path for a resource. | def _get_path(cls, **parameters):
if parameters:
if all([p is not None for p in parameters.values()]):
return cls._path.format(**parameters)
return cls._path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_path(self, resource):\n return str(self.path.joinpath(resource))",
"def resource_path(self, resource):\n return str(self.path.joinpath(resource))",
"def resource_path(self, resource):\n # type: (Text) -> Text\n # This deliberately raises FileNotFoundError instead of\n ... | [
"0.86315787",
"0.86315787",
"0.75142026",
"0.7466097",
"0.73980784",
"0.73419726",
"0.7320389",
"0.7314941",
"0.71489865",
"0.70702946",
"0.70295435",
"0.6970443",
"0.69216186",
"0.68570954",
"0.6769085",
"0.67610306",
"0.67560315",
"0.66605455",
"0.6645477",
"0.6633541",
"0.... | 0.0 | -1 |
Reset all projection weights to an initial (untrained) state, but keep the existing vocabulary. | def reset_weights(self):
np.random.seed(self.seed)
self.node_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)
self.context_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)
self.centroid = np.zeros((self.k, se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self._weights.clear()",
"def reset(self):\n for i in range(0, len(self.current_state)):\n self.current_state[i] = 0\n\n for i in range(0, len(self.weights)):\n self.weights[i] = 0",
"def reset(self):\n weight = self.module.weight.data\n ... | [
"0.7002778",
"0.7001617",
"0.6949413",
"0.6860031",
"0.6832189",
"0.67620414",
"0.6634122",
"0.6615725",
"0.65935725",
"0.6592816",
"0.65746814",
"0.65252745",
"0.64712715",
"0.64670706",
"0.6387383",
"0.6379383",
"0.634511",
"0.6329626",
"0.63157684",
"0.6314753",
"0.6303276... | 0.7131178 | 0 |
Reset all projection weights to an initial (untrained) state, but keep the existing vocabulary. | def reset_communities_weights(self, k):
np.random.seed(self.seed)
self.k = k
self.centroid = np.zeros((self.k, self.layer1_size), dtype=np.float32)
self.covariance_mat = np.zeros((self.k, self.layer1_size, self.layer1_size), dtype=np.float32)
self.inv_covariance_mat = np.zeros((s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_weights(self):\n np.random.seed(self.seed)\n self.node_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n self.context_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n\n\n self.centroid = np.zeros(... | [
"0.7131178",
"0.7002778",
"0.7001617",
"0.6949413",
"0.6860031",
"0.6832189",
"0.67620414",
"0.6634122",
"0.6615725",
"0.65935725",
"0.6592816",
"0.65746814",
"0.65252745",
"0.64712715",
"0.64670706",
"0.6387383",
"0.6379383",
"0.634511",
"0.6329626",
"0.63157684",
"0.6314753... | 0.60335326 | 68 |
Reset all projection weights to an initial (untrained) state, but keep the existing vocabulary. | def reset_weight_random(self):
self.node_embedding = np.random.uniform(low=-4.5, high=4.5, size=(self.vocab_size, self.layer1_size)).astype(
np.float32)
self.context_embedding = np.random.uniform(low=-4.5, high=4.5, size=(self.vocab_size, self.layer1_size)).astype(np.float32)
self.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_weights(self):\n np.random.seed(self.seed)\n self.node_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n self.context_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n\n\n self.centroid = np.zeros(... | [
"0.71300036",
"0.70021087",
"0.70009804",
"0.6948315",
"0.68589354",
"0.6830983",
"0.67616093",
"0.663148",
"0.66168255",
"0.65932035",
"0.65739435",
"0.65253544",
"0.6469183",
"0.64668244",
"0.6387738",
"0.63808966",
"0.634424",
"0.6329266",
"0.631619",
"0.6311559",
"0.63040... | 0.65919435 | 10 |
Reset all projection weights to an initial (untrained) state, but keep the existing vocabulary. | def reset_weight_zero(self):
self.node_embedding = np.random.uniform(low=-0.5, high=0.5, size=(self.vocab_size, self.layer1_size)).astype(
np.float32)
self.context_embedding = np.zeros((self.vocab_size, self.layer1_size), dtype=np.float32)
self.centroid = np.zeros((self.k, self.laye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_weights(self):\n np.random.seed(self.seed)\n self.node_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n self.context_embedding = xavier_normal(size=(self.vocab_size, self.layer1_size), as_type=np.float32)\n\n\n self.centroid = np.zeros(... | [
"0.7130626",
"0.7002747",
"0.7001367",
"0.69487923",
"0.68596697",
"0.67615825",
"0.6632965",
"0.66158324",
"0.6592861",
"0.6592446",
"0.6574339",
"0.6524941",
"0.647033",
"0.6466661",
"0.63866043",
"0.63807714",
"0.63451284",
"0.6329498",
"0.631593",
"0.6313653",
"0.6303531"... | 0.68315405 | 5 |
Execute uniform crossover. Take the ith row of parent1 and randomly swap bits with the ith row of p2. | def crossover(parent1: Individual, parent2: Individual, root_individual: RootIndividual,
**kwargs) -> Tuple[Individual, Individual]:
sieve = np.random.randint(2, size=len(parent1.params)) # Array of 0's and 1's
not_sieve = sieve ^ 1 # Complement of sieve
child1 = Individual(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossover(parent1, parent2):\n child = parent1.clone()\n for k in range(parent1.num_input + parent1.num_output):\n if np.random.randint(2) == 1:\n child.identifiers[k] = parent2.identifiers[k]\n child.inhibitors[k] = parent2.inhibitors[k]\n child.enhancers[k] = par... | [
"0.75367624",
"0.73235446",
"0.6973175",
"0.69680727",
"0.69570386",
"0.69496214",
"0.6917254",
"0.6869177",
"0.6837743",
"0.6777098",
"0.67581344",
"0.67402154",
"0.6689997",
"0.6681522",
"0.66550106",
"0.6648935",
"0.66436905",
"0.6619873",
"0.6493216",
"0.64447224",
"0.643... | 0.68828773 | 7 |
Generates a gradient color mask from a specified palette. | def gen_gradient_mask(
size: int,
palette: str,
icon_dir: str = ".temp",
gradient_dir: str = "horizontal",
invert_mask: bool = False,
):
mask_array = gen_mask_array(icon_dir, invert_mask, size)
mask_array = np.float32(mask_array)
palette_func = gen_palette(palette)
gradient = n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_from_gradient(self):\n \n color0 = pero.Color.Black\n color1 = pero.Color.White\n \n colors = (color0, color1)\n gradient = pero.Gradient(colors)\n \n picked = pero.Palette.from_gradient(gradient, 2)\n self.assertEqual(len(picked), 2)\n ... | [
"0.5950786",
"0.5730761",
"0.5692618",
"0.5661667",
"0.56544435",
"0.5561198",
"0.54973084",
"0.5464175",
"0.53833103",
"0.5376529",
"0.5254512",
"0.5248878",
"0.5193046",
"0.51913655",
"0.5164314",
"0.5144329",
"0.51092696",
"0.51091623",
"0.5106728",
"0.5097464",
"0.5088746... | 0.67436486 | 0 |
Return a list of KeyedJaggedTensor, where each KeyedJaggedTensor represents one step's sparse data. | def create_sparse_data_per_step(
self,
state_id_list: KeyedJaggedTensor,
state_id_score_list: KeyedJaggedTensor,
action_id_list: KeyedJaggedTensor,
action_id_score_list: KeyedJaggedTensor,
seq_len: int,
):
# Convert id_list data as id score list data with weig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SimpleSparseTensorFrom(x):\n x_ix = []\n x_val = []\n for batch_i, batch in enumerate(x):\n for time, val in enumerate(batch):\n x_ix.append([batch_i, time])\n x_val.append(val)\n x_shape = [len(x), np.asarray(x_ix).max(0)[1]+1]\n\n return x_ix, x_val, x_shape",
"def sparse_arrays(self):\n ... | [
"0.63818383",
"0.63548744",
"0.62488276",
"0.60579944",
"0.58146477",
"0.5807797",
"0.5782205",
"0.5460244",
"0.53535426",
"0.5289332",
"0.52515996",
"0.5246073",
"0.52371585",
"0.5207474",
"0.5180332",
"0.5170422",
"0.51613456",
"0.5137213",
"0.5113568",
"0.5106174",
"0.5072... | 0.61916816 | 3 |
Add any missing head /'s | def _normalise_head_slashes(url_segment):
return url_segment if url_segment.startswith("/") else "/" + url_segment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BuildHeadList(all_file_contents):\n head_list = []\n list_all_file_contents = (all_file_contents)\n for line in list_all_file_contents: \n if line[0:4] != 'ATOM':\n head_list.append(line)\n else:\n break\n\n return head_list",
"def all_headlines(html_root_node)... | [
"0.62188476",
"0.60407215",
"0.5792617",
"0.5767084",
"0.57257247",
"0.56419003",
"0.5640028",
"0.55990964",
"0.5597199",
"0.5594238",
"0.5552565",
"0.5539189",
"0.5528258",
"0.5528154",
"0.552724",
"0.55263567",
"0.54999083",
"0.5490824",
"0.54702806",
"0.54401785",
"0.54371... | 0.0 | -1 |
Fetch month from date string. | def get_month_from_date(raw_format_date):
date = None
for pattern in NAMCS_DATASET_MONTH_PATTERNS:
try:
date = datetime.strptime(raw_format_date, pattern)
if date:
break
except ValueError:
continue
# Numeric format for month
month = da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_month(string): \n datetime_object = datetime.datetime.strptime(string, \"%B\")\n\n month_number = datetime_object.month\n\n return month_number",
"def get_month(string): \n return int(string[15:17])",
"def get_month(url):\n month = \" \".join(re.findall(\"[a-zA-Z]+\", url))\n ... | [
"0.7776043",
"0.75545573",
"0.7478499",
"0.745995",
"0.7353813",
"0.72400606",
"0.6959547",
"0.692082",
"0.68797",
"0.6806118",
"0.67297846",
"0.6674377",
"0.6508573",
"0.65073085",
"0.64724976",
"0.647035",
"0.64280915",
"0.63238734",
"0.6258868",
"0.6227082",
"0.6135609",
... | 0.7532135 | 2 |
Method to normalize patient age into days. | def get_age_normalized_to_days(age=None, **kwargs):
if kwargs and not age:
month_of_visit = kwargs.get(NAMCSFieldEnum.MONTH_OF_VISIT.value)
month_of_birth = kwargs.get(NAMCSFieldEnum.MONTH_OF_BIRTH.value)
year_of_visit = str(kwargs.get(NAMCSFieldEnum.YEAR_OF_VISIT.value))
year_of_bir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_patient_age(age):\n if age == 'None' or not age:\n return None\n\n conversion = { # conversion to days\n 'Y': 365,\n 'M': 30,\n 'W': 7,\n 'D': 1,\n }\n scale = age[-1:]\n value = age[:-1]\n if scale not in conversion.keys():\n # Assume years\n ... | [
"0.67607135",
"0.6484741",
"0.6315703",
"0.6315703",
"0.6315703",
"0.6315703",
"0.62709564",
"0.62593377",
"0.6246976",
"0.6172597",
"0.61519337",
"0.6084411",
"0.6034905",
"0.5949943",
"0.58771884",
"0.5817413",
"0.57591534",
"0.5750689",
"0.57241625",
"0.57206935",
"0.57203... | 0.74092 | 0 |
r"""Returns the twoneutrino Hamiltonian for matter oscillations. Computes and returns the 2x2 real twoneutrino Hamiltonian for oscillations in matter with constant density. | def hamiltonian_2nu_matter(h_vacuum_energy_independent, energy, VCC):
h_matter = cp.deepcopy(h_vacuum_energy_independent)
h_matter = np.multiply(1.0/energy, h_matter)
# Add the matter potential to the ee term to find the matter
# Hamiltonian
h_matter[0][0] += VCC
return h_matter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Hamiltonian(self):\n U = self.U.flatten()\n Vmat = sparse.spdiags([U], [0], len(U), len(U))\n Kmat = sparse.kron(-self.KEy * Schrodinger.D2mat(len(self.y), self.y[1] - self.y[0], self.periodic_y, self.qy),\n sparse.identity(len(self.x))) + \\\n spars... | [
"0.60494936",
"0.58732766",
"0.5781869",
"0.57604533",
"0.571135",
"0.5698964",
"0.56819",
"0.5653591",
"0.562073",
"0.5616223",
"0.56089026",
"0.5586898",
"0.55793387",
"0.5562645",
"0.5562645",
"0.5561908",
"0.5558298",
"0.5541645",
"0.55358624",
"0.5534646",
"0.5503013",
... | 0.62922525 | 0 |
r"""Returns the twoneutrino Hamiltonian for oscillations with NSI. Computes and returns the 2x2 real twoneutrino Hamiltonian for oscillations with nonstandard interactions (NSI) in matter with constant density. | def hamiltonian_2nu_nsi(h_vacuum_energy_independent, energy, VCC, eps):
h_nsi = cp.deepcopy(h_vacuum_energy_independent)
h_nsi = np.multiply(1.0/energy, h_nsi)
eps_ee, eps_em, eps_mm = eps
h_nsi[0][0] += VCC*(1.0+eps_ee)
h_nsi[0][1] += VCC*eps_em
h_nsi[1][0] += VCC*np.conj(eps_em)
h_nsi[1]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def J_Nhat(h, Psi2):\n\n h = MTS(h)\n Psi2 = MTS(Psi2)\n\n # # Note that the contributions from the last two terms drop out as soon as we\n # # take the imaginary part below.\n # m = mass_aspect(Psi2, h)\n # N̂ = 2 * Psi1 - 0.25 * (h.bar * h.eth) - h.t * m.eth - 0.125 * (h * h.bar).eth\n\n # Ψ... | [
"0.6091388",
"0.5973544",
"0.58937836",
"0.58240277",
"0.5642153",
"0.562665",
"0.56218123",
"0.5595279",
"0.5572325",
"0.55717677",
"0.55336577",
"0.5527942",
"0.55264807",
"0.5525613",
"0.5522954",
"0.5521935",
"0.55110055",
"0.5482389",
"0.54665345",
"0.54648966",
"0.54631... | 0.6002834 | 1 |
Shortcut to mute, play favourite, stop favourite, and unmute. Preserve the mute state | def cue_favourite(speaker, action, args, soco_function, use_local_speaker_list):
if not speaker.is_coordinator:
error_and_exit(
"Action '{}' can only be applied to a coordinator".format(action)
)
return False
unmute = False
unmute_group = False
if not speaker.mute:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mute():\n request_command(tv_command=TVCommand.mute)",
"async def mute(self, *args, **kwargs):\n self.muted = not self.muted # toogle\n if self.muted:\n self.just_muted = True\n return \"I've been muted :(\"\n return \"I'm back! :D\"",
"def mute(self, msg, arg... | [
"0.7717247",
"0.73772126",
"0.7376052",
"0.71235245",
"0.6916576",
"0.6890221",
"0.6886069",
"0.6850246",
"0.6735209",
"0.6581618",
"0.6527393",
"0.65097684",
"0.6477251",
"0.64641875",
"0.6459846",
"0.64028925",
"0.6391751",
"0.63574284",
"0.63309926",
"0.6313766",
"0.629558... | 0.5501906 | 75 |
Initializes an event data attribute container. | def __init__(self, data_type=None):
super(EventData, self).__init__()
self._event_data_stream_identifier = None
self._event_data_stream_row_identifier = None
self.data_type = data_type
self.offset = None
self.parser = None
self.query = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(FseventsdEventData, self).__init__(data_type=self.DATA_TYPE)\n self.event_identifier = None\n self.file_entry_modification_time = None\n self.flags = None\n self.node_identifier = None\n self.path = None",
"def __init__(self):\n super(EventTag, self).__init__()\n ... | [
"0.6550511",
"0.6209484",
"0.6142718",
"0.61331266",
"0.60987103",
"0.60692257",
"0.6054902",
"0.6041554",
"0.6040391",
"0.5976322",
"0.5968829",
"0.59123546",
"0.5865399",
"0.5857294",
"0.5803473",
"0.5774275",
"0.5738803",
"0.5724546",
"0.56781256",
"0.5674405",
"0.5674405"... | 0.6431954 | 1 |
Sets the identifier of the associated event data stream. The event data stream identifier is a storage specific value that should not be serialized. | def SetEventDataStreamIdentifier(self, event_data_stream_identifier):
self._event_data_stream_identifier = event_data_stream_identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetEventDataIdentifier(self, event_data_identifier):\n self._event_data_identifier = event_data_identifier",
"def setId(self, identifier):\n self.identifier = identifier",
"def identifier(self, identifier):\n self._identifier = identifier",
"def identifier(self, identifier):\n sel... | [
"0.676881",
"0.6693273",
"0.6494955",
"0.6494955",
"0.64331853",
"0.6419453",
"0.6419453",
"0.6419453",
"0.6419453",
"0.6322583",
"0.62571734",
"0.62468874",
"0.61861086",
"0.61861086",
"0.61627877",
"0.616225",
"0.6071132",
"0.60210514",
"0.60084546",
"0.6003979",
"0.5999918... | 0.7853482 | 0 |
Initializes an event data attribute container. | def __init__(self):
super(EventDataStream, self).__init__()
self.file_entropy = None
self.md5_hash = None
self.path_spec = None
self.sha1_hash = None
self.sha256_hash = None
self.yara_match = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(FseventsdEventData, self).__init__(data_type=self.DATA_TYPE)\n self.event_identifier = None\n self.file_entry_modification_time = None\n self.flags = None\n self.node_identifier = None\n self.path = None",
"def __init__(self, data_type=None):\n super(EventData, se... | [
"0.6550511",
"0.6431954",
"0.6209484",
"0.6142718",
"0.61331266",
"0.60987103",
"0.60692257",
"0.6054902",
"0.6041554",
"0.6040391",
"0.5976322",
"0.5968829",
"0.59123546",
"0.5865399",
"0.5857294",
"0.5803473",
"0.5774275",
"0.5738803",
"0.5724546",
"0.5674405",
"0.5674405",... | 0.56781256 | 19 |
Compares if the event attribute container is less than the other. Events are compared by timestamp. | def __lt__(self, other):
return (self.timestamp < other.timestamp or
self.timestamp_desc < other.timestamp_desc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other: Event) -> bool:\n return self.timestamp < other.timestamp",
"def __lt__(self, other: 'Event') -> bool:\n return self.time < other.time",
"def __lt__(self, other):\n return self.timestamp < other.timestamp",
"def __lt__(self, other) -> bool:\n if self.timest... | [
"0.79469293",
"0.7724423",
"0.7482222",
"0.722369",
"0.71494573",
"0.7039315",
"0.6882377",
"0.6800224",
"0.6799816",
"0.6775877",
"0.6759199",
"0.6758536",
"0.67009425",
"0.66775167",
"0.6640861",
"0.655648",
"0.655648",
"0.6541459",
"0.6540525",
"0.6539719",
"0.6536305",
... | 0.7204919 | 4 |
Sets the identifier of the associated event data. The event data identifier is a storage specific value that should not be serialized. | def SetEventDataIdentifier(self, event_data_identifier):
self._event_data_identifier = event_data_identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, identifier):\n self.identifier = identifier",
"def SetEventIdentifier(self, event_identifier):\n self._event_identifier = event_identifier",
"def identifier(self, identifier):\n self._identifier = identifier",
"def identifier(self, identifier):\n self._identifier = ide... | [
"0.7133538",
"0.70999527",
"0.7023965",
"0.7023965",
"0.6923223",
"0.6923223",
"0.6923223",
"0.6923223",
"0.6871252",
"0.67560863",
"0.6556885",
"0.6556885",
"0.65554774",
"0.65554774",
"0.6507019",
"0.64041084",
"0.6394862",
"0.6303013",
"0.62872183",
"0.62503135",
"0.618967... | 0.7912496 | 0 |
Sets the identifier of the associated event. The event identifier is a storage specific value that should not be serialized. | def SetEventIdentifier(self, event_identifier):
self._event_identifier = event_identifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setId(self, identifier):\n self.identifier = identifier",
"def SetEventDataIdentifier(self, event_data_identifier):\n self._event_data_identifier = event_data_identifier",
"def identifier(self, identifier):\n self._identifier = identifier",
"def identifier(self, identifier):\n sel... | [
"0.73055255",
"0.72184986",
"0.7212269",
"0.7212269",
"0.719597",
"0.719597",
"0.7089514",
"0.70894164",
"0.70894164",
"0.70894164",
"0.70894164",
"0.686781",
"0.686781",
"0.6788488",
"0.6657261",
"0.6464429",
"0.644977",
"0.6366879",
"0.6358065",
"0.630745",
"0.6298035",
"... | 0.79614335 | 0 |
If the category_id is in the valid map categories, but category does not exist it should raise a 404 | def test_response_category_does_not_exist(self, mocked_valid_map_category_ids):
cat = Category.add_root()
# We'll look for this category_ID...
wrong_cat_id = cat.pk + 1
# ... which will be a valid_map_category_id:
mocked_valid_map_category_ids.return_value = [wrong_cat_id]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_a_category_not_found(self):\n self.test_add_category_success()\n response = self.client.get('/categories/100',\n headers={\"Authorization\": self.token})\n self.assertEqual(response.status_code, 404)\n self.assertIn('category with id: 100 i... | [
"0.72679836",
"0.70417905",
"0.6987987",
"0.6944518",
"0.6844195",
"0.6795051",
"0.6722684",
"0.6578696",
"0.65699893",
"0.6473431",
"0.6345752",
"0.6245059",
"0.60962677",
"0.609408",
"0.60828704",
"0.60780126",
"0.6076336",
"0.6057654",
"0.605507",
"0.6049974",
"0.6048943",... | 0.7844148 | 0 |
view that returns the index page | def index(request):
last_six = Property.objects.order_by('created')[:6]
last_six_in_ascending_order = reversed(last_six)
carousel_items = Property.objects.order_by('rating')[:5]
context = {
'properties': last_six_in_ascending_order,
'carousel_items': carousel_items,
}
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index(self):\n\t\treturn render_template('ind... | [
"0.8685039",
"0.8672103",
"0.8621258",
"0.8621258",
"0.8605599",
"0.8598444",
"0.85529125",
"0.85529125",
"0.85125875",
"0.8507397",
"0.8489784",
"0.8489125",
"0.8476405",
"0.8457269",
"0.84557134",
"0.8440132",
"0.84316075",
"0.84316075",
"0.84316075",
"0.84293973",
"0.84259... | 0.0 | -1 |
Creates a single Node, representing a board in database. | def save_board_to_db(ladders, snakes):
new_board = GRAPH_DB.create(node(snakes=to_hackerrank_paths(snakes),
ladders=to_hackerrank_paths(ladders)))[0]
new_board.add_labels("board")
return new_board._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_board():\n\n board = Board()\n board.print_board()",
"def create_node(self, **kwargs):\n if not self.nodes:\n self.get_nodes()\n\n _node = Node(project_id=self.project_id, connector=self.connector, **kwargs)\n\n _node.create()\n self.nodes.append(_node)... | [
"0.70216006",
"0.6787511",
"0.667633",
"0.6424152",
"0.6362489",
"0.62107337",
"0.6186118",
"0.6151916",
"0.61247087",
"0.612162",
"0.6115165",
"0.6094009",
"0.6045924",
"0.6023892",
"0.60115993",
"0.60028595",
"0.59529716",
"0.5947199",
"0.5936542",
"0.59276843",
"0.5926199"... | 0.56843233 | 49 |
Finds all boards in database. | def get_all_boards():
return [board for board in GRAPH_DB.find("board")] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boards(self):\r\n return Boards(self)",
"def listConnectedBoards(dap_class=DAPAccess):\n all_mbeds = MbedBoard.getAllConnectedBoards(dap_class, close=True,\n blocking=False)\n index = 0\n if len(all_mbeds) > 0:\n for mb... | [
"0.6463945",
"0.6091118",
"0.6049209",
"0.60351735",
"0.5963165",
"0.5959871",
"0.5893733",
"0.58165705",
"0.57981545",
"0.567235",
"0.56550705",
"0.56530315",
"0.55696297",
"0.55507684",
"0.55217725",
"0.55207986",
"0.54952496",
"0.5466374",
"0.5429453",
"0.541973",
"0.54011... | 0.82779163 | 0 |
Close the bound connection. | def close(self):
if self._conn:
try:
self._conn.close()
except Exception as e: # TODO: no general exception!
raise CloseBindError(str(e))
# Event callback.
self.event_callback[ConnectionEvent.ON_DISCONNECT](self._conn) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n if self._conn:\n logger.info(\"close connection.\")\n self._conn.unbind_s()",
"def close(self):\n self._conn and self._conn.unbind_s()",
"def close_connection(self):\n self._conn.close()",
"def close(self):\n with self.connlock:\n ... | [
"0.82091635",
"0.7931997",
"0.78803873",
"0.7801534",
"0.7799442",
"0.7798508",
"0.7773186",
"0.7759127",
"0.7683686",
"0.76833516",
"0.7667422",
"0.7665421",
"0.7661082",
"0.7661082",
"0.76370764",
"0.7633302",
"0.7629378",
"0.76261264",
"0.760367",
"0.758538",
"0.758538",
... | 0.7773759 | 6 |
Encode the variances from the priorbox layers into the ground truth boxes we have matched (based on jaccard overlap) with the prior boxes. | def encode(matched, priors, variances):
g_cxcy = (matched[:, :2] + matched[:, 2:]) / 2 - priors[:, :2]
g_cxcy /= variances[0] * priors[:, 2:]
g_wh = (matched[:, 2:] - matched[:, :2]) / priors[:, 2:]
g_wh = torch.log(g_wh) / variances[1]
return torch.cat([g_cxcy, g_wh], 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(predictions, priors, variances):\n\n boxes = np.concatenate((\n priors[:, :2] + predictions[:, :2] * variances[0] * priors[:, 2:4],\n priors[:, 2:4] * np.exp(predictions[:, 2:4] * variances[1])), 1)\n boxes[:, :2] = boxes[:, :2] - (boxes[:, 2:4] / 2)\n boxes[:, 2:4] = boxes[:, 2:4... | [
"0.62352544",
"0.5659943",
"0.556662",
"0.5537571",
"0.55330515",
"0.54976153",
"0.5468602",
"0.5423917",
"0.5397042",
"0.5363354",
"0.534133",
"0.5330279",
"0.5275176",
"0.5259793",
"0.5258",
"0.52542907",
"0.52303255",
"0.52106273",
"0.52004445",
"0.5145856",
"0.51391226",
... | 0.487666 | 55 |
Encode the variances from the priorbox layers into the ground truth boxes we have matched (based on jaccard overlap) with the prior boxes. | def encode_landm(matched, priors, variances):
matched = torch.reshape(matched, (matched.size(0), 4, 2))
priors_cx = priors[:, 0].unsqueeze(1).expand(matched.size(0), 4).unsqueeze(2)
priors_cy = priors[:, 1].unsqueeze(1).expand(matched.size(0), 4).unsqueeze(2)
priors_w = priors[:, 2].unsqueeze(1).expand(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(predictions, priors, variances):\n\n boxes = np.concatenate((\n priors[:, :2] + predictions[:, :2] * variances[0] * priors[:, 2:4],\n priors[:, 2:4] * np.exp(predictions[:, 2:4] * variances[1])), 1)\n boxes[:, :2] = boxes[:, :2] - (boxes[:, 2:4] / 2)\n boxes[:, 2:4] = boxes[:, 2:4... | [
"0.62352544",
"0.5659943",
"0.556662",
"0.5537571",
"0.55330515",
"0.54976153",
"0.5468602",
"0.5423917",
"0.5397042",
"0.5363354",
"0.534133",
"0.5330279",
"0.5275176",
"0.5259793",
"0.5258",
"0.52542907",
"0.52303255",
"0.52106273",
"0.52004445",
"0.5145856",
"0.51391226",
... | 0.4694345 | 97 |
Convert prior_boxes to (xmin, ymin, xmax, ymax) representation for comparison to point form ground truth data. | def point_form(boxes):
return torch.cat((boxes[:, :2] - boxes[:, 2:] / 2, boxes[:, :2] + boxes[:, 2:] / 2), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_prior_boxes(self):\n # value of k for each feature map to create k^2 boxes for each feature map\n feature_map_dims = {'conv4_3': 38, 'conv7': 19, 'conv8_2': 10, 'conv9_2': 5}\n\n # scale for boxes across different feature maps. boxes for inner feature maps\n # are scaled much... | [
"0.67252016",
"0.6653847",
"0.64321494",
"0.6389076",
"0.6330956",
"0.6244485",
"0.62111884",
"0.60595244",
"0.5924846",
"0.59145087",
"0.58325195",
"0.5814462",
"0.58084863",
"0.58084863",
"0.57961106",
"0.5774948",
"0.57614493",
"0.57127744",
"0.5709639",
"0.56839186",
"0.5... | 0.0 | -1 |
Match each prior box with the ground truth box of the highest jaccard overlap, encode the bounding boxes, then return the matched indices corresponding to both confidence and location preds. | def match(threshold, truths, priors, variances, labels, landms, loc_t, conf_t, landm_t, idx):
overlaps = jaccard(truths, point_form(priors))
best_prior_overlap, best_prior_idx = overlaps.max(1, keepdim=True)
valid_gt_idx = best_prior_overlap[:, 0] >= 0.2
best_prior_idx_filter = best_prior_idx[valid_gt_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_matches(gt_boxes, gt_class_ids, gt_masks,\n pred_boxes, pred_class_ids, pred_scores, pred_masks,\n iou_threshold=0.5, score_threshold=0.0):\n # Trim zero padding\n # TODO: cleaner to do zero unpadding upstream\n gt_boxes = trim_zeros(gt_boxes)\n gt_mask... | [
"0.6492868",
"0.6424544",
"0.6241823",
"0.62010163",
"0.61811584",
"0.61576366",
"0.61499256",
"0.6083819",
"0.59674674",
"0.58806837",
"0.58784086",
"0.5859169",
"0.57871246",
"0.5748906",
"0.5746782",
"0.572251",
"0.57155055",
"0.5712711",
"0.5698323",
"0.5685846",
"0.56648... | 0.55005336 | 36 |
Makes the upper and lower quartiles for a violin plot. | def make_quartiles(s, q1, q3):
return graph_objs.Scatter(
x=[s, s],
y=[q1, q3],
text=['lower-quartile: ' + '{:0.2f}'.format(q1),
'upper-quartile: ' + '{:0.2f}'.format(q3)],
mode='lines',
line=graph_objs.Line(
width=4,
color='rgb(0,0,0)'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def violinplot(vals, colors=None):\n \n if colors is None:\n colors = [\"#1F77B4\", \"#FF7F0E\"]\n \n sides = [np.asarray(vals[0], np.float), np.asarray(vals[1], np.float)]\n \n # summary statistics\n stats = [calc_stats(side) for side in sides]\n # kernel density estimation of pdf\... | [
"0.65867525",
"0.6306683",
"0.6295552",
"0.62579334",
"0.58124185",
"0.5693353",
"0.56481177",
"0.56091917",
"0.5590166",
"0.5549503",
"0.54639584",
"0.54458696",
"0.5425517",
"0.54204714",
"0.5408965",
"0.53875566",
"0.53487754",
"0.5343865",
"0.53417754",
"0.5317452",
"0.53... | 0.67412806 | 0 |
Makes the yaxis for a violin plot. | def make_YAxis(yaxis_title):
yaxis = graph_objs.YAxis(title=yaxis_title,
showticklabels=True,
autorange=True,
ticklen=4,
showline=True,
zeroline=False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __draw_yaxis(self):\n self.ax.set_ylim(self.ylims)\n # set y ticks\n yticks = [*range(0, self.ymax, 5)]\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"ylabel.fontsize\"] is None else self.settings.otherParams[\"ylabel.fontsize\"]\n ... | [
"0.69131756",
"0.66778326",
"0.66607594",
"0.66607594",
"0.6592278",
"0.6401416",
"0.6284119",
"0.60909456",
"0.6066628",
"0.6043237",
"0.6004436",
"0.592197",
"0.58690214",
"0.585838",
"0.5853588",
"0.57857466",
"0.57857466",
"0.57739484",
"0.5713293",
"0.5673678",
"0.564810... | 0.6611979 | 4 |
Accepts a filepath containing the dataset and returns the deserializes pandas.DataFrame. | def _read_dataset(self, dataset_path):
dataset = pd.read_pickle(dataset_path)
return dataset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset(filepath):\n return pandas.read_csv(filepath, header='infer')",
"def read_data(filepath):\n df = pd.read_csv(filepath)\n return df",
"def read_data(filepath):\n df = pd.read_csv(filepath)\n return df",
"def read_data(filepath):\n df = pd.read_csv(filepath... | [
"0.7606356",
"0.7317544",
"0.7317544",
"0.7317544",
"0.7315895",
"0.7235804",
"0.71985537",
"0.71784717",
"0.7163045",
"0.7109476",
"0.70923644",
"0.70068556",
"0.6867498",
"0.6853095",
"0.6852567",
"0.6839747",
"0.6834444",
"0.6828039",
"0.682549",
"0.679076",
"0.6787169",
... | 0.73227185 | 1 |
Returns a filename for the model checkpoint. | def _get_checkpoint_name(self):
dataset_basename = Path(self._train_dataset_path).resolve().stem
filename = "model_cpt_{}.pkl".format(dataset_basename)
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_checkpoint_path(self) -> str:\n return self._j_checkpoint_storage.getCheckpointPath().toString()",
"def _get_checkpoint(self):\n ckpt = tf.train.get_checkpoint_state(self.model)\n if ckpt and ckpt.model_checkpoint_path:\n ckpt_path = ckpt.model_checkpoint_path\n els... | [
"0.7620419",
"0.7384944",
"0.72182196",
"0.71382713",
"0.7021785",
"0.68705356",
"0.68261296",
"0.68243825",
"0.6792901",
"0.6787957",
"0.67357224",
"0.67357224",
"0.67212963",
"0.6719931",
"0.67044795",
"0.6704031",
"0.66989625",
"0.66863275",
"0.6658194",
"0.66034746",
"0.6... | 0.85385567 | 0 |
Accepts a directory path and returns the filepath where the checkpoint for the model is saved. Creates the destination directory if it does not exist. | def _save_model(self, checkpoint_dir):
# Check whether the specified path exists or not
isExist = os.path.exists(checkpoint_dir)
if not isExist:
# Create a new directory because it does not exist
os.makedirs(checkpoint_dir)
filename = self._get_checkpoint_name()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkpoint_directory(checkpoint):\n if os.path.isdir(checkpoint):\n pass\n else:\n os.mkdir(checkpoint)",
"def makedir(checkpoint_dir):\n if not os.path.exists(checkpoint_dir):\n os.makedirs(checkpoint_dir, exist_ok = True)",
"def save_checkpoint(dir, state, is_best, filename=... | [
"0.7650398",
"0.73572433",
"0.7138971",
"0.6958608",
"0.6834737",
"0.66874284",
"0.6658253",
"0.66306084",
"0.6623943",
"0.65592146",
"0.65401787",
"0.65173584",
"0.6474428",
"0.64721197",
"0.6403867",
"0.6398399",
"0.6385883",
"0.6373161",
"0.6354181",
"0.63382566",
"0.63310... | 0.6921227 | 4 |
Accepts a directory path. Returns the filepath where the model checkpoint is saved after being partially trained. | def train_and_save(self, checkpoint_dir):
dataset = self._read_dataset(self._train_dataset_path)
features, labels = self.get_features_and_labels(dataset)
self._model.partial_fit(features, labels, classes=self._classes)
checkpoint_path = self._save_model(checkpoint_dir)
return che... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_model(self, checkpoint_dir):\n # Check whether the specified path exists or not\n isExist = os.path.exists(checkpoint_dir)\n\n if not isExist:\n # Create a new directory because it does not exist\n os.makedirs(checkpoint_dir)\n\n filename = self._get_chec... | [
"0.74091375",
"0.7323657",
"0.7233753",
"0.7091137",
"0.70160663",
"0.70142025",
"0.6945544",
"0.6934318",
"0.68869585",
"0.67865217",
"0.67709553",
"0.6762679",
"0.67525476",
"0.6705682",
"0.66943717",
"0.6685939",
"0.66705966",
"0.6666668",
"0.66660804",
"0.6649484",
"0.661... | 0.7010326 | 6 |
Constructor for the LabelSmoothing module. | def __init__(self, smoothing=0.0):
super(LabelSmoothing, self).__init__()
self.confidence = 1.0 - smoothing
self.smoothing = smoothing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, smoothing=0.1):\n super(LabelSmoothing, self).__init__()\n self.confidence = 1.0 - smoothing\n self.smoothing = smoothing",
"def __init__(self, classes, smoothing=0.0, dim=-1, weight = None):\n super(LabelSmoothingLoss, self).__init__()\n self.confidence = 1.... | [
"0.85014725",
"0.7740796",
"0.76720005",
"0.6831716",
"0.6535184",
"0.64484084",
"0.6373303",
"0.6344245",
"0.6325938",
"0.6322719",
"0.6288337",
"0.61676824",
"0.616322",
"0.6125794",
"0.60863334",
"0.60729283",
"0.60607344",
"0.59531105",
"0.59465086",
"0.59139585",
"0.5907... | 0.8505097 | 1 |
Azure DevOps Organization properties. | def __init__(__self__, *,
provisioning_status_message: str,
provisioning_status_update_time_utc: str,
actionable_remediation: Optional['outputs.ActionableRemediationResponse'] = None,
onboarding_state: Optional[str] = None,
provisionin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def properties(self) -> Optional['outputs.AzureDevOpsOrgPropertiesResponse']:\n return pulumi.get(self, \"properties\")",
"def get_organization(self):\n return self.reference[REF_ORGANIZATION][REF_VALUE]",
"def org():\n\n settings = current.deployment_settings\n ADMIN = current.sess... | [
"0.7649656",
"0.6695075",
"0.66768175",
"0.65793496",
"0.6515508",
"0.6510871",
"0.6427905",
"0.63972497",
"0.6350465",
"0.6338399",
"0.63375413",
"0.63201284",
"0.6319868",
"0.6304674",
"0.6293727",
"0.62137043",
"0.6162084",
"0.6154358",
"0.6154358",
"0.6091233",
"0.6089359... | 0.0 | -1 |
Azure DevOps Organization resource. | def __init__(__self__, *,
id: str,
name: str,
system_data: 'outputs.SystemDataResponse',
type: str,
properties: Optional['outputs.AzureDevOpsOrgPropertiesResponse'] = None):
pulumi.set(__self__, "id", id)
pulumi.set(__s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization(self):\n return self._tower.get_organization_by_id(self._data.get('organization'))",
"def organization(self):\r\n return Organization(self)",
"def organization(self):\r\n return Organization(self)",
"def organization(self):\r\n return Organization(self)",
"def g... | [
"0.69512224",
"0.69287515",
"0.69287515",
"0.69287515",
"0.68728715",
"0.681347",
"0.67822605",
"0.6762488",
"0.65640634",
"0.65603936",
"0.6458872",
"0.6425666",
"0.6403369",
"0.6385928",
"0.63763237",
"0.6362124",
"0.6347158",
"0.6297685",
"0.6293803",
"0.62718743",
"0.6265... | 0.54398054 | 85 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7919597",
"0.7919597",
"0.78673583",
"0.78673583",
"0.78673583",
"0.78673583",
"0.78673583",
"0.77080876",
"0.7553674",
"0.72835004",
"0.7059125",
"0.69798136",
"0.6922035",
"0.687112",
"0.6729629",
"0.6704585",
"0.66538656",
"0.6646474",
"0.65501463",
"0.6543157",
"0.6543... | 0.6639466 | 33 |
Azure DevOps Organization properties. | def properties(self) -> Optional['outputs.AzureDevOpsOrgPropertiesResponse']:
return pulumi.get(self, "properties") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organization(self):\n return self.reference[REF_ORGANIZATION][REF_VALUE]",
"def org():\n\n settings = current.deployment_settings\n ADMIN = current.session.s3.system_roles.ADMIN\n SECTORS = \"Clusters\" if settings.get_ui_label_cluster() \\\n else \... | [
"0.6695075",
"0.66768175",
"0.65793496",
"0.6515508",
"0.6510871",
"0.6427905",
"0.63972497",
"0.6350465",
"0.6338399",
"0.63375413",
"0.63201284",
"0.6319868",
"0.6304674",
"0.6293727",
"0.62137043",
"0.6162084",
"0.6154358",
"0.6154358",
"0.6091233",
"0.60893595",
"0.608935... | 0.7649656 | 0 |
Gets or sets minimum severity level for a given category. | def minimum_severity_level(self) -> Optional[str]:
return pulumi.get(self, "minimum_severity_level") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_level(self, value: Union[int, str]) -> None:\n\n if not isinstance(value, (int, str)):\n raise TypeError(f\"<value> should be {int} or {str}, {type(value)} given.\")\n\n # pylint: disable=protected-access\n if isinstance(value, int) and value not in logging._levelToName:\n ... | [
"0.6419128",
"0.6235063",
"0.5993578",
"0.5955305",
"0.58714837",
"0.5845116",
"0.5671744",
"0.5633503",
"0.5633503",
"0.5633503",
"0.5576771",
"0.5529853",
"0.54994917",
"0.54375523",
"0.5383734",
"0.5378324",
"0.5378324",
"0.5304716",
"0.52824634",
"0.5271764",
"0.52642643"... | 0.7390821 | 0 |
Gets or sets internal GitHub id. | def git_hub_internal_id(self) -> str:
return pulumi.get(self, "git_hub_internal_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_id(self):\n return self.id",
"def get_repository_id(self) -> str:\n raise NotImplementedError",
"def getid(self):\n if self.Id is None:\n return self.internalid\n else:\n return self.Id",
"def getid(self):\n if self.Id is None:\n re... | [
"0.6310405",
"0.6265122",
"0.6202945",
"0.6202945",
"0.6202945",
"0.6202945",
"0.6202945",
"0.6202945",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"0.6164347",
"... | 0.66968405 | 0 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.79191524",
"0.79191524",
"0.7866989",
"0.7866989",
"0.7866989",
"0.7866989",
"0.7866989",
"0.7707799",
"0.7553387",
"0.7282639",
"0.70594364",
"0.6979728",
"0.6921343",
"0.6869332",
"0.67303586",
"0.6704556",
"0.6654243",
"0.6646484",
"0.6550656",
"0.6542634",
"0.6542634",... | 0.6639077 | 35 |
Gets or sets the human readable fullyqualified name of the Group object. This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. | def fully_qualified_friendly_name(self) -> str:
return pulumi.get(self, "fully_qualified_friendly_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def get_group_name(self):\n return self.groupname",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def group_name(self) ->... | [
"0.7732202",
"0.7573267",
"0.75431615",
"0.74629164",
"0.7339973",
"0.7246272",
"0.7106325",
"0.7036105",
"0.7036105",
"0.6868783",
"0.68502307",
"0.6831629",
"0.67460364",
"0.67164177",
"0.67164177",
"0.67164177",
"0.67164177",
"0.6665068",
"0.6665068",
"0.6641645",
"0.66377... | 0.0 | -1 |
Gets or sets the fullyqualified name of the Group object. This contains the entire namespace hierarchy where namespaces are separated by the '$' character. | def fully_qualified_name(self) -> str:
return pulumi.get(self, "fully_qualified_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def get_group_name(self):\n return self.groupname",
"def namespace(self):\n name = self._name if self._name is not None else '<unnamed>'\n if self.... | [
"0.69795185",
"0.69709235",
"0.6861976",
"0.6728294",
"0.6690681",
"0.6674499",
"0.66007453",
"0.65920734",
"0.652345",
"0.6457112",
"0.6457112",
"0.64271796",
"0.64204794",
"0.6400287",
"0.63811016",
"0.6335843",
"0.6335843",
"0.63131315",
"0.62908363",
"0.6241287",
"0.62108... | 0.60572994 | 33 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.7918918",
"0.7918918",
"0.7866843",
"0.7866843",
"0.7866843",
"0.7866843",
"0.7866843",
"0.7707669",
"0.75535375",
"0.7282573",
"0.70593405",
"0.6979795",
"0.6921477",
"0.6869792",
"0.6728835",
"0.6705346",
"0.6654243",
"0.6646549",
"0.6551288",
"0.65420413",
"0.65420413",... | 0.6639855 | 40 |
The type of identity that created the resource. | def created_by_type(self) -> Optional[str]:
return pulumi.get(self, "created_by_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self) -> pulumi.Input['ResourceIdentityType']:\n return pulumi.get(self, \"type\")",
"def type(self) -> Optional[pulumi.Input['ResourceIdentityType']]:\n return pulumi.get(self, \"type\")",
"def created_by_type(self) -> Optional[pulumi.Input[Union[str, 'IdentityType']]]:\n return ... | [
"0.8255673",
"0.8014981",
"0.7372117",
"0.71985024",
"0.7168418",
"0.71437",
"0.7070173",
"0.70280266",
"0.69838005",
"0.68890923",
"0.686309",
"0.6844002",
"0.67700636",
"0.6763271",
"0.6724401",
"0.6703369",
"0.6695644",
"0.6664346",
"0.66642934",
"0.65966016",
"0.65327346"... | 0.6752386 | 17 |
Build a CNN with two Convolution + MaxPooling layers and two Dense layers The model takes 32x32 singlechannel images (32, 32, 1) | def build_model():
model = keras.Sequential()
model.add(Conv2D(32, (5, 5), activation='relu', input_shape=(32, 32, 1)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.1))
model.add(Conv2D(64, (5, 5), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_cnn(self):\n model = Sequential()\n model.add(Conv2D(24, (1, 3), activation = 'relu', input_shape = (1, grid_size*grid_size+2, 1)))\n model.add(Conv2D(24, (1, 3), activation = 'relu', input_shape = (1, grid_size*grid_size+2, 1)))\n model.add(Flatten())\n model.add(Dense... | [
"0.7659261",
"0.7601831",
"0.7573641",
"0.7553142",
"0.73641",
"0.730879",
"0.73052615",
"0.7297849",
"0.7272257",
"0.7157527",
"0.7154847",
"0.71448594",
"0.7107865",
"0.7103982",
"0.7100928",
"0.7093838",
"0.7070587",
"0.70584923",
"0.7023134",
"0.701474",
"0.7001121",
"0... | 0.6963881 | 28 |
shifts the elements of a list to the left to right | def shift_list(array, s):
# Calculate acutal shift amount (e.g. 11 --> 1 if lenght of the array is 5)
s %= len(array)
# reverse the shift direction to be more intuitive
s *= -1
#shift arry with slicing
shifted_array = array[s:] + array[:s]
return shifted_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_left(L):\n\n\t# store the first item of the list\n\tfirst_item = L[0]\n\n\t# Start the loop from the second item\n\tfor i in range(1, len(L)):\n\t\t# Takes the item at i position and move to i-1 position\n\t\tL[i - 1] = L[i]\n\t# Take the item at index 0 and move to the last position\n\tL[-1] = first_ite... | [
"0.7310385",
"0.7034294",
"0.70183736",
"0.67973787",
"0.6661608",
"0.66306776",
"0.6590441",
"0.6534243",
"0.64591247",
"0.6436126",
"0.64216053",
"0.6380062",
"0.6353055",
"0.6289936",
"0.6284706",
"0.6189593",
"0.61883956",
"0.61869645",
"0.61864346",
"0.61806655",
"0.6179... | 0.63613635 | 12 |
Convert the price to cents, stripping the currency sign | def convert_to_cents(price: str) -> int:
price = price.replace("$", "").replace(",", ".")
converted_price: float = float(price) * 100
return int(converted_price) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_currency(val):\n new_val = val.replace(',','').replace('$', '')\n return float(new_val)",
"def normalize_price(price: str) -> float:\n return float(price.strip().replace(',', ''))",
"def cents_from(text):\n text = text.replace(\",\", \"\").strip()\n # intentionally allow errors to ... | [
"0.7394811",
"0.7178976",
"0.7060785",
"0.70483786",
"0.7042418",
"0.69600046",
"0.6932724",
"0.6897678",
"0.6840749",
"0.6762604",
"0.6744574",
"0.6703222",
"0.66190827",
"0.65999603",
"0.65582556",
"0.6554868",
"0.6538427",
"0.6505639",
"0.6498878",
"0.6496742",
"0.6448112"... | 0.74192715 | 0 |
Clean and convert a string date into a datetime data | def string_to_date(given_date: str) -> date:
return datetime.strptime(given_date, "%m/%d/%Y").date() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(self, date_str, format='%Y-%m-%d'):\n from pandas import to_datetime\n rv = to_datetime(date_str, format=format)\n if hasattr(rv, 'to_datetime'):\n rv = rv.to_datetime()\n return rv",
"def _str_to_date(self, date):\n return datetools.date_parser(date)",
... | [
"0.76628286",
"0.7645673",
"0.7517279",
"0.74483",
"0.74322087",
"0.74066025",
"0.74052054",
"0.736807",
"0.73549885",
"0.73159313",
"0.7308357",
"0.7285407",
"0.7260718",
"0.72255903",
"0.7171093",
"0.7154159",
"0.71303445",
"0.7125737",
"0.7125476",
"0.7098438",
"0.70694214... | 0.6838154 | 42 |
Provided with a date in date format, convert this to a string format | def date_to_string(date_to_convert: date) -> str:
return date.strftime(date_to_convert, "%m/%d/%Y") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_string(date) -> str:\n\n return date.strftime('%m/%d/%Y')",
"def date_to_final_str(date_obj: datetime) -> str:\n return date_obj.strftime(\"%Y-%m-%d\")",
"def format_date(self, date):\n return date.strftime('%Y-%m-%d')",
"def transform_date(date):\n if type(date) == str:\n... | [
"0.8017631",
"0.7933727",
"0.7917079",
"0.76677805",
"0.7661591",
"0.75827056",
"0.7536011",
"0.750991",
"0.75032246",
"0.74273187",
"0.74242806",
"0.739741",
"0.7300745",
"0.7274795",
"0.7236905",
"0.72255933",
"0.72255933",
"0.72084427",
"0.71979153",
"0.71813923",
"0.71295... | 0.757927 | 6 |
Checks a filename to ensure the extension is correct. | def check_allowed_extension(filename):
return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_filename(filename):\n extension = \".ics\"\n if not filename.endswith(extension):\n filename = filename + extension\n return filename",
"def validate_extension(filename):\r\n split_tup = os.path.splitext(ntpath.basename(filename))\r\n file_extension = split_tup[1]\r\n if file_... | [
"0.8270729",
"0.80059797",
"0.7965837",
"0.79541546",
"0.79427713",
"0.7842169",
"0.7833764",
"0.7788115",
"0.7740723",
"0.77352315",
"0.77352315",
"0.77340555",
"0.77340555",
"0.77186877",
"0.77186877",
"0.77186877",
"0.77186877",
"0.77186877",
"0.77186877",
"0.77186877",
"0... | 0.824125 | 1 |
Ensures no funny stuff with filenames | def secure_filename(filename):
return os.path.basename(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_check_filename_False(self):\n self.assertFalse(check_filename('sample.txt'))",
"def is_filename_safe(value):\n return value == str_to_filename(value)",
"def handle_filename_collision(filename, filenames):\n if filename.lower() in filenames:\n try:\n basename, ext=file... | [
"0.7036759",
"0.69903016",
"0.6885454",
"0.68520623",
"0.6839851",
"0.6826883",
"0.67973965",
"0.67743886",
"0.67677647",
"0.6766105",
"0.669627",
"0.66857916",
"0.668201",
"0.66785836",
"0.66618013",
"0.66268766",
"0.6625304",
"0.66127723",
"0.6583825",
"0.6549465",
"0.65473... | 0.0 | -1 |
Crops a random patch from image. | def get_image_patch_tensor(image, label, image_path, patch_width):
assert len(image.get_shape().as_list()) == 3, image.get_shape().as_list()
size = tensorflow.constant([patch_width, patch_width, 1], dtype=tensorflow.int32)
patch = tensorflow.expand_dims(tensorflow.random_crop(image, size), 0)
expanded... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_random_patch_of_the_image(im, crop_size):\n y, x = im.shape\n rand_x = np.random.randint(x - crop_size[1])\n rand_y = np.random.randint(y - crop_size[0])\n patch = im[rand_y:rand_y + crop_size[0],\n rand_x:rand_x + crop_size[1]]\n return patch",
"def get_random_patch(image, cro... | [
"0.76395625",
"0.6936866",
"0.68906426",
"0.6596045",
"0.65088016",
"0.6340328",
"0.62925816",
"0.61589104",
"0.61383736",
"0.6108369",
"0.6102771",
"0.6088681",
"0.60765904",
"0.60404783",
"0.603782",
"0.60280013",
"0.60095716",
"0.59448284",
"0.5924383",
"0.59127486",
"0.58... | 0.0 | -1 |
Initial positive ion charge density | def y01(x):
# return pini*((special.gamma(k1+p1))/(special.gamma(k1)*special.gamma(p1))*((x/l)**(k1-1))*(1-(x/l))**(p1-1))/7.3572
return 1/100*x*epsilon*1/q*1e21
# return 1e13*1/sigma*np.sqrt(2*np.pi) * np.exp(-np.power(x - u, 2.) / (2 * np.power(sigma, 2.)))-1e15*1/sigma
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ion_densities(self):\n nD = self.ne_in*(6-self.zeff_in)/(5.)\n nC = self.ne_in*(self.zeff_in-1)/(30.)\n nC[np.where(nC<0)]=0.\n print(\"nC/nD: \"+str(np.mean(nC/nD)*100.)+\" %\")\n self.ni_in[0,:] = nD\n self.ni_in[1,:] = nC",
"def computeChargeDensity(self):\n ... | [
"0.6727095",
"0.66942626",
"0.64611745",
"0.6440507",
"0.6440507",
"0.640799",
"0.63336676",
"0.6318113",
"0.6297858",
"0.6297858",
"0.6297858",
"0.62921333",
"0.6244138",
"0.62284964",
"0.62188613",
"0.62184435",
"0.62162435",
"0.61442405",
"0.61235744",
"0.6118238",
"0.6083... | 0.0 | -1 |
Get a random, dumb Trump quote alternatively, search for something similarly stupid he's said | async def _trump(self, ctx: commands.Context, *, query: str = None):
if query:
search_results = await aio_get_json(
ctx.bot.aio_session,
self.SEARCH_URL,
params={"query": quote_plus(query)},
)
if search_results is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_quote():\n with open (\"./data/quotes.txt\", \"r\") as quotes:\n\n all_quotes = quotes.read().rstrip(\"\\n\").split(\"\\n\\n\")\n\n quote = choice(all_quotes)\n\n return quote",
"def random_quote():\n quotes = [\n \"Growth is never by mere chance; it is the result... | [
"0.7263897",
"0.7208684",
"0.71108395",
"0.7061593",
"0.7056362",
"0.66998214",
"0.6449046",
"0.6391778",
"0.6314051",
"0.62837684",
"0.62645495",
"0.6221263",
"0.6175046",
"0.6145007",
"0.61425245",
"0.60841155",
"0.6061917",
"0.60527384",
"0.60505486",
"0.6044293",
"0.60330... | 0.0 | -1 |
Create and return some string at random | def _rs() -> str:
return uuid.uuid4().hex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random(self,num):\n return ''.join(sample('abcdefghijklmnopqrstuvwxyz1234567890!',8))",
"def __generate_random_string():\n return uuid4().hex[:6].upper()",
"def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # no... | [
"0.7841179",
"0.7766565",
"0.7722308",
"0.771758",
"0.77106434",
"0.76111126",
"0.7593751",
"0.7576425",
"0.7575531",
"0.75300646",
"0.7524812",
"0.74164367",
"0.74156713",
"0.7405575",
"0.73963255",
"0.73893166",
"0.7365877",
"0.7360601",
"0.7359509",
"0.735193",
"0.7351151"... | 0.0 | -1 |
Removes hashtags from a tweet's text | def clean_hashtags(self, tweet):
self.hashtags = [tag.strip('#') for tag in tweet.split()
if tag.startswith('#')]
for hashtag in self.hashtags:
tweet = tweet.replace('#'+hashtag, '')
tweet = self.clean_unnecessary_whitespaces(tweet)
return tweet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_hashtags(text):\n text = re.sub('\\B#\\w*[a-zA-Z]+\\w*', '', text)\n return text",
"def filter_hashtags(text):\n return re.sub(\"#\\S+\", \"\", text)",
"def remove_hashtags(text):\n return ' '.join(re.sub(r'[#][^\\s#@]+', ' ', text).split())",
"def remove_hashtag_symbols(text):... | [
"0.8743536",
"0.8646125",
"0.84047705",
"0.8336655",
"0.81067723",
"0.7923292",
"0.78451556",
"0.77551514",
"0.73775065",
"0.73775065",
"0.73208237",
"0.72619426",
"0.7219651",
"0.7183396",
"0.71304613",
"0.7110886",
"0.7105203",
"0.70876443",
"0.70128036",
"0.7012462",
"0.68... | 0.8262945 | 4 |
Removes urls from a tweet's text | def clean_urls(self, tweet):
self.urls = re.findall(self.regexpForURLs, tweet)
for url in self.urls:
tweet = tweet.replace(url, '')
tweet = self.clean_unnecessary_whitespaces(tweet)
return tweet | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_urls(self, tweet_text):\n\n url_free_tweet_text = \" \".join(\n re.sub(r\"http\\S+\", \"\", tweet_text).split())\n\n return url_free_tweet_text",
"def remove_url(txt):\n print(txt['fields']['tweet'])\n return \" \".join(re.sub(\"([^0-9A-Za-z \\t])|(\\w+:\\/\\/\\S+)\", \"... | [
"0.8707948",
"0.84847766",
"0.8402398",
"0.8269473",
"0.8257376",
"0.8131839",
"0.8123718",
"0.809607",
"0.8040857",
"0.7975096",
"0.7858202",
"0.78015625",
"0.7781961",
"0.7775159",
"0.773078",
"0.76947004",
"0.7657125",
"0.7616593",
"0.7596955",
"0.75835395",
"0.7420456",
... | 0.8440333 | 2 |
Checks if string contains digits | def string_contains_digits(self, string):
return bool(self.compiledDigitRegex.search(string)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))",
"def hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)",
"def isNumber(string):\r\n for char in string:\r\n charNum = ord(char)\r\n if (charNum < 48 or charNum > 57):\r... | [
"0.8282755",
"0.8113584",
"0.78642523",
"0.7795138",
"0.7769485",
"0.7754559",
"0.7673631",
"0.7646361",
"0.763669",
"0.7495709",
"0.74920803",
"0.74673504",
"0.74411196",
"0.7360905",
"0.73468906",
"0.73256385",
"0.73198164",
"0.7313898",
"0.7283442",
"0.72579026",
"0.719602... | 0.82233036 | 1 |
Test sign up with invalid email | def test_signup_invalid_email(self):
user = {
'firstname' : 'Caleb',
'lastname' : 'Mbugua',
'username' : 'MbuguaCaleb',
'email' : 'mbuguac',
'password' : '123456',
'phone_number' : '0704699193'
}
response =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registeration_invalid_email(self):\n response = self.signup_a_user(self.user_invalid_email)\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertEqual(response.data[\"errors\"][\"email\"],\n [\"Enter a valid email address.\"]\n ... | [
"0.85228634",
"0.82532495",
"0.8077355",
"0.8057829",
"0.80531454",
"0.80283374",
"0.7944066",
"0.7913213",
"0.79075825",
"0.7831437",
"0.77942",
"0.776986",
"0.77615035",
"0.77365065",
"0.773067",
"0.7715822",
"0.7715224",
"0.76850843",
"0.7684145",
"0.7676991",
"0.7659106",... | 0.7792437 | 11 |
Test login with an un unregistered user credentials | def test_login_for_unregistered_user(self):
user = {
'username' : 'Gabriel',
'password' : '##@qssR7qq'
}
response = self.client.post('/api/v1/login', json=user, headers={'Content-Type': 'application/json'})
data = response.get_json()
self.assertEqual(res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_user_login(self):\n self.user.list_of_accounts = [{'username': 'Parseen',\n 'pwd': 'mypassword',\n 'email': 'david.parseen@yahoo.com'}]\n msg = self.user.login(\"nonuser@yahoo.com\", \"idontevenhaveone\")\n ... | [
"0.8056584",
"0.795791",
"0.79340476",
"0.78322345",
"0.7786183",
"0.7732738",
"0.76468825",
"0.7602712",
"0.75822765",
"0.7578143",
"0.75341475",
"0.75216615",
"0.75060654",
"0.75014323",
"0.7488345",
"0.7459787",
"0.7455907",
"0.7434147",
"0.7428439",
"0.7424916",
"0.739544... | 0.7952091 | 2 |
Get the VSM Model of documents. | def getVSMSpace():
sids,documents = getSongTextInfo()
texts = [[word for word in document.lower().split()] for document in documents]
dictionary = corpora.Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
songMap = {}
index = 0
for doc in corpus:
sid = sids[index]
rMap = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc2vec_model(self):\n file_name = join(PARENT_BASE_DIR, '.files/model.model')\n if isfile(file_name):\n mdl = gensim_document_to_vector.load(file_name)\n return mdl, 'model exist.'\n else:\n return None, 'model not exist in \"base directory/.files/model.mo... | [
"0.733661",
"0.6912719",
"0.67712075",
"0.666379",
"0.66455305",
"0.6326814",
"0.6051585",
"0.60438347",
"0.59602207",
"0.58850414",
"0.58700395",
"0.5796139",
"0.57939005",
"0.5774567",
"0.5727249",
"0.56862843",
"0.5668",
"0.5661358",
"0.56477934",
"0.5637511",
"0.5613981",... | 0.0 | -1 |
r"""ResNext model from `"Aggregated Residual Transformations for Deep Neural Network" | def get_resnext(num_layers, cardinality=32, bottleneck_width=4, use_se=False,
pretrained=False, ctx=cpu(0),
root=os.path.join('~', '.mxnet', 'models'), **kwargs):
assert num_layers in resnext_spec, \
"Invalid number of layers: %d. Options are %s"%(
num_layers, str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ResNet20(inputShape):\n inputs = Input(shape=inputShape)\n x = resLayer(inputs) # resLayer1\n\n # resBlocks\n for nStage in range(3):\n for nBlock in range(3):\n x = resBlock(x, nStage, nBlock)\n\n x = AveragePooling2D(pool_size=8)(x)\n y = Flatten()(x)\n outputs = Dense... | [
"0.66206807",
"0.65272903",
"0.6519684",
"0.64477533",
"0.6363018",
"0.6354466",
"0.625262",
"0.6223059",
"0.6166305",
"0.6163671",
"0.6115087",
"0.6088203",
"0.60835046",
"0.604886",
"0.60406476",
"0.6020415",
"0.60141885",
"0.60115147",
"0.5970137",
"0.59159756",
"0.5907368... | 0.6278932 | 6 |
r"""ResNext50 32x4d model from `"Aggregated Residual Transformations for Deep Neural Network" | def resnext50_32x4d(**kwargs):
kwargs['use_se'] = False
return get_resnext(50, 32, 4, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnext50_32x4d(pretrained=False, **kwargs):\n kwargs['groups'] = 32\n kwargs['width_per_group'] = 4\n model = ResNetFeatures(BottleneckFeatures, [3, 4, 6, 3], **kwargs)\n \n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnext50_32x4d']))\n \n return m... | [
"0.7105225",
"0.7099228",
"0.6868007",
"0.6868007",
"0.6848918",
"0.6698059",
"0.6691926",
"0.6534964",
"0.63902456",
"0.63104385",
"0.63069487",
"0.62715834",
"0.6221513",
"0.6199721",
"0.61822206",
"0.61663353",
"0.615949",
"0.61066014",
"0.6080321",
"0.6044593",
"0.6042158... | 0.643375 | 8 |
r"""ResNext101 32x4d model from `"Aggregated Residual Transformations for Deep Neural Network" | def resnext101_32x4d(**kwargs):
kwargs['use_se'] = False
return get_resnext(101, 32, 4, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnext50_32x4d(pretrained=False, **kwargs):\n kwargs['groups'] = 32\n kwargs['width_per_group'] = 4\n model = ResNetFeatures(BottleneckFeatures, [3, 4, 6, 3], **kwargs)\n \n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnext50_32x4d']))\n \n return m... | [
"0.6997518",
"0.6816184",
"0.68038285",
"0.68038285",
"0.67579746",
"0.67556894",
"0.67250985",
"0.64711845",
"0.6415097",
"0.64122105",
"0.6407036",
"0.6407036",
"0.63842916",
"0.63825387",
"0.6359972",
"0.632607",
"0.6299026",
"0.6297797",
"0.6282635",
"0.62782",
"0.6239456... | 0.6067697 | 26 |
r"""ResNext101 64x4d model from `"Aggregated Residual Transformations for Deep Neural Network" | def resnext101_64x4d(**kwargs):
kwargs['use_se'] = False
return get_resnext(101, 64, 4, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnext50_32x4d(pretrained=False, **kwargs):\n kwargs['groups'] = 32\n kwargs['width_per_group'] = 4\n model = ResNetFeatures(BottleneckFeatures, [3, 4, 6, 3], **kwargs)\n \n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnext50_32x4d']))\n \n return m... | [
"0.66901535",
"0.6577717",
"0.64860034",
"0.64784944",
"0.6459572",
"0.6459572",
"0.640925",
"0.6250215",
"0.62178016",
"0.6202177",
"0.6188763",
"0.61356354",
"0.6120711",
"0.61197495",
"0.6106485",
"0.6071855",
"0.6071855",
"0.60663664",
"0.6064331",
"0.6055201",
"0.6046647... | 0.5981965 | 23 |
In the constructor we instantiate two nn.Linear modules and assign them as member variables. | def __init__(self, N_sym, n_nodes, activations, N_element, bias = True, scaling = None):
super(MultiLayerNet, self).__init__()
N_layers = len(n_nodes)
if N_layers == 0:
self.net = torch.nn.Linear(N_sym, N_element, bias = bias)
else:
layers = []
for n i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)",
"def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ... | [
"0.77401125",
"0.75483596",
"0.75074446",
"0.74346",
"0.7366003",
"0.7335429",
"0.73152226",
"0.7286699",
"0.7273464",
"0.72729063",
"0.72729063",
"0.7268201",
"0.72429734",
"0.72211164",
"0.72030157",
"0.7167753",
"0.7111596",
"0.7077496",
"0.7065618",
"0.7063983",
"0.705345... | 0.64639366 | 48 |
Long securities that are above their n period Simple Moving Averages with equal weights. | def above_sma(tickers=None, sma_per=50, start='2010-01-01', name='above_sma', data=None):
# download data
if tickers:
data = bt.get(tickers, start=start)
# calc sma
sma = data.rolling(sma_per).mean()
# create strategy
s = bt.Strategy(name, [SelectWhere(data > sma),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def averageBelow(requestContext, seriesList, n):\n return [ series for series in seriesList if safeDiv(safeSum(series),safeLen(series)) <= n ]",
"def early_warnings_sensitivity_analysis(series,\n indicators=['var','ac'],\n winsizerang... | [
"0.582496",
"0.57474405",
"0.5655439",
"0.56447315",
"0.55365914",
"0.5533284",
"0.5506705",
"0.5498663",
"0.5471845",
"0.5433872",
"0.5360606",
"0.5358667",
"0.53420305",
"0.5321071",
"0.53172946",
"0.5299682",
"0.5291974",
"0.5270528",
"0.52647567",
"0.5263048",
"0.5238592"... | 0.0 | -1 |
CharCNN, see Zhang and LeCun, 2015. | def char_cnn(features, n_vocab, n_classes, with_dropout=True):
# reserve for special control characters – eg unknown, padding
n_vocab = n_vocab + data.N_VOCAB_RESERVED
if with_dropout:
dropout_probability = 0.5
else:
dropout_probability = 0.0
def conv(inputs, filters, kernel_size)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, emb_dim=100, window_size=3, init_emb=None,\n hidden_dim=100, vocab_size=0, PAD_IDX=None):\n super(CharCNNEncoder, self).__init__(\n emb_dim=emb_dim, window_size=window_size, init_emb=init_emb,\n hidden_dim=hidden_dim, splitter=None, vocab_size=vocab_s... | [
"0.6051514",
"0.5779075",
"0.57062936",
"0.561197",
"0.5573738",
"0.5472362",
"0.5450894",
"0.5444336",
"0.54182315",
"0.5361993",
"0.5332403",
"0.53308976",
"0.5326816",
"0.5323698",
"0.5311696",
"0.52982056",
"0.52769417",
"0.5272042",
"0.52575266",
"0.5241723",
"0.5215271"... | 0.5711468 | 2 |
Whether the top mapping of the modality is pointwise. An example of a pointwise top mapping is a linear layer followed by a softmax. Given a tensor [batch, length, height, depth] it operates only on the last axis, on every point in [batch, length, height] fully independently. In contrast, a classifier that first averag... | def top_is_pointwise(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsTopSnappable(self):\r\n \r\n return self.HasFlag(self.optionTopSnapped)",
"def top_block(x, output_image_shape=None, top='classification', dropout_rate=0.0, include_top=True,\n classes=1, activation='sigmoid', final_pooling=None,\n filters=64, dense_layers=0, hidden_... | [
"0.5981919",
"0.54519606",
"0.53052115",
"0.5273389",
"0.51803946",
"0.50551975",
"0.50496155",
"0.4998125",
"0.49922445",
"0.49494377",
"0.49494267",
"0.4941354",
"0.49358565",
"0.49353957",
"0.49238622",
"0.49139938",
"0.49136382",
"0.48951417",
"0.48852184",
"0.48491102",
... | 0.7309758 | 0 |
Sets a matrix row with an MVector or MPoint. [in/out] matrix Matrix to set. [in] new_vector Vector to use. [in] row Row number. | def set_matrix_row(matrix, new_vector, row):
set_matrix_cell(matrix, new_vector.x, row, 0)
set_matrix_cell(matrix, new_vector.y, row, 1)
set_matrix_cell(matrix, new_vector.z, row, 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setMatrixRow(self, row):\n item = self._item()\n if item is not None:\n matrix = item.getMatrix()\n matrix[self._index, :] = row.x(), row.y(), row.z()\n item.setMatrix(matrix)",
"def replace_row(self, row_number, vector):\n if not self.__is_valid_row(row... | [
"0.71688473",
"0.68554574",
"0.627872",
"0.62036586",
"0.6016456",
"0.59625334",
"0.59190387",
"0.5852895",
"0.5831566",
"0.5782787",
"0.57294554",
"0.57263047",
"0.5530608",
"0.5475638",
"0.5463189",
"0.5416471",
"0.5413486",
"0.5389098",
"0.5362064",
"0.53500056",
"0.533386... | 0.8701553 | 0 |
Renders a box using an image. | def render(self,surf,box,r,size=None,offset=None):
if box == 0: return
if is_color(box):
surf.fill(box,r)
return
x,y,w,h=r.x,r.y,r.w,r.h
if (size and offset):
pass
# destx = x
# desty = y
# Calculate the size of each ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_box(\n draw,\n box,\n img_width,\n img_height,\n text=\"\",\n color=(255, 255, 0),\n) -> None:\n\n line_width = 3\n font_height = 8\n y_min, x_min, y_max, x_max = box\n (left, right, top, bottom) = (\n x_min * img_width,\n x_max * img_width,\n y_min * img... | [
"0.71769184",
"0.6984197",
"0.6968608",
"0.6654031",
"0.6639899",
"0.6625081",
"0.6622196",
"0.6603588",
"0.6540412",
"0.6521585",
"0.6483711",
"0.6481564",
"0.6477518",
"0.6460541",
"0.6440115",
"0.64198637",
"0.6419037",
"0.6415883",
"0.63927823",
"0.6385988",
"0.63828367",... | 0.0 | -1 |
Saves labels in JSON file | def dump_labels(label_indices, labels_path):
with open(labels_path, 'w') as json_file:
json.dump(label_indices, json_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SaveLabels(filepath, labels):\n # 1) Create a string with all the text to be stored\n text = '\\n'.join(labels)\n\n # 2) Open the datafile and save the text\n with open(filepath, 'w') as outfile:\n outfile.write(text)",
"def put_labels():\n dao.delete_all_labels()\n for label in requ... | [
"0.6743702",
"0.67184377",
"0.6705947",
"0.66015875",
"0.6593159",
"0.6585682",
"0.65326047",
"0.637834",
"0.6368813",
"0.6361083",
"0.63148975",
"0.62918544",
"0.62852234",
"0.6272509",
"0.625129",
"0.61964",
"0.6196348",
"0.6196348",
"0.61860293",
"0.6182542",
"0.61557066",... | 0.69401306 | 0 |
Retrieves label indices from passed data generator | def retrieve_label_indices(json_path):
with open(json_path) as data_file:
label_indices = json.load(data_file)
index_labels = {v: k for (k, v) in label_indices.iteritems()}
return index_labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_of_label(self, label_name):\n return self.indices_of('label', label_name)",
"def get_label_indices(num_labels: int, sample_label: str) -> list:\n if sample_label == \"sample\": # sample a random label\n return [random.randrange(num_labels)]\n elif sample_label == \"first\": # use th... | [
"0.72620976",
"0.6866642",
"0.67798555",
"0.6641664",
"0.6624008",
"0.6481305",
"0.64453393",
"0.6318482",
"0.62822294",
"0.62498",
"0.61781204",
"0.6170746",
"0.6170746",
"0.6128272",
"0.611447",
"0.6094127",
"0.608765",
"0.6085987",
"0.6073813",
"0.6061418",
"0.60281163",
... | 0.0 | -1 |
Returns the transport used by the client instance. | def transport(self) -> ServiceControllerTransport:
return self._client.transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> TraceServiceTransport:\n return self._client.transport",
"def transport(self) -> MetadataServiceTransport:\n return self._client.transport",
"def transport(self) -> Controller2Transport:\n return self._client.... | [
"0.82946277",
"0.7887542",
"0.773068",
"0.76806635",
"0.7674273",
"0.76357967",
"0.7558095",
"0.7551682",
"0.75303864",
"0.74958986",
"0.7488142",
"0.7436853",
"0.7423566",
"0.7368433",
"0.73340607",
"0.721926",
"0.7109823",
"0.7102308",
"0.68808985",
"0.68144",
"0.6671675",
... | 0.773594 | 2 |
Initialises the sender of the email. | def __init__(self, sender):
self.sender = sender | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_sender(self, email=\"\", name=\"\"):\n if not email:\n return\n if not name:\n name = False\n self.from_who = _email.formataddr( (name, email) )",
"def from_email(self, from_email):\n\n self._from_email = from_email",
"def __init__(self, *args, **kwa... | [
"0.7351502",
"0.6444189",
"0.6342841",
"0.6271262",
"0.6249377",
"0.6188036",
"0.6073873",
"0.60705954",
"0.6061908",
"0.60433537",
"0.586004",
"0.582883",
"0.58243775",
"0.5803689",
"0.57890457",
"0.57652473",
"0.5751057",
"0.5751057",
"0.5723784",
"0.57047164",
"0.5665333",... | 0.0 | -1 |
Returns the filename of the attachment from the full file path. | def _getFileName(self, filePath):
head, tail = ntpath.split(filePath)
return tail or ntpath.basename(head) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachment_filename(self, filename):\n if self.entry.customer_id:\n path = 'attachs/{kind}/{lang}/{cust}_{filename}'.format(\n kind=self.entry.kind.name,\n lang=self.entry.kind.language,\n cust=self.entry.customer_id,\n filename=filename\n )\n ... | [
"0.7568892",
"0.7248678",
"0.72339094",
"0.72010607",
"0.71912724",
"0.7186082",
"0.7099228",
"0.70696795",
"0.7031512",
"0.7013615",
"0.7001706",
"0.6951505",
"0.69109577",
"0.68780315",
"0.6837822",
"0.6835222",
"0.68294895",
"0.6802516",
"0.6780751",
"0.6768679",
"0.675110... | 0.65011084 | 36 |
Here we are going save the dataframe on disk as a csv file, load the csv file and use copy_from() to copy it to the table | def copy_from_file(conn, df, table):
# Save the dataframe to disk
tmp_df = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "tmp_dataframe.csv")
df.to_csv(tmp_df, index=False, header=False)
f = open(tmp_df, 'r')
cursor = conn.cursor()
try:
cursor.copy_from(file=f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_csv_to_train_table(conn, csv_file):\n COPY_TRAIN = \"08_copy_train_to_table.psql\"\n copy_expert_psql_script(conn, COPY_TRAIN, csv_file)",
"def copy_into_postgres(df, conn, fname):\n print(f\"`{fname}`: Loading data...\")\n\n null_cols = [\n \"col_a\", \"col_b\", \"col_c\", \"col_d\",... | [
"0.6843135",
"0.6511886",
"0.6461958",
"0.64478165",
"0.64467645",
"0.64178014",
"0.64048904",
"0.64032936",
"0.63270414",
"0.62387913",
"0.62337637",
"0.62308043",
"0.61763793",
"0.61684835",
"0.6162453",
"0.614496",
"0.6144535",
"0.61402303",
"0.612204",
"0.6116065",
"0.610... | 0.7186593 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.