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
Increase the scaffold overlap between two sets of indices by randomly selecting two unshared scaffolds, one in each set, and splitting the indices evenly between the two sets.
def increase_overlap(indices_1: Set[int], indices_2: Set[int], index_to_scaffold: Dict[int, str], scaffold_to_indices: Dict[str, Set[int]], indices_1_size: float) -> Tuple[Set[int], Set[int]]: # Make copies to prevent altering input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrease_overlap(indices_1: Set[int],\n indices_2: Set[int],\n index_to_scaffold: Dict[int, str],\n scaffold_to_indices: Dict[str, Set[int]],\n indices_1_size: float) -> Tuple[Set[int], Set[int]]:\n # Make copies to prevent alte...
[ "0.79564273", "0.733144", "0.6357831", "0.63047314", "0.615096", "0.6049924", "0.5993188", "0.5838642", "0.5782231", "0.57533544", "0.57329917", "0.55902934", "0.55560696", "0.5551713", "0.5516679", "0.551179", "0.5465472", "0.54605436", "0.54539526", "0.5452993", "0.54470766...
0.8115335
0
Split a dataset by scaffold so that no molecules sharing a scaffold are in the same split.
def scaffold_split_overlap(data: MoleculeDataset, overlap: float, overlap_error: float = 0.025, max_attempts: int = 10000, sizes: Tuple[float, float, float] = (0.8, 0.1, 0.1), size_erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaffold_split_one(data: MoleculeDataset) -> Tuple[MoleculeDataset,\n MoleculeDataset,\n MoleculeDataset]:\n # Map from scaffold to index in the data\n scaffold_to_indices = scaffold_to_smiles(data...
[ "0.80908746", "0.74137425", "0.6739863", "0.63182425", "0.6241313", "0.6174691", "0.58469987", "0.5844013", "0.5775175", "0.5748342", "0.57448846", "0.574323", "0.5672647", "0.5648632", "0.5641028", "0.56339", "0.5622885", "0.5618617", "0.5613962", "0.5579254", "0.5524884", ...
0.56979907
12
Return this table as HTML, ready to be inserted into a template. To customize the output, set the ``template`` meta option to a new template, and use the table_tags to build your own template. See README for examples.
def as_html(self): # pragma: no cover return render_to_string( self._meta.template, { "table": self } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_html(self):\r\n template = get_template(self.template)\r\n request = build_request()\r\n return template.render(RequestContext(request, {'table': self}))", "def create_html(self):\n rows = self.check()\n htmlrows = \"\"\n for row in rows:\n data = self....
[ "0.8210146", "0.73944736", "0.73321325", "0.72068954", "0.7188988", "0.71167964", "0.6978338", "0.69088024", "0.6835821", "0.67731744", "0.6751451", "0.6749531", "0.67170566", "0.67142826", "0.6711615", "0.66077894", "0.65958345", "0.65854436", "0.65589684", "0.6472386", "0.6...
0.8329112
0
Return a list of fire weather stations.
async def get_stations(response: Response, source: StationSourceEnum = StationSourceEnum.UNSPECIFIED): try: logger.info('/stations/') weather_stations = await get_stations_as_geojson(source) response.headers["Cache-Control"] = no_cache return WeatherStationsR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_stations() -> List[WeatherStation]:\n # Check if we're really using the api, or loading from pre-generated files.\n use_wfwx = config.get('USE_WFWX') == 'True'\n if use_wfwx:\n return await _get_stations_remote()\n return _get_stations_local()", "def stations():\n\n return sta...
[ "0.75444496", "0.73146105", "0.7232804", "0.7110344", "0.7090891", "0.6833961", "0.6830662", "0.673927", "0.66736394", "0.6660907", "0.6619825", "0.6617389", "0.6539462", "0.6521833", "0.651591", "0.64141506", "0.6389208", "0.63866407", "0.6371408", "0.6364273", "0.6323151", ...
0.58162564
71
Override rich comparison method. It compares the indices of the documents in the self.documents list. Returns True if the indices are the same in both documents lists, False otherwise.
def __eq__(self, other): if not self or not other: #either one of them is null return False if len(self.documents) != len(other.documents): return False for i in xrange(0, len(self.documents)): if self.documents[i].index != other.documents[i].index: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Corpus):\n raise NotImplementedError(\"Only a Corpus can be compared to another Corpus.\")\n\n if len(self) != len(other):\n return False\n\n for i in range(len(self)):\n if self.documents[i] != other.document...
[ "0.6868995", "0.66270757", "0.6577935", "0.6496078", "0.6383377", "0.63524246", "0.6248521", "0.62020355", "0.61382425", "0.6022278", "0.6014331", "0.6013102", "0.6006355", "0.59929043", "0.5977401", "0.5951384", "0.59509236", "0.59257156", "0.5917298", "0.59118927", "0.59067...
0.73647726
0
Transforms an YIQ image into the RGB color space.
def yiq2rgb(imYIQ): return np.dot(imYIQ, np.linalg.inv(TRANSFORM).T.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformYIQ2RGB(imgYIQ: np.ndarray) -> np.ndarray:\r\n yiq_from_rgb = np.array([[0.299, 0.587, 0.114],\r\n [0.59590059, -0.27455667, -0.32134392],\r\n [0.21153661, -0.52273617, 0.31119955]])\r\n rgb_from_yiq = np.linalg.inv(yiq_from_rgb)\r\n\r\n ...
[ "0.8312355", "0.8259237", "0.8081804", "0.7993288", "0.76654387", "0.7594864", "0.7186081", "0.71535397", "0.7102299", "0.70564187", "0.6948649", "0.68958557", "0.68218267", "0.68105596", "0.6784802", "0.6613954", "0.6396271", "0.63403475", "0.62976307", "0.6289597", "0.62389...
0.80055135
3
Find q vector from z vector.
def find_q(z, hist_orig): gray_levels = np.arange(BITS) # vector of all the gray levels in range [0, 255] q = np.zeros(len(z)-1) for i in range(len(z)-1): # formula from the class q[i] = np.sum(gray_levels[z[i]:z[i+1]+1]*hist_orig[z[i]:z[i+1]+1]) / np.sum(hist_orig[z[i]:z[i+1]+1]) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _q_z(self):\n D = self.latt_par['D'].value\n lambda_r = self.latt_par['lambda_r'].value\n gamma = self.latt_par['gamma'].value\n return 2*np.pi*(self.h/D - self.k/lambda_r/np.tan(gamma))", "def find_z(q):\n z = np.zeros(len(q) - 1, int)\n for i in range(len(q) - 1):\n z[i] = np.ceil(...
[ "0.69013536", "0.67796665", "0.66324735", "0.6573723", "0.6535911", "0.6519126", "0.6348701", "0.633755", "0.6297241", "0.62085783", "0.6186977", "0.6146965", "0.61301327", "0.6129197", "0.61165744", "0.610691", "0.6080239", "0.59950686", "0.59941405", "0.59802324", "0.597485...
0.5930834
24
Find q vector from z vector.
def find_z(q): z = np.zeros(len(q) - 1, int) for i in range(len(q) - 1): z[i] = np.ceil(q[i]/2 + q[i+1]/2) # formula from class return np.concatenate([[0], z, [BITS-1]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _q_z(self):\n D = self.latt_par['D'].value\n lambda_r = self.latt_par['lambda_r'].value\n gamma = self.latt_par['gamma'].value\n return 2*np.pi*(self.h/D - self.k/lambda_r/np.tan(gamma))", "def e_z(self, z):\n onez = 1+z \n onez2 ...
[ "0.69018024", "0.66323406", "0.6574459", "0.65359885", "0.6517065", "0.6348055", "0.6338913", "0.62964493", "0.6208453", "0.61859995", "0.6146106", "0.61299306", "0.6127998", "0.61149", "0.610666", "0.60803676", "0.5994957", "0.59931463", "0.59810233", "0.597437", "0.596203",...
0.6780009
1
Padding which allows to simultaneously pad in a reflection fashion and map to complex.
def __init__(self, pad_size, input_size, pre_pad=False): self.pre_pad = pre_pad self.pad_size = pad_size self.input_size = input_size self.build()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(x, pad_left=0, pad_right=0, to_complex=True):\n output = pad_1d(x, pad_left, pad_right, mode='reflect')\n if to_complex:\n output = torch.stack((output, torch.zeros_like(output)), dim=-1)\n return output", "def build(self):\n pad_size_tmp = list(self.pad_size)\n\n # This han...
[ "0.6470411", "0.6267466", "0.62590736", "0.61670756", "0.60758746", "0.6044263", "0.59978795", "0.5988728", "0.5939337", "0.59084773", "0.5906249", "0.5868863", "0.58217543", "0.5801737", "0.5784492", "0.5765109", "0.5756248", "0.5756244", "0.5743488", "0.5713688", "0.5713037...
0.0
-1
Return the current system timezone
def GetAuditedSystemTimezone(): Timezone = False try: Timezone = os.path.realpath(os.path.join(ROOT_PATH, "etc/localtime")) Timezone = Timezone.split("/") except Exception as e: PrintAndLog(u"Cannot read the timezone" + str(e.args).decode("utf-8"), "ERROR") return Timezone[-2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone():\n\n return time.timezone", "def time_zone():\n return timezone('Etc/GMT-10')", "def get_timezone():\n return dates.get_timezone(_get_tz())", "def get_timezone(self) -> str:\n return self.AD.time_zone", "def get_timezone():\n try:\n for line in open('/etc/syscon...
[ "0.8638515", "0.8165198", "0.81053346", "0.76771677", "0.76731414", "0.762153", "0.76022875", "0.7528684", "0.7526337", "0.7484276", "0.7484276", "0.7484276", "0.7482943", "0.74291104", "0.740821", "0.73642504", "0.7363934", "0.73002017", "0.72446585", "0.7242143", "0.7136974...
0.7554259
7
Determines whether a URL is the redirect URI for this client.
def is_redirect_uri(self, application_url, url): redirect_uri = self._construct_url([application_url, self.base_url_path, self.redirect_uri]) path_url = url.partition('?')[0] return redirect_uri == path_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_redirect_uri(self, client_id, redirect_uri, request, *args, **kwargs):\n request.client = request.client or self._clientgetter(client_id)\n client = request.client\n if hasattr(client, 'validate_redirect_uri'):\n return client.validate_redirect_uri(redirect_uri)\n ...
[ "0.71405023", "0.71121943", "0.69457793", "0.6885453", "0.6767164", "0.66483873", "0.64862335", "0.6463275", "0.64614815", "0.6456081", "0.63940734", "0.63927776", "0.63826865", "0.6365699", "0.6359056", "0.63528407", "0.6319239", "0.6273521", "0.6246883", "0.6231241", "0.622...
0.8336722
0
Joins components of a URL with separators where needed.
def _construct_url(parts): results = [] last_idx = len(parts) - 1 for n, part in enumerate(parts): if n > 0: part = part.lstrip('/') if n < last_idx: part = part.rstrip('/') if part: results.append(part) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urljoin(*parts):\n def _gen(parts):\n prev = None\n for part in parts:\n if not part:\n continue\n if not prev:\n prev = part\n elif (prev[-1] == '/') != (part[0] == '/'): # Exactly one slash was present\n prev = pa...
[ "0.78598994", "0.77680624", "0.769096", "0.7595144", "0.7594625", "0.7532864", "0.7529185", "0.75231504", "0.74930847", "0.7435269", "0.734676", "0.7331661", "0.71889573", "0.7146014", "0.714052", "0.7139423", "0.6971064", "0.6800093", "0.67886126", "0.673153", "0.66855735", ...
0.7665759
3
This fuction converts a given peak wavelength to an approximate RGB color value. The wavelength should be from 380 nm through 750 nm otherwise it will return zeros (i.e. black color).
def wavelength_to_rgb(wavelength, gamma=0.8, float_values=False): wavelength *= 10. ** 9. if 380. <= wavelength < 440.: attenuation = 0.3 + 0.7 * (wavelength - 380.) / (440. - 380.) r = ((-(wavelength - 440.) / (440. - 380.)) * attenuation) ** gamma g = 0.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wavelength_to_rgb(w: float, gamma: float = 1.) -> ndarray:\n\n if w <= BLU:\n c = (BLU - w) / 90, 0., 1. # violet - blue\n elif w <= CYA:\n c = 0., (w - BLU) / BC, 1. # blue - cyan\n elif w <= GRN:\n c = 0., 1., (GRN - w) / CG # cyan - green\n elif w <= YEL:\n c = (w ...
[ "0.7030515", "0.6838825", "0.67588544", "0.65369767", "0.6371136", "0.62787795", "0.6265969", "0.62597114", "0.6251292", "0.6152144", "0.60409725", "0.59426177", "0.5935737", "0.5935737", "0.5935737", "0.5935737", "0.58939606", "0.5892293", "0.5836986", "0.5829641", "0.582583...
0.6708099
3
Split DataFrame on two parts.
def df_split_random(df, N, random_seed=None): random = np.random.RandomState(random_seed) all_local_indices = np.arange(len(df)) shuffled = random.permutation(all_local_indices) df1 = df.iloc[shuffled[:N]] df2 = df.iloc[shuffled[N:]] return df1, df2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitData(df, split):\n train = df.iloc[:int(len(df)*split)]\n test = df.iloc[int(len(df)*split):]\n \n return train, test", "def split_on_whole_table(\n df: pyspark.DataFrame,\n ) -> pyspark.DataFrame:\n return df", "def splitting_df(dataframe):\n dataframe = dataframe.drop...
[ "0.7186549", "0.711421", "0.70219564", "0.69289196", "0.6712501", "0.6703415", "0.65471244", "0.65036076", "0.6352522", "0.63412976", "0.62779367", "0.6276081", "0.62718457", "0.6227857", "0.61960644", "0.617916", "0.6172768", "0.6166577", "0.61506385", "0.6144001", "0.611286...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CountPreoccupyIpNumRequest): return False 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.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
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.8456063", "0.83918154", "0.8144437", "0.8140196", "0.8132038", "0.8093834", "0.80918837", "0.80918837", "0.80918837", "0.80852824", "0.80852824", "0.807626", "0.807626", "0.80657643" ]
0.0
-1
Save the message on the Server This backend always assigns a new uid, so the uid arg is ignored. This function will update the self.messagelist dict to contain the new message after sucessfully saving it, including labels. See folder/Base for details. Note that savemessage() does not check against dryrun settings, so y...
def savemessage(self, uid, content, flags, rtime): if not self.synclabels: return super(GmailFolder, self).savemessage(uid, content, flags, rtime) labels = set() for hstr in self.getmessageheaderlist(content, self.labelsheader): labels.update(imaputil.labels_from_header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savemessagelabels(self, uid, labels):\n if uid in self.messagelist and 'labels' in self.messagelist[uid]:\n oldlabels = self.messagelist[uid]['labels']\n else:\n oldlabels = set()\n labels = labels - self.ignorelabels\n newlabels = labels | (oldlabels & self.ig...
[ "0.6426375", "0.57177705", "0.5686666", "0.5623984", "0.5565752", "0.5477714", "0.5402384", "0.5339278", "0.5300301", "0.5261444", "0.52459556", "0.52429676", "0.52099377", "0.51339483", "0.51322776", "0.5094475", "0.50941217", "0.50941217", "0.50941217", "0.50941217", "0.509...
0.68003327
0
Filter a transition matrix, removing all the transitions towards suffixes that are not in the given list of values If values is None, do nothing
def filter_values(matrix, values): if values is None: return matrix res = TransitionMatrix(order=matrix.order) for prefix, probabilities in matrix.items(): filtered = {suffix: probabilities[suffix] for suffix in probabilities if suffix in values} if filtered: res[prefix] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without(values, seq):\n for item in seq:\n if item not in values:\n yield item", "def strip_head(sequence, values):\n values = set(values)\n return list(itertools.dropwhile(lambda x: x in values, sequence))", "def _remove_all_matches(values, needle):\n values[:] = (i for i...
[ "0.578562", "0.56050646", "0.55618083", "0.54359293", "0.53596264", "0.52945614", "0.5288177", "0.5279489", "0.5222232", "0.5217521", "0.51013094", "0.5066446", "0.50521463", "0.5041288", "0.50255555", "0.50217223", "0.4991823", "0.4984307", "0.4969121", "0.49212953", "0.4908...
0.7467702
0
Create and return a new WordCount object.
def createWordCount(word, count): return WordCount(word, count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wordcount_obj(text):\r\n return dict2obj(get_wordcount(text))", "def word_count(self):\n return Counter(self._normalize(self._raw_phrase_str))", "def from_dict(cls, source: List):\n o = WordCount()\n for ts_string, word_count in source:\n o.append(ts_string, word_coun...
[ "0.66432583", "0.6505284", "0.64439225", "0.62680393", "0.62185013", "0.61230034", "0.611494", "0.6075214", "0.60578096", "0.60046446", "0.59811383", "0.5980801", "0.59782165", "0.59593934", "0.59562385", "0.59508824", "0.5913012", "0.57914126", "0.5759913", "0.5719026", "0.5...
0.8317772
0
Show image with landmarks
def show_landmarks(folder_dir, img_name, landmarks, expand_bbox_info): imgs = os.path.join(folder_dir, img_name) image = Image.open(imgs) # img.thumbnail((480, 480)) # 使用PIL裁切图片使用PIL需要引用Image,使用Image的open(file)方法可以返回打开的图片,使用crop((x0,y0,x1,y1))方法可以对图片做裁切。 # # 区域由一个4元组定义,表示为坐标是 (left, uppe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_landmarks(image, landmarks):\n\n if isinstance(image, str):\n # image = io.imread(image)\n image = cv2.cvtColor(cv2.imread(image), cv2.COLOR_BGR2RGB)\n\n plt.imshow(image)\n\n plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')\n plt.pause(0.001) # pause a bit...
[ "0.808608", "0.7926357", "0.7926357", "0.7926357", "0.78171635", "0.778297", "0.7465765", "0.6598388", "0.65567565", "0.65280706", "0.6492143", "0.6483718", "0.6477732", "0.644593", "0.64328134", "0.63780797", "0.6371934", "0.6371934", "0.6371934", "0.636128", "0.6348264", ...
0.7464966
7
Updates original graph by assigning new belief strengths to their respective nodes in the graph.
def update_belief_strength(self, G, change): for node in change: #loops through the dictionary G.nodes[node]['belief_strength'] = change[node] #assigns a new value for belief strength to a node. return G
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_edge_weight(self, G):\r\n for node in G.nodes:\r\n n1 = G.nodes[node]['belief_strength'] #gets a node's belief strength\r\n for pre in G.predecessors(node):\r\n n2 = G.nodes[pre]['belief_strength'] #gets the node's predecessors' belief strength\r\n ...
[ "0.7557754", "0.7157379", "0.7108078", "0.6794624", "0.6792593", "0.6661552", "0.6658258", "0.6624481", "0.64533687", "0.64493775", "0.6447183", "0.6430362", "0.63784355", "0.62919325", "0.62204367", "0.616087", "0.61512613", "0.61274296", "0.61145127", "0.60502183", "0.60314...
0.75894976
0
Get names of output variables.
def get_output_var_names(self, var_val): var_val = self._output_var_names return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_names(self):\n outputNames = []\n for outVar in self.outputs:\n # outVar is of type InOutVar and the object that it contains is a PyFMI variable\n outputNames.append(outVar.get_object().name)\n return outputNames", "def variable_names(self):\n\n status...
[ "0.8468522", "0.7889633", "0.75799996", "0.734823", "0.73286426", "0.7300235", "0.7169149", "0.71586597", "0.7110081", "0.70965505", "0.7080989", "0.7076314", "0.7057687", "0.70570886", "0.70488465", "0.69816834", "0.69655883", "0.69144344", "0.6903832", "0.68854547", "0.6857...
0.7477548
3
Get units of variable.
def get_var_nbytes(self, var_name): return self.get_value_ref(var_name).nbytes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_units(self, variable):\n try:\n units = self.dataset[variable].units\n return units\n except:\n return None", "def unit_of_measurement(self):\n return self.var_units", "def get_units(self):\r\n msg = struct.pack('>2B', 56, 14)\r\n resp...
[ "0.83103883", "0.8189632", "0.7948371", "0.7880219", "0.7875394", "0.7875394", "0.7852583", "0.7852583", "0.77704597", "0.7724156", "0.77080154", "0.7680472", "0.767998", "0.75592726", "0.7523269", "0.7493969", "0.74555004", "0.7451385", "0.7451175", "0.7448223", "0.74259824"...
0.0
-1
Get units of variable.
def get_var_units(self, var_name, var_val): var_val = self._var_units[var_name] return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_units(self, variable):\n try:\n units = self.dataset[variable].units\n return units\n except:\n return None", "def unit_of_measurement(self):\n return self.var_units", "def get_units(self):\r\n msg = struct.pack('>2B', 56, 14)\r\n resp...
[ "0.83103883", "0.8189632", "0.7948371", "0.7880219", "0.7875394", "0.7875394", "0.7852583", "0.7852583", "0.77704597", "0.7724156", "0.77080154", "0.7680472", "0.767998", "0.75592726", "0.7523269", "0.7493969", "0.74555004", "0.7451385", "0.7451175", "0.7448223", "0.74259824"...
0.0
-1
Name of the component.
def get_component_name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\r\n return self.component.get(\"Name\", \"\")", "def name(self):\r\n return self.component.get(\"Name\", \"\")", "def get_name(self):\n return COMPONENT_LIST[self.index][0]", "def getComponentName(self):\n if self.componentName:\n return self.componentNa...
[ "0.8687381", "0.8687381", "0.8462051", "0.8167638", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.77756315", "0.7775231", "0.7775231", "0.7775231", "0.7775231", "0.7703021", "0.77005935", "0.77...
0.8905444
0
Removes the last value and returns it.
def pop(self): popped = self.__list[-1] self.__list = self.__list[:-1] return popped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self): ##################### <-\n value = self.lst[-1]\n self.lst = self.lst[:-1]\n return value", "def del_value(self):\n return self.list.pop()", "def pop(self):\n b = self.a[-1]\n del self.a[-1]\n return b", "def pop(self):\n\n value = self.v...
[ "0.7892454", "0.7864021", "0.77454287", "0.7609421", "0.7539565", "0.743071", "0.7407218", "0.7405283", "0.73662955", "0.7331007", "0.73282063", "0.7291241", "0.72135264", "0.71850544", "0.7181424", "0.71549064", "0.7147303", "0.7131332", "0.7125476", "0.7088555", "0.70641696...
0.72214884
12
Moves the first "amount" of values to the end of the list. Returns the list.
def move(self, amount): self.__validate_index(amount) for i in range(amount): self.__list = self.__list[1:] + [self.__list[0]] return self.__list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def butlast(mylist):\n # This returns a copy of mylist\n return mylist[:-1]", "def move_top ( self ):\n list, index = self.get_info()\n self.value = [ list[index] ] + list[:index] + list[index+1:]", "def pop(self, amount=1) -> Union[BitVec, List[BitVec]]:\n if amount > len(self.stac...
[ "0.60799766", "0.5966946", "0.5941272", "0.5929805", "0.58110285", "0.5775642", "0.56279457", "0.5596776", "0.5582453", "0.5581828", "0.55610234", "0.5546621", "0.55438143", "0.55426806", "0.55370617", "0.5523189", "0.55133", "0.5508297", "0.5463782", "0.5435849", "0.54124415...
0.7639682
0
Initialize the hidden state with zeros.
def initialize_hidden_state(self, batch_size): return tf.zeros((batch_size, self.enc_units))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_hidden_state(self):\n initializer = tf.keras.initializers.Zeros()\n rnnten = initializer(shape=(self.batch, self.units))\n return rnnten", "def initHidden(self, batch_size):\n zero_hidden = torch.zeros(self.n_layers, batch_size, self.hidden_size)\n return zero_hi...
[ "0.79861766", "0.787504", "0.78671885", "0.7816188", "0.76396877", "0.7572875", "0.7523184", "0.72714657", "0.69829756", "0.69797844", "0.69610065", "0.69428575", "0.69428575", "0.6914388", "0.6914388", "0.69097793", "0.69097793", "0.6906865", "0.6906865", "0.6906865", "0.688...
0.75518566
6
Create the attention layer.
def __init__(self, units): super(BahdanauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units) self.W2 = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, input_shape):\n hidden_dim = input_shape[2]\n self.W = self.add_weight(\n name='{}_W'.format(self.name),\n shape=(hidden_dim, hidden_dim,),\n initializer='uniform',\n trainable=True)\n self.b = self.add_weight(\n name='{}_b...
[ "0.6838761", "0.67751503", "0.64022326", "0.6364616", "0.6293086", "0.6272237", "0.6216382", "0.62022656", "0.6196761", "0.6166969", "0.61518437", "0.60484946", "0.60116357", "0.601037", "0.59498703", "0.59429073", "0.59386516", "0.59189075", "0.5914943", "0.5910486", "0.5872...
0.0
-1
Padded shapes used to add padding when batching multiple sequences.
def padded_shapes(self): return (([None], [None]), [None])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paddings(self):\n return tf.constant([[0, 0,],\n [self._settings.half_patch_size, self._settings.half_patch_size],\n [self._settings.half_patch_size, self._settings.half_patch_size],\n [0, 0]])", "def _pad_sequences(s...
[ "0.6650374", "0.664846", "0.6632724", "0.6612361", "0.6600893", "0.6589615", "0.65575624", "0.6527427", "0.64948213", "0.64529824", "0.6439129", "0.63959527", "0.63831156", "0.6278437", "0.6245869", "0.62399006", "0.6205846", "0.6202205", "0.6200044", "0.6191493", "0.61889136...
0.6885178
0
Write json string to file
def save_to_file(cls, list_objs): my_list = [] if list_objs or list_objs is not None: my_list = [obj.to_dictionary() for obj in list_objs] with open(cls.__name__ + '.json', 'w+') as f: f.write(cls.to_json_string(my_list))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def write_json_file(self, fname, content):\n pass", "def write_json_file(self, fname, content):\n pass", "def write_json(self, json_dict):\n ...
[ "0.7886272", "0.7855688", "0.7855688", "0.78360116", "0.77595156", "0.77153814", "0.76603466", "0.7620124", "0.76046497", "0.75864154", "0.75695366", "0.75665456", "0.7564328", "0.7548747", "0.75305486", "0.7521442", "0.75167626", "0.7512159", "0.749917", "0.748097", "0.74701...
0.0
-1
Load a json string from a file and return dictionary
def load_from_file(cls): empty_list = [] try: f = open(cls.__name__ + '.json') f.close() except FileNotFoundError: return empty_list with open(cls.__name__ + ".json", 'r') as f: new_list = cls.from_json_string(f.read()) for i in ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_load(path):\n with open(path) as f:\n dictionary = json.load(f)\n return dictionary", "def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dictionary", "def json_dict(pa...
[ "0.8250063", "0.8087443", "0.8013369", "0.79877234", "0.7986716", "0.79786015", "0.7945774", "0.7933533", "0.78672713", "0.78418934", "0.78179353", "0.781791", "0.78129375", "0.7800302", "0.77821213", "0.77790284", "0.77765054", "0.77741253", "0.7773424", "0.7725738", "0.7716...
0.0
-1
Returns torch.utils.data.DataLoader for train and validation datasets
def get_data_loader(batch_size=10, num_workers=2): data_loader = torch.utils.data.DataLoader(dataset=TempuckeyDataSet(), batch_size=batch_size, shuffle=True, pin_memory=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_loader(dataset, train_batch_size, validation_split=0.2):\n # number of samples in train and test set\n train_len = int(len(dataset) * (1 - validation_split))\n test_len = len(dataset) - train_len\n train_set, test_set = torch.utils.data.random_split(dataset, [train_len, test_len])\n # creat...
[ "0.8141247", "0.81195253", "0.81176543", "0.8069734", "0.8051652", "0.7971867", "0.79161066", "0.7871869", "0.7858872", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7830289", "0.7800721", "0.77973735", "0.77464867"...
0.7130026
64
Export environment variable KUBECONFIG for future calls of OC commands or other API calls
def set_kubeconfig(kubeconfig_path): # Test cluster access log.info("Testing access to cluster with %s", kubeconfig_path) if not os.path.isfile(kubeconfig_path): log.warning("The kubeconfig file %s doesn't exist!", kubeconfig_path) return False os.environ["KUBECON...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment_configuration():\n\n try:\n time_limit = int(os.getenv('AUTOBOT_POST_TIMELIMIT'))\n except TypeError:\n time_limit = None\n\n # if we're using Redis Labs\n redis_cloud_url = os.getenv('REDISCLOUD_URL')\n\n if redis_cloud_url:\n url = urlparse.urlparse(redis_c...
[ "0.625255", "0.6236772", "0.619272", "0.6031845", "0.5993234", "0.5941762", "0.5907925", "0.5897159", "0.5853032", "0.58303845", "0.5820501", "0.581416", "0.57630026", "0.57220846", "0.5691352", "0.5689089", "0.5642033", "0.56186134", "0.56048864", "0.5574101", "0.55545074", ...
0.5056234
77
Gets all the projects in the cluster
def get_projects(self): ret = self.v1_projects.get() return [each.metadata.name for each in ret.items]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n projects = []\n page = 1\n while not len(projects) % 100:\n projects += self._get('/projects?{0}'.format(urllib.urlencode({'per_page': 100, 'page': page})))\n if not projects:\n break\n page += 1\n return projects...
[ "0.7879697", "0.77686447", "0.77153444", "0.7680758", "0.7602172", "0.75627667", "0.7512502", "0.7491586", "0.7475105", "0.7404541", "0.74008924", "0.7400617", "0.73860025", "0.7368386", "0.7344002", "0.7330798", "0.73195624", "0.73041916", "0.7296092", "0.7193902", "0.716374...
0.731302
17
Get the model file if needed and return VGG19 weights and mean pixel
def _get_model_attr(model_dir): global MODEL_URL coco_utils.maybe_download_and_extract(model_dir, MODEL_URL) filename = MODEL_URL.split("/")[-1] filepath = os.path.join(model_dir, filename) if not os.path.exists(filepath): raise IOError("VGG Model not found.") data = scipy.io.loadma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_vgg_model(self):\n vgg = scipy.io.loadmat(self.model_path)\n self.vgg_layers = vgg['layers'][0]", "def get_vgg_model(self):\n # Load our model. We load pretrained VGG, trained on imagenet data\n self.vgg_model = tf.keras.applications.vgg19.VGG19(\n include_top=Fals...
[ "0.6666116", "0.6615207", "0.6589589", "0.64674133", "0.6401307", "0.63752115", "0.6340215", "0.62598217", "0.62562495", "0.62545955", "0.62060434", "0.61868876", "0.6142184", "0.61353844", "0.6123273", "0.6061504", "0.6045226", "0.60201716", "0.60005295", "0.5995933", "0.598...
0.77340966
0
Test that an AWS Lambda function has an IAM role.
def lambda_function_has_iam_role(function_name: str, role_name: str) -> bool: lambda_function = aws_lambda.get_function(FunctionName=function_name) lambda_function_iam_role: list = lambda_function.get('Configuration').get('Role') return role_name in lambda_function_iam_role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasRole():\n conn = iamConn()\n try:\n conn.get_role(getArgs().role_name)\n return True\n except boto.exception.BotoServerError:\n return False", "def use_iam_role():\n session = Session(region_name='us-east-1')\n return session", "def test_present():\n name = \"myrol...
[ "0.6633239", "0.6146971", "0.6142679", "0.61373097", "0.6136447", "0.60688317", "0.59749174", "0.59568065", "0.5915601", "0.58894587", "0.5882287", "0.5863305", "0.58583796", "0.5835306", "0.5812001", "0.580969", "0.5806154", "0.5759594", "0.57495314", "0.5739313", "0.5738318...
0.73985726
0
Test that the library does not create workspace when created normally.
def test_init_does_not_create(self): self.logger.info("STEP: Initialize the workspace library.") self.workspace = Workspace(Mock()) self.logger.info( "STEP: Verify that the workspace library did not create a workspace " "directory." ) self.assertFalse(Pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_workspace():\n\n bambi = create_test_bambi()\n bambi.create_workspace(bambi.name)\n success = check_workspace_existance(bambi)\n\n assert success", "def setUp(self):\r\n # this lets us delete the workspace after its done no matter the\r\n # the rest result\r\n sel...
[ "0.76550514", "0.694893", "0.6925919", "0.6835711", "0.68279076", "0.68279076", "0.68279076", "0.68279076", "0.68279076", "0.68279076", "0.68279076", "0.6710682", "0.6612715", "0.6512675", "0.6457979", "0.63955534", "0.6381671", "0.6371415", "0.63258094", "0.6305037", "0.6298...
0.8485712
0
Test that the compression method raises exception when no workspace exists.
def test_compress_error_when_no_workspace_exists(self): self.logger.info("STEP: Attempt to compress a directory that does not exist.") self.workspace = Workspace(Mock()) with self.assertRaises(Exception): self.logger.info("STEP: Verify that an exception was raised.") self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress(self):\n self.logger.info(\"STEP: Create the workspace directory to be compressed.\")\n workspace = Workspace(Mock)\n directory = Path.cwd().joinpath(\"workspace\")\n directory.mkdir()\n workspace.workspace = directory\n\n # Create a file to verify compre...
[ "0.6787375", "0.6297237", "0.61560434", "0.6064327", "0.6061227", "0.60290605", "0.60023546", "0.59135", "0.5672461", "0.5671975", "0.5646006", "0.56418276", "0.56173575", "0.55956936", "0.5582791", "0.5545369", "0.54625297", "0.5443166", "0.5430896", "0.54288507", "0.5406292...
0.8452976
0
Test that the workspace library can create a test directory as a context manager.
def test_test_directory(self): self.logger.info("STEP: Initialize the workspace.") with Workspace(Mock()) as workspace: self.workspace = workspace self.logger.info("STEP: Enter test directory in a context manager.") with workspace.test_directory("dir") as directory: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_context(self):\n self.logger.info(\"STEP: Initialize the workspace library as a context manager.\")\n with Workspace(Mock()) as workspace:\n self.workspace = workspace\n self.logger.info(\n \"STEP: Verify that the workspace library created the main \"\n ...
[ "0.7745369", "0.73142076", "0.7248098", "0.72224647", "0.7123573", "0.7123573", "0.7123573", "0.7123573", "0.7123573", "0.7123573", "0.7123573", "0.712129", "0.7114458", "0.70451933", "0.6912516", "0.68925565", "0.6889198", "0.68644106", "0.6732693", "0.6629522", "0.6591479",...
0.81470317
0
Test that test directory raises exception if not workspace exist.
def test_test_directory_no_workspace(self): self.logger.info("STEP: Enter a test directory without a workspace.") self.workspace = Workspace(Mock()) self.logger.info("STEP: Verify that an exception was raised.") with self.assertRaises(Exception): with self.workspace.test_dire...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_does_not_create(self):\n self.logger.info(\"STEP: Initialize the workspace library.\")\n self.workspace = Workspace(Mock())\n\n self.logger.info(\n \"STEP: Verify that the workspace library did not create a workspace \"\n \"directory.\"\n )\n s...
[ "0.7469659", "0.7394075", "0.73671615", "0.72187626", "0.70348716", "0.6989729", "0.696854", "0.6861252", "0.68519676", "0.67864656", "0.67566067", "0.6753539", "0.67277706", "0.66922146", "0.66518694", "0.66272104", "0.6620235", "0.6584976", "0.6567438", "0.6564178", "0.6547...
0.8372566
0
To compute energy function for a fully visible Boltzmann machine. energy function E(x) = xT W x bT x.
def energy_function(self, x): return -T.dot(T.transpose(x), T.dot(self.W, x)) -\ T.dot(T.transpose(self.b), x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].T.val_SI)) / 2\n\n return (i[0] * (o[2] - i[2]) -\n self.A.val * (\n self.E.val...
[ "0.7098127", "0.6886161", "0.6788846", "0.6755604", "0.6734077", "0.6613271", "0.6595658", "0.6581154", "0.64968556", "0.64945894", "0.6483825", "0.6443397", "0.64334285", "0.641363", "0.6412701", "0.6389371", "0.6367572", "0.63647443", "0.6358525", "0.635569", "0.6305159", ...
0.7693399
0
Darknet Convolution2D followed by BatchNormalization and LeakyReLU.
def DarknetConv2D_BN_Leaky(*args, **kwargs): no_bias_kwargs = {'use_bias': False} no_bias_kwargs.update(kwargs) return compose(DarknetConv2D(*args, **no_bias_kwargs), tf.keras.layers.BatchNormalization(), tf.keras.layers.LeakyReLU(alpha=0.1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def darknet_CBL(*args, **kwargs):\n\n no_bias_kwargs = {'use_bias': False} # 没懂为啥用 no_bias\n no_bias_kwargs.update(kwargs)\n return compose(\n darknet_Conv2D(*args, **no_bias_kwargs),\n custom_batchnormalization(),\n LeakyReLU(alpha=0.1)\n )", "def darknet_CBM(*args, **kwargs):\...
[ "0.72769314", "0.69703734", "0.68800706", "0.6775198", "0.66250277", "0.6619191", "0.6596903", "0.6548156", "0.64908445", "0.6438889", "0.6412645", "0.6403083", "0.6384412", "0.6384063", "0.6368069", "0.63608307", "0.63480204", "0.6341501", "0.6320468", "0.6317373", "0.631605...
0.6808079
3
Input n>=6, Returns a list of primes, 2 <= p < n
def primes2(n): n, correction = n-n%6+6, 2-(n%6>1) sieve = [True] * (n/3) for i in xrange(1,int(n**0.5)/3+1): if sieve[i]: k=3*i+1|1 sieve[ k*k/3 ::2*k] = [False] * ((n/6-k*k/6-1)/k+1) sieve[k*(k-2*(i&1)+4)/3::2*k] = [False] * ((n/6-k*(k-2*(i&1)+4)/6-1)/k+1) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes(n):\n\n return list(primes_sieve(n))", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n if is_prime(i):\n out_list.append(i)\n return out_list", "def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i...
[ "0.85413843", "0.84438545", "0.84063387", "0.8358301", "0.82609856", "0.8234336", "0.8213978", "0.82113606", "0.82060546", "0.8170585", "0.81014943", "0.8003272", "0.7959604", "0.79537195", "0.79436857", "0.7939605", "0.78893626", "0.78684366", "0.78684366", "0.78623396", "0....
0.7611071
35
Compute the weighted quantile of a 1D numpy array.
def quantile_1d(data, weights, quantile_limit): data = np.asarray(data) weights = np.asarray(weights) if data.ndim != 1: raise TypeError("data must be a one dimensional array") if data.shape != weights.shape: raise TypeError("the length of data and weights must be the same") if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantile(data, weights, quantile_limit):\n data = np.asarray(data)\n # TO DO: Allow to specify the axis\n if data.ndim == 0:\n raise TypeError(\"data must have at least one dimension\")\n\n elif data.ndim == 1:\n return quantile_1d(data, weights, quantile_limit)\n\n # elif data.ndi...
[ "0.7217673", "0.6720041", "0.67164385", "0.67164385", "0.6690575", "0.6687368", "0.6686444", "0.66836166", "0.660251", "0.6537799", "0.6504308", "0.6396063", "0.6338247", "0.62059075", "0.6187356", "0.613913", "0.61195487", "0.6085778", "0.6059164", "0.6054292", "0.5957532", ...
0.71212786
1
Weighted quantile of an array with respect to the last axis.
def quantile(data, weights, quantile_limit): data = np.asarray(data) # TO DO: Allow to specify the axis if data.ndim == 0: raise TypeError("data must have at least one dimension") elif data.ndim == 1: return quantile_1d(data, weights, quantile_limit) # elif data.ndim > 1: shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantile_ndim(arr, quantiles):\n return pipe(\n zip(arr, quantiles),\n fmap(lambda x: np.quantile(*x, axis=-1, interpolation=\"nearest\").T),\n np.stack,\n )", "def _weighted_quantile_unchecked(\n a, q, w=None, axis=None, out=None, \n overwrite_input=False, interpolat...
[ "0.67408216", "0.65690666", "0.65463793", "0.64544874", "0.64419645", "0.6389295", "0.6305194", "0.6303884", "0.6303884", "0.62947106", "0.6078249", "0.6043367", "0.5964708", "0.5887918", "0.5854728", "0.5831092", "0.58070064", "0.57290864", "0.5684102", "0.56683034", "0.5658...
0.6951748
0
Creates a safe name to run tests. This method avoids the 60' delay between deleted queues.
def generate_name(self): name = self._generate_test_name() while self.exists(name): name = self._generate_test_name() return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_make_unique_name():\n def _make_unique_name(prefix):\n return f\"{prefix}{time.time_ns()}\"\n return _make_unique_name", "def _generate_name(name):\n return 'test-%s-%s-%s' % (time.strftime('%Y%m%d%H%M%S'),\n random.randint(0, 999), name)", "def name_gen...
[ "0.71358895", "0.7127008", "0.69525456", "0.677186", "0.64615136", "0.63748604", "0.63429964", "0.62733775", "0.6244938", "0.62149596", "0.613629", "0.6111109", "0.6109556", "0.6102906", "0.60510844", "0.60080934", "0.5986134", "0.59643", "0.58902675", "0.58822614", "0.586114...
0.6915452
3
Initializes global _vs_xid_names to map vserver xids to slice names.
def init_vserver_xid_names(): global _vs_xid_names collectd.info('mlab: requesting vs_xid_names.') _vs_xid_names = read_vsys_data('vs_xid_names', _VSYS_FRONTEND_VERSION)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_segs_names(self):\n segs_names = np.zeros(self.X.shape[0], dtype=np.int8)\n self.segs_names_unique = []\n for iseg, seg in enumerate(self.segs):\n segs_names[seg] = iseg\n self.segs_names_unique.append(iseg)\n self.segs_names = segs_names", "def set_segs_...
[ "0.5636893", "0.5522153", "0.52812475", "0.52301073", "0.51671296", "0.5112816", "0.5109894", "0.5021759", "0.49783167", "0.4969676", "0.49648255", "0.49628487", "0.4956506", "0.49513608", "0.4946688", "0.490924", "0.49030608", "0.48704565", "0.48351312", "0.48341462", "0.482...
0.8509733
0
Function that sets log levels and format strings. Checks for the OT_API_LOG_LEVEL environment variable otherwise defaults to INFO
def log_init(level_name: str) -> None: fallback_log_level = "INFO" ot_log_level = level_name.upper() if ot_log_level not in logging._nameToLevel: sys.stderr.write( f"OT Log Level {ot_log_level} not found. " f"Defaulting to {fallback_log_level}\n" ) ot_log_leve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_info():\n set_log_level_format(logging.INFO,\n '%(asctime)s %(levelname)s:%(name)s:%(message)s')", "def set_log_level_api(self, value: t.Union[str, int] = LOG_LEVEL_API) -> None:\n self.API_LOG_LEVEL: str = logs.str_level(value)\n for obj in self.API_CACHE.val...
[ "0.66874826", "0.6589748", "0.6513537", "0.64591783", "0.6333217", "0.6328598", "0.63138473", "0.62733537", "0.6239347", "0.62277675", "0.62011147", "0.6188797", "0.61739117", "0.61598855", "0.61595464", "0.61410654", "0.6134573", "0.61194736", "0.61183256", "0.6086732", "0.6...
0.6268328
8
Based on the all given properties of Cost as parameters this method modifys the properties of Cost object in database.
def ModifyTheFullRowOfCost(idOfCost, registrationDate, dateOfPayment, amount, description, category): logs.logger.debug( "Start to modify the properties of Cost object in database " "based on the all given properties of Cost.") try: modifiedCost = session.quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_costs(self) -> None:\n self[\"glider cost\"] = (\n self[\"glider base mass\"] * self[\"glider cost slope\"]\n + self[\"glider cost intercept\"]\n )\n self[\"lightweighting cost\"] = (\n self[\"glider base mass\"]\n * self[\"lightweighting\"]\...
[ "0.60249054", "0.5900154", "0.5779519", "0.5745271", "0.57116735", "0.5698654", "0.5648234", "0.5627256", "0.54596466", "0.54413337", "0.5384032", "0.53756505", "0.53339744", "0.532222", "0.5310683", "0.5294133", "0.52864933", "0.52797604", "0.5244163", "0.5234909", "0.523311...
0.72679263
0
Based on the ID of the Cost object the registration date is modified in database.
def ModifyRegistrationDateOfCost(idOfCost, registrationDate): logs.logger.debug( "Start to modify registration date of Cost based on the ID.") try: modifiedCost = session.query(Cost.Cost).filter( Cost.Cost.id == idOfCost).one() modifiedCost.registrationDate = registrationDat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ModifyDateOfPaymentOfCost(idOfCost, dateOfPayment):\n\n logs.logger.debug(\n \"Start to modify payment date of Cost based on the ID.\")\n try:\n modifiedCost = session.query(Cost.Cost).filter(\n Cost.Cost.id == idOfCost).one()\n modifiedCost.dateOfPayment = dateOfPayment\n...
[ "0.69081503", "0.6564969", "0.5898605", "0.58336765", "0.5688528", "0.5628036", "0.56229764", "0.5610867", "0.55934894", "0.54194903", "0.54046184", "0.538428", "0.5312994", "0.53014374", "0.52989376", "0.5288772", "0.52676433", "0.52676433", "0.52541226", "0.52541226", "0.52...
0.7674434
0
Based on a defined month adds all amount of Cost objects.
def SumCostByMonth(year, numberOfMonth): logs.logger.debug( "Start to adds all amount of Cost objects based on a defined month.") try: num_days = calendar.monthrange(year, numberOfMonth)[1] searchedCostByMonthFromDB = GetAllCostByDateOfPaymentBandFromDB( date(year, numberOfM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumCostByMonthPerCategory(year, numberOfMonth, category):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects based on the month of payment date and on the category.\")\n try:\n num_days = calendar.monthrange(year, numberOfMonth)[1]\n searchedCostByMonthFromDB = GetAl...
[ "0.71988547", "0.67182624", "0.6701152", "0.647716", "0.6454659", "0.6191727", "0.6183539", "0.60424227", "0.5972429", "0.59429646", "0.58308154", "0.5828105", "0.5822306", "0.5822099", "0.57874244", "0.57857776", "0.5773494", "0.57730544", "0.57183385", "0.5656412", "0.56540...
0.8204188
0
Based on the payment date and on the category adds all amount of Cost objects.
def SumCostByDayPerCategory(day, category): logs.logger.debug( "Start to adds all amount of Cost objects based on the payment date and on the category") try: searchedCostByDayPerCategoryFromDB = session.query( Cost.Cost).filter(Cost.Cost.dateOfPayment == day).filter( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumCostByDay(dateOfPayment):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects based on the payment date.\")\n try:\n searchedCostByDayFromDB = GetAllCostByDateOfPaymentFromDB(dateOfPayment)\n sumTotal = 0\n for item in searchedCostByDayFromDB:\n s...
[ "0.6924593", "0.685676", "0.67877376", "0.67533684", "0.66822225", "0.62845093", "0.6238191", "0.6173786", "0.6105009", "0.60480267", "0.5607281", "0.55802166", "0.5459683", "0.54464096", "0.54020333", "0.5400573", "0.53808737", "0.5365998", "0.5345533", "0.53190535", "0.5303...
0.6626103
5
Based on the month of payment date and on the category adds all amount of Cost objects.
def SumCostByMonthPerCategory(year, numberOfMonth, category): logs.logger.debug( "Start to adds all amount of Cost objects based on the month of payment date and on the category.") try: num_days = calendar.monthrange(year, numberOfMonth)[1] searchedCostByMonthFromDB = GetAllCostByDateOf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumCostByMonth(year, numberOfMonth):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects based on a defined month.\")\n try:\n num_days = calendar.monthrange(year, numberOfMonth)[1]\n searchedCostByMonthFromDB = GetAllCostByDateOfPaymentBandFromDB(\n date(y...
[ "0.73662865", "0.67063445", "0.6665996", "0.6451493", "0.64312774", "0.6418048", "0.63532764", "0.6071058", "0.59187526", "0.5883243", "0.56107855", "0.560603", "0.55616343", "0.55352634", "0.54953206", "0.54837793", "0.54656994", "0.543895", "0.54066986", "0.53911537", "0.53...
0.7708099
0
Between two payment date and on the category adds all amount of Cost objects.
def SumCostByBetweenDatesPerCategory(startDate, endDate, category): logs.logger.debug( "Start to adds all amount of Cost objects between two payment date and on the category") try: searchedCostByBetweenDatesFromDB = GetAllCostByDateOfPaymentBandFromDB( startDate, endDate) su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumCostByBetweenDates(startDate, endDate):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects between two dates.\")\n try:\n searchedCostByBetweenDatesFromDB = GetAllCostByDateOfPaymentBandFromDB(\n startDate, endDate)\n sumTotal = 0\n for item in s...
[ "0.711402", "0.66217005", "0.650447", "0.6427047", "0.6404306", "0.62961364", "0.60495865", "0.58920693", "0.5763607", "0.56230205", "0.5616452", "0.55582434", "0.5501523", "0.5338119", "0.53262866", "0.5322487", "0.5290364", "0.5265957", "0.52578205", "0.52472043", "0.523393...
0.76470697
0
Utility function to recursively flatten a list of lists. Each element in the list can be another list, tuple, set, or np.ndarray, and can have variable sizes.
def flatten_array(arr): flat_array = [] for item in arr: if isinstance(item, (list, tuple, set, np.ndarray)): flat_array.extend(flatten_array(item)) else: flat_array.append(item) return np.array(flat_array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(list_to_flatten): \n flattened_list = []\n for item in list_to_flatten:\n if isinstance(item, list) or isinstance(item, tuple):\n flattened_list += flatten(item)\n else:\n flattened_list.append(item)\n return flattened_list", "def flatten(list_of_lists):\n...
[ "0.841995", "0.8187215", "0.8173554", "0.8166283", "0.81570935", "0.81241864", "0.8121669", "0.8055444", "0.804401", "0.8041065", "0.80381835", "0.8028857", "0.8025141", "0.8018862", "0.80187315", "0.8013674", "0.8009298", "0.79646903", "0.7957841", "0.7921238", "0.7912365", ...
0.68784666
93
Instantiate linkedlist object with optional iterable.
def __init__(self, iterable=None): self.head = None if iterable and hasattr(iterable, "__iter__"): for value in iterable: self.push(value) # for py27 elif iterable and isinstance(iterable, str): for char in iterable: self.push(char)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, iterable=None):\n self.linked_list = LinkedList()\n if iterable:\n for item in iterable:\n self.push(item)", "def __init__(self, maybe_an_iterable=None):\n try:\n self._container = DblLinkedList(maybe_an_iterable[::-1])\n except ...
[ "0.79081327", "0.7844683", "0.78046656", "0.77586704", "0.75485325", "0.7460365", "0.7455654", "0.74206835", "0.7040529", "0.70317256", "0.6584406", "0.6528608", "0.64787525", "0.6466624", "0.64558196", "0.6442649", "0.6435665", "0.64295214", "0.630783", "0.63022935", "0.6293...
0.69708353
10
Test the minimum pressure value.
def test_min_pressure_value(self): self.assertEqual("%0.7f" % self.PminValue, str(0.0101325))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def native_min_value(self) -> float:\n return TEMP_MINIMUM", "def _minimum(self) -> float:\n if self._type == \"power\":\n return 1.0\n elif self._type == \"setpoint\":\n return self._product.get_data_config_json()[\"_value_setpoint_min\"]\n elif self._type == \"...
[ "0.6885027", "0.67346054", "0.6727807", "0.6621602", "0.65870225", "0.65331954", "0.6510285", "0.650445", "0.6467488", "0.6465689", "0.64651674", "0.64651674", "0.64651674", "0.64407027", "0.64407027", "0.6391949", "0.6391949", "0.63723016", "0.6370906", "0.6358931", "0.63236...
0.79551804
0
Test the max grain size value.
def test_maximum_grain_size_value(self): self.assertEqual(self.maximum_grain_size_value, 0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_max_size(self, max_size):\n return self.polyp_size and sorted(self.polyp_size, reverse=True)[0].get_max_dim() < max_size", "def graph_data_size_max(self) -> int:\n return int(self.graph_tuple_stats.graph_data_size_max or 0)", "def test_size_too_big(self):\n max_size = max(settings.MISA...
[ "0.65336424", "0.6410251", "0.62790006", "0.61541957", "0.6127388", "0.60831994", "0.6059759", "0.60422474", "0.6034238", "0.6019041", "0.6011512", "0.5976169", "0.5943377", "0.5937209", "0.5922372", "0.59214103", "0.5911295", "0.58891755", "0.5878956", "0.586951", "0.5857870...
0.83903146
0
Test loading a YAML file generated by RMG v 2.4.1 and by a more recent version
def test_loading_different_versions_of_yaml(self): arkane_spc_v_241 = ArkaneSpecies.__new__(ArkaneSpecies) arkane_spc_v_241.load_yaml(path=os.path.join(self.data_path, 'vinoxy_v_2.4.1.yml')) self.assertIsInstance(arkane_spc_v_241, ArkaneSpecies) # checks make_object self.assertEqual(ark...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_yaml_spec(self):\n pass", "def test_from_yaml_file(self, use_c_lib_yaml: bool) -> None:\n try:\n config.parsers.yaml.use_c_lib_yaml = use_c_lib_yaml\n reference = self.EXAMPLE_ENTRY_DICT.copy()\n entries = YAMLParser().parse(self.EXAMPLE_YAML_FILE)\n ...
[ "0.73822194", "0.72066516", "0.71713746", "0.7001893", "0.6947713", "0.69349355", "0.6924528", "0.6912414", "0.68982357", "0.6885027", "0.68657124", "0.6864976", "0.6807025", "0.6800187", "0.67999816", "0.677005", "0.67684513", "0.676549", "0.67604655", "0.67563874", "0.67268...
0.646005
37
Test that the correct mass/number/isotope is returned from get_element_mass
def test_get_mass(self): self.assertEqual(get_element_mass(1), (1.00782503224, 1)) # test input by integer self.assertEqual(get_element_mass('Si'), (27.97692653465, 14)) # test string input and most common isotope self.assertEqual(get_element_mass('C', 13), (13.00335483507, 6)) # test specifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mass(element):\n return pt.elements.isotope(element).mass", "def get_mass(elem):\n return mass[get_num(elem)]", "def test_get_element_mass_from_xyz(self):\n mass_list = converter.get_element_mass_from_xyz({'symbols': ('N', 'H', 'H', 'N', 'H', 'H', 'N', 'H'),\n ...
[ "0.76347417", "0.705843", "0.7053579", "0.68898815", "0.67189646", "0.6556634", "0.6464246", "0.6450774", "0.6390924", "0.6382352", "0.6374204", "0.62843245", "0.62785864", "0.6229998", "0.62049896", "0.61733806", "0.61306816", "0.61259604", "0.611668", "0.6092173", "0.606704...
0.873458
0
Initializes this PlaylistGUI. Sets the window title, geometry, and the main layouts.
def initialize(self): self.setWindowTitle("Playlist Maker") self.setGeometry(0,0, 800, 494) self.mbox = QVBoxLayout() self.hbox = QHBoxLayout() self.hbtnbox = QHBoxLayout()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initGUI(self):\n\n\t\t# Set main frame's location \n\t\tself.grid(row=0, column=0, sticky=\"nsew\")\n\n\t\t# Set path entry frame and its location\n\t\tself.entryFrame = Frame(self, relief = RAISED, borderwidth = 1)\n\t\tself.entryFrame.pack(fill = BOTH, expand = False)\n\t\t# Make label\n\t\tif self.message:\...
[ "0.7175063", "0.70562327", "0.7044105", "0.7019141", "0.699656", "0.6986893", "0.69540864", "0.6930915", "0.6849292", "0.6785272", "0.6733232", "0.67235285", "0.6716513", "0.66891736", "0.667368", "0.66723263", "0.6661534", "0.66432154", "0.6568791", "0.655782", "0.6548638", ...
0.8233761
0
Adds a QTreeView to this PlaylistGUI. For storing songs found in each playlist.
def add_tree_view(self): self.data_view = QTreeView() self.data_view.setRootIsDecorated(False) self.data_view.setAlternatingRowColors(True) self.mbox.addWidget(self.data_view) self.data_layout = QHBoxLayout() self.data_layout.addWidget(self.data_view) self.model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, parent):\n self.widget = QtGui.QTreeView(parent)", "def init_file_tree(self):\r\n # layout for the file explorer\r\n path=QtCore.QDir.currentPath()\r\n\r\n # file system model init\r\n self.model = QtWidgets.QFileSystemModel()\r\n self.model.setRootPath(...
[ "0.6952604", "0.5760132", "0.55429035", "0.5430844", "0.541225", "0.53597796", "0.53586644", "0.5349673", "0.5330964", "0.53210133", "0.5289308", "0.5275016", "0.5265651", "0.522598", "0.5225277", "0.52200687", "0.5205795", "0.51722187", "0.51661867", "0.5155859", "0.5153015"...
0.70616525
0
Adds a QLineEdit into this PlaylistGUI. Where you can enter playlist to edit, create, or play.
def add_pl_line_edit(self): self.pl_line_edit = QLineEdit() self.pl_line_edit.setPlaceholderText("Enter name of new playlist...") self.hbox.addWidget(self.pl_line_edit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_artist_line(self, itemid, first_name='', last_name=''):\n hbox = qtw.QHBoxLayout()\n hbox.addWidget(qtw.QLabel(f'{itemid:>3}.', self))\n win_f = qtw.QLineEdit(first_name, self)\n hbox.addWidget(win_f)\n win_l = qtw.QLineEdit(last_name, self)\n win_l.setMaximumWidth...
[ "0.6887151", "0.64892423", "0.63797873", "0.6328601", "0.6280455", "0.611519", "0.60480934", "0.6012775", "0.58603996", "0.5847256", "0.584692", "0.58031225", "0.57658106", "0.5765581", "0.5734947", "0.5722022", "0.5693516", "0.5646986", "0.5608276", "0.556886", "0.55006576",...
0.84675145
0
By default, the final controller tried to fulfill the request when no other routes match. It may be used to display a template
def view(self, url): abort(404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_route(self, request, *args, **kwargs):\n raise Http404()", "def model_resource_default_view(context, request):\n return HTTPFound(request.resource_url(context, \"show\"))", "def view(obj, request):\n return HTTPNotFound()", "def serve(self, request, *args, **kwargs):\n raise Htt...
[ "0.65651643", "0.6494993", "0.6215296", "0.6169746", "0.6169746", "0.6169746", "0.6169746", "0.6169746", "0.60814184", "0.6038033", "0.6011612", "0.59923565", "0.5930444", "0.5929495", "0.59292877", "0.59292877", "0.59292877", "0.59292877", "0.59292877", "0.5919102", "0.58756...
0.58099407
24
return the Cauchy stress tensor.
def stress_tensor(self): s = "::: forming the Cauchy stress tensor :::" print_text(s, self.color) epi = self.strain_rate_tensor(self.U3) I = Identity(3) sigma = 2*self.eta*epi - self.p*I return sigma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deviatoric_stress_tensor(self):\n s = \"::: forming the deviatoric part of the Cauchy stress tensor :::\"\n print_text(s, self.color)\n epi = self.strain_rate_tensor()\n tau = 2*self.eta*epi\n return tau", "def effective_stress(self):\n tau = self.deviatoric_stress_tensor()\n tu_xx ...
[ "0.7720255", "0.6816555", "0.61346936", "0.60173094", "0.5991823", "0.59161", "0.58430916", "0.5754936", "0.5753838", "0.5712692", "0.56808484", "0.567674", "0.5660551", "0.5656851", "0.5645711", "0.5629031", "0.5620341", "0.56136787", "0.56124234", "0.5552848", "0.5528905", ...
0.8528255
0
return the Cauchy stress tensor.
def deviatoric_stress_tensor(self): s = "::: forming the deviatoric part of the Cauchy stress tensor :::" print_text(s, self.color) epi = self.strain_rate_tensor() tau = 2*self.eta*epi return tau
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stress_tensor(self):\n s = \"::: forming the Cauchy stress tensor :::\"\n print_text(s, self.color)\n epi = self.strain_rate_tensor(self.U3)\n I = Identity(3)\n\n sigma = 2*self.eta*epi - self.p*I\n return sigma", "def effective_stress(self):\n tau = self.deviatoric_stress_tensor(...
[ "0.85285074", "0.68166596", "0.6135397", "0.60179394", "0.5991891", "0.5916772", "0.5843015", "0.5754897", "0.5753841", "0.5713693", "0.5683746", "0.5675579", "0.56576824", "0.5656627", "0.5646859", "0.56279045", "0.5621266", "0.56133956", "0.561315", "0.5555086", "0.55283254...
0.7718883
1
Sets the status of the given setup to "final".
def set_final(self, setup_id): setup = Setup.objects.get(id=setup_id) if setup.status == "draft": try: self.save_setup_info(setup) except: return "failed: failed building gridpoints. (Check your subspaces values)" success_msg = SetupSer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_status(self, final_status):\n\n self._final_status = final_status", "def mark_as_done(self):\n self.status = \"DONE\"", "def set_goal_done(self):\n self.has_goal = False\n self.last_goal_wait = False", "def _updateStatus(self, result):\n\n if result.status is not ...
[ "0.7301475", "0.5818895", "0.58095807", "0.5587667", "0.55574083", "0.5508082", "0.5473835", "0.54340243", "0.5416624", "0.53765315", "0.53705096", "0.5364372", "0.5360547", "0.5329847", "0.5301774", "0.5299898", "0.524629", "0.520872", "0.5195455", "0.5190328", "0.51788074",...
0.7396222
0
Load the tokenizer for the utterances and the encoder for the labels.
def __loadTokenizerAndEncoder(fileName): y, x = __prepareDataSet(fileName) tokenizer = Tokenizer(num_words=max_words) tokenizer.fit_on_texts(x) encoder = LabelEncoder() encoder.fit(y) return tokenizer, encoder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(self):\n\n x = [] # input documents\n for file_path in glob.glob(self.train_dir + '*.txt'):\n file_as_string = open(file_path).read()\n x.append(file_as_string)\n\n self.tokenizer.fit_on_texts(x)\n print('input vocabulary size:', len(self.tokenizer.word_index))\n pickle_file =...
[ "0.66955256", "0.65680724", "0.65402794", "0.6535586", "0.6391296", "0.6347114", "0.6071331", "0.60369986", "0.59917134", "0.59150577", "0.5912805", "0.5853261", "0.5820278", "0.5784508", "0.57844615", "0.57640827", "0.57464874", "0.57320446", "0.56669", "0.56596166", "0.5632...
0.73020977
0
Closes the connection and cleans up.
def close(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n try:\n self.connection.Close()\n del self.connection\n except:\n pass", "def close(self):\n self.connection = None", "def close(self): \n\t\tself.connection = None", "def _close_connection(self):\n if self.connection:\n ...
[ "0.83457476", "0.83215004", "0.8262493", "0.8239899", "0.8230114", "0.81023765", "0.81023765", "0.81022584", "0.8072292", "0.8072292", "0.8072292", "0.8072292", "0.8072292", "0.8072292", "0.8072292", "0.80517155", "0.80507255", "0.8042944", "0.8004673", "0.7970164", "0.795717...
0.0
-1
Gets next item from the underlying iterator, and if filter_func returns True on it, applies casting_func to it and returns it.
def next(self): while True: source_next = self.source_iter.next() if self.filter_func is None or self.filter_func(source_next): if self.casting_func is not None: return self.casting_func(source_next) else: return so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_item(self, func):\n return next((_(x) for x in self._ if func(x)), None)", "def filter(self, predicate):\n def _filter(iterator):\n while True:\n item = next(iterator)\n if predicate(item):\n return item\n return self.__cla...
[ "0.59523964", "0.57848763", "0.56917626", "0.565095", "0.5538673", "0.551973", "0.5506931", "0.53716016", "0.53715134", "0.5350799", "0.53417265", "0.5320681", "0.5287989", "0.5286814", "0.52750415", "0.52696663", "0.5250515", "0.5171896", "0.5169647", "0.51612663", "0.513912...
0.76526195
0
Returns the sample mean and variance of x using the ML estimator of the sample variance.
def sample_mean_var_ml(x): n = len(x) assert(n > 0) if n == 1: return x[0], 0 s = 0.0 ss = 0.0 for i in x: s += i ss += i*i mu = s/n var = (ss/n) - mu*mu return mu, var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_mean_var_unbiased(x):\n n = len(x)\n assert(n > 0)\n if n == 1:\n return x[0], float('Inf')\n mean, v = sample_mean_var_ml(x)\n var = v*n/(n-1)\n return mean, var", "def mean_var_sd(x):\n n = x.size\n assert 2 <= n\n mean = x.sum() / n\n diff = x - mean\n var = ...
[ "0.7311148", "0.6917866", "0.68134665", "0.681155", "0.6786188", "0.6786188", "0.6786188", "0.66726804", "0.6667326", "0.66200227", "0.6536847", "0.65145123", "0.65144366", "0.6464467", "0.64629585", "0.6453864", "0.64443445", "0.6436601", "0.6414344", "0.63321227", "0.625618...
0.8163022
0
Project points on to a certain plane
def proj_to_plane(norm, d, pts): a = norm[0] b = norm[1] c = norm[2] p = [] for i in range(len(pts)): x_p = pts[i][0] y_p = pts[i][1] z_p = pts[i][2] if a != 0: x_0 = (b * b + c * c) * x_p - a * b * y_p - a * c * z_p - a * d y_0 = (b * 1.0 /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_points_plane(points, plane):\n return [project_point_plane(point, plane) for point in points]", "def project_point_plane(point, plane):\n base, normal = plane\n normal = normalize_vector(normal)\n vector = subtract_vectors(point, base)\n snormal = scale_vector(normal, dot_vectors(vecto...
[ "0.769581", "0.76754713", "0.72310346", "0.7029089", "0.6976901", "0.68996334", "0.6822846", "0.6788213", "0.6744013", "0.67265934", "0.67129856", "0.659991", "0.6529723", "0.6515409", "0.64884156", "0.646591", "0.6450414", "0.6416574", "0.6393952", "0.63547456", "0.63255614"...
0.6806934
8
Transfer dcm to quaternion
def coor_to_quater(coordinate): rotation = np.transpose(coordinate) r = R.from_dcm(rotation) q = r.as_quat() # m = r.as_dcm() return q.tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dcm_to_quaternions(dcm):\n trace = np.trace(dcm)\n b_2 = (1/4)*np.array([(1+trace), (1 + 2*dcm[0, 0] - trace), (1 + 2*dcm[1, 1] - trace), (1 + 2*dcm[2, 2] - trace)])\n argmax = np.argmax(b_2)\n b = np.zeros(4)\n b[argmax] = np.sqrt(b_2[argmax])\n\n # There is probably a cleaner way to do thes...
[ "0.7474201", "0.7113331", "0.7103733", "0.70882505", "0.69679654", "0.68895775", "0.67082304", "0.67016673", "0.66017455", "0.65504813", "0.6456338", "0.64162135", "0.635974", "0.6248495", "0.62439275", "0.61844575", "0.614215", "0.6140531", "0.6067424", "0.60571414", "0.6037...
0.6115136
18
Return the output of the wrapped PyTorch model for the given input, along with a callback to handle the backward pass.
def forward(model: Model, X: Any, is_train: bool) -> Tuple[Any, Callable]: convert_inputs = model.attrs["convert_inputs"] convert_outputs = model.attrs["convert_outputs"] Xtorch, get_dX = convert_inputs(model, X, is_train) Ytorch, torch_backprop = model.shims[0](Xtorch, is_train) Y, get_dYtorch = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, input):\n if isinstance(input.data, torch.cuda.FloatTensor) and \\\n self.num_gpu > 1:\n out = nn.parallel.data_parallel(\n self.layer, input, range(self.num_gpu))\n else:\n out = self.layer(input)\n\n return out.view(-1)", ...
[ "0.6441277", "0.6422015", "0.6415654", "0.6316734", "0.63101536", "0.63079363", "0.62927705", "0.62682676", "0.62682676", "0.62682676", "0.62627226", "0.62627226", "0.6252994", "0.6244344", "0.6242637", "0.624188", "0.6230361", "0.61971253", "0.61781", "0.61641717", "0.615134...
0.5710763
76
The sequence of operators which `from_op` could be mutated to.
def _to_ops(from_op): for to_op in OPERATORS: if to_op and isinstance(from_op, ast.Not): # 'not' can only be removed but not replaced with # '+', '-' or '~' b/c that may lead to strange results pass elif isinstance(from_op, ast.UAdd) and (to_op is None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fanins(op):\n return {t.op for t in op.inputs}", "def orderOp(self, stream):\n ops = []\n if stream.op(OP_ORDER):\n for op in stream.ops['ops']:\n if op.startswith(OP_ORDER):\n ops.append( (self.leftStream(stream, op), op) )\n return ops", ...
[ "0.6275297", "0.60522527", "0.58557343", "0.5728362", "0.570031", "0.5670316", "0.558716", "0.555777", "0.5552749", "0.5547678", "0.553837", "0.54812574", "0.54162633", "0.53969145", "0.5386381", "0.53822255", "0.53665847", "0.53635806", "0.53578496", "0.5352245", "0.5341275"...
0.7405146
0
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.82229227", "0.8222085", "0.8222085", "0.8222085", "0.8222085", "0.819543", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "0.8162872", "...
0.7127908
60
Return the Hamming distance between equallength sequences
def hamming_distance(s1, s2, hamming_distance = 3): s1 = str(s1) s2 = str(s1) if len(s1) != len(s2): s1 = replenish_int(s1, 6) s2 = replenish_int(s2, 6) dis = sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2)) if dis <= hamming_distance: '表示海明距离在 3 以内' return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hamming_distance(s1, s2):\n if len(s1) != len(s2):\n raise ValueError(\"Undefined for sequences of unequal lenght.\")\n return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2))", "def __hamming_distance(s1, s2):\n if len(s1) != len(s2):\n raise ValueError(\"Undefined for sequences of...
[ "0.7564989", "0.7553281", "0.7524423", "0.7510748", "0.7498424", "0.73834527", "0.72914463", "0.7283258", "0.72027653", "0.719384", "0.7186409", "0.7184023", "0.7142286", "0.7130274", "0.71298635", "0.70760477", "0.70056623", "0.6964983", "0.69032145", "0.6894841", "0.6880024...
0.6547985
36
get random number from array; use uniformal distribution
def _get_random_number(self,min_max_array): # check length of array and caluclate random number ############################################################ if len(min_max_array) > 1: return random.uniform(min_max_array[0],min_max_array[1]) else: return min_max_array[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_normal():\r\n return inverse_normal_cdf(random.random())", "def random_normal():\n return inverse_normal_cdf(random.random())", "def sample(self):\n u = np.asarray(np.random.uniform())\n return self.invert(u)", "def random():\r\n return R.NextDouble()", "def random_distrib...
[ "0.70841587", "0.7003696", "0.69446665", "0.6802248", "0.67958033", "0.67753094", "0.67753094", "0.6769705", "0.67395395", "0.66357416", "0.6596956", "0.6581757", "0.6581757", "0.65577084", "0.65475714", "0.6546282", "0.65425235", "0.64989555", "0.64801204", "0.6461034", "0.6...
0.6166124
48
Test successful getting escalated articles
def test_getting_of_an_escalated_article_with_admin(self): token = self.user3.token() self.client.credentials( HTTP_AUTHORIZATION='Bearer ' + token) self.escalate_an_article_successfully() resp = self.get_article() self.assertEqual(resp.status_code, status.HTTP_200_OK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_escalation_of_an_article(self):\n token = self.user1.token()\n self.client.credentials(\n HTTP_AUTHORIZATION='Bearer ' + token)\n resp = self.escalate_an_article_successfully()\n self.assertEqual(resp.status_code, status.HTTP_201_CREATED)", "def test_getting_of_an_...
[ "0.7470194", "0.72625047", "0.72242457", "0.7153657", "0.71420866", "0.6820102", "0.66953367", "0.65002793", "0.6436562", "0.64319354", "0.6210155", "0.6179826", "0.6170977", "0.6139477", "0.6122537", "0.6109205", "0.61025673", "0.60806865", "0.60634816", "0.60575676", "0.605...
0.7769464
0
Test unsuccessful getting escalated articles
def test_getting_of_an_escalated_article_with_users(self): token = self.user1.token() self.client.credentials( HTTP_AUTHORIZATION='Bearer ' + token) resp = self.get_article() self.assertEqual(resp.status_code, status.HTTP_403_FORBIDDEN) self.assertEqual(resp.data["err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_escalation_of_a_404_article(self):\n token = self.user1.token()\n self.client.credentials(\n HTTP_AUTHORIZATION='Bearer ' + token)\n resp = self.escalate_an_article()\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)\n self.assertEqual(resp.data[...
[ "0.7565672", "0.73382246", "0.7114636", "0.6969177", "0.6797394", "0.67715967", "0.6622221", "0.6555586", "0.6448273", "0.64152306", "0.6351098", "0.6237788", "0.6211422", "0.6167086", "0.61306095", "0.605699", "0.60262775", "0.5992974", "0.5990667", "0.59902215", "0.5980788"...
0.7083966
3
Creates an argument parser for the nbdiff command.
def _build_arg_parser(): parser = argparse.ArgumentParser( description=_description, add_help=True, ) add_generic_args(parser) add_diff_args(parser) add_filename_args(parser, ["base", "remote"]) parser.add_argument( '-o', '--output', default=None, hel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init_arg_parser() -> argparse.ArgumentParser:\n\n parser = argparse.ArgumentParser(\n description='Run this app to label images by appending the label at the front of the filename.')\n\n parser.add_argument('source_directory',\n type=str,\n help='Dir...
[ "0.6716528", "0.6465517", "0.64577746", "0.64322937", "0.64079374", "0.63602203", "0.635668", "0.6349856", "0.6349159", "0.63358086", "0.6313479", "0.6276977", "0.62768584", "0.6274493", "0.6272565", "0.62650436", "0.62613994", "0.6222885", "0.62181914", "0.6216688", "0.61952...
0.62291247
17
Convert this ExperimentGroup into a Cohort (a group of Mice so a group of ExperimentGroups).
def to_cohort(self, name=None): mouse_dict = defaultdict(list) for e in self: mouse_dict[e.mouse_id].append(e) mice = [Mouse(expts, item_class=self.item_class, parallelize=self.parallelize) for mouse_id, expts in mouse_dict.items()] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cohort_task(sample_task_class):\n name = sample_task_class.__name__ + 'Cohort'\n cohort_task_class = type(name, (CohortTask, luigi.WrapperTask),\n {'SAMPLE_REQUIRES': sample_task_class})\n return cohort_task_class", "def add_cohort(course_key, name):\r\n log.deb...
[ "0.5366107", "0.49241865", "0.4749343", "0.47028914", "0.4577627", "0.45640707", "0.45408723", "0.44663775", "0.43944463", "0.43732795", "0.4372525", "0.4370139", "0.43579683", "0.43228564", "0.43180227", "0.42536992", "0.42361805", "0.42331463", "0.42232314", "0.42224303", "...
0.66129047
0
Test that email broadcaster initialises the smtp library correctly
def test_init(self, MockSMTP: MagicMock) -> None: client = EmailBroadcaster("localhost", 25, "test", "testpass") MockSMTP.assert_called_with(hostname="localhost", port=25) self.assertIs(client._username, "test") self.assertIs(client._password, "testpass")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_smtp(self):\n self._endpointServerTest(\"smtp\", protocols.SMTPFactory)", "def test_endpointSMTP(self):\n self._endpointTest(\"smtp\")", "def test_email():\n recipients = configs[\"email_to\"].split(\", \")\n email_body = test_email_content()\n if configs[\"smtp_ssl\"] == 1:\n ...
[ "0.7645353", "0.7041312", "0.6892129", "0.6718706", "0.6617694", "0.66156834", "0.65670556", "0.6485195", "0.6447329", "0.6408189", "0.63813955", "0.63778996", "0.63671523", "0.63512766", "0.6325136", "0.6315891", "0.6308974", "0.6294649", "0.62507576", "0.62399244", "0.62013...
0.7544602
1
Takes file path as string; returns text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text.
def open_and_read_file(file_path): contents = open(file_path).read() # your code goes here return contents
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text", "def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string", ...
[ "0.81214136", "0.808571", "0.80747753", "0.8070949", "0.79575056", "0.7941712", "0.7890047", "0.7815816", "0.7715659", "0.77015245", "0.76658094", "0.763286", "0.7625066", "0.76137406", "0.75801224", "0.7531774", "0.7528765", "0.74890053", "0.7441644", "0.7412805", "0.7373296...
0.69870394
34
This function sets the field value of the y axis magnetorquer
def __set_y__(self,y): # Input vaidation try: y = int(y) except: raise ValueError('H Bridge direction is not valid') if(y != 0 and y != 1 and y != -1): raise ValueError('H Bridge direction is not valid') self.direction['y'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setY(self, value):\n self.components[1] = value", "def setY(self, value):\n self.components[1] = value", "def setY(self, value):\n self.position[1] = value", "def set_axis_y(self, new_axis_point):\r\n self.__y_axis = new_axis_point", "def set_y(self, new_y):\r\n self....
[ "0.72608316", "0.72608316", "0.71388537", "0.70805997", "0.70503837", "0.7026052", "0.69250876", "0.69157887", "0.68553346", "0.6842112", "0.67211604", "0.6678632", "0.6671024", "0.66604", "0.6632223", "0.6624512", "0.6531813", "0.65244293", "0.6500283", "0.6500133", "0.64896...
0.68297595
10
Returns the current y axis magnetorquer value
def __get_y__(self): return self.Direction['y']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_axis_y(self):\r\n return self.__y_axis", "def get_y(self):\n return self.__y", "def y(self):\n return self.axes[0]", "def y(self) -> float:\n return self.data[1]", "def yaxis ( self ) :\n return self.__yaxis", "def yaxis ( self ) :\n return self.__yaxis...
[ "0.82586217", "0.80430275", "0.7973374", "0.7895726", "0.78931576", "0.78931576", "0.7850739", "0.78323907", "0.78269047", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7790115", "0.7747448", "0.7747448...
0.787351
6
Return an authenticated OAuth1Session object
def get_session(client_key, client_secret, resource_owner_key=None, resource_owner_secret=None): if not resource_owner_key or not resource_owner_secret: resource_owner_key, resource_owner_secret = authorize(client_key, client_secret) return OAuth1Session(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session(cls):\n if not (cls._consumer_key and cls._consumer_secret):\n raise NoCredentialsException\n if not cls._session:\n cls._session = OAuth1Session(\n client_key=cls._consumer_key,\n client_secret=cls._consumer_secret\n )\n ...
[ "0.7576792", "0.7253131", "0.71215135", "0.7048725", "0.6881396", "0.6827724", "0.6650588", "0.66434854", "0.65471804", "0.6515352", "0.64998287", "0.6398918", "0.6267154", "0.6250623", "0.62322444", "0.6226618", "0.6214261", "0.62060475", "0.62052584", "0.6183912", "0.616711...
0.70016295
4
Initialize a logging Formatter with an appropriate format string.
def __init__(self, study_dir): super(LogfileStyleFormatter, self).__init__( fmt='%(levelname)s: %(file_indicator)s:' '%(line_indicator)s%(column_indicator)s' ' %(message)s%(cause_indicator)s') self.study_dir = study_dir self.previous_filename = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, fmt, datefmt=None):\n logging.Formatter.__init__(self, fmt, datefmt)", "def init_logging(log_format: str='default', level: str='INFO') -> Union[DefaultFormatter, DebugFormatter]:\n stream_handler = logging.StreamHandler()\n if log_format == 'default':\n formatter = DefaultF...
[ "0.7901536", "0.7421911", "0.6647904", "0.6583011", "0.64686763", "0.62549025", "0.6234094", "0.61548924", "0.6126279", "0.6060544", "0.60584795", "0.60100144", "0.59685314", "0.5903129", "0.583758", "0.58251333", "0.5746234", "0.57139266", "0.570447", "0.5663039", "0.5624990...
0.62501377
6
Resolves a prefix to a namespace raising an error (FONS0004) if the prefix is not found in the namespace map.
def get_namespace(self, prefix): try: return self.parser.namespaces[prefix] except KeyError as err: raise self.error('FONS0004', 'No namespace found for prefix %s' % str(err))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_to_ns(self, prefix):\n defin = self.module.i_ctx.get_module(\n self.module.i_prefixes[prefix][0])\n return defin.search_one(\"namespace\").arg", "def declareNamespace (self, namespace, prefix=None, add_to_map=False):\n if not isinstance(namespace, pyxb.namespace.Namespa...
[ "0.6963049", "0.66704005", "0.65708107", "0.6546241", "0.6392292", "0.63532704", "0.62987864", "0.5978416", "0.5967826", "0.58918184", "0.58477926", "0.5843482", "0.58110946", "0.57636905", "0.57462144", "0.57437706", "0.5721149", "0.5674365", "0.5626828", "0.5623059", "0.559...
0.71799254
0
A context manager for use a locale setting for string comparison in a code block.
def use_locale(self, collation): loc = locale.getlocale(locale.LC_COLLATE) if collation == UNICODE_CODEPOINT_COLLATION: collation = 'en_US.UTF-8' try: locale.setlocale(locale.LC_COLLATE, collation) except locale.Error: raise self.error('FOCH0002', 'Un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_locale_activation(self):\n with translation.override('fr'):\n self.assertEqual(\n Template(\"{% load i18n %}{% blocktrans %}Yes{% endblocktrans %}\").render(Context({})),\n 'Oui'\n )", "def test_single_locale_activation(self):\n wi...
[ "0.5932038", "0.5865116", "0.5419026", "0.5374974", "0.53476477", "0.53375244", "0.53078747", "0.5157592", "0.5146666", "0.51339775", "0.5118586", "0.50736827", "0.50657856", "0.50467825", "0.49825343", "0.49523458", "0.48661226", "0.4827698", "0.47786614", "0.47739562", "0.4...
0.5749164
2
Normalize tensor to 0 mean and 1 variance.
def batch_norm_tensor(t): return (t - t.mean()) / torch.sqrt(t.var())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(tensor: np.ndarray):\n if len(tensor.shape) < 4:\n tensor = np.expand_dims(tensor, axis=2)\n mean = np.array([tensor[..., chn, :].mean() for chn in range(tensor.shape[2])])\n std = np.array([tensor[..., chn, :].std() for chn in range(tensor.shape[2])])\n return (tensor - mean[:, np...
[ "0.7995458", "0.76622885", "0.7661302", "0.7661302", "0.74793935", "0.7408027", "0.74069643", "0.7384607", "0.7296112", "0.71037716", "0.7063406", "0.6985653", "0.69839674", "0.6916941", "0.69113815", "0.68838054", "0.68838054", "0.68618387", "0.68618387", "0.68485945", "0.68...
0.651572
45
Goes forward in the network multiply the weights, apply relu, multiply weights again and apply softmax
def forward(self, w): # Repeat the rewards as they were repeated at the end of F in # Identification problem (see build_input() in find_weights.py script repeatedR = self.R.repeat(J, 1).unsqueeze(dim=2) # shape is J x J x 1 # multiply w1 with r and add the resulting tensor with the a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedforward1_6(self, a):\r\n for b, w in list(zip(self.biases, self.weights))[:len(self.biases)-1]:\r\n a = relu(np.dot(w, a)+b)\r\n b,w = self.biases[-1], self.weights[-1]\r\n a = softmax(np.dot(w, a)+b)\r\n return a", "def feed_forward(self):\n pre = self.pre_l...
[ "0.73415136", "0.7277904", "0.7195697", "0.71158135", "0.7108848", "0.70581657", "0.69864", "0.6959647", "0.69511116", "0.6949624", "0.6925658", "0.6890367", "0.6878172", "0.687509", "0.68711936", "0.68669367", "0.68517774", "0.6842369", "0.6840495", "0.68388563", "0.68372285...
0.6851746
17
Returns a clone of gradients grad, calculated w.r.t. rewards, with those for nonavicaching locations set to 0. This hook must be registered before calling backward on loss.
def non_avi_zero_grad_hook(grad): grad_clone = grad.clone() grad_clone[not_avi_idx] = 0 return grad_clone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self):\n gradient = blah\n return gradient", "def backward(self):\n gradient = blah\n return gradient", "def backward(ctx, grad_output):\n\n # This is a pattern that is very convenient - at the top of backward\n # unpack saved_tensors and initialize all gr...
[ "0.71885246", "0.71885246", "0.7156543", "0.7048143", "0.692014", "0.68090355", "0.68090355", "0.6779985", "0.67292583", "0.67031324", "0.67017823", "0.66958266", "0.6684745", "0.66368526", "0.6629405", "0.6620559", "0.661624", "0.6597808", "0.65789825", "0.65608364", "0.6551...
0.6421503
33
Get a random element from the set.
def getRandom(self) -> int: return random.choice(self.arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.5954455
73
Get a random element from the set.
def getRandom(self) -> int: #print(self.size) i = random.randrange(self.size) return self.array[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df= pd.read_csv(CITY_DATA[city]) #create column for month, day of week df['Start Time'] = pd.to_datetime(df['Start Time']) df['Month'] = df['Start Time'].dt.month_name() df['day_of_week'] = df['Start Time'].dt.day_name() #get the filtered data frame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.7889219", "0.7882541...
0.79610896
11
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # display the most common month #if month == 'all': common_month = df['Month'].value_counts().idxmax() print('The most common month is:', common_month, '\n') # display the most...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80234534", "0.80220866", "0.7914726", "0.7826028", "0.7821531", "0.7813864", "0.7765123", "0.7739495", "0.7735815", "0.773377", "0.76860726", "0.7667975", "0.7651258", "0.7644125", "0.76395637", "0.763636", "0.7624526", "0.76224995", "0.7612101", "0.7599869", "0.7583085", ...
0.73772466
47
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station print("The most common used start station is:", df['Start Station'].value_counts().idxmax(), '\n') # display most commonly used end station ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815431", "0.7661541", "0.7553297", "0.749107", "0.7474493", "0.7445922", "0.7430571", "0.7423423", "0.741729", "0.74000263", "0.73870325", "0.7385237", "0.73645216", "0.7358968", "0.7356304", "0.735434", "0.7351656", "0.73508406", "0.7349957", "0.7341757", "0.7339878", ...
0.7151731
54
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time print("The total travel time is:", df['Trip Duration'].sum() ,'min \n') # display mean travel time print("The mean travel time is:", df['Trip Duration'].mean(),'min \n')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7845923
30