query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Provides a function which deletes all subparts of a dictionary based on a list of paths.
def glob_filter(exclude_globs: List[str]) -> Callable[[Dict], None]: def filter_func(state_dict: Dict) -> None: # Flatten dictionary into paths paths = [] _flatten_keys(state_dict, paths, '/') filtered_paths = [] for exclude_glob in exclude_globs: filtered_paths...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_by_path(data: Dict[str, T], path: Sequence[str]):\n del get_by_path(data, path[:-1])[path[-1]]", "def _clean_paths(paths):\n\n\tclean_paths = {key: np.concatenate([path[key] for path in paths]) for key in paths[0].keys()}\n\n\treturn clean_paths", "def delete_keys_from_dict(dictionary, list_keys)...
[ "0.6701357", "0.66678226", "0.6317049", "0.61463994", "0.6094173", "0.60304415", "0.5982631", "0.5948575", "0.59154505", "0.59153736", "0.59026176", "0.5891703", "0.58425975", "0.58365303", "0.57102394", "0.56950706", "0.5676483", "0.5665751", "0.5658024", "0.5655463", "0.564...
0.0
-1
Load a torch checkpoint, catching errors due to backwards compatibility issues.
def safe_torch_load( composer_states_filepath: Union[Path, str], map_location: str = 'cpu', load_fsdp_monolith_rank0_only: bool = False, ) -> Dict[str, Any]: try: if not load_fsdp_monolith_rank0_only: return torch.load(composer_states_filepath, map_location=map_location) log....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(ckpt_path):\n checkpoint = None\n if ckpt_path:\n logger.info(\"Loading checkpoint from %s\" % ckpt_path)\n checkpoint = torch.load(ckpt_path, map_location=torch.device(\"cpu\"))\n\n if \"model\" in checkpoint.keys():\n # This preserves backward-compat for ...
[ "0.74511135", "0.7429308", "0.74096036", "0.73403966", "0.72154325", "0.72154325", "0.72027546", "0.7168721", "0.7161929", "0.712888", "0.71182865", "0.71064115", "0.7092487", "0.70710784", "0.70690227", "0.7059356", "0.70333356", "0.70289314", "0.69980466", "0.6958403", "0.6...
0.0
-1
Restore a checkpoint into ``state`` and returns the rng state dicts (if ``load_weights_only`` is False).
def _restore_checkpoint( state: State, logger: Logger, composer_states_filepath: str, extracted_rank_n: bool, extracted_checkpoint_folder: Optional[str], load_weights_only: bool, strict_model_weights: bool, ignore_keys: Optional[Union[List[str], Callable[[Dict], None]]], exclude_algo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore_training_state(self, restore_state):\n self.load_state_dict(restore_state[\"model\"])\n self.optimizer.load_state_dict(restore_state[\"optimizer\"])\n self.lr_scheduler.load_state_dict(restore_state[\"lr_scheduler\"])\n start_iteration = restore_state[\"iteration\"] + 1\n ...
[ "0.73388803", "0.72150517", "0.7131705", "0.70134574", "0.6997281", "0.6942888", "0.6694779", "0.6665034", "0.6642213", "0.66123784", "0.65712357", "0.65587157", "0.6545347", "0.6525875", "0.65182793", "0.6469714", "0.64419687", "0.64180094", "0.63763607", "0.63705903", "0.63...
0.6288278
24
Replace a file with its compressed version. The contents will be called ``basename`` inside the compressed archive.
def _compress_file(filename: str, basename: str): write_mode = _get_write_mode(filename) with tempfile.TemporaryDirectory() as tmpdir: shutil.move(filename, os.path.join(tmpdir, basename)) with tarfile.open(filename, write_mode) as tarball: tarball.add(tmpdir, arcname='')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_file(filename, contents):\n filename = path.join(PATH_ROOT, filename)\n filename_bak = \"%s.release.bak\" % filename\n os.rename(filename, filename_bak)\n with open(filename, \"w\") as out_file:\n out_file.write(\"\".join(contents))\n shutil.copymode(filename_bak, filename)\n o...
[ "0.6415052", "0.6314928", "0.6199872", "0.6001604", "0.5810293", "0.5780952", "0.5752636", "0.57117546", "0.5672663", "0.5574416", "0.55683494", "0.55642724", "0.55603486", "0.5546732", "0.5530672", "0.55286574", "0.550386", "0.5496359", "0.5496359", "0.54615456", "0.54451406...
0.6844481
0
Save Deepspeed model and tarball the files.
def _save_deepspeed_model(model, filename: str): write_mode = _get_write_mode(filename) read_mode = f'r{write_mode[1:]}' with tempfile.TemporaryDirectory() as tmpdir: model.save_checkpoint(tmpdir, _DEEPSPEED_TAG) if os.path.exists(filename): # extract to tmpdir to append below ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, step):\n\n # file_name = params['name']\n # pickle.dump(self, gzip.open(file_name, 'wb'))", "def save(self, path=None):\n if path is None:\n path = os.path.join(logger.get_dir(), \"model.pkl\")\n\n with tempfile.TemporaryDirectory() as td:\n ...
[ "0.6917545", "0.6801277", "0.6786645", "0.6771546", "0.65725636", "0.654351", "0.6506806", "0.6503191", "0.6480949", "0.6474152", "0.64712524", "0.64655024", "0.6454765", "0.64464855", "0.643115", "0.64104533", "0.6390846", "0.6343271", "0.6322349", "0.6322143", "0.63072705",...
0.7130798
0
Get the association type mapping for a given query string, splitting the category and predicate components apart
def get_association_type_mapping_by_query_string( query_string: str, ) -> AssociationTypeMapping: categories = parse_query_string_for_category(query_string) matching_types = [ a_type for a_type in AssociationTypeMappings.get_mappings() if set(a_type.category) == set(categories) ] if len(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_categories(querystring):\n tokens = tokenize_query(querystring)\n categories = []\n for idx, token in enumerate(tokens):\n if token.type == \"EXTERNAL_COMMAND\":\n categories.append(category.get(token.value, \"Miscellaneous\"))\n elif token.type == \"MACRO\":\n ...
[ "0.58501035", "0.52250046", "0.51798195", "0.48137656", "0.4768399", "0.46968216", "0.4696489", "0.46959627", "0.46701097", "0.46667367", "0.46602768", "0.46147487", "0.46047112", "0.45540965", "0.4524083", "0.4497096", "0.44962004", "0.44849357", "0.4439901", "0.443559", "0....
0.71058404
0
Spawner en kopi af instancen til en given position
def spawn(self: T, game_map, x: int, y: int) -> T: clone = copy.deepcopy(self) clone.x, clone.y = x, y clone.parent = game_map game_map.entities.add(clone) return clone
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn(self, y, x, h, w):\n self.pos = (np.random.randint(y, y + h), np.random.randint(x, x + w))", "def create(self, pos):\n self.pos = pos", "def __init__(self, position: Sequence[float], respawn_time: float = 20.0):\n self._position = position\n self._tnt: Optional[Bomb] = None\n ...
[ "0.69008267", "0.6770838", "0.6619198", "0.6575561", "0.6571484", "0.65230316", "0.6420453", "0.635845", "0.63377917", "0.6319819", "0.62801486", "0.627715", "0.62371975", "0.6227935", "0.6213373", "0.6204491", "0.6200694", "0.61768955", "0.61760086", "0.61162835", "0.6102015...
0.6046237
25
Returns the distance between the current entity and the given (x, y) coordinate.
def distance(self, x: int, y: int) -> float: return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to(self, x, y):\n\t\tdx = x - self.x\n\t\tdy = y - self.y\n\t\treturn math.sqrt((dx**2)+(dy**2))", "def distance_from_center(self, x: int, y: int) -> float:\n width, height = self.width, self.height\n dis = distance(x, y, width/2, height/2)\n return dis", "def distance(self, x...
[ "0.81523913", "0.7383806", "0.72868764", "0.7262011", "0.7195622", "0.7163461", "0.7131348", "0.71239984", "0.71239984", "0.71239984", "0.71239984", "0.71239984", "0.71239984", "0.71239984", "0.7074517", "0.70256484", "0.7024614", "0.70112294", "0.68983996", "0.6831905", "0.6...
0.7916495
1
Process Calculate debit, credit and balance
def _total_d(self): debit = 0.0 for l in self.data: debit += l['debit'] self.t_credit += l['credit'] self.t_balance += l['balance'] return debit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_balance(self,args):\n \"\"\"Can show total, available(available for trading), or reserved(reserved in open orders)\"\"\"\n \"\"\"usage: balance [available/reserved](optional)\"\"\"\n args = stripoffensive(args)\n if 'available' in args:\n btc,usd = available() \n ...
[ "0.658766", "0.65644854", "0.6550185", "0.653063", "0.64185905", "0.641678", "0.63939947", "0.6387895", "0.6294101", "0.6265298", "0.6234861", "0.6214223", "0.6211379", "0.6209451", "0.61597407", "0.6155157", "0.61335325", "0.6120291", "0.61068213", "0.60987514", "0.6071012",...
0.6470188
4
Process get company name and detail values from account Return Company Name,Address of Company
def _cname(self,account_id): company = self.pool.get('account.account').browse(self.cr, self.uid, account_id).company_id self.caddress = self._cadd(company) return company.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company(self):\n\n x = 0\n my_company = self.data[\"Company Name\"]\n my_account = self.data[\"Account\"]\n result = []\n for i in my_company:\n my_string = i + \" -- \" + my_account[x]\n x += 1\n result.append(my_string)\n\n return res...
[ "0.69058377", "0.6532363", "0.63970184", "0.6110438", "0.6075707", "0.6048244", "0.6011991", "0.5984431", "0.59701777", "0.58567214", "0.5844856", "0.5829678", "0.58110636", "0.58070755", "0.57983863", "0.5797018", "0.5794627", "0.57643694", "0.5755209", "0.5755209", "0.57437...
0.64875424
2
Process Monthly period wise report Find all child accounts of parent(Total Accounts = Own + Its child accounts) Get context value to pass on _query_get method Query to get values of account move line period wise Return list of dictionary
def lines(self, form, ids=None, done=None): moveline_obj = self.pool.get('account.move.line') cr,uid = self.cr,self.uid ctx = self.context.copy() ctx['fiscalyear'] = form['fiscalyear_id'] if form['filter'] == 'filter_period': ctx['period_from'] = form['period_from'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_get(self, cr, uid, obj='l', context=None):\n \n fiscalyear_obj = self.pool.get('account.fiscalyear')\n fiscalperiod_obj = self.pool.get('account.period')\n account_obj = self.pool.get('account.account')\n journal_obj = self.pool.get('account.journal')\n initial_bal = c...
[ "0.6288617", "0.6161747", "0.5946709", "0.58965355", "0.5824919", "0.55932254", "0.551057", "0.5463138", "0.545744", "0.542648", "0.5404174", "0.5381288", "0.52867204", "0.5258971", "0.52570456", "0.51793706", "0.51743454", "0.514316", "0.51324767", "0.5126693", "0.5098991", ...
0.5420634
10
Make sure that the file is writeable. Useful if our source is readonly.
def _make_writeable(filename): if not os.access(filename, os.W_OK): st = os.stat(filename) new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR os.chmod(filename, new_permissions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_can_write(self):\n if self._mode not in WRITE_MODES:\n raise IOError(\"File is not writable\")\n if self.Writable == 'no':\n raise IOError(\"'Writable' flag is 'no'\")", "def is_writable_file(obj):\n try:\n obj.write(\"\")\n except(AttributeError, OS...
[ "0.7919693", "0.7208863", "0.71912867", "0.715788", "0.715714", "0.7111602", "0.70478153", "0.6997669", "0.6925458", "0.6914876", "0.68376625", "0.6644299", "0.6634337", "0.65951955", "0.65799665", "0.65485585", "0.65146774", "0.6463636", "0.6432738", "0.642454", "0.63557035"...
0.7010632
7
Similar to forward but only return features. Includes several features from "Jointly Learning to Align and Translate with Transformer Models" (Garg et al., EMNLP 2019).
def extract_features_scriptable( self, prev_output_tokens, encoder_out: Optional[Dict[str, List[Tensor]]], incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None, full_context_alignment: bool = False, alignment_layer: Optional[int] = None, alig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward (self, features, cat_featrs=None):\n \n # cat_featrs = None\n features = features.view (-1, N_FEATURES)\n f_emb = self.features2emb()\n features_2 = torch.matmul (features, f_emb)\n \n # Concatenate the two features (features + their embeddings)\n ...
[ "0.7270778", "0.72664255", "0.7230385", "0.7188819", "0.7188819", "0.7116068", "0.7092778", "0.6863423", "0.6840569", "0.6833632", "0.6770238", "0.6749367", "0.67337835", "0.66973716", "0.66973716", "0.66921663", "0.66771543", "0.667196", "0.66449076", "0.6639564", "0.6632218...
0.0
-1
Project features to the vocabulary size.
def output_layer(self, features): if self.adaptive_softmax is None: # project back to size of vocabulary return self.output_projection(features) else: return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review_to_vec(words, model, num_features , index2word_set):\n \n feature_vec = np.zeros((num_features), dtype=\"float32\")\n word_count = 0\n \n \n \n for word in words:\n if word in index2word_set: \n word_count += 1\n feature_vec += model[word]\n\n if word...
[ "0.6354882", "0.6334816", "0.62666094", "0.6220303", "0.6203577", "0.616738", "0.6150227", "0.6132004", "0.6092889", "0.6077156", "0.6057188", "0.6045521", "0.6029445", "0.6023707", "0.6004405", "0.59847", "0.59653866", "0.59480286", "0.5927678", "0.59204453", "0.59164006", ...
0.57181746
39
Maximum output length supported by the decoder.
def max_positions(self): if self.embed_positions is None: return self.max_target_positions return min(self.max_target_positions, self.embed_positions.max_positions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def len_max(self):\n return 16 + 16 + 8 + 8 + Tools.bin_to_dec(self.get_data_size()) + Tools.bin_to_dec(self.get_verification_size())", "def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)", "def setMaxOutputLength(self, value):\n return self._set(maxOutputLength...
[ "0.7432989", "0.73925817", "0.73925817", "0.73925817", "0.7161096", "0.71449983", "0.70124006", "0.69647205", "0.69551724", "0.69273204", "0.68699276", "0.68549514", "0.684077", "0.68397105", "0.68026745", "0.6781775", "0.67704415", "0.6759464", "0.6752665", "0.6748612", "0.6...
0.0
-1
Upgrade a (possibly old) state dict for new versions of fairseq.
def upgrade_state_dict_named(self, state_dict, name): if isinstance(self.embed_positions, SinusoidalPositionalEmbedding): weights_key = "{}.embed_positions.weights".format(name) if weights_key in state_dict: del state_dict[weights_key] state_dict[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade_state_dict(self, state_dict):\n return state_dict", "def upgrade_state_dict(self, state_dict):\n return state_dict", "def upgrade_state_dict(self, state_dict):\n self.upgrade_state_dict_named(state_dict, \"\")", "def upgrade_state_dict_named(self, state_dict, name):\n ...
[ "0.7462838", "0.7462838", "0.7427273", "0.67221797", "0.66385204", "0.6512428", "0.6499821", "0.645798", "0.62921524", "0.6210894", "0.6208642", "0.6035896", "0.6035896", "0.6035896", "0.60316265", "0.6010375", "0.60029566", "0.59973645", "0.594021", "0.58850825", "0.5855274"...
0.6633675
5
Calc md5 32 hexa digits
def calc_md5(string): return md5(string).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MD5(self) -> _n_0_t_3[_n_0_t_9]:", "def hash_password(password):\n password_md5 = hashlib.md5(password.encode('utf-8')).hexdigest()\n for i in range(0, len(password_md5), 2):\n if password_md5[i] == '0':\n password_md5 = password_md5[0:i] + 'c' + password_md5[i + 1:]\n return passw...
[ "0.74037653", "0.73589516", "0.7223155", "0.71314096", "0.7061002", "0.7040754", "0.69246835", "0.69222784", "0.6914624", "0.68938214", "0.6877271", "0.6828704", "0.68168634", "0.67665535", "0.67429805", "0.6740992", "0.6719082", "0.67109585", "0.6700948", "0.66997695", "0.66...
0.7135242
3
Brute force md5 hash
def main(): md5_pass = sys.argv[1] print brute_force_rec('f', md5_pass)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MD5(self) -> _n_0_t_3[_n_0_t_9]:", "def _md5(input):\n m = hashlib.md5()\n m.update(input)\n return m.hexdigest()", "def __hash_md5__(self, text):\n key = hashlib.md5()\n key.update(text.encode('utf-8'))\n return key.digest()", "def __md5_hash(txt) -> str:\n\n ...
[ "0.8090531", "0.7789014", "0.7702612", "0.76611775", "0.756921", "0.7564498", "0.7545351", "0.7458243", "0.74500227", "0.73919755", "0.7363182", "0.7308294", "0.7295818", "0.7254136", "0.71921223", "0.7171104", "0.7152653", "0.71270955", "0.7125174", "0.71061033", "0.70904404...
0.65695006
61
Turns dataset into string object
def read_dataset(filetxt): text = open(filetxt, 'r') dataset = text.read() dataset = dataset.strip() text.close() return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataAsString(self):\n\n # Force generation of .array\n d = self.asArray()\n slist = []\n for l in self.array:\n s = \"%s %s\" % (self.name, self.rowAsString(l))\n slist.append(s)\n return '\\n'.join(slist)", "def _convert_to_str(self, data):\n r...
[ "0.65239686", "0.6491759", "0.6149112", "0.61289436", "0.6053482", "0.6053482", "0.60275704", "0.6023861", "0.5988325", "0.5981235", "0.5981235", "0.5981235", "0.5981235", "0.5981235", "0.59611607", "0.59489954", "0.5908034", "0.5877692", "0.5870428", "0.58585924", "0.5854603...
0.0
-1
Turns dataset string separated by \n into a list
def split_dataset(dataset): sequence = dataset.split() return sequence
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_grid(self, data):\n return [list(row) for row in data.strip().split(\"\\n\")]", "def load_data():\n with open('../data/dataset.txt', 'r') as data_file:\n return data_file.read().split('\\n')", "def format_data(data_string):\n lines = data_string.split('\\\"\\n\\\"')\n split_dat...
[ "0.6875302", "0.6804295", "0.6741924", "0.6668688", "0.66176885", "0.6568523", "0.6558075", "0.6512331", "0.65080684", "0.645106", "0.6440016", "0.64314526", "0.6427407", "0.6367948", "0.6280195", "0.6262507", "0.62485737", "0.6235929", "0.620022", "0.619506", "0.6193576", ...
0.59947836
37
create dictionary with protein ids and fasta sequence from uniprot site
def open_uniprotsite(prot_names): fasta_dict = {} for prot_id in prot_names: uniprot_link = "https://www.uniprot.org/uniprot/" + prot_id + ".fasta" uniprot_fasta = urllib.request.urlopen(uniprot_link) fasta_sequence = uniprot_fasta.readlines()#.decode('utf-8') fasta_sequenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prot_sequence_finder(protL):\n \n idDict = prot_id_converter(protL, \"9606\", inpDB = \"genesymbol\",outDB=\"refseqproteingi\")\n seqD = prot_entrez_fetch(idDict, retM=\"gb\", retT=\"fasta\")\n \n protD = {}\n \n for keyS, valueS in idDict.items():\n protD[keyS] = seqD[valueS]\n \n return protD", ...
[ "0.6781977", "0.6571823", "0.6411829", "0.63938284", "0.6391897", "0.6324395", "0.63109064", "0.6232596", "0.62234", "0.6181884", "0.61223954", "0.60952413", "0.6050396", "0.5965492", "0.5963545", "0.5963038", "0.5939162", "0.58732736", "0.5828895", "0.578113", "0.57796746", ...
0.7153276
0
create dictionary with protein ids and motif positions of N{P}[ST]{P} +overlapping matches
def search_motif(sequences): motif = re.compile(r'(?=(N[^P](S|T)[^P]))') #N{P}[ST]{P} motif_index = {} for key,value in sequences.items(): match_motif = re.finditer(motif, value) motif_start_list = [] for i in match_motif: motif_start_list.append(str(i.start()+1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping(reads_list, k, h, index, genome):\n snps_dict = {}\n # Map the read on the genome and store the snps found\n for read in reads_list:\n reversed_read = reverse_read(read)\n reverse = False\n list_mapping = seed_and_extend(read, k, h, index, genome)\n if list_mapping[...
[ "0.58689076", "0.5789363", "0.5755219", "0.5687147", "0.5647959", "0.5635121", "0.5623256", "0.56161094", "0.5606003", "0.5603484", "0.5583012", "0.5560962", "0.55549896", "0.55387646", "0.5521165", "0.55000585", "0.54610294", "0.5446249", "0.54335797", "0.5430714", "0.542768...
0.71227914
0
Remove every allowed functions from the condition.
def condition_is_valid(self): cond = self.condition.lower() cond = re.sub('\s+', ' ', cond) for ap in self.available_functions: ap = ap.lower() ret = re.search(ap, cond) if ret: # [('a', 'b'), ('a', 'b'), ...] self.used_functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(func):", "def bypass_conds(self):\n for block in self.get_basic_blocks_followed_by_branches():\n constants = collect_constant_assigns(block.statements)\n branch = block.outgoing_edge[0]\n cond = deepcopy(branch.cond)\n cond = specialize_constants(cond...
[ "0.6023306", "0.5889629", "0.5797258", "0.5612402", "0.5607669", "0.55887026", "0.5466718", "0.54654783", "0.5451011", "0.54385215", "0.5421896", "0.5409747", "0.5409747", "0.5409747", "0.5408993", "0.53844345", "0.53592044", "0.5351946", "0.5325206", "0.52944034", "0.5287918...
0.0
-1
Evaluate the provided object to the condition
def evaluate(self, obj): #obj._print() # substitute event's attributes names by their values. cond = self.condition for attr in obj._attr_: cond = re.sub('evt\.%s' % attr, "\"%s\"" % str(obj._attr_[attr]), cond) # if it remains evt.* objects in the rule, there is a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, operand: object) -> bool:\n pass", "def eval(self, Vobj):\n try:\n return Vobj.evaluated_on(self)\n except AttributeError:\n return self.A() * Vobj + self.b()", "def condition(self) -> global___Expression:", "def condition(self) -> global___Expres...
[ "0.6598018", "0.6156341", "0.6133143", "0.6133143", "0.6017951", "0.59076935", "0.5841889", "0.5841889", "0.5840776", "0.5840498", "0.5802535", "0.57257354", "0.5681474", "0.56519026", "0.56487983", "0.5630435", "0.56184256", "0.56154966", "0.56067294", "0.55853695", "0.55552...
0.71140516
0
Execute the action of a rule. This mainly execute a script. We should add parameters passing ;)
def take_action(self, obj): self.logger.info( "Rule \"%s\" triggered and now I'm supposed to run the action \"%s\" with the log's object..." % (self.name, self.action))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_script(self, action, *args):\n self.host.cmd(('./%s' + len(args) * ' %s') % (action, *args))", "def execute_action(self, agent, action):\n abstract", "def _execute(self):\n\n action_name = self.action.lower()\n method_name = action_name.replace('node', 'do')\n met...
[ "0.6758261", "0.6552314", "0.6320851", "0.6226973", "0.6191258", "0.6191258", "0.6187765", "0.60632503", "0.5946773", "0.59280115", "0.5915756", "0.59023356", "0.58932996", "0.58872306", "0.5838028", "0.5825276", "0.58204365", "0.57939714", "0.5788293", "0.57869744", "0.57848...
0.5289828
75
Gets the assigned_user of this Workitems.
def assigned_user(self): return self._assigned_user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignee(self):\n membership = UnitMembershipFactory(unit=self.unit)\n return membership.user", "def assigned_to(self) -> Optional[str]:\n return pulumi.get(self, \"assigned_to\")", "def assigned_to(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"assigned_to\")...
[ "0.70582396", "0.70253783", "0.68387794", "0.6594624", "0.64337957", "0.63194", "0.62276447", "0.61899453", "0.61852264", "0.617757", "0.617757", "0.6168088", "0.6168088", "0.6166981", "0.612094", "0.6104734", "0.6104734", "0.6104734", "0.6104734", "0.606838", "0.60127085", ...
0.8579693
0
Sets the assigned_user of this Workitems.
def assigned_user(self, assigned_user): self._assigned_user = assigned_user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assigned_by_user(self, assigned_by_user):\n\n self._assigned_by_user = assigned_by_user", "def assigned_user(self):\n return self._assigned_user", "def assign_user_to_issue(self, issue, JIRAUsername):\r\n # TODO: Review docs\r\n self.jira.assign_issue(issue=issue, assignee=JIRAUsern...
[ "0.8350922", "0.68189096", "0.5876797", "0.58575225", "0.57323456", "0.56373864", "0.56373864", "0.55778617", "0.55627865", "0.55390745", "0.55118716", "0.55098593", "0.54444087", "0.54271966", "0.54271966", "0.54271966", "0.54271966", "0.54271966", "0.54271966", "0.54271966", ...
0.85572076
0
Gets the author of this Workitems.
def author(self): return self._author
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_author(self):\n return self.author", "def get_author(self):\n return self.author", "def author(self):\n return self._changeset.get('author', None)", "def author(self):\r\n return self.user", "def author(self) -> str:\n return self._author", "def author(self) -> ...
[ "0.81033164", "0.81033164", "0.7832732", "0.7830362", "0.77745897", "0.77745897", "0.7709737", "0.766907", "0.76471317", "0.7558222", "0.7392863", "0.7310641", "0.7100226", "0.7055616", "0.69088775", "0.68823814", "0.6879495", "0.68097967", "0.667739", "0.6604308", "0.6585194...
0.7929328
4
Sets the author of this Workitems.
def author(self, author): self._author = author
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_author (self, author):\n self.author = author", "def set_author(self, author):\n self.author = author\n self.opf.author = author", "def author(self, author):\n\n self._author = author", "def author(self, author):\n\n self._author = author", "def author(self, autho...
[ "0.7831896", "0.7744839", "0.7661029", "0.7661029", "0.76171625", "0.7417469", "0.73834866", "0.723238", "0.7022792", "0.69591576", "0.69440097", "0.6846459", "0.6799037", "0.6625127", "0.654796", "0.6416991", "0.6416991", "0.64145887", "0.6382336", "0.6332261", "0.6310402", ...
0.7739136
2
Gets the developer of this Workitems.
def developer(self): return self._developer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def developer(self):\n return self.proto.creator", "def get_maintainer(self):\n return self.paragraphs[0].get(\"Maintainer\")", "def technical_owner(self):\n return self._technical_owner", "def user(self):\n return self._project.user", "def is_developer(self):\n\n return ...
[ "0.6467594", "0.6383037", "0.59011614", "0.58858037", "0.5882263", "0.58464813", "0.58373034", "0.58373034", "0.58332425", "0.5788284", "0.5727513", "0.5696962", "0.5679556", "0.5662634", "0.56608135", "0.5650917", "0.5645489", "0.5638031", "0.56320435", "0.5630453", "0.56304...
0.77347624
0
Sets the developer of this Workitems.
def developer(self, developer): self._developer = developer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def developer_certificate_identity(self, developer_certificate_identity):\n\n self._developer_certificate_identity = developer_certificate_identity", "def developer(self):\n return self._developer", "def set_maintainer(self, maintainer):\n self.paragraphs[0][\"Maintainer\"] = maintainer", ...
[ "0.6069986", "0.6056044", "0.5680614", "0.5558243", "0.5480942", "0.5418043", "0.53070056", "0.5263238", "0.51771384", "0.51729125", "0.5170096", "0.51270753", "0.50323236", "0.50323236", "0.5031481", "0.49122766", "0.48889783", "0.4874513", "0.48558733", "0.4839325", "0.4819...
0.78007984
0
Gets the domain of this Workitems.
def domain(self): return self._domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain(self):\n # type: () -> string_types\n return self._domain", "def domain(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"domain\")", "def get_domain(self):\n return self._domain", "def _get_domain(self):\n self.ensure_one()\n domain = []\n ...
[ "0.7335138", "0.7294818", "0.7221173", "0.72163355", "0.71790045", "0.7176716", "0.7176716", "0.7156457", "0.7156457", "0.70826006", "0.7024091", "0.6920591", "0.6887922", "0.6887922", "0.6887922", "0.6878303", "0.68715984", "0.6822546", "0.6797321", "0.6797321", "0.6797321",...
0.7219861
5
Sets the domain of this Workitems.
def domain(self, domain): self._domain = domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain(self, domain):\n\n self._domain = domain", "def domain(self, domain):\n\n self._domain = domain", "def setDomainRange(self, domain, range):\n self.domain = domain.cloneSpace()\n self.range = range.cloneSpace()\n return", "def set_domain(self, var, domain) :\n ...
[ "0.6938591", "0.6938591", "0.68689", "0.68229336", "0.65074587", "0.647992", "0.64145446", "0.6360417", "0.6316579", "0.6233607", "0.62118834", "0.62118834", "0.6182328", "0.61120147", "0.60630286", "0.6041117", "0.6008707", "0.5991201", "0.5972056", "0.596478", "0.5924517", ...
0.6992701
1
Gets the iteration of this Workitems.
def iteration(self): return self._iteration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter(self):\n return self._iter", "def __iter__(self):\n return iter(self._items)", "def __iter__(self):\n return iter(self._items)", "def __iter__(self):\r\n return iter(self._items)", "def __iter__(self):\r\n return iter(self._items)", "def getIteration(self): ...
[ "0.6821687", "0.66895986", "0.66895986", "0.6630318", "0.6630318", "0.6520295", "0.6465367", "0.64646924", "0.64641094", "0.6435678", "0.6435678", "0.64066315", "0.6316668", "0.6269533", "0.62403", "0.6145356", "0.611292", "0.61077815", "0.6079022", "0.60638726", "0.60638726"...
0.6638763
6
Sets the iteration of this Workitems.
def iteration(self, iteration): self._iteration = iteration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, iteration):\n pass", "def setIterations( self, iterations):\n self.iterations = iterations", "def it(self, it):\n\n self._it = it", "def setIterationCount(self, newIterationCount):\n \n pass", "def i(self, i):\n\n self._i = i", "def set_all(self, val...
[ "0.6847173", "0.65657055", "0.6490476", "0.6258614", "0.61279064", "0.59690887", "0.5951158", "0.5938038", "0.5919914", "0.5919914", "0.5919914", "0.5919914", "0.58851314", "0.58851314", "0.58851314", "0.58851314", "0.5750854", "0.5742167", "0.57331824", "0.569525", "0.569525...
0.72155607
2
Gets the module of this Workitems.
def module(self): return self._module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_module(self):\n return self.module", "def module(self):\n return self.lib.module", "def module(self) -> Optional[Module]:\n return self._module", "def get_module_name(self):\n return self.module_name", "def get_module(self, name: str) -> ModuleInstance:\n return s...
[ "0.7658881", "0.7166972", "0.7157267", "0.66238433", "0.6583515", "0.6492179", "0.6423812", "0.63698703", "0.63572747", "0.6329867", "0.63244796", "0.6299108", "0.62677187", "0.62471384", "0.62409633", "0.6178302", "0.61514336", "0.6147349", "0.6082053", "0.603593", "0.597129...
0.7441217
5
Sets the module of this Workitems.
def module(self, module): self._module = module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_module(self, module):\n setattr(self, \"module\", module)", "def _setModule(self, module):\n self._module = module", "def setModule(name, module):", "def _setModule(self, module):\n self._module = module\n # copy the original module for exploration\n self.n_values =...
[ "0.7361021", "0.73544645", "0.69366276", "0.6877493", "0.65113515", "0.6313436", "0.60764545", "0.60761255", "0.5895355", "0.5888052", "0.5743862", "0.5599974", "0.5553506", "0.55327725", "0.55154467", "0.55154467", "0.5501181", "0.5475767", "0.5469222", "0.5444131", "0.54159...
0.6948856
4
Gets the status of this Workitems.
def status(self): return self._status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self) -> pulumi.Output['outputs.JobStatus']:\n return pulumi.get(self, \"status\")", "def getStatus(self):\n return self._status", "def get_status(self):\n return self._status", "def getStatus(self):\n return self.__status", "def status(self):\n return self._ge...
[ "0.7593097", "0.75146943", "0.74803483", "0.74482", "0.74374527", "0.74322176", "0.742835", "0.7412562", "0.73759395", "0.73736787", "0.7371924", "0.7368407", "0.7368407", "0.7368407", "0.73665434", "0.73664135", "0.73664135", "0.73664135", "0.7341932", "0.7341932", "0.731509...
0.73683554
34
Sets the status of this Workitems.
def status(self, status): self._status = status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setstatus(self, status):\n with self.lock:\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def setStatus(self, status)...
[ "0.72003525", "0.7144866", "0.7144866", "0.7144866", "0.71241933", "0.71099335", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", "0.6907424", ...
0.6939003
12
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Workitems): 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.80886984", "0.80886984", "0.8055307", "0.7983415", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", ...
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.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Convert a timedomain array `E` to the frequency domain via 2D FFT. `dx` and `dy` are sample spacing in x (leftright, 1st axis) and y (updown, 0th axis) directions. An optional `upsample > 1` will zeropad `E` to obtain an upsampled spectrum. Returns `(spectrum, xf, yf)` where `spectrum` contains the 2D FFT of `E`. If `N...
def makeSpectrum(E, dx, dy, upsample=10): zeropadded = np.array(E.shape) * upsample F = fft.fftshift(fft.fft2(E, zeropadded)) / E.size xf = fft.fftshift(fft.fftfreq(zeropadded[1], d=dx)) yf = fft.fftshift(fft.fftfreq(zeropadded[0], d=dy)) return (F, xf, yf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fft2d(pm, win, x, /, detrend='constant'):\n x = signal.detrend(x, type=detrend, axis=0) # remove trend or mean from \"time\"\n x = signal.detrend(x, type='constant', axis=1) # remove mean from \"longitude\"\n\n # Use 1D numpy.fft.rfft (identical)\n # Follows Libby's recipe, where instead real is...
[ "0.5888486", "0.56503826", "0.5601818", "0.54491526", "0.5392617", "0.5390208", "0.53717124", "0.5368106", "0.5360478", "0.5329879", "0.5306462", "0.524618", "0.5245024", "0.524321", "0.5240639", "0.5181204", "0.51742285", "0.51686364", "0.5167768", "0.51577264", "0.5120336",...
0.74132943
0
Test that the bot selects the shortest input string.
def test_strat(strategy, l, expected): assert strategy(*l) == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_short():\n short = input('What DNA sequence would you like to match? ')\n short = short.upper()\n return short", "def test_minlength():\n assert has_min_length(None, 8) is None\n assert has_min_length('abcd1234', 8) is None\n assert has_min_length('a', 8)", "def check_this_input(self, inp,...
[ "0.62415373", "0.59910303", "0.58833826", "0.58302915", "0.57707727", "0.57583714", "0.5756031", "0.57520384", "0.57448035", "0.5701577", "0.56848115", "0.56739223", "0.5619197", "0.56118274", "0.5557221", "0.55126894", "0.5511944", "0.5500234", "0.54978585", "0.54975474", "0...
0.0
-1
Output a string to the html file with a trailing newline
def outputHtml(s): htmlFile.write(s + "\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_html_page(htmldata, filename):\n begin = \"<html>\\n\\n<body>\\n\\n<p>\\n\"\n end = \"\\n</p>\\n\\n</body>\\n\\n</html>\"\n full_text = begin + htmldata + end\n f = open(filename, \"w\")\n f.write(full_text)\n f.close()", "def finish(self):\r\n\r\n self.text += \"</html>\\n\"\r\n\...
[ "0.66473573", "0.66443795", "0.6528386", "0.6365278", "0.63228464", "0.6304377", "0.6303967", "0.6297656", "0.62927836", "0.62136006", "0.6187122", "0.61672395", "0.6166157", "0.6161343", "0.6142821", "0.61315984", "0.6131482", "0.6089356", "0.6076196", "0.6050305", "0.601354...
0.8278069
0
Output the HTML boilerplate at the top of a file
def outputHtmlFileHeader(pageTitle): outputHtml( """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_header_part1(outfile: TextIO, title: str, indexpath: str = \"\") -> None:\n outfile.write(\"<!DOCTYPE HTML>\\n\")\n outfile.write(\"<html lang=\\\"en\\\">\\n\")\n outfile.write(\" <head>\\n\")\n outfile.write(\" <!-- Google tag (gtag.js) -->\\n\")\n outfile.write(\" <script async src=\...
[ "0.66860414", "0.6647583", "0.6486037", "0.6479137", "0.6328803", "0.6274983", "0.60532254", "0.5973262", "0.595949", "0.5949522", "0.594761", "0.5927138", "0.5927138", "0.5917435", "0.5899198", "0.58875376", "0.58822405", "0.5860369", "0.5858839", "0.5831532", "0.5831131", ...
0.65417224
2
Compute arithmetic mean of a list
def mean(l): return sum(l) / len(l) if len(l) != 0 else 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_mean(lst):\n return list_sum(lst) / len(lst)", "def getMean(list):\n return sum(list) / len(list)", "def lmean (inlist):\r\n sum = 0\r\n for item in inlist:\r\n sum = sum + item\r\n return sum/float(len(inlist))", "def mean(my_list):\n the_mean = sum(my_list) / len(my_list)\...
[ "0.86610144", "0.85852724", "0.8468351", "0.83844525", "0.82865095", "0.8281245", "0.81897223", "0.8165559", "0.815529", "0.814069", "0.81378514", "0.81044215", "0.80317014", "0.8011878", "0.8000918", "0.7990514", "0.7977984", "0.7968724", "0.79624313", "0.79264283", "0.79127...
0.78250355
26
Compute the geometric mean of a list
def geomean(l): return math.exp(mean([math.log(v) for v in l if v != 0]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometric_mean(xs):\n p = 1.0\n for num in xs:\n p = p * num\n return (p)**(1.0/len(xs))", "def geo_mean(num_list):\n np_array = np.array(num_list)\n return np_array.prod() ** (1.0 / len(np_array))", "def lgeometricmean (inlist):\r\n mult = 1.0\r\n one_over_n = 1.0/len(inlist)\r...
[ "0.8738079", "0.8272834", "0.81446886", "0.8056818", "0.8011409", "0.8007783", "0.79629153", "0.79254365", "0.7901607", "0.7868861", "0.7864818", "0.784954", "0.78374404", "0.7753002", "0.77423346", "0.766942", "0.76617575", "0.76493603", "0.7628073", "0.7620105", "0.757927",...
0.0
-1
Transpose a hash of hashes so that the inner keys are now outer
def transpose(h): res = {} for i in list(h.keys()): v = h[i] for j in list(v.keys()): if not res.get(j, None): res[j] = {} res[j][i] = v[j] return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose_2d_table(dicts_within_dict_table):\n transposed_table = {}\n for x2 in dicts_within_dict_table:\n for x1 in dicts_within_dict_table[x2]:\n if x1 not in transposed_table:\n transposed_table[x1] = \\\n {x2: dicts_within_d...
[ "0.7166209", "0.65619993", "0.5991071", "0.59697735", "0.5820064", "0.5810341", "0.5809102", "0.57978475", "0.5764748", "0.57150954", "0.5670478", "0.5656125", "0.5622417", "0.55814767", "0.55814767", "0.5565617", "0.5564947", "0.5563796", "0.5557678", "0.5549799", "0.5546132...
0.7801839
0
Split a string which may contain a number into a tuple of the string without the digits, and the integer value of the digits. We can then use that as a good thing to sort on, so that we get "a5" and "a15" right.
def extractDigits(key): text = "" digits = "" for c in key: if c in "0123456789": digits += c else: text += c return (text, 0 if not digits else int(digits))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_num(a_str):\n idx = None\n for i in iter(a_str):\n if i.isdigit():\n idx = a_str.index(i)\n break\n if idx == None:\n return (a_str[:idx], int('1'))\n else:\n return (a_str[:idx], int(a_str[idx:]))", "def split_num(s):\n i = 0\n while...
[ "0.7999296", "0.7962896", "0.7909838", "0.7309415", "0.71487594", "0.6907238", "0.68968225", "0.6889628", "0.67835516", "0.677049", "0.6512375", "0.64990336", "0.6499031", "0.6465821", "0.64021933", "0.63611853", "0.63611853", "0.6291423", "0.6285332", "0.62362725", "0.623576...
0.5844136
37
Choose a good ordering for the implementations
def compareFn(impl1, impl2): for (v1, v2) in zip( [extractDigits(f.strip()) for f in impl1.split(",")], [extractDigits(f.strip()) for f in impl2.split(",")], ): res = comparePair(v1, v2) if res: return res return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order(self):\n raise NotImplementedError()", "def order_ideal(self, gens):", "def test_hookimpls_can_be_sorted_by_the_order():\n # given\n hooks = [\n HookImpl(\"what\", \"when\", None, [], 1),\n HookImpl(\"what\", \"when\", None, [], 10),\n HookImpl(\"what\", \"when\", No...
[ "0.73337257", "0.61040646", "0.6041241", "0.60189027", "0.6015308", "0.5974476", "0.5974476", "0.5907545", "0.58723503", "0.57924604", "0.5774532", "0.57127625", "0.57061774", "0.56941235", "0.56875736", "0.56831706", "0.56466395", "0.56466395", "0.56368846", "0.56287706", "0...
0.0
-1
Compute the line colour and point style for each implementation once so that all plots are consistent.
def computeStyles(implv, monotone=False): # The lengths of the styles and colours lists should be co-prime, # so that you don't get replication of the same style and colour before # you have seen the product of the two lengths. styles = ("+", "*", "o", "^", "D", "v", "x", "p", "s", "h") if monotone:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_lines(self):\n self._checkfigure()\n for ld in self.lines:\n line = ld['line']\n\n color = ld['color']\n line.set_color(color)\n\n lw = ld['linewidth']\n hlf = ld['highlight factor']\n highlight = hlf if ld['highlighted'] el...
[ "0.64330816", "0.63422924", "0.625823", "0.6153564", "0.6108134", "0.5927725", "0.5922304", "0.59211296", "0.59206307", "0.5802298", "0.5726381", "0.57217574", "0.5707714", "0.5695703", "0.568625", "0.568072", "0.56716514", "0.56624395", "0.56526595", "0.56420404", "0.5628221...
0.5691588
14
Set up the X axis, including scaling, labels and max/min values
def setupXAxis(plot, minVal, maxVal, label, logarithmic): plot.set_xlabel(label) if logarithmic: plot.set_xscale("log") plot.set_xlim(minVal, maxVal) # plot.set_xscale('log', basex=2) # tickLabels = [1] # labelValue = minVal # while labelValue <= maxVal: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_xaxis(self):\n self.ax.set_xlim(self.xlims)\n # put x ticks on top\n xticks = [1]\n xticks.extend(range(5, self.xmax+5, 5))\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"xlabel.fontsize\"] is None else self.settings.othe...
[ "0.76962334", "0.7142678", "0.70777565", "0.7023679", "0.6677621", "0.66705173", "0.6669855", "0.66405183", "0.65903085", "0.6455307", "0.64306533", "0.64306533", "0.6370854", "0.6364356", "0.62985694", "0.6293797", "0.6283952", "0.62325585", "0.6220945", "0.61975974", "0.617...
0.7718785
0
Add the legend to the plot, shrinking the plot slightly to make room, since we add the legend outside the plot to the right, or leaving the plot full sized and allowing matplotlib to choose a good placement
def addLegend(ax, lines, impls, legendPos): # If there's only one piece of data being plotted, there's no need for a legend # since all the parameters will be in the title. # Compute the length (in characters) of the longest implementation. legendLen = max(list(map(len, impls))) if legendLen == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legend(self):\n if self.nplots == 1:\n lax = self.ax\n loff = 0.2\n else:\n lax = self.ax1\n loff = 0.4\n box = lax.get_position()\n\n lax.figure.subplots_adjust(bottom=loff) # make space on bottom for legend\n lax.legend(self.plot...
[ "0.8135134", "0.7360067", "0.7313128", "0.73119825", "0.72300524", "0.7143622", "0.7033816", "0.70186085", "0.69774044", "0.6967444", "0.692776", "0.6845011", "0.6801535", "0.6784947", "0.6779383", "0.67106515", "0.65214556", "0.6519761", "0.65141386", "0.6490154", "0.6467635...
0.76351845
1
Generate a lits of strings to use as labels, given the list of labels. Depending on how many entries there are we may label only every 5th or 10th entry. Doing that really only makes sense if the list of labels is actually numeric with constant delta between them...
def generateLabelsTicks(posns): if len(posns) <= 10: return labelsTicks(posns, 1) elif len(posns) <= 50: return labelsTicks(posns, 5) else: return labelsTicks(posns, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_labels(self, ilines):\n\n llist = []\n for lind, lstr in enumerate(ilines):\n # get label and value list\n rv, label, vals = self.get_label_vals(lstr)\n if rv < 1: continue\n\n nvals = len(vals)\n\n # label = self.find_parent_label(label)\n\n if se...
[ "0.72463655", "0.69913936", "0.6633301", "0.6608494", "0.65925914", "0.65915483", "0.65355", "0.65144134", "0.6511961", "0.6503672", "0.6500188", "0.64750016", "0.6460352", "0.64051265", "0.638604", "0.6364243", "0.6330974", "0.63303053", "0.63243955", "0.63158953", "0.626744...
0.6879352
2
Generate a heatmap Each experiment becomes a line in the map. We expect the experiments to have names of the form "text number", and all agree on the text. The text then becomes the yaxis name, the number the value used to sort the experiments, and the label associated with each one.
def generateHeatmap(title, unit, labels, sizeValues, xAxisName, legendPos, timeUnit): fig = preparePlot(title) ax = fig.axes[0] impls = sorted(list(sizeValues.keys()), key=cmp_to_key(compareFn)) yposns = [val for (discard, val) in [extractDigits(impl) for impl in impls]] (yAxisName, discard) = extra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_heatmap(data, labels_dict, file_title, plot_title):\n\n fig = plt.figure()\n ax = sn.heatmap(data,\n linewidths=0.3)\n figure = ax.get_figure()\n\n if labels_dict:\n ax.set_xlabel(labels_dict[\"x\"])\n ax.set_ylabel(labels_dict[\"y\"])\n if plot_title:\n...
[ "0.6487668", "0.6414247", "0.64019465", "0.6235494", "0.62288266", "0.6192175", "0.6147586", "0.6145392", "0.6111261", "0.6063312", "0.60262156", "0.59966576", "0.59835917", "0.59658575", "0.59642565", "0.5914604", "0.5872015", "0.58711034", "0.58513516", "0.5820075", "0.5809...
0.57783556
23
Generate a single plot, which has various options. The maximum y axis value can be set Grid lines can be plotted across the graph Error bars can be plotted
def generatePlot( bmName, yAxisName, npl, sizeValues, deviations=None, yMax=None, yMin=None, yLines=(), fileSuffix="", xMin=None, xLabel="", logarithmic=False, legendPos="best", sortKeyFn=lambda x: x, timeUnit=None, ): print("Plot: '" + bmName + "'") f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TwoOrOneValuePlot(no_of_sets, Xax, Ydat1, Ydat2, Label1, Label2,\n xmin, xmax, ymin_1, ymax_1, ymin_2, ymax_2,\n XLab, YLab_1, YLab_2, SupTitle, Title, FileName,\n currentDate, currentTime, Software_version):\n\n rc('font', size=6, weight=...
[ "0.6829554", "0.661534", "0.6599279", "0.6443192", "0.64005935", "0.6339009", "0.6306646", "0.6288057", "0.6278511", "0.62476623", "0.6240224", "0.6229401", "0.62160033", "0.62088746", "0.62024546", "0.6184107", "0.6181531", "0.6175892", "0.61673915", "0.61650753", "0.6149910...
0.66698444
1
Generate a single bar chart
def generateBarChart(bmName, yAxisName, bins, fileSuffix="", xLabel=""): fig = plt.figure() plt.title(bmName) ax = fig.add_subplot(111) setupXAxis(ax, 1, len(bins), xLabel, False) # print "npl: " + str(npl) + " sizeValues " + str(sizeValues) ax.bar(numpy.arange(len(bins)), bins, 1, color="blue")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def barGraph(listOfWord, listOfFrequency):\r\n\r\n\tindex = np.arange(len(listOfWord))\r\n\r\n\tplt.title(\"Frekuensi Kemunculan Kata\")\r\n\tplt.barh(index, listOfFrequency)\r\n\tplt.xlabel('Frekuensi')\r\n\tplt.yticks(index, listOfWord, fontsize=6)\r\n\r\n\tplt.show()", "def _bar_example_1(quantity_by_fruit):\...
[ "0.71167594", "0.70187116", "0.6961445", "0.69579554", "0.6940399", "0.69216317", "0.6876572", "0.6829726", "0.6812839", "0.6810216", "0.68029815", "0.67386836", "0.6736258", "0.66588956", "0.6652312", "0.66424024", "0.6640939", "0.66339326", "0.66232735", "0.66198415", "0.66...
0.6277766
42
Extract a sorted list of all the second level keys
def extractColumnKeys(array): columnKeys = set() for i in list(array.values()): columnKeys |= set(i.keys()) return sorted(list(columnKeys), key=cmp_to_key(compareFn))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(self, depth=None):\n if depth is not None:\n levels = self.levels[0:depth]\n else:\n levels = self.levels\n\n return [level.key for level in levels]", "def sortedKeys(self):\n sortedItems = self.items()\n compare = lambda x, y: sign(y[1] - x[1])\n...
[ "0.6977336", "0.69595975", "0.6898443", "0.6693866", "0.65704405", "0.6485746", "0.64736134", "0.64507824", "0.6409091", "0.6212825", "0.61982757", "0.61745584", "0.6172122", "0.6162426", "0.61520964", "0.61424357", "0.61192876", "0.61134183", "0.61134183", "0.61051226", "0.6...
0.0
-1
Print an HTML table from a two deep hash. The top level hash keys form the row titles The second level keys the column titles
def outputHtmlTable( leftmostTitle, array, formatFn=lambda x: str(x), valueFn=lambda x: x, best="Lowest", okPercent=5, ): # Work out what all the column titles should be, we can't assume that each # row has all of the same data entries # Sort the numeric entries, then add the non-nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_table(response, title):\n print title + ':'\n\n if 'rows' not in response:\n print 'Empty response'\n return\n\n rows = response['rows']\n row_format = '{:<20}' + '{:>20}' * 4\n print row_format.format('Keys', 'Clicks', 'Impressions', 'CTR', 'Position')\n for row in rows:\n keys = ''\n ...
[ "0.6904662", "0.66678137", "0.66342795", "0.65841013", "0.6493956", "0.6489375", "0.6478768", "0.6459146", "0.64458627", "0.64458627", "0.6423975", "0.6423727", "0.63952196", "0.6314732", "0.6302233", "0.6301837", "0.62923825", "0.62326974", "0.6199919", "0.61683637", "0.6139...
0.6058267
27
Output a media wiki formatted table
def mediaWikiTable(leftmostTitle, array, formatFn=lambda x: str(x)): columnKeys = extractColumnKeys(array) print("{|") for t in [leftmostTitle] + [str(k) for k in columnKeys]: print("!" + " !! ".join(titles)) for k in sorted(array.keys, key=cmp_to_key(compareFn)): print("|-") pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_table():\n\n title_list = ('ID', 'Platform', 'Producer', 'Year', 'Elements')\n \n return table, title_list", "def print_table(self):\n print(\"%-12s%-12s%-12s%-12s%-12s\" % (\"index\",\"balance\",\"payment\",\"interest\",\"amortization\"))\n print(\"-------------------------------...
[ "0.6593098", "0.65204376", "0.6463597", "0.6431361", "0.643116", "0.6429846", "0.63246125", "0.63038605", "0.6286171", "0.626248", "0.6258474", "0.6157692", "0.6144443", "0.6130239", "0.6066116", "0.60581213", "0.6050008", "0.60433495", "0.602486", "0.60156596", "0.6002523", ...
0.7025748
0
Print info on a linear fit
def linearFit(title, threadCounts, bestTimes, independentVar, unit): outputHtml("<h1>" + title + "</h1>") results = {} impls = sorted(list(bestTimes.keys()), key=cmp_to_key(compareFn)) outputHtml('<table border="1">') if independentVar[-1] == "s": independentVar = independentVar[:-1] out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n print \"Name: \"+str(self.name)\n ss = self.y.shape[0]\n for i in xrange(ss):\n print \"Actual: \"+str(self.y[i])\n print \"Prediction: \"+str(self.a[i])\n print \"\"\n print \"\\n\"", "def print_fit(funct, fit, cov=False):\n param...
[ "0.6531072", "0.64496905", "0.6358777", "0.6357666", "0.629485", "0.6260334", "0.6251646", "0.6163279", "0.6158657", "0.61278737", "0.6047489", "0.6043604", "0.59669435", "0.5965726", "0.5951386", "0.59207463", "0.5912625", "0.5912578", "0.58851093", "0.58696395", "0.5834422"...
0.53718823
97
Plot the data and best fit for implementations that contain the given key
def plotFit(title, threadCounts, bestTimes, coeffs, independentVar, unit): values = {} for impl in sorted(list(bestTimes.keys()), key=cmp_to_key(compareFn)): values[impl] = bestTimes[impl] (tThread, tZero) = coeffs[impl] values[impl + "(best fit)"] = [ tZero + thread * tThrea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_predictions(ax, key='M19'):\n \n pred = {'TT95': (0.3, 0.27),\n 'R03': (0.5, 0.33),\n 'M19': (0.33, 0.3)}\n \n x = np.array(ax.get_xlim())\n y2d = pred[key][0] * np.ones(2)\n y3d = pred[key][1] * np.ones(2)\n \n ax.plot(x, y2d, color='black', ls='--', lw=0.5)\n ...
[ "0.6572249", "0.6459799", "0.6231436", "0.60326815", "0.584273", "0.5824968", "0.5811195", "0.57366365", "0.5727006", "0.5686137", "0.56817913", "0.56704575", "0.5646141", "0.56150794", "0.5598639", "0.5595212", "0.55930716", "0.5543753", "0.5513676", "0.55058753", "0.5436735...
0.5828787
5
Convert a measurement with a range suffix into a suitably scaled value
def extractSI(s): # If this is representing a range, just return it as is. if "[" in s: return (s, None) types = {"T": "Time", "O": "Rate", "A": "Rate", "s": "Seconds", "%": "Percentage"} du = s.split() # Preserve integers as such, so that columns like "Threads" generate an X axis "1 2 3",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remap_interval(val, input_interval_start, input_interval_end, output_interval_start, output_interval_end):\n inputrange = float(input_interval_end) - float(input_interval_start) #finds length or original interval\n outputrange = float(output_interval_end) - float(output_interval_start) #finds leng...
[ "0.6494964", "0.6392252", "0.63828164", "0.6337366", "0.62488836", "0.61872506", "0.6183594", "0.61008835", "0.6078754", "0.6049721", "0.60395986", "0.6036124", "0.60281193", "0.5985939", "0.59293014", "0.5922022", "0.59183216", "0.59165215", "0.59144276", "0.5909274", "0.589...
0.0
-1
Load data into a Pandas' data frame, we're not using this yet...
def readData(f): line = f.readline() fieldnames = [x.strip() for x in line.split(",")] line = f.readline().strip() data = [] while line != "": if line[0] != "#": fields = line.split(",") data.append((fields[0], [extractSI(v)[0] for v in fields[1:]])) line = f....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=5, exog_idx=[10, 2, 6, 7, 8])", "def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)", "def load_pandas():\n data = _get_data()\n return du.process_pandas(data, endog_idx=0)", ...
[ "0.749106", "0.74122226", "0.74122226", "0.727072", "0.71829814", "0.7006", "0.69675386", "0.6942656", "0.6923089", "0.68960166", "0.68508947", "0.68508947", "0.67666906", "0.6748329", "0.67455745", "0.6717121", "0.6707512", "0.6682415", "0.66772085", "0.66612744", "0.6639854...
0.0
-1
Extract a time from a string of the form "%dm %4.2fs" which is what "time" generates.
def extractTime(s): msRe = r"([0-9]+)m +([0-9]+\.[0-9]+)s" matched = re.match(msRe, s) if matched: return 60 * int(matched.group(1)) + float(matched.group(2)) # Maybe we don't have any minutes sRe = r"([0-9]+\.[0-9]+)s" matched = re.match(sRe, s) if matched: return float(matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_time(s: str):\n return utils.parsers.parse_eng_unit(s, base_unit='s', default=1e-12)", "def parse_time(value: str) -> float:\n return float(value[:-1]) * TIME[value[-1]]", "def _get_time(string):\n string = string[0:7] # Drop day\n return string.replace(\"-\", \"\")", "def parse_time(s...
[ "0.7376245", "0.69885296", "0.69597244", "0.680901", "0.6714649", "0.67008376", "0.66874033", "0.6630157", "0.6610557", "0.65271956", "0.65221244", "0.64632", "0.6434758", "0.64113086", "0.6404067", "0.6317093", "0.63148624", "0.6314434", "0.631036", "0.6283578", "0.6228409",...
0.7262653
1
Format a number in engineering format, where the exponent is a multiple of 3
def engFormat(f): if f == 0.0: value = 0.0 exponent = 0 else: exponent = math.log10(-f if f < 0 else f) if exponent < 0: exponent = -int(math.ceil(-exponent)) else: exponent = int(math.floor(exponent)) for i in range(3): if (exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_engineering( number, unit = \"\" ):\n if math.isnan(number):\n return \"nan\"\n if number == 0.0:\n return 0\n\n convert_table = {-18:'a', -15:'f', -12:'p', -9:'n', -6:'u',\n -3:'m', -2:'c', -1:'d', 0:'', 3:'k',\n 6:'M', 9:'G', 12...
[ "0.7254678", "0.6709356", "0.65849704", "0.6535096", "0.64507467", "0.64036494", "0.63798475", "0.6357471", "0.6309954", "0.6143084", "0.61399496", "0.6122176", "0.61172795", "0.6037605", "0.59719115", "0.5958524", "0.58732384", "0.5864186", "0.5839863", "0.5835042", "0.58245...
0.6764551
1
If a measurement has Min and Max, we can convert them into a notional error bar by replacing the name_SD field with a [minNamevalue, maxNamevalue] pair
def convertMinMaxIntoError(m, name, minName, maxName): minVal = m.__dict__.get(minName, None) maxVal = m.__dict__.get(maxName, None) if maxVal == None or minVal == None: return None value = m.__dict__[name] return [[value - minVal], [maxVal - value]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determinePlotLimits(self):\n max_str = \"up99\"\n min_str = \"dn99\"\n if self.keywords.get(\"limit_type\",\"99per\") == \"minmax\":\n max_str = \"max\"\n min_str = \"min\"\n \n # Determine the min/max of variables over all models\n limits = {...
[ "0.55634105", "0.5557625", "0.5547021", "0.54915667", "0.53918475", "0.5362521", "0.5332207", "0.5294759", "0.5274828", "0.52670044", "0.5266675", "0.5235942", "0.5220849", "0.51992804", "0.51608247", "0.51373273", "0.51251656", "0.5120511", "0.51145077", "0.5092589", "0.5086...
0.66927224
0
Extract a list of thread counts, The times per benchmark/thread, and standard deviations per benchmark/thread
def summarizeResults(results, what, discard=(), minName=None, maxName=None): # threadCounts = sorted (transpose(results).keys()) threadCounts = [t for t in list(transpose(results).keys()) if t not in discard] if not isinstance(threadCounts[0], str): threadCounts.sort() sds = {} meanValue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getThreads():\r\n return multiprocessing.cpu_count()", "def count_benchmarks():\n return len(setup_storage().fetch_benchmark({}))", "def per_cpu_times():\n ret = []\n for user, system, idle, interrupt, dpc in cext.per_cpu_times():\n item = scputimes(user, system, idle, interrupt, dpc)\n ...
[ "0.60619295", "0.60282296", "0.60126525", "0.5891208", "0.5888971", "0.58332855", "0.5748321", "0.5742721", "0.57208693", "0.57146215", "0.5707351", "0.5706242", "0.5697053", "0.5691065", "0.56903625", "0.56756157", "0.5672929", "0.56703794", "0.5642237", "0.5642025", "0.5637...
0.0
-1
Extract a minimum or maximum value for the given key on the fewest number of threads we measured on (anywhere)
def selectedT1(results, what, doMin=True): selectedCount = min( [k for k in transpose(results).keys() if not isinstance(k, str)] ) selectedVal = 1e9 if doMin else -1e9 # print "selectedCount " + str(selectedCount) comparison = min if doMin else max for k in list(results.keys()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_6_min_value_list_of_dicts(data: DT, key: str) -> ST:\n purified_from_not_valid_dicts = filter(lambda dic: key in dic, data)\n return min(purified_from_not_valid_dicts, key=lambda dic: dic[key])", "def get_max_key(dico):\n our_max = 0\n argmax = None\n for key, val in dico.items():\n ...
[ "0.6385478", "0.6036219", "0.6012997", "0.5945911", "0.5859294", "0.58188885", "0.5807972", "0.5760502", "0.57217646", "0.57083887", "0.56111264", "0.56076187", "0.56050617", "0.5570697", "0.55512816", "0.55372494", "0.5534718", "0.5507914", "0.55025536", "0.5500761", "0.5477...
0.5430186
23
Apply the function to all of the measurements
def transformResults(threadCounts, values, function): res = {} for bm in list(values.keys()): res[bm] = [] for (nThreads, v) in zip(threadCounts, values[bm]): res[bm].append(None if v == None else function(v, nThreads)) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_fn(self,fn):\r\n \r\n self.check_Data()\r\n for split,data_ in self.processed_data.items():\r\n x = data_['x']\r\n x = np.array([fn(xi) for xi in x])\r\n data_['x'] = x", "def applyFuncOnValues(self, func):\r\n self._value = func(self._value)...
[ "0.6649706", "0.6167145", "0.60951185", "0.600086", "0.5972153", "0.5929994", "0.57918704", "0.5734103", "0.5721275", "0.5699407", "0.56757295", "0.5655823", "0.56521386", "0.5651394", "0.56490105", "0.5633817", "0.56256026", "0.5601849", "0.55617565", "0.552346", "0.5499854"...
0.0
-1
Compute mean and standard deviation results for duplicate entries in the list of measurements.
def computeStats(results, independentVariable): common = {} # Collect lists of the values for v in results: test = v.__dict__[independentVariable] try: common[test].append(v) except: common[test] = [v] result = [] # Sanity check for number of data it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _avg_sd_from_list(lst):\n arr = flex.double(lst)\n avg = round(flex.mean(arr), 5)\n std = round(arr.standard_deviation_of_the_sample(), 5)\n return avg, std", "def stat(lst):\n n = float(len(lst))\n mean = sum(lst) / n\n stdev = sqrt((sum(x * x for x in lst) / n) - (mean ...
[ "0.683622", "0.673926", "0.65098774", "0.6467416", "0.63125694", "0.63054687", "0.62478226", "0.62117904", "0.6203736", "0.6197018", "0.616801", "0.6128668", "0.60844576", "0.60655826", "0.6058886", "0.6038068", "0.6000037", "0.5999568", "0.5967793", "0.5965543", "0.59363204"...
0.64897317
3
Add an overall mean for the given field
def addOverallMeans(results, fieldNames, fields): # Work out what the values we already have look like meanValues = ["Overall Mean"] geoMeanValues = ["Overall Geometric Mean"] for name in fieldNames[1:]: if name in fields: values = [r.__dict__[name] for r in results] geoM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMean(self, field):\n\n return np.mean([self.fitnesses[i][field] for i in range(len(self.fitnesses))])", "def fmean(field):\n warnings.simplefilter(\"ignore\")\n return np.nanmean(field, axis=3, keepdims=True)", "def mean(self, field, axis=None, region=None):\n # \n # If a regi...
[ "0.7278746", "0.7135875", "0.6684064", "0.6644748", "0.6622957", "0.65778464", "0.6480201", "0.644461", "0.6373308", "0.6351624", "0.6294219", "0.62699544", "0.62606704", "0.6239302", "0.62274325", "0.6176736", "0.6157787", "0.6149142", "0.6136901", "0.61185", "0.6103634", ...
0.7149263
1
Find a good value for the maximum on the Y axis
def computeGoodMax(totalTimes, noerrs): # Could allow a small amount of space above the top, but it's annnoying for percentages! # return None factor = 1.00 maxReading = factor * max( [max([v for v in l if v != None]) for l in list(totalTimes.values())] ) if maxReading == 0: maxR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_max(self):\n return self.get_max_value(self.Y_INDEX)", "def get_y_max(self):\n if len(self._statDict) == 0:\n return -1E10\n\n line_id_list = self._statDict.keys()\n max_y = self._statDict[line_id_list[0]][3]\n for i_plot in range(1, len(line_id_list)):\n ...
[ "0.8277419", "0.8052967", "0.78747857", "0.7690648", "0.7672491", "0.7557933", "0.74574304", "0.7440886", "0.7161742", "0.70999867", "0.69315743", "0.6918759", "0.6918502", "0.6871075", "0.68578976", "0.68520427", "0.6791778", "0.67885953", "0.6769947", "0.67635864", "0.67626...
0.62784785
86
Return the next nonblank, noncomment line N.B. readline returns a zero length line at EOF.
def readFiltered(f): line = f.readline() while line: line = line.strip() if len(line) != 0: if line == "### NEW EXPERIMENT ###": # print ("readFiltered: ''") yield "" elif line[0] != "#": # print ("readFiltered: '",line,"'")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_line(fin):\n line = fin.readline()\n\n pos = line.find(\"#\")\n\n while (pos == 0 or line.strip() == \"\") and line:\n line = fin.readline()\n pos = line.find(\"#\")\n\n if pos == -1:\n return line.strip()\n return line[:pos]", "def _consume_blanklines(self):\n ...
[ "0.7206668", "0.6796377", "0.6481613", "0.6395342", "0.6350605", "0.63455814", "0.63159776", "0.62680876", "0.62291354", "0.6182882", "0.61470836", "0.6128067", "0.6110453", "0.60997826", "0.60870755", "0.60870755", "0.6078397", "0.6022083", "0.5994597", "0.59730536", "0.5958...
0.0
-1
Consume a single experiment from a file. That is either the whole file, or the amount up to a NEW EXPERIMENT line
def readExperiment(getLine, desiredFields, minX, maxX): try: title = next(getLine) except StopIteration: # We're at the end of the file return (None, None, None, None) l = next(getLine) # print ("Title: " + title) # print ("l: " + l) line = next(getLine) fieldnames...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_experiment(experiment_file, exp_method_template, experiment):\n with open(exp_method_template, 'r') as f:\n exp_text = f.readlines()\n for idx, l in enumerate(exp_text):\n exp_text[idx] = exp_text[idx].replace('EDIT', experiment)\n exp_text[idx] = exp_text[idx].replace('RANDALPHA...
[ "0.5461225", "0.5247547", "0.51944584", "0.5111096", "0.50642157", "0.505239", "0.50488585", "0.50231916", "0.49975798", "0.49756852", "0.49649516", "0.4946024", "0.49411646", "0.4932227", "0.49090433", "0.49063843", "0.49063843", "0.49010712", "0.48967376", "0.48967376", "0....
0.45445573
81
Find each set of results with the same first parameter, compute the min of their means and then scale all their results by that. The aim here is to scale results for specific processors in a way that is internally consistent. Scaling each run by its own min can be misleading, since then results which were smaller can l...
def normalizeResults(results, independentVariable, basis): normValues = {} if basis == "min": reduction = min elif basis == "mean": reduction = mean elif basis == "max": reduction = max print("Normalising by " + basis) for k in results.keys(): ik = k.split(",")[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_together(data, comp):\n scales = []\n guess = 1.\n s = opt.minimize(sq_residuals_in_range, guess, args = (data, comp), \n method = 'Nelder-Mead').x\n return s", "def cluster_means_scaled(self):\n if self.evaluate_by is not None:\n return(self.merged_scaled_...
[ "0.5730076", "0.57292515", "0.5662298", "0.5552494", "0.551228", "0.5499445", "0.5480341", "0.5479149", "0.5476675", "0.5461815", "0.5429813", "0.5428306", "0.5410855", "0.5396706", "0.5393401", "0.5375831", "0.5367997", "0.5347249", "0.53420913", "0.5333558", "0.5322741", ...
0.6127019
0
Turn runs of bad characters to have in a filename into a single underscore, remove any trailing underscore
def cleanFilename(fname): return re.sub("_$", "", re.sub("[ _\n\t/()*,&:;@.]+", "_", fname))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrub_underscore_suffix(filename):\n scrubbed = re.sub(r\"_[^_]+\\.\", \".\", filename)\n return scrubbed", "def safe_filename(filename):\n string = str(filename).strip().replace(\" \", \"_\")\n string = re.sub(r\"(?u)[^-\\w.]\", \"_\", string)\n return re.sub(r\"_+\", \"_\", string)", "def ...
[ "0.84402937", "0.8271259", "0.79155785", "0.78541076", "0.7842436", "0.7829296", "0.7724186", "0.76734734", "0.76034737", "0.75659907", "0.75494283", "0.75451845", "0.75305706", "0.7522911", "0.74923533", "0.7423959", "0.742056", "0.7403071", "0.73820186", "0.7378246", "0.737...
0.8063518
2
Performs mutations on the children, stochastically, based on the mutation probability.
def _mutate(self, p_mutate, mutation): self.children = mutation(self.children, p_mutate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutation(child_weights):\n for index, _ in enumerate(child_weights):\n # Add a chance for random mutation\n has_mutation = random.uniform(0, 1)\n if has_mutation <= .1:\n child_weights[index] *= random.randint(0, 5)", "def __mutate(self, chromosomes, mutation_probability):\...
[ "0.7766687", "0.7341522", "0.7289419", "0.7230715", "0.7209466", "0.7037261", "0.6843733", "0.674903", "0.6699263", "0.65760726", "0.6472517", "0.61829436", "0.6166081", "0.61597234", "0.6155939", "0.60983205", "0.6072234", "0.60406685", "0.6036837", "0.598226", "0.5959217", ...
0.71829987
5
Parents are selected according to fitness probability.
def add_parents(self, sample, fitness, max_parent_per_capita=1.0): assert isinstance(max_parent_per_capita, Number) and 0 <= max_parent_per_capita <= 1.0 self.size = len(sample) max_parent_size = int(max_parent_per_capita * self.size) probabilities = np.cos(fitness) ** 2 r = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stochastic_universal_selection(self, fitness, num_parents):\n\n fitness_sum = numpy.sum(fitness)\n if fitness_sum == 0:\n self.logger.error(\"Cannot proceed because the sum of fitness values is zero. Cannot divide by zero.\")\n raise ZeroDivisionError(\"Cannot proceed becaus...
[ "0.7950645", "0.76420844", "0.73373795", "0.7301062", "0.7292271", "0.7162419", "0.7154131", "0.71514004", "0.68911153", "0.679339", "0.66302663", "0.66150093", "0.6567251", "0.65266013", "0.6484518", "0.6401505", "0.6389962", "0.63223356", "0.62270945", "0.62139714", "0.6186...
0.62084496
20
Check empty, set, test, reset, test.
def test_credentials_set_reset(self): empty_setting = { 'AccessKeyId': None, 'SecretAccessKey': None, 'SessionToken': None } nonempty_setting = { 'AccessKeyId': '1', 'SecretAccessKey': '2', 'SessionToken': '3' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty(self):\n pass", "def _test_empty(t):\n return t.is_empty()", "def test_empty_functions():", "def isEmpty(self, *args):", "def check():", "def is_empty(self):", "def is_empty(self):", "def check(self) -> None:", "def test_is_empty_methods(self):\n\n batch = Batch(Mock...
[ "0.6656806", "0.64239687", "0.6303982", "0.63000506", "0.6287836", "0.61566705", "0.61566705", "0.6151039", "0.60715675", "0.6051508", "0.6051508", "0.6051508", "0.6051508", "0.60382605", "0.6027669", "0.6026403", "0.5953078", "0.5922615", "0.59059507", "0.5905704", "0.589207...
0.0
-1
Initialize the spacecraft and set its initial position
def __init__(self, ai_settings, screen): super(Ship, self).__init__() self.screen = screen self.ai_settings = ai_settings # Loading spacecraft image and obtaining its external rectangle self.image = pygame.transform.rotate(pygame.image.load('images/soldier.png'), 90) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_position():\n __maze.init_position()", "def _init(self, position):\n\t\tself._position = position", "def __init__(self):\n self.position = 0", "def __init__(self):\r\n self.position=(0,0)\r\n self.direction = 0.\r\n self.speed = 0\r\n self.state = 0\r\n p...
[ "0.73910457", "0.6936796", "0.69150186", "0.6890182", "0.6856978", "0.6777854", "0.6660125", "0.66269314", "0.6598146", "0.65341693", "0.6520882", "0.64898777", "0.6488802", "0.6433804", "0.6430992", "0.6425387", "0.63644", "0.63239896", "0.63174313", "0.63057685", "0.6294312...
0.60956055
43
Adjust the position of the spacecraft according to the moving signs
def update(self): # Update the center value of the ship instead of rect if self.moving_right and self.rect.right < self.screen_rect.right: self.center += self.ai_settings.ship_speed_factor if self.moving_left and self.rect.left > 0: self.center -= self.ai_settings.sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_position(self):\n # clamp on upper and lower bounds\n new_pos = self.position[1] + self.velocity\n # TODO: proper centering on borders\n if new_pos >= (config['globals']['HEIGHT'] - int(config['globals']['PAD_HEIGHT'] / 2)\n or new_pos <= int(config['glo...
[ "0.69893175", "0.6943141", "0.69328576", "0.685824", "0.68279225", "0.68111914", "0.6796697", "0.67530197", "0.6751285", "0.6731766", "0.671755", "0.6685444", "0.6650916", "0.66422963", "0.66167086", "0.6610373", "0.6579091", "0.65636206", "0.655607", "0.65556437", "0.6530584...
0.0
-1
Draw the spacecraft at the designated location
def blitme(self): self.screen.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n #for (x, y) in self.coords:\n # pyxel.rect(\n # (x + self.x) * 4,\n # (y + self.y) * 4,\n # (x + self.x) * 4 + 3,\n # (y + self.y) * 4 + 3,\n # self.color)", "def draw(self):\n x = self.displacement.x ...
[ "0.7066118", "0.70287776", "0.69161975", "0.68440825", "0.68423927", "0.6745069", "0.67068917", "0.66786164", "0.65995675", "0.6584293", "0.652891", "0.6528739", "0.6506193", "0.6500058", "0.64977103", "0.64929116", "0.6466362", "0.6442369", "0.6441227", "0.6439538", "0.64387...
0.0
-1
Center the ship on the screen
def center_ship(self): self.center = self.screen_rect.centerx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_ship(self):\n self.center = self.screen_rect.centerx", "def center_ship(self):\n self.center = self.screen_rect.centerx", "def center_ship(self):\n self.center = self.screen_rect.centerx", "def center_ship(self):\n # Start each new ship at the bottom center\n sel...
[ "0.90181214", "0.90181214", "0.90181214", "0.8599386", "0.77910644", "0.761576", "0.7553747", "0.7458518", "0.7252782", "0.72375983", "0.7168899", "0.71423084", "0.7113291", "0.7064254", "0.7018259", "0.6994591", "0.6934956", "0.69271857", "0.6910503", "0.69049215", "0.690492...
0.90641564
1
Attach a lot of summaries to a Tensor (for Tensorboard visualization).
def variable_summaries(var): with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) tf.summary.scalar('stddev', stddev) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ...
[ "0.7055453", "0.69594884", "0.69594884", "0.679989", "0.6766926", "0.67630017", "0.6671678", "0.6671673", "0.6623029", "0.6601337", "0.6584152", "0.6577044", "0.6568252", "0.65088475", "0.6503359", "0.6411265", "0.64072824", "0.63004506", "0.6281558", "0.62347925", "0.6217481...
0.56149787
77
Computes the average precision at k. This function computes the average prescision at k between two lists of items.
def apk(actual, predicted, k=10): if len(predicted) > k: predicted = predicted[:k] score = 0.0 num_hits = 0.0 for i, p in enumerate(predicted): if p in actual and p not in predicted[:i]: num_hits += 1.0 score += num_hits / (i + 1.0) # if not actual:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco...
[ "0.7475594", "0.74314404", "0.7328193", "0.7280659", "0.7271064", "0.7129832", "0.7087148", "0.6987466", "0.69284856", "0.6889254", "0.68219167", "0.6814678", "0.68059695", "0.6796172", "0.6774947", "0.6767025", "0.6767025", "0.676344", "0.66914594", "0.6675632", "0.66103244"...
0.6196564
36
Load npy of network weights
def load_npy(session, data_path, ignore_missing=False, ignore_params=None): data_dict = np.load(data_path).item() for op_name in data_dict: if ignore_params is None or op_name not in ignore_params: # print op_name with tf.variable_scope(op_name, reuse=True): for p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()", "def load_weights(self, weights):\n weight = np.load(weights)\n return weight", "...
[ "0.777255", "0.7503046", "0.72860277", "0.697063", "0.6858621", "0.68511444", "0.67280126", "0.6723838", "0.6582674", "0.6542274", "0.64869034", "0.6420334", "0.6418078", "0.63853097", "0.63563514", "0.6348038", "0.6348038", "0.63442945", "0.63413405", "0.63134426", "0.631223...
0.5807888
57
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.82235825", "0.82227623", "0.82227623", "0.82227623", "0.82227623", "0.8196081", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857", "0.81635857",...
0.712861
62
Calculates word frequency for a given text. We don't consider stop words when calculating frequency.
def word_frequency(text): tokenizer = RegexpTokenizer(r'\w+') tokens = tokenizer.tokenize(text) stop = set(stopwords.words('english')) tokens_without_stop = list(filter(lambda word: word.lower() not in stop, tokens)) counts = Counter(tokens_without_stop) return counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_word_counts(text : Text)->Counter:\n return Counter(tokenized_text(text))", "def frequency(text):\n # TODO: change function input to a textfile?\n import collections\n freq = collections.Counter(text)\n # print freq\n return freq", "def complexity(text:str) -> float:\n words = ...
[ "0.8071999", "0.75517035", "0.74244624", "0.7402747", "0.73363006", "0.7313311", "0.730345", "0.72393984", "0.72356933", "0.7208666", "0.7173497", "0.7112697", "0.7105219", "0.7059449", "0.7059299", "0.7014396", "0.7002395", "0.69982463", "0.6997513", "0.69905484", "0.6984714...
0.818352
0
Returns word frequency in format suitable for d3 to use. Returns top 250 words only so that it fits on UI. This limit can be taken as an input from user in future to make this function more usable.
def word_frequency_data_for_d3(text): counts = word_frequency(text) list_for_d3 = [{'text': word, 'size': count} for word, count in counts.items() if len(word) > 1 and len(word) > 2] sorted_list = sorted(list_for_d3, key=lambda item: item['size'], reverse=True) return sorted_list[:250]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_top_n_words(total_count__of_words, n): # Considering n=10 here as specified in the requirements\n return sorted(total_count__of_words.items(), key=lambda i: i[1], reverse=True)[:n]", "def count_words(data, number_word_frequency_results=40):\n current_max_sentence_size = 0\n count_word_freq...
[ "0.7272161", "0.7177371", "0.7076005", "0.7043782", "0.7010348", "0.6989289", "0.6973895", "0.69045085", "0.6855814", "0.68073785", "0.677965", "0.67379", "0.67073333", "0.667007", "0.666989", "0.66444814", "0.6633075", "0.6630215", "0.6595672", "0.65790606", "0.65766", "0....
0.6641748
16
Check if a mol has 2D coordinates and if not, calculate them.
def check_2d_coords(mol, force=False): if not force: try: mol.GetConformer() except ValueError: force = True # no 2D coords... calculate them if force: if USE_AVALON_2D: pyAv.Generate2DCoords(mol) else: mol.Compute2DCoords()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_coords():\n split_coords = row[\"map_coord\"].split(',')\n map_x, map_y = [int(i) for i in split_coords]\n map_x_normed = ((map_x*2) / self.MINIMAP_DIM) - 1\n map_y_normed = -(((map_y*2) / self.MINIMAP_DIM) - 1)\n return map_x_normed, map_y_normed"...
[ "0.6219354", "0.6077779", "0.6013348", "0.584337", "0.58144647", "0.5808867", "0.5737401", "0.57239455", "0.56685406", "0.56669194", "0.56379074", "0.56226474", "0.5609471", "0.56056577", "0.5604061", "0.55906796", "0.55845845", "0.5557084", "0.5556743", "0.55530614", "0.5545...
0.7064952
0
Returns True, if x is a number (i.e. can be converted to float).
def isnumber(x): try: float(x) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(x):\n if isinstance(x, (int, float)):\n return True\n else:\n return False", "def is_float(x):\r\n try:\r\n float(x)\r\n except ValueError:\r\n return False\r\n return True", "def _is_number(value):\n try:\n float(value)\n re...
[ "0.8831771", "0.84678894", "0.8269232", "0.8268981", "0.8215385", "0.81769127", "0.8087828", "0.80597544", "0.8051537", "0.8027391", "0.7998552", "0.7986285", "0.7984602", "0.7984602", "0.7984602", "0.79576087", "0.79458576", "0.79081887", "0.78952646", "0.78746027", "0.78025...
0.90320134
0
mode `int` displays similarities not to references but to other internal compounds (just displays the `Similarity` column).
def overview_report(df, cutoff=LIMIT_SIMILARITY_L / 100, highlight=False, mode="cpd"): cpp.load_resource("SIM_REFS") sim_refs = cpp.SIM_REFS detailed_cpds = [] if isinstance(df, cpp.DataSet): df = df.data t = Template(cprt.OVERVIEW_TABLE_HEADER) if "int" in mode: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode(self):\n return self._summarize(lambda c: c.mode)", "def mode(self) -> int:", "def mode(self) -> str:\r\n ...", "def get_mode(dataframe):\n mode = lambda x: x.mode() if len(x) > 2 else np.array(x)\n print(dataframe.groupby('face color')['eye color'].agg(mode))", "def mode(self)...
[ "0.65930176", "0.6014257", "0.586596", "0.5808036", "0.56258184", "0.5414828", "0.53677154", "0.53506863", "0.53100467", "0.5308456", "0.521769", "0.5209448", "0.5180258", "0.5096023", "0.5053267", "0.50504166", "0.5018957", "0.5018957", "0.50172937", "0.50101167", "0.4987906...
0.48514766
36
For interactive viewing in the notebook.
def show_images(plate_full_name, well): if not IPYTHON: return src_dir = op.join(cp_config["Paths"]["SrcPath"], plate_full_name) ctrl_images = load_control_images(src_dir) image_dir = op.join(src_dir, "images") templ_dict = {} for ch in range(1, 6): im = load_image(image_dir, we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notebook():\n pass", "def notebook():\n pass", "def interactive():\n IPython.start_ipython(argv=[])", "def jupyter():", "def _ipython_display_(self):\n with self._sc:\n self._box._ipython_display_()", "def output_notebook(self):\n self._notebook = True", "def _ipyt...
[ "0.7690705", "0.7690705", "0.73434025", "0.7072106", "0.7023148", "0.6829893", "0.6669605", "0.65967554", "0.6558241", "0.65490204", "0.64912015", "0.6477528", "0.64667416", "0.6445142", "0.6425655", "0.639713", "0.639713", "0.6380591", "0.6327313", "0.6292819", "0.6233279", ...
0.0
-1
A building block for a dense block.
def conv_block(self, x, params, training, name, memory): with tf.variable_scope(name, reuse=tf.AUTO_REUSE): if params.use_bc: x1 = tf.layers.conv2d(x, 4 * params.growth_rate, kernel_size=1, padding='same', use_bias=False, name='_1_conv') x1 = tf.layers.dropout(x1, par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense_block(x, blocks, name, train_bn):\r\n for i in range(blocks):\r\n x = conv_block(x, 32, name=name + '_block' + str(i + 1), train_bn=train_bn)\r\n return x", "def _dense_block(self, input_data, name):\n block_input = input_data\n with tf.variable_scope(name):\n for ...
[ "0.66214377", "0.6609796", "0.6592855", "0.6590386", "0.6504537", "0.63902044", "0.62953377", "0.6231654", "0.612018", "0.6036814", "0.6024914", "0.6012743", "0.60080326", "0.59583706", "0.5917011", "0.5887384", "0.5836732", "0.5834219", "0.5789371", "0.5787604", "0.5748851",...
0.0
-1
Instantiates the DenseNet architecture.
def model(self, x, params, training, memory=None): with tf.variable_scope("_densenet", reuse=tf.AUTO_REUSE): if params.blocks_size > 0 and params.blocks_num > 0: blocks_size = [params.blocks_size] * params.blocks_num elif params.net_name is not None: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_base_network(NumberOfFeatures, NumberOfClasses,init_mode='glorot_normal'):\n network = Sequential()\n network.add(Dense(44, activation='sigmoid', kernel_initializer=init_mode,input_dim=NumberOfFeatures))\n# network.add(Dense(22, activation='sigmoid',kernel_initializer=init_mode))\n network.a...
[ "0.69732815", "0.69310397", "0.6879293", "0.6875603", "0.6796704", "0.6787399", "0.6776941", "0.6755538", "0.673781", "0.67071885", "0.66999316", "0.6690914", "0.6687706", "0.6639211", "0.6602322", "0.65980804", "0.6596391", "0.65892094", "0.65678", "0.6567025", "0.6549191", ...
0.0
-1
For disordered systems with relaxed atomic positions, it might be better to use initial atomic positions to use the symmetry of the structure (POSCAR_initial).
def run(self): poscar = Poscar('POSCAR') number_of_atoms = poscar.get_atoms().get_number_of_atoms() dummy_symbols = self.create_dummy_symbols(number_of_atoms) poscar.get_atoms().set_chemical_symbols(dummy_symbols) poscar.write_poscar('POSCAR_ideal')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def propanolIntermediate():\n coords = [\n [-1.60306996, 0.10333519, 0.50792736],\n [-0.66904416, -0.46962566, -0.55371646],\n [0.67345677, 0.26436258, -0.61179298],\n [1.26292797, -0.10585085, -1.45392921],\n [0.49744830, 1.34089332, -0.75955140],\n [1.47742183, 0.0517...
[ "0.6103005", "0.59019697", "0.5630828", "0.55407274", "0.55275506", "0.54735744", "0.54610157", "0.54103494", "0.53193635", "0.53148454", "0.5281034", "0.5277508", "0.5273492", "0.5247259", "0.52436775", "0.5241989", "0.52053905", "0.5181437", "0.5178617", "0.51722807", "0.51...
0.5067868
31
Rank points in a cluster based on their distance to the cluster centroid/medoid
def __init__(self, points, clusterer, metric='euclidean', selection_method='centroid'): self.clusterer = clusterer self.metric = metric allowed_methods = ['centroid', 'medoid'] if selection_method not in allowed_methods: raise ValueError(f'Selection method must be on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_cluster_points_by_distance(self, cluster_id):\n cluster_of_interest = self.embedding_df[self.embedding_df['cluster'] == cluster_id].copy()\n \n if cluster_of_interest.empty:\n raise ValueError(f'Cluster id {cluster_id} not found')\n \n if 'dist_to_rep_poin...
[ "0.774409", "0.7352601", "0.6793966", "0.6695094", "0.6618769", "0.66128606", "0.647569", "0.6447817", "0.638387", "0.6371435", "0.6332436", "0.6308149", "0.63051474", "0.6276134", "0.62399524", "0.6237592", "0.62352484", "0.6164116", "0.61512566", "0.6150622", "0.60985726", ...
0.0
-1