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
generate the subjects structure needed to create the folders in drive
def init():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_analysis_skeleton(project_dir,sub_stem):\n \n # Move from project_dir to ToProcess\n TP_dir = os.path.join(project_dir,'ToProcess')\n move_files(project_dir, TP_dir, '')\n \n all_files = glob.glob(os.path.join(TP_dir,'*%s*' % (sub_stem)))\n all_files = [os.path.basename(f) for f in a...
[ "0.66462374", "0.6618272", "0.6297069", "0.62176675", "0.6198142", "0.6193512", "0.61851746", "0.6171276", "0.6035251", "0.59953237", "0.5969861", "0.59673655", "0.59498274", "0.5922048", "0.59138757", "0.58946705", "0.5894622", "0.5891271", "0.5885636", "0.5885636", "0.58764...
0.0
-1
upload the folders created by init command and store the ids of those folders
def create():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def syncfolder():", "def upload_handler(self):\n \n for root, dirs, files in os.walk(self.path):\n\n current_dir = os.path.basename(root)\n \n if root == self.path:\n root_id = self.gapy.create_file(current_dir, path=root, isFolder=True)\n else...
[ "0.7135781", "0.69107336", "0.6597334", "0.63834125", "0.63768333", "0.61487734", "0.60573316", "0.5947639", "0.5946258", "0.5875613", "0.5851059", "0.58484143", "0.5845889", "0.5836926", "0.582836", "0.5809538", "0.57464784", "0.57359505", "0.5716436", "0.57146806", "0.57087...
0.0
-1
List available subjects with its respective id,
def ls():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all_subjects(self):\n self.load_subjects_in_twSubjects([self.pj[SUBJECTS][x][\"name\"] for x in self.pj[SUBJECTS]])", "def subject_list():\n items = []\n\n soup = abcradionational.get_soup(URL + \"/podcasts/subjects\")\n \n subject_heading = abcradionational.get_podcast_heading(soup)\...
[ "0.7564551", "0.7342874", "0.71160054", "0.6835792", "0.6800803", "0.6768294", "0.66140616", "0.65194505", "0.6450174", "0.6444373", "0.6353457", "0.6339355", "0.6324993", "0.6312181", "0.63060343", "0.62966466", "0.62959385", "0.62355834", "0.6221914", "0.6215571", "0.620728...
0.0
-1
set the current class to upload screenshots and notes
def set():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._uploaded_file_ops = False", "def __init__(self):\n self.label = \"Attachments to File\"\n self.description = \"Extract attachments from a feature class to file\"\n self.canRunInBackground = False", "def _class(self, _class):\n\n self.__class = _cla...
[ "0.59720474", "0.5885543", "0.5759416", "0.5759416", "0.5745129", "0.571496", "0.5641162", "0.555142", "0.55076414", "0.5460135", "0.5361149", "0.5250432", "0.5223033", "0.52166", "0.52166", "0.5196023", "0.5161504", "0.51547116", "0.5143689", "0.5122844", "0.51184845", "0....
0.0
-1
take a screenshot and upload to drive
def ts(region, tags, reset):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def capture_and_upload_screenshot(self) -> None:", "def take_screeshot():\n\n # generate a unique identifier for the screenshot\n if not settings.screenshot_app:\n return ('Screenshots are disabled', 404)\n\n url, width, height = parse_querystring(request)\n\n if url ...
[ "0.8495051", "0.67579937", "0.6725828", "0.6612546", "0.65725386", "0.65676177", "0.65237814", "0.64896345", "0.64476013", "0.6365933", "0.63239276", "0.6300869", "0.6244247", "0.62289286", "0.61827874", "0.6180655", "0.6180655", "0.5982894", "0.5978675", "0.59644985", "0.596...
0.0
-1
write a note and upload to drive
def note():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_note():\n\n title_note = request.form.get(\"title\")\n note = request.form.get(\"note\")\n\n date_string = datetime.today().strftime('%Y-%m-%d')\n diary = Note(user_id=session[\"user_id\"],title_note = title_note, note_created=date_string, note=note)\n\n db.session.add(diary)\n db.sessi...
[ "0.63436806", "0.6299849", "0.6289657", "0.6258689", "0.62170416", "0.60311145", "0.6003288", "0.59646916", "0.5945315", "0.59226435", "0.5851861", "0.5838711", "0.57635957", "0.5729649", "0.5624441", "0.56025285", "0.5579801", "0.55744195", "0.55653083", "0.55628324", "0.552...
0.56140125
15
merge all notes in currentclass, ignore merged notes
def mergenotes():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def augment(self):\n for n in self.notes:\n n.augment()", "def remove_duplicate_notes(self):\n res = []\n for x in self.notes:\n if x not in res:\n res.append(x)\n self.notes = res\n return res", "def merge_docs(self):", "def merge_notes...
[ "0.6050369", "0.60432845", "0.57947606", "0.57807094", "0.57020885", "0.5661482", "0.5608127", "0.55626655", "0.5536551", "0.5486437", "0.5468853", "0.54607016", "0.5439737", "0.53964967", "0.53964967", "0.53695685", "0.53639656", "0.5339577", "0.5308613", "0.52500844", "0.52...
0.52022606
21
get notes, you can either copy to a sync folder or download to local
def getnotes():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNotes(self, request, global_params=None):\n config = self.GetMethodConfig('GetNotes')\n return self._RunMethod(\n config, request, global_params=global_params)", "async def _view_all_notes(self, ctx: Context):\n\n author = ctx.author\n\n note_infos = []\n\n embed_li...
[ "0.6348131", "0.62294436", "0.6095098", "0.6090929", "0.5969424", "0.5913103", "0.58877283", "0.5875533", "0.587039", "0.5755032", "0.57102007", "0.5685677", "0.5674463", "0.5654117", "0.5636658", "0.5633647", "0.56146985", "0.5590802", "0.5529989", "0.55236137", "0.5484942",...
0.7081106
0
get images, you can either copy to a sync folder or download to local
def getimgs():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images(self):\n # test\n for it in self.xml.iterfind('image'):\n print(it)\n\n elements = []\n els = self.xml.findall('image')\n for el in els:\n elements.push(el.find('src')[0])\n els = self.xml.findall('full_picture')\n elements = ele...
[ "0.72774976", "0.7222684", "0.72116727", "0.7136989", "0.7032972", "0.70138687", "0.694288", "0.69381595", "0.6933958", "0.6932005", "0.69210017", "0.6874914", "0.68325573", "0.6811903", "0.67718667", "0.67658556", "0.67449826", "0.6718865", "0.6667427", "0.66618836", "0.6644...
0.70800644
4
Set the drive folder to copy files after getting its content
def syncfolder():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copydir(self):\n pass", "def CopyFiles(self):\n pass", "def __copyFiles(self):\n if os.path.isdir(self.__sourcePath):\n shutil.copytree(self.__sourcePath, self.__targetPath)\n else:\n shutil.copy2(self.__sourcePath, self.__targetPath)", "def copy_files(self):...
[ "0.7134269", "0.66678053", "0.6458958", "0.63541377", "0.63032097", "0.6300692", "0.623825", "0.6070141", "0.6057919", "0.60387754", "0.5986305", "0.5978761", "0.5971984", "0.5920381", "0.5912804", "0.59033316", "0.5897482", "0.5890843", "0.5889729", "0.58855975", "0.58276963...
0.6645535
2
Set the drive folder to copy files after getting its content
def tagger():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copydir(self):\n pass", "def CopyFiles(self):\n pass", "def syncfolder():", "def __copyFiles(self):\n if os.path.isdir(self.__sourcePath):\n shutil.copytree(self.__sourcePath, self.__targetPath)\n else:\n shutil.copy2(self.__sourcePath, self.__targetPath)", ...
[ "0.713296", "0.6666113", "0.6648299", "0.6457268", "0.63525325", "0.6302015", "0.6299908", "0.6238088", "0.6070035", "0.6057461", "0.60360557", "0.5986712", "0.59776515", "0.5970163", "0.5919527", "0.5913841", "0.5900404", "0.5895153", "0.5888388", "0.5887716", "0.58868253", ...
0.0
-1
Find next node of a given node in a BST.
def next_node(node): # is root if not node.parent: return _min_node(node.right) # is subtree and is left if node.parent.left == node: if not node.right: return node.parent return _min_node(node.right) # is subtree and is right return node.parent.parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_node(node):\n\n if node.right_child is not None:\n # First case: ``node`` has right child, the next node is in the subtree\n # rooted at the right child, and it is leftmost node in this subtree.\n current_node = node.right_child\n while current_node.left_child is not Non...
[ "0.74567485", "0.7090742", "0.6928549", "0.68795377", "0.67899877", "0.6764543", "0.669973", "0.65375566", "0.6487014", "0.6486642", "0.64003444", "0.6399026", "0.639506", "0.63792956", "0.6377282", "0.63366306", "0.63348866", "0.63336825", "0.6327812", "0.62818664", "0.62653...
0.76324075
0
Return the min node of a BST subtree.
def _min_node(node): if not node: return None i = node while i.left: i = i.left return i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(self) -> TreeNode:\n node = self.root\n while True:\n if not node.left:\n return node\n node = node.left", "def _find_smallest(node):\n if node.left:\n return BinarySearchTree._find_smallest(node.left)\n else:\n r...
[ "0.8181223", "0.7754536", "0.7699864", "0.7666253", "0.7632981", "0.76130587", "0.7516755", "0.75156", "0.7462528", "0.7420651", "0.73975736", "0.73489773", "0.7188644", "0.7147024", "0.71064144", "0.7091051", "0.70677614", "0.706635", "0.70491433", "0.7002115", "0.69909126",...
0.79107755
1
uses a set for duplicates, the dict is for frequencies only instead of an array of dicts separates each window length into an algorithm chunk (sliding window) 3x faster than clumpFinder() but still slow (many redundant operations!)
def chunkedClumpFinder(sequence, k, L, t): frequentPatterns = set([]) for i in range(len(sequence)): window = sequence[i:i + L] frequencies = {} for j in range(len(window)): pattern = window[j:j + k] if pattern not in frequencies: frequencies[pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_of_sets(l):\r\n distinct_sweets = set(l) #let's find all distinct sweets from input list\r\n dict_of = {} #empty dict to store key:value (sweet:number of occurrences)\r\n\r\n for i in distinct_sweets:\r\n dict_of[i] = l.count(i)\r\n \r\n key_min = min(dict_of.keys(), key=(lambda k...
[ "0.63687587", "0.6196125", "0.6118355", "0.6066688", "0.60510707", "0.603749", "0.6013759", "0.5971861", "0.59603256", "0.5899018", "0.5868384", "0.58586293", "0.58455414", "0.5835125", "0.5807947", "0.5777659", "0.5767623", "0.57562715", "0.57500553", "0.5744204", "0.5737346...
0.63872755
0
uses a set for duplicates, the dict is for frequencies only instead of an array of dicts separates each window length into an algorithm chunk (sliding window) 3x faster than clumpFinder() but still slow (many redundant operations!)
def fastClumpFinder(sequence, k, L, t): # to be implemented ;) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunkedClumpFinder(sequence, k, L, t):\n\n frequentPatterns = set([])\n for i in range(len(sequence)):\n window = sequence[i:i + L]\n frequencies = {}\n\n for j in range(len(window)):\n pattern = window[j:j + k]\n if pattern not in frequencies:\n ...
[ "0.6386038", "0.6369567", "0.619515", "0.6119224", "0.60642827", "0.60519266", "0.6037478", "0.6013743", "0.59721917", "0.5960064", "0.5898815", "0.58673316", "0.5858758", "0.58453965", "0.58349407", "0.5806918", "0.5777867", "0.5766551", "0.5756229", "0.57486904", "0.5741851...
0.5265449
85
Return True if the update happened, False if it did not
def update(db, spec, doc): resp = db.sole.sole.update(spec, doc, upsert=False, safe=True) if (resp.get('updatedExisting') == False): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_updated(self):\n return self.timestamp > 0", "def needs_update(self) -> bool:\n return False", "def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return False\r\n\r\n # if not self.h...
[ "0.82221776", "0.81986374", "0.8170888", "0.80791825", "0.7879904", "0.7732131", "0.76466054", "0.7580046", "0.7571564", "0.754413", "0.7488154", "0.746068", "0.7378105", "0.7359835", "0.73528314", "0.7308108", "0.72857326", "0.72699004", "0.7263354", "0.72479844", "0.7240922...
0.0
-1
given params sent in with a POST request, return a doc that is ready to be stored in the database
def format_params_for_create(user_id, params): s = { A_TIME: params.get(A_TIME), A_LON: params.get(A_LON), A_LAT: params.get(A_LAT), A_ADDRESS: params.get(A_ADDRESS), A_COURSE_ID: params.get(A_COURSE_ID), A_USER_ID: user_id } day = params.get(A_DAY) m = re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_post(params, db_conn):\n\n tablename = post_schema['tablename']\n return get_document(tablename, params, db_conn)", "def oparl_documentsss():\n start_time = time.time()\n jsonp_callback = request.args.get('callback', None)\n ref = request.args.get('reference', '')\n references = ref.split(',')\...
[ "0.7473108", "0.6820269", "0.64150715", "0.6363577", "0.63143444", "0.62964106", "0.6254058", "0.62082756", "0.6199685", "0.6171967", "0.61257607", "0.6114795", "0.6104304", "0.60767525", "0.60735416", "0.5987432", "0.5980778", "0.59701914", "0.59610623", "0.5899309", "0.5888...
0.0
-1
Objective function for optimization, when we optimize using multiple marginal SFSs.
def _object_func_marginals(params, data_vec, model_func, pts, lower_bound=None, upper_bound=None, verbose=0, multinom=True, flush_delay=0, func_args=[], func_kwargs={}, fixed_params=None, ll_scale=1, output_stream=sys.stdout, store_thetas=False): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def add_objective(self): \n \n if \"CSS\" in self.algorithm:\n \n if self.num_hidden == 0:\n \n data_term = self.compute_energy(self.x, self.batch_size)\n \n else:\n \n data_te...
[ "0.6199027", "0.60962456", "0.5875499", "0.58583134", "0.57640135", "0.57609576", "0.5720939", "0.56782895", "0.56628907", "0.55962974", "0.5555265", "0.5554905", "0.55286443", "0.551337", "0.55092394", "0.55089766", "0.55062085", "0.54951364", "0.54929906", "0.5462576", "0.5...
0.5757614
6
Objective function for optimization, when we optimize using multiple marginal SFSs.
def _object_func_marginals_c(params, data_vec, model_func, pts, lower_bound=None, upper_bound=None, verbose=0, multinom=True, flush_delay=0, func_args=[], func_kwargs={}, fixed_params=None, ll_scale=1, output_stream=sys.stdout, store_thetas=False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def add_objective(self): \n \n if \"CSS\" in self.algorithm:\n \n if self.num_hidden == 0:\n \n data_term = self.compute_energy(self.x, self.batch_size)\n \n else:\n \n data_te...
[ "0.6198953", "0.6100035", "0.58765996", "0.5856214", "0.5765808", "0.5763503", "0.57589847", "0.5680736", "0.56663513", "0.55975723", "0.5556067", "0.5555249", "0.55298555", "0.55139184", "0.5513455", "0.550935", "0.55041033", "0.54962236", "0.5494656", "0.5465352", "0.546478...
0.57218295
7
Objective function for optimization in log(params).
def _object_func_marginals_c_log(log_params, *args, **kwargs): return _object_func_marginals_c(numpy.exp(log_params), *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objective_llh(self, params):\n\n try:\n obj = self.log_likelihood(params[0], params[1], params[2:])\n except (LinAlgError, ZeroDivisionError, ValueError):\n obj = -np.inf\n return obj", "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self...
[ "0.72464484", "0.72327834", "0.7067476", "0.70212835", "0.70010036", "0.6936446", "0.69265854", "0.685497", "0.68126464", "0.678558", "0.6772992", "0.6772992", "0.6727183", "0.6648505", "0.66342664", "0.6624805", "0.6561634", "0.6520975", "0.64957696", "0.6482517", "0.6445161...
0.5975172
81
Objective function for optimization in log(params).
def _object_func_marginals_log(log_params, *args, **kwargs): return _object_func_marginals(numpy.exp(log_params), *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objective_llh(self, params):\n\n try:\n obj = self.log_likelihood(params[0], params[1], params[2:])\n except (LinAlgError, ZeroDivisionError, ValueError):\n obj = -np.inf\n return obj", "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self...
[ "0.72464484", "0.72327834", "0.7067476", "0.70212835", "0.70010036", "0.6936446", "0.69265854", "0.685497", "0.68126464", "0.678558", "0.6772992", "0.6772992", "0.6727183", "0.6648505", "0.66342664", "0.6624805", "0.6561634", "0.6520975", "0.64957696", "0.6482517", "0.6445161...
0.6013213
68
Objective function for optimization in log(params).
def _object_func_marginals_coarse_log(log_params, *args, **kwargs): return _object_func_marginals_coarse(numpy.exp(log_params), *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objective_llh(self, params):\n\n try:\n obj = self.log_likelihood(params[0], params[1], params[2:])\n except (LinAlgError, ZeroDivisionError, ValueError):\n obj = -np.inf\n return obj", "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self...
[ "0.72464484", "0.72327834", "0.7067476", "0.70212835", "0.70010036", "0.6936446", "0.69265854", "0.685497", "0.68126464", "0.678558", "0.6772992", "0.6772992", "0.6727183", "0.6648505", "0.66342664", "0.6624805", "0.6561634", "0.6520975", "0.64957696", "0.6482517", "0.6445161...
0.59806603
79
Optimize log(params) to fit model to data using the BFGS method. This optimization method works well when we start reasonably close to the optimum. It is best at burrowing down a single minimum. Because this works in log(params), it cannot explore values of params < 0. It should also perform better when parameters rang...
def optimize_log(p0, data, model_func, pts, lower_bound=None, upper_bound=None, verbose=0, flush_delay=0.5, epsilon=1e-3, gtol=1e-5, multinom=True, maxiter=None, full_output=False, func_args=[], func_kwargs={}, fixed_params=None, ll_scale=1, output_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximize_loglik(model_params: Union[CupidParams, CupidParamsCSHeteroxy, CupidParamsFcmnl],\n x_init: np.ndarray,\n lower: Optional[np.ndarray] = None,\n upper: Optional[np.ndarray] = None,\n checkgrad: Optional[bool] = False,\n ...
[ "0.65304214", "0.64780915", "0.6177655", "0.6161781", "0.61599773", "0.60868424", "0.60741144", "0.6044265", "0.60271394", "0.60215414", "0.60146534", "0.59783334", "0.5933783", "0.59062", "0.5886293", "0.5869606", "0.58289564", "0.5819565", "0.5812694", "0.5792707", "0.57897...
0.6719574
0
Optimize log(params) to fit model to data using NelderMead. This optimization method make work better than BFGS when far from a minimum. It is much slower, but more robust, because it doesn't use gradient information. Because this works in log(params), it cannot explore values of params < 0. It should also perform bett...
def optimize_log_fmin(p0, data, model_func, pts, lower_bound=None, upper_bound=None, verbose=0, flush_delay=0.5, multinom=True, maxiter=None, full_output=False, func_args=[], func_kwargs={}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self._LL(self.endog, rate=lambda_)\n\n return -np.log(ll_output)", "def __log_likelihood(self, params, *args):\n\t\tX, y, feature_set, lambda_reg, empirical_weights, verbose, sign = args\n\n\t\tno_example = len(X)\n\t\ttotal_logZ = 0\n...
[ "0.67615706", "0.67385006", "0.67084426", "0.65556633", "0.6543541", "0.6473266", "0.644554", "0.64344704", "0.63720936", "0.63556635", "0.63141555", "0.63138676", "0.6299224", "0.622597", "0.6189101", "0.61648405", "0.6129973", "0.6100781", "0.60894597", "0.6047367", "0.6043...
0.58699507
29
Optimize log(params) to fit model to data using NelderMead. This optimization method make work better than BFGS when far from a minimum. It is much slower, but more robust, because it doesn't use gradient information. Because this works in log(params), it cannot explore values of params < 0. It should also perform bett...
def optimize_log_fmin_coarse(p0, coarsenings,data, model_func, pts, lower_bound=None, upper_bound=None, verbose=0, flush_delay=0.5, multinom=True, maxiter=None, full_output=False, func_args=[], func_kwargs=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nloglikeobs(self, params):\n lambda_ = params[0]\n\n ll_output = self._LL(self.endog, rate=lambda_)\n\n return -np.log(ll_output)", "def __log_likelihood(self, params, *args):\n\t\tX, y, feature_set, lambda_reg, empirical_weights, verbose, sign = args\n\n\t\tno_example = len(X)\n\t\ttotal_logZ = 0\n...
[ "0.67606986", "0.6739016", "0.67089283", "0.6554713", "0.654431", "0.647485", "0.6445823", "0.64342856", "0.6373043", "0.63545066", "0.6316349", "0.63147515", "0.62980264", "0.6225396", "0.6189243", "0.61654437", "0.61321706", "0.61011934", "0.608998", "0.6047437", "0.6043340...
0.5554022
59
Spectrum from a dictionary of polymorphisms.
def from_data_dict(data_dict, pop_ids, projections, mask_corners=True, polarized=True,print_successrate=False): failed=0 Npops = len(pop_ids) fs = numpy.zeros(numpy.asarray(projections)+1) for snp, snp_info in data_dict.items(): # Skip SNPs that aren't ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectra(self, value):\n\n _errtxt = f\"This assignment {value} does not contain valid spectra\"\n if type(value) == dict:\n _data = value\n # if not _data:\n # self.start_fit = False\n elif type(value).__name__ == \"SpectrumDataCollection\":\n _d...
[ "0.5118848", "0.49894622", "0.48169142", "0.48116708", "0.4687041", "0.4682823", "0.46786124", "0.4653587", "0.46364433", "0.46307474", "0.46270955", "0.4620451", "0.4561472", "0.45467377", "0.45438758", "0.45324418", "0.45044976", "0.44949386", "0.44943097", "0.44928306", "0...
0.0
-1
Read benchmark data and make scaling plots.
def post_process(self, filename): title = self.title outfile = open(filename, 'r') data = outfile.readlines() name = data[0].strip() mode = data[1].strip() ops = data[2].strip().split(',') nl = 'True' in ops[0] ln = 'True' in ops[1] drv = 'True' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(logy):\n filep = sys.stdin\n dataf = pd.read_csv(filep, sep=\" \", index_col=0, header=None)\n dataf.plot(logy=logy)\n print(dataf)\n plt.savefig(\"scaling.pdf\")", "def main():\n df_data = import_clean_process()\n plot_data_matplotlib(df_data)\n return", "def main():\n\n co...
[ "0.6262268", "0.6241368", "0.60495985", "0.5843554", "0.5773783", "0.57549113", "0.5750781", "0.5728409", "0.5685088", "0.5643176", "0.56256104", "0.56139076", "0.5595927", "0.5574747", "0.55527896", "0.55416715", "0.55249935", "0.55140436", "0.55054355", "0.5498047", "0.5485...
0.0
-1
0 > Main droite 1 > Main Gauche
def sphere(self, path, args): note_name = args[0] hands = args[1] probability = args[2] force = args[3] print "got sphere : %s '%s', %d, %f, %f" % (path, note_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goToZero():\n #on remet tout à zero\n usr_choice = 0\n fonctions_pfc.x = 0\n fonctions_pfc.y = 0\n fonctions_pfc.result = \"\"\n fonctions_pfc.pc_score = \" SCORE DU PC : \"\n fonctions_pfc.usr_score = \" SCORE DU PC : \"\n #on ré-affiche tous les composants\n display_pack_component(...
[ "0.60082096", "0.5796911", "0.57385117", "0.57088554", "0.5694299", "0.56703836", "0.55788225", "0.5578342", "0.55587816", "0.55525583", "0.55124044", "0.5471946", "0.5468912", "0.5454788", "0.5433908", "0.5432025", "0.54042614", "0.54018486", "0.53990334", "0.5394289", "0.53...
0.0
-1
name, force, xyz_r, xyz_l
def two_hands_gesture(self, path, args): name = args[0] if name == 'chord': # proba, force, position (R, L) print "Got Chord" engine._TheEngine().process(PitchbendEvent(engine.in_ports()[0], 1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_xyz(atoms,coordinates,filename):\n coordinates = [[w / angtobh for w in ww] for ww in coordinates] #bh to ang\n xyz = open(filename,\"a\")\n xyz.write(str(len(atoms)))\n xyz.write(\"\\nOptimizer geometry\\n\")\n for i in xrange(len(atoms)):\n\txyz.write(atoms[i] + ' ')\n\txyz.write(\" \".j...
[ "0.58931416", "0.58661944", "0.56863695", "0.54583025", "0.54349345", "0.54218984", "0.5382613", "0.5357074", "0.53335613", "0.5328906", "0.529051", "0.52662313", "0.5220069", "0.5215272", "0.5201261", "0.5187543", "0.51764745", "0.5168201", "0.5167269", "0.51668924", "0.5144...
0.0
-1
Drops records from the dataframe df is var1 is greater than var2 For example, if var1 is spending on clothing and var2 is total income it is not logical that var1 is greater than var2
def drop_illogical(df,var1,var2): #Mask the illogical entries mask = df[var1]>df[var2] #Record the number of entries NumRecords = df.shape[0] #drop the illogical entries df = df[df.keys()][~mask] #Notify the user how many records were dropped print('{} records dropped because {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_outliers(df, var):\n import numpy as np\n \n df = df.copy()\n \n # remove outliers\n Q1 = np.nanquantile(df[var] ,0.25)\n Q3 = np.nanquantile(df[var], 0.75)\n IQR = Q3 - Q1\n \n lower_end = Q1 - 1.5 * IQR \n high_end = Q3 + 1.5 * IQR \n \n df_filtered = df.drop(df[(...
[ "0.61005276", "0.6079517", "0.589066", "0.5799702", "0.5617992", "0.55075836", "0.5503977", "0.55010396", "0.55010396", "0.54976255", "0.5436637", "0.54360694", "0.5389384", "0.53594834", "0.535714", "0.535346", "0.5332813", "0.53143257", "0.5292683", "0.5286526", "0.52819777...
0.7170435
0
This function (initiated by clicking the "Upload Tariff File" button) brings up a file browser window and lets the user select a tariff csv file to import into the tool. After successfully selecting a file to upload, the function reads the file into a pandas data frame, calls the validate_tariff() function to ensure th...
def uploaddata(self): self.filename = filedialog.askopenfilename(filetypes=[('CSV', '*.csv')], initialdir='./Tariffs') if self.filename: # don't try to import anything if filename is empty self.data = pd.read_csv(self.filename) self.validate_tariff() # TODO: build out contingency when validati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(self):\n self.master.switch_frame(UploadFileView)", "def start_upload(self):\n filename = filedialog.askopenfilename(filetypes=[('Data Frame files', '.csv .xls .xlsx .data .json .xsl .txt')],\n title='Select data frame file')\n if ...
[ "0.57963634", "0.5779103", "0.57500017", "0.57128847", "0.56889844", "0.56412196", "0.55905133", "0.5528796", "0.55150217", "0.539664", "0.53774077", "0.5343562", "0.5332065", "0.5328703", "0.53249145", "0.5309067", "0.52954215", "0.5286032", "0.5284576", "0.5274875", "0.5272...
0.71449256
0
This function contains the tests required to validate that a tariff data frame is valid
def validate_tariff(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_to_df(upload_dataframe: pd.DataFrame) -> None:\n validated = UploadCollection.from_dataframe(upload_dataframe)\n assert upload_dataframe.equals(validated.to_dataframe()[upload_dataframe.columns])", "def verify_pandas(self):\n self.check_dataset_duplicate_ids(self.vertices)\n #...
[ "0.6895882", "0.62581795", "0.62322396", "0.62277174", "0.61887205", "0.6177782", "0.6155625", "0.6149133", "0.6099006", "0.6096892", "0.6054584", "0.6043061", "0.6030683", "0.6006912", "0.60010093", "0.5993058", "0.59914565", "0.5975324", "0.5944749", "0.591502", "0.5887435"...
0.775189
0
This function makes a visualization of a valid tariff data frame and draws it into a canvas in the frame.
def plot_tariff(self): plt.figure(1) plt.cla() # clear the plotting window to allow for re-plotting if self.chargetypetoplot.get() == 'energy': toplot = [] energy_filter = ('energy' == self.data["Charge"]) | ('Energy' == self.data["Charge"]) for mo in range(1, 13): month_filter = (mo >= self.data["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCanvas(self,filebasename,plotname,legLabel = \"run\"):\n canvas = TCanvas(filebasename+\"_\".join([str(i) for i in self.runs]))\n leg = TLegend(0.75,0.65,0.85,0.85)\n option=\"Hist\"\n color=2\n for run in self.runs:\n rfile = self.runManager.GetTAFRootFile(run,...
[ "0.5762495", "0.57607573", "0.57272094", "0.56894237", "0.5662646", "0.56590706", "0.56198055", "0.5605073", "0.55738837", "0.55490476", "0.55442595", "0.5543866", "0.5537717", "0.55325013", "0.55304974", "0.55229515", "0.5512369", "0.550883", "0.5502392", "0.54734075", "0.54...
0.0
-1
1.1 Generate Fingerprint VCFs Here we use Dalmatian to run the fingerprint_bam_with_liftover workflow on Terra. This workflow calls Picard ExtractFingerprint to generate a fingerprint VCF and then calls Picard LiftoverVcf to covert this vcf to hg38. To fingerprint hg38 bam files just run fingerprint_bam instead.
async def addToFingerPrint(samples, sampleset=, allsampleset="all", workspace=WORKSPACE, sid=, vcf_list=None, vcf_list_dir=, working_dir, crosscheck_batch_size, recreate_batch, bamcolname, taiga_dataset, taiga_filename): bams = samples[bamcolname] bams[sid] = bams.index print('adding '+str(len(bams))+' new sampl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fingerprint(self, algorithm):", "def main():\n parser = argparse.ArgumentParser(description='MergeGVCFs and genotype them using the GATK')\n parser.add_argument('-g', '--gatk', dest='gatk', help=\"Location of the GATK\", required=True)\n parser.add_argument('-x', '--xmx', dest='xmx', help=\"Memory t...
[ "0.5775645", "0.57632786", "0.5658153", "0.561844", "0.54591256", "0.5334822", "0.5325309", "0.5305328", "0.52687347", "0.5263997", "0.5230877", "0.521849", "0.5206169", "0.51302344", "0.5123245", "0.5070162", "0.50444156", "0.5006062", "0.5003408", "0.49965554", "0.4986839",...
0.6725894
0
Helper method to get all disks that are not in use, either by the boot pool or the user pools.
async def get_unused(self, join_partitions): all_disks = await self.middleware.call('disk.query') serial_to_disk = defaultdict(list) for disk in all_disks: serial_to_disk[(disk['serial'], disk['lunid'])].append(disk) reserved = await self.middleware.call('disk.get_reserved'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_non_ovf_disks():\n return [\n d.get_id() for d in get_all_disks() if (\n d.get_alias() != ENUMS['ovf_disk_alias']\n )\n ]", "def get_all_disks():\n return DISKS_API.get(abs_link=False)", "def get_all_disk():\n\t\tdisks = []\n\t\tdisks_lines = linux.exe_shell(\"lsblk -o...
[ "0.7110578", "0.6596567", "0.63993245", "0.6327407", "0.63001627", "0.6283016", "0.61342686", "0.6117332", "0.610183", "0.59533006", "0.59367496", "0.5926375", "0.5924363", "0.57731235", "0.5771047", "0.57462", "0.56889755", "0.5652023", "0.56227106", "0.5542059", "0.54929835...
0.6205291
6
Makes sure the disks are present in the system and not reserved by anything else (boot, pool, iscsi, etc).
async def check_disks_availability(self, disks, allow_duplicate_serials): verrors = ValidationErrors() disks_cache = dict(map(lambda x: (x['devname'], x), await self.middleware.call('disk.query'))) disks_set = set(disks) disks_not_in_cache = disks_set - set(disks_cache.keys()) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _PreCheckDisks(self, ispec):\n self.diskparams = self.cfg.GetInstanceDiskParams(self.instance)\n\n inst_nodes = self.cfg.GetInstanceNodes(self.instance.uuid)\n excl_stor = compat.any(\n list(rpc.GetExclusiveStorageForNodes(self.cfg, inst_nodes).values())\n )\n\n # Get the group access typ...
[ "0.71250546", "0.63917005", "0.61703014", "0.61318177", "0.61042476", "0.60634845", "0.6014175", "0.60058516", "0.5998691", "0.5984649", "0.59578073", "0.59428805", "0.5934872", "0.59283465", "0.5911958", "0.5880785", "0.5870844", "0.582219", "0.58177876", "0.5780115", "0.576...
0.66384786
1
Contructor of the class
def __init__(self): # self.threshold = 3. self.gamma_min = 3 self.gamma_max = 12 self.n_samples = 40 # self.do_plots = False # self.do_albedo = True # self.verbose = True self.nbands = 7 self.bu = np.array([0.004, 0.015, 0.003, 0.004, 0.013, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__ (self):\n pass", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError",...
[ "0.8680643", "0.8506947", "0.8399", "0.8399", "0.8399", "0.8399", "0.8379655", "0.83343095", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885", "0.8254885",...
0.0
-1
Creates a regulariser with a default lag of 1. Clearly, other lags can be specified by changing ``lag``.
def create_regulariser (self, nx, lag=1): I = np.diag (np.ones(nx)) D = (I - np.roll ( I, -lag)).T D2 = D.T.dot(D) Z = np.zeros_like (I) DD0 = np.array([D2, Z, Z]).reshape ( nx*3, nx).T DD1 = np.array([Z, D2, Z]).reshape ( nx*3, nx).T # HACK! 10* DD2 = np.array([Z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_lag(self,inputLabels,lagNum,suffix=None,fillMissing=np.nan,verbose=0,n_jobs=1):\n self._transform_wrapper(\n inputLabels,\n None,\n make_lag,\n suffix,\n lagNum,\n False,\n n_jobs,\n verbose,\n lagNum...
[ "0.57087487", "0.53776217", "0.50716937", "0.5034615", "0.49503228", "0.49326134", "0.4897093", "0.4829849", "0.48250768", "0.48185134", "0.4808591", "0.48084906", "0.47779104", "0.4774139", "0.4773688", "0.47535902", "0.47450256", "0.4730975", "0.47273833", "0.47186923", "0....
0.5751384
0
Having an estimate of the kernel weights over an entire period of time, this function will simulate observations acquired for the same spectral band, stored in rho and with geometries given by vza, sza and raa. The doys are the dates of the observations and refer to the position of the time step in the xsol array.
def predict_refl (self, xsol, doys, vza, sza, raa, rho, do_plots=True, ndoys=365 ): passer = (doys - 1).astype(np.int) # Max: ndoys f0 = xsol[:ndoys][passer] f1 = xsol[ndoys:(ndoys*2)][passer] f2 = xsol[(ndoys*2):][passer] KK = Kernels( vza, sza, raa, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_regularised_problem (self, lambdas, band_unc, doys, vza, sza, raa, rho,\n doy_range=None, do_unc=False):\n # The number of kernels is 3\n n_kernels = 3\n # Figure out how many spectral bands we'll be using...\n if np.ndim ( band_unc ) < 2:\n ...
[ "0.5685351", "0.5599899", "0.55112875", "0.5492639", "0.5338046", "0.52963346", "0.5255298", "0.5202095", "0.51412654", "0.5132842", "0.5120179", "0.51088923", "0.51087165", "0.51008874", "0.50944215", "0.50872093", "0.50496185", "0.5046378", "0.50438154", "0.50413454", "0.50...
0.532401
5
Solve the regularised linear kernel BRDF problem. The function solves for the kernel weights (f0, f1 and f2) for one or more spectral bands, taking into account the inherent uncertainty in the observations, the acquisition timing and geometries. The inversion is made more robust with a regularisation term (1 lag at the...
def solve_regularised_problem (self, lambdas, band_unc, doys, vza, sza, raa, rho, doy_range=None, do_unc=False): # The number of kernels is 3 n_kernels = 3 # Figure out how many spectral bands we'll be using... if np.ndim ( band_unc ) < 2: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_BCGPLVM_rbf_bias_white_kern_2D(self):\n N, input_dim, D = 50, 1, 2\n X = np.random.rand(N, input_dim)\n k = GPy.kern.RBF(input_dim, 0.5, 0.9 * np.ones((1,))) + GPy.kern.Bias(input_dim, 0.1) + GPy.kern.White(input_dim, 0.05)\n K = k.K(X)\n Y = np.random.multivariate_norma...
[ "0.56890315", "0.56866467", "0.56495404", "0.56435627", "0.55941147", "0.54710853", "0.54298985", "0.5426635", "0.5388084", "0.5231405", "0.5211121", "0.5172353", "0.51439714", "0.5140322", "0.512901", "0.5103335", "0.5101635", "0.50989527", "0.50945956", "0.5093803", "0.5022...
0.5250373
9
Read time series of reflectance data and save to a pkl file
def get_time_series(self, tile, year, loc, px, py, cols=1, rows=1, step=1, save_dir='txt/'): # keys = ['sza', 'saa', 'vza', 'vaa', 'qa', 'b01', 'b02', 'b03', 'b04', 'b05', 'b06', 'b07'] timeBefore = time.clock() f_list = np.array(glob.glob(loc + '%s_%d_*_1km.nc' % (tile, year))) # if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n pathfolder = \"/home/vanessa/DATA_SEEG/PKL_FILE/\"\n filename = \"/data.pkl\"\n # pathfolder = argv[1]\n # filename = argv[2]\n\n ti = 10. # initial time\n tf = 590. # final time\n t_split = 300. # split\n fs = 1000. # s...
[ "0.584482", "0.5595723", "0.55526674", "0.5443912", "0.54403263", "0.54293597", "0.5404327", "0.5394117", "0.5311001", "0.52930295", "0.52906024", "0.52605844", "0.52552223", "0.5253987", "0.52471757", "0.5227777", "0.52184516", "0.5202356", "0.52016103", "0.5197414", "0.5175...
0.0
-1
Create an netCDF file where we store the results
def create_netcdf(self, netcdf_file, cols, rows, doy_range, do_zlib=True): # least_significant_digit for createVariable(...) lsd=None # create a new netCDF file rootgrp = nc.Dataset(netcdf_file, "w") rootgrp.description = "NBAR reflectance and BB albedo" # Create group...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_netcdf(self, outfile):", "def output_netcdf(forecast,proj_dict,grid_dict,start_hour,end_hour,\n stride,size,run_date,target_dataset,smoothing,config):\n for d,date in enumerate(run_date):\n date_outpath = config.forecast_out_path+'20{0}/netcdf/'.format(\n date)\...
[ "0.81742424", "0.7664478", "0.7599359", "0.7499293", "0.7466186", "0.74496263", "0.7369795", "0.7266277", "0.72151846", "0.7211757", "0.71940386", "0.70676875", "0.7012102", "0.6917403", "0.677125", "0.6757801", "0.67547697", "0.67115766", "0.668003", "0.6675043", "0.6636511"...
0.62261045
34
Calculate broad band albedo and reflectance for given BRDF kernel solution
def make_albedo(self, x_sol, unc, nbands=7): n_doys = x_sol.shape[0] / 3 n_bands = x_sol.shape[1] bhr_spectral = np.zeros((n_doys, n_bands)) bhr_spectral_unc = np.zeros((n_doys, n_bands)) bhr_spectral_nbar = np.zeros((n_doys, n_bands)) bhr_spectral_nbar_unc = np.zeros((n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hbls_hbbl(self):\n [Ly,N] = self.b.shape\n z_u_w = self.grid_dict['z_u_w']\n z_u_r = self.grid_dict['z_u_r']\n u = self.u\n v = self.v\n \n v_upts = TTTW_func.v2u(v)\n Hz = z_u_w[:,1:] - z_u_w[:,:-1]\n\n\n\n # CALCULATE swr_frac\n ...
[ "0.6240019", "0.6153248", "0.598355", "0.5953789", "0.59093034", "0.5867363", "0.58337384", "0.58280855", "0.58218926", "0.5677912", "0.5673785", "0.5670195", "0.563399", "0.5632684", "0.56246775", "0.5615285", "0.5587835", "0.5580431", "0.55696726", "0.55669475", "0.5566303"...
0.0
-1
Solve problem for each pixel inside moving window.
def do_window(self, netcdf, output, year, cols, rows, cx, cy, n_days, doys, doy_range): win_x = np.arange(cols) win_y = np.arange(rows) # ------------------------------------------------ # Get optimal gamma # ------------------------------------------------ # get random...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\n dim = self.puzzle.dimension\n\n # initial loop\n for value, (row, col) in self.puzzle:\n if value:\n self.clear_row(row, value)\n self.clear_col(col, value)\n self.clear_subgrid(row, col, value)\n self.up...
[ "0.63087326", "0.62517476", "0.61803126", "0.6134465", "0.6083904", "0.6065481", "0.6065481", "0.6032246", "0.59571964", "0.58761084", "0.5865916", "0.58432245", "0.58409566", "0.58102006", "0.5774845", "0.57376975", "0.57370627", "0.57366765", "0.5733906", "0.57100964", "0.5...
0.0
-1
Do the main job. Call the routine of hdf5 creation, estimate gamma, solve regularized problem and save a hdf5 file.
def do_job(self, nc_file, loc, pattern, year, tile, ul_px, ul_py, lr_px, lr_py, cols, rows, \ step=1, do_adj_years=True, do_vrt = False): timeBefore = time.clock() # Size of an image must be multiple of window size N = (lr_px-ul_px) / int(cols) * cols M = (lr_py-ul_py) /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_output_database():\n\n# Do not alter the hdf5 file if it already exists\n if os.path.exists(database_path):\n print(\"DATABASE STATUS:\")\n print(\"\\t\" + database_path + \" already exists and is ready to store the results of computations\")\n return None\n# Create hdf5 file. The flag \"-w\" means \...
[ "0.665698", "0.6522957", "0.6506959", "0.6447895", "0.6251527", "0.6232781", "0.6221436", "0.61841214", "0.6106533", "0.5949692", "0.59292674", "0.5917778", "0.5898403", "0.5855418", "0.58377635", "0.58365107", "0.5789868", "0.5789642", "0.5769132", "0.5759015", "0.5744126", ...
0.0
-1
Returns component I/O for optical testing with single input and oputput fibers (no fiber array)
def route_fiber_single( component: Component, optical_io_spacing: int = 50, grating_coupler: Component = grating_coupler_te, min_input2output_spacing: int = 230, optical_routing_type: int = 1, optical_port_labels: None = None, excluded_ports: List[Any] = [], **kwargs ) -> Union[ Tupl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n op = help()\n for t in [\"bowtie2\", \"samtools\", \"bamToBed\"]:\n if not isTool(t):\n logger.error(\"%s not exits! Please install through conda.\" % t)\n return\n if not os.path.exists(op.fqd):\n logger.error(\"Input %s not exists! Return.\" % op.fqd)\n ...
[ "0.5328557", "0.53075993", "0.53037673", "0.52203745", "0.521377", "0.5203995", "0.5170913", "0.5154463", "0.5106008", "0.506503", "0.503149", "0.5025848", "0.5007072", "0.4989395", "0.4977966", "0.4966646", "0.4966646", "0.49450508", "0.49429226", "0.4941513", "0.4933067", ...
0.5205837
5
Parse command line arguments
def params_args(args=None): # parameters of model and files params = argparse.ArgumentParser( description='Run distribute model CTR DNN.') params.add_argument("--name", type=str, default="ctr-dnn", help="The name of current mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(\n description=\"Reads datapacket pcds, interpolates quaternions and generates scans from dataset in config file\")\n parser.add_argument(\"--visualization\", \"-v\", action=\"store_true\", help=\"if generated clouds ...
[ "0.8496655", "0.7753886", "0.7493129", "0.7442371", "0.74171716", "0.74159735", "0.7408078", "0.7406955", "0.73962003", "0.7394545", "0.73533267", "0.7352908", "0.73298883", "0.732645", "0.7312877", "0.72991174", "0.7295703", "0.72947407", "0.7294336", "0.7288987", "0.7278817...
0.0
-1
Format string payload generator.
def gen_fmt_payload(write_map, write_bits='hn', printed=0, testing=False): if testing: payload = ''.join('%{}$p'.format(idx) for value,idx in sorted(write_map)) else: payload = '' # sorted by value in ascending order. for value, idx in sorted(write_map): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gen_fmt_str__(self, fmt):\n return '=' + (self.num_pts_recv * (fmt + ' '))", "def remap_payload(payload):\n i = 0\n for x in payload:\n i = i%10\n yield str((x+i)%10)[0]\n i += 1", "def format(self) -> str:", "def format(self, data):", "def _get_fmt_string(self):\n ...
[ "0.61453587", "0.6033142", "0.6032285", "0.596967", "0.58249974", "0.58163774", "0.5788948", "0.573833", "0.56880134", "0.5684776", "0.56300914", "0.55890155", "0.555911", "0.5544999", "0.5530412", "0.5526723", "0.5508725", "0.5496755", "0.54892087", "0.54570377", "0.5434926"...
0.59211266
4
Test for index settings page is included in this test because the database row does not appear to persist between tests.
def test_add_index_settings(self): response = self.post('base:add_index', self.form_data(), **self.slugs()) assert 'base/project.html' in response.template_name response = self.get('base:index_settings', **self.index_slugs()) assert 'base/index_update_form.html' in response.template_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def test_indexPage(self):\n LOGGER.debug(\"XXX: test_indexPage entered\")\n LOGGER.debug(\"XXX: %s\", settings.TEMPLATES)\n self.post.status = 'publish'\n ...
[ "0.70742357", "0.70742357", "0.6653984", "0.6399997", "0.62087905", "0.6084469", "0.5994128", "0.59871066", "0.59534085", "0.5902207", "0.58989024", "0.58647585", "0.58597213", "0.584537", "0.5809805", "0.57758653", "0.5730176", "0.57241803", "0.56845737", "0.5682785", "0.568...
0.68603957
2
Test that the unzip function works with zip files that contain files other than pdfs.
def test_verify_unzip(self): assert os.path.exists( os.path.join( settings.MEDIA_ROOT, "indices", "test-index", "data", "sample.txt" ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unzip_file(self):\n\n # Path to the compressed file\n zipped_file = os.path.join(self.xmlfilepath, \"DLTINS_20210117_01of01.zip\")\n # Test for correct data\n # NOTE : For this test case to pass the source xml zipped file\n # should be present in the download path\n ...
[ "0.7355168", "0.7098369", "0.70498216", "0.69765973", "0.69159365", "0.6854873", "0.6835567", "0.6797622", "0.66845447", "0.66813475", "0.66783005", "0.6655777", "0.6611854", "0.660133", "0.6597193", "0.6570835", "0.6523277", "0.65053606", "0.6495154", "0.6464771", "0.6463756...
0.64175653
24
Receive broadcasts from other nodes, launches a thread to connect to new nodes and exchange timestamps.
def receive_broadcast_thread(): global neighbor_information client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) client.bind(('', get_broadcast_port())) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_broadcast_thread():\n current_node = get_node_uuid()\n while True:\n # TODO: write logic for receiving broadcasts.\n data, (ip, port) = broadcaster.recvfrom(4096)\n items = data.decode('UTF-8').split(' ')\n key = items[0]\n actual_port = int(items[2])\n i...
[ "0.7504", "0.74852496", "0.7020729", "0.67168087", "0.6220197", "0.6190433", "0.6159416", "0.6031282", "0.59475446", "0.5942349", "0.59308153", "0.5887535", "0.58224946", "0.57985353", "0.57363206", "0.56215864", "0.5614009", "0.5613697", "0.5607666", "0.5605568", "0.56008685...
0.6493267
4
Accept connections from other nodes and send them this node's timestamp once they connect.
def tcp_server_thread(id, tcpPort): global server # TCP Connection conn,adrr = server.accept() received_time_stamp = struct.unpack('!f', conn.recv(4096))[0] exchange = daemon_thread_builder(CalcDelay, args=(received_time_stamp, id,tcpPort )) exchange.start() exchange.join() pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tcp_server_thread():\n neigbour_sock, neighbour_addr = server.accept()\n my_timestamp = datetime.datetime.utcnow().timestamp()\n packed = struct.pack(\"!d\", my_timestamp)\n neigbour_sock.send(packed)\n pass", "def tcp_server_thread():\n while True:\n server.listen(4096)\n con...
[ "0.6720128", "0.6533498", "0.6439251", "0.6316046", "0.6313253", "0.6296173", "0.6256884", "0.6221823", "0.6147624", "0.6110266", "0.61037403", "0.609133", "0.59992737", "0.5917574", "0.59052026", "0.58938557", "0.5878946", "0.5848995", "0.5839791", "0.5825865", "0.5822812", ...
0.0
-1
Open a connection to the other_ip, other_tcp_port and do the steps to exchange timestamps. Then update the neighbor_info map using other node's UUID.
def exchange_timestamps_thread(other_uuid: str, other_ip: str, other_tcp_port: int): tcpserver=daemon_thread_builder(tcp_server_thread, args=(other_uuid, other_tcp_port)) SENDER = socket.socket(socket.AF_INET, socket.SOCK_STREAM) SENDER.connect((other_ip,int(other_tcp_port))) address = (other_ip, int(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_timestamps_thread(other_uuid: str, other_ip: str, other_tcp_port: int):\r\n print_yellow(f\"ATTEMPTING TO CONNECT TO {other_uuid}\")\r\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\n sock.connect((other_ip, int(other_tcp_port)))\r\n other_time = sock.recv(4096)\r\n other_...
[ "0.8264321", "0.80638933", "0.8030872", "0.7862096", "0.6225704", "0.58393455", "0.5660077", "0.56123143", "0.54760754", "0.5442698", "0.5426285", "0.52990323", "0.5269797", "0.51783824", "0.51644313", "0.5143751", "0.51365656", "0.51334614", "0.50976205", "0.50662106", "0.50...
0.66718477
4
Use this function to make threads. Leave as is.
def daemon_thread_builder(target, args=()) -> threading.Thread: th = threading.Thread(target=target, args=args) th.setDaemon(True) return th
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_start_threads(self):\r\n self.create_threads()\r\n self.start_threads()", "def _make_thread(self):\r\n pass", "def create_workers(self, threads_count):\n\n for _ in xrange(threads_count):\n new_thread = Thread(target=self.execute)\n self.threads....
[ "0.78817755", "0.7458283", "0.6712016", "0.66176367", "0.6480147", "0.6425454", "0.64114654", "0.63368505", "0.63326395", "0.62520283", "0.624767", "0.624767", "0.62471247", "0.6244331", "0.6223761", "0.6218233", "0.6202923", "0.6194842", "0.614637", "0.6122263", "0.6099799",...
0.0
-1
Performs a single training step for critic and actor.
def update_step(self, replay_buffer_iter): states, actions, rewards, discounts, next_states = next( replay_buffer_iter) critic_dict = self.fit(states, actions, next_states, rewards, discounts) actor_dict = self.fit_alpha(states) return {**actor_dict, **critic_dict}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_actor_and_critic(self):\n\n # if not enough transitions in memory, don't train!\n if len(self.memory) < self.batch_size:\n return\n\n transitions = self.memory.sample() # sample a batch from memory\n\n # Convert experience tuples to separate arrays for each element\...
[ "0.7754257", "0.6942381", "0.67552686", "0.6744409", "0.64315784", "0.6248872", "0.61960554", "0.6153682", "0.61321175", "0.6125277", "0.6124174", "0.6114244", "0.6085445", "0.6071526", "0.59699905", "0.59624714", "0.595758", "0.59572315", "0.59403145", "0.58573264", "0.58545...
0.0
-1
Ensure we can retrieve a list of our own photos and photos accessible via album groups.
def test_paginated_photos(self): own_album = AlbumFactory.create(user=self.user) photos = PhotoFactory.create_batch(3, album=own_album) PhotoFactory.create_batch(2, album=own_album, trash=True) trash_album = AlbumFactory.create(user=self.user, trash=True) PhotoFactory.create(alb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_users_photos_view_set_get_own_photos(self):\n # Create user and data\n user = account_models.User.objects.create_user(email='mrtest@mypapaya.io', password='pass', username='aov_hov')\n category = photo_models.PhotoClassification.objects\\\n .create_or_update(name='Test', cl...
[ "0.6538849", "0.63964623", "0.6376904", "0.6322045", "0.6120553", "0.60942847", "0.60395104", "0.5947685", "0.594612", "0.5942414", "0.59387887", "0.5931279", "0.59208906", "0.59201974", "0.58497167", "0.5842505", "0.5822845", "0.578619", "0.57696813", "0.5761645", "0.5749474...
0.58845454
14
This callback is called on every http request to the server
def callback_uri(flow): print("\033[93m" + "WARNING: Potential possible Attack detected on %s" % str(flow) + "\033[0m") uri = flow.http_info.uri if ((uri)and(len(uri) > 500)): """ A URI bigger than 500 bytes could be suspicious """ items = uri.split("?") args = items[1].split("&") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onConnect(self, request_or_response):", "def _process_request(self, request, response):\n ...", "def event_handler(self, response):\n pass", "async def _response_handler(self):", "def connectionMade(self):", "def on_response(self, response):\n pass", "def run(self):\n se...
[ "0.68035215", "0.66667825", "0.66151416", "0.6559298", "0.64284265", "0.6419971", "0.6418524", "0.6417652", "0.63845855", "0.6382211", "0.6347527", "0.6285853", "0.6277875", "0.6248943", "0.6248943", "0.6242948", "0.6242948", "0.624212", "0.6197155", "0.6197155", "0.6190355",...
0.0
-1
Pad x and y so that the results have the same length (second dimension).
def _pad_tensors_to_same_length(x, y): with tf.compat.v1.name_scope("pad_to_same_length"): x_length = tf.shape(input=x)[1] y_length = tf.shape(input=y)[1] max_length = tf.maximum(x_length, y_length) x = tf.pad(tensor=x, paddings=[[0, 0], [0, max_length - x_length], [0, 0]]) y = tf.pad(tensor=y, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_vals(x, y):\n\n xshapes = []\n for x_arr in x:\n\n x_arr = np.array(x_arr)\n xshapes.append(x_arr.shape[0])\n\n x_max_shape = np.max(xshapes)\n for i, x_arr in enumerate(x):\n\n pad_len = x_max_shape - x_arr.shape[0]\n x[i] = np.pad(x_arr, (0, pad_len), mode='constan...
[ "0.72084653", "0.64343303", "0.6101265", "0.6084313", "0.60171574", "0.5993216", "0.5956909", "0.59541947", "0.59405696", "0.59165305", "0.5867438", "0.58579695", "0.5835595", "0.58168256", "0.5816696", "0.5811862", "0.57709336", "0.5734227", "0.5715207", "0.5693807", "0.5685...
0.7147605
1
Calculate cross entropy loss while ignoring padding.
def padded_cross_entropy_loss(logits, labels, smoothing, vocab_size): with tf.compat.v1.name_scope("loss", values=[logits, labels]): logits, labels = _pad_tensors_to_same_length(logits, labels) # Calculate smoothing cross entropy with tf.compat.v1.name_scope("smoothing_cross_entropy", values=[logits, lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss():\n return nn.CrossEntropyLoss()", "def cross_entropy(y_pred,y):\n \n epsilon = 0.001 # To prevent overflow and ensure numerical stability\n return sum(-y*np.log(y_pred+epsilon))", "def Weighted_Cross_Entropy(y_true, y_pred, eps = 1e-10):\n y_pred = tf.cast(y_pred, 'float...
[ "0.72118425", "0.6977244", "0.6913567", "0.69001913", "0.68212694", "0.6808604", "0.6790559", "0.6770588", "0.67624503", "0.67545956", "0.6719684", "0.6712214", "0.6701527", "0.67001855", "0.6690241", "0.6655911", "0.66522497", "0.6647189", "0.6639884", "0.66260445", "0.66160...
0.60390383
99
Wrap a metric fn that returns scores and weights as an eval metric fn. The input metric_fn returns values for the current batch. The wrapper aggregates the return values collected over all of the batches evaluated.
def _convert_to_eval_metric(metric_fn): def problem_metric_fn(*args): """Returns an aggregation of the metric_fn's returned values.""" (scores, weights) = metric_fn(*args) # The tf.metrics.mean function assures correct aggregation. return tf.compat.v1.metrics.mean(scores, weights) return problem_me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_fn(\n # The pytype below must be Any, because the code below uses internal methods\n # only present on tff.learning.from_keras_model-derived TFF models.\n model: Any,\n dataset: tf.data.Dataset,\n batch_size: int = 1,\n) -> collections.OrderedDict[str, tf.Tensor]:\n # Resets the model'...
[ "0.6395356", "0.6359279", "0.629271", "0.6235188", "0.62173855", "0.6195198", "0.61704963", "0.6149006", "0.6123954", "0.6117296", "0.6049343", "0.601445", "0.5938186", "0.5898094", "0.58803093", "0.58801115", "0.58606005", "0.58545065", "0.5843001", "0.58256847", "0.5775458"...
0.7159342
0
Returns an aggregation of the metric_fn's returned values.
def problem_metric_fn(*args): (scores, weights) = metric_fn(*args) # The tf.metrics.mean function assures correct aggregation. return tf.compat.v1.metrics.mean(scores, weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg(self, values, agg_func):\n assert len(values) > 0, \"Empty list of values\"\n f = agg_func.strip().lower()\n assert f in self.__AGGREGATIONS, \"Aggregation function \" + agg_func + \" is not valid\"\n\n ret = 0 # just to avoid \"Local variable might be referenced before assignm...
[ "0.6408343", "0.63543737", "0.62959653", "0.62449336", "0.6215591", "0.61848396", "0.6074576", "0.60159856", "0.5993007", "0.59578437", "0.5943741", "0.593868", "0.59344465", "0.59140265", "0.5911688", "0.5882706", "0.58362037", "0.5827314", "0.5803448", "0.5791047", "0.57742...
0.5814285
18
Return dictionary of model evaluation metrics.
def get_eval_metrics(logits, labels, params): metrics = { "accuracy": _convert_to_eval_metric(padded_accuracy)(logits, labels), "accuracy_top5": _convert_to_eval_metric(padded_accuracy_top5)( logits, labels), "accuracy_per_sequence": _convert_to_eval_metric( padded_sequence_accur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self) -> Dict[str, float]:\n eval_dataloader = self.get_eval_dataloader()\n\n output = self._prediction_loop(eval_dataloader, description=\"Evaluation\")\n return output.metrics", "def calc_metrics(model, X, y):\n\n # Get model predictions\n y_predict_r = model.predict(X)\...
[ "0.78439504", "0.7329396", "0.72895527", "0.71769637", "0.7115815", "0.7106972", "0.7095427", "0.69898015", "0.6976603", "0.6963649", "0.6947694", "0.69401413", "0.6920403", "0.69152176", "0.683158", "0.6821512", "0.6805699", "0.680537", "0.6803111", "0.6790149", "0.67836165"...
0.6120414
76
Percentage of times that predictions matches labels on non0s.
def padded_accuracy(logits, labels): with tf.compat.v1.variable_scope("padded_accuracy", values=[logits, labels]): logits, labels = _pad_tensors_to_same_length(logits, labels) weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32) outputs = tf.cast(tf.argmax(input=logits, axis=-1), dtype=tf.int32) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0", "def percent_accuracy(self, true_values, predicted_values):\n\n correct = 0\n size = len(true_values)\n for i in range(len(true_values)):\n tr...
[ "0.76227057", "0.7379493", "0.72297883", "0.722671", "0.71479374", "0.71069294", "0.7047552", "0.70354223", "0.7023279", "0.7022213", "0.70219743", "0.6970781", "0.6960516", "0.69523424", "0.69481045", "0.6926855", "0.692359", "0.6909524", "0.68767715", "0.68717813", "0.68661...
0.0
-1
Percentage of times that topk predictions matches labels on non0s.
def padded_accuracy_topk(logits, labels, k): with tf.compat.v1.variable_scope("padded_accuracy_topk", values=[logits, labels]): logits, labels = _pad_tensors_to_same_length(logits, labels) weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32) effective_k = tf.minimum(k, tf.shape(input=logits)[-1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracies(preds, labels, ks):\n num_topks_correct = topks_correct(preds, labels, ks)\n return [(x / preds.size(0)) * 100.0 for x in num_topks_correct]", "def topk_errors(preds, labels, ks):\n num_topks_correct = topks_correct(preds, labels, ks)\n return [(1.0 - x / preds.size(0)) * 100.0 fo...
[ "0.78908753", "0.73390025", "0.7233049", "0.72291976", "0.7195095", "0.70900184", "0.7036402", "0.70240974", "0.69874215", "0.6977213", "0.6972062", "0.6952351", "0.6952351", "0.69479007", "0.69431925", "0.69333524", "0.69322234", "0.6922573", "0.6919798", "0.6919798", "0.691...
0.0
-1
Percentage of times that predictions matches labels everywhere (non0).
def padded_sequence_accuracy(logits, labels): with tf.compat.v1.variable_scope("padded_sequence_accuracy", values=[logits, labels]): logits, labels = _pad_tensors_to_same_length(logits, labels) weights = tf.cast(tf.not_equal(labels, 0), dtype=tf.float32) outputs = tf.cast(tf.argmax(input=logits, axis=-1),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0", "def accuracy(predictions, labels):\n predictions = list(predictions)\n labels = list(labels)\n count = 0\n for i in range(len(labels)):\n if labels[i] == ...
[ "0.7791173", "0.7454314", "0.73788065", "0.7339361", "0.73184043", "0.72473156", "0.7175092", "0.7150846", "0.71485466", "0.71371794", "0.70903116", "0.7048925", "0.7027989", "0.6983812", "0.6973967", "0.6961783", "0.6957565", "0.6949172", "0.6945957", "0.6927787", "0.6919117...
0.0
-1
Average logperplexity excluding padding 0s. No smoothing.
def padded_neg_log_perplexity(logits, labels, vocab_size): num, den = padded_cross_entropy_loss(logits, labels, 0, vocab_size) return -num, den
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_log_perplexity(self, output, flat_labels): #completed, expensive, should be compiled\n return -np.sum(np.log2(np.clip(output, a_min=1E-12, a_max=1.0))[np.arange(flat_labels.shape[0]), flat_labels[:,1]])", "def mean_logprob(context, pos_lm):\n logprobs = []\n for tag in pos_lm.vocab:\n ...
[ "0.66184866", "0.6430783", "0.64092505", "0.6403149", "0.63637125", "0.6289191", "0.62084115", "0.61952806", "0.6139312", "0.6139312", "0.6114071", "0.60729593", "0.6072521", "0.60281146", "0.6023515", "0.60105234", "0.59943175", "0.5982887", "0.59648985", "0.59572244", "0.59...
0.5679914
60
Approximate BLEU score computation between labels and predictions. An approximate BLEU scoring method since we do not glue word pieces or decode the ids and tokenize the output. By default, we use ngram order of 4 and use brevity penalty. Also, this does not have beam search.
def bleu_score(logits, labels): predictions = tf.cast(tf.argmax(input=logits, axis=-1), dtype=tf.int32) # TODO: Look into removing use of py_func bleu = tf.compat.v1.py_func(compute_bleu, (labels, predictions), tf.float32) return bleu, tf.constant(1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, target_text, prediction_text):\n bleu_score = sacrebleu.corpus_bleu([prediction_text], [[target_text]],\n smooth_method=\"exp\",\n smooth_value=0.0,\n force=False,\n ...
[ "0.676764", "0.6673371", "0.6643084", "0.66368395", "0.6494957", "0.6433774", "0.6251299", "0.61644274", "0.6140684", "0.6140684", "0.6137825", "0.61087483", "0.60575855", "0.6050852", "0.5999082", "0.5985014", "0.596442", "0.5956953", "0.5927048", "0.5841247", "0.5831066", ...
0.5997709
15
Extracts all ngrams up to a given maximum order from an input segment.
def _get_ngrams_with_counter(segment, max_order): ngram_counts = collections.Counter() for order in xrange(1, max_order + 1): for i in xrange(0, len(segment) - order + 1): ngram = tuple(segment[i:i + order]) ngram_counts[ngram] += 1 return ngram_counts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ngrams(line, min_order=1, max_order=BLEU.NGRAM_ORDER) -> Counter:\n\n ngrams = Counter() # type: Counter\n tokens = line.split()\n for n in range(min_order, max_order + 1):\n for i in range(0, len(tokens) - n + 1):\n ngram = ' '.join(tokens[i: i + n])\n ...
[ "0.6581706", "0.65742457", "0.64183784", "0.62482524", "0.6233594", "0.6122576", "0.6087275", "0.6044856", "0.6036233", "0.59712744", "0.59699684", "0.5965845", "0.59467024", "0.59328526", "0.5909492", "0.59071153", "0.5855572", "0.58542573", "0.5828259", "0.5820391", "0.5790...
0.62992704
3
Computes BLEU score of translated segments against one or more references.
def compute_bleu(reference_corpus, translation_corpus, max_order=4, use_bp=True): reference_length = 0 translation_length = 0 bp = 1.0 geo_mean = 0 matches_by_order = [0] * max_order possible_matches_by_order = [0] * max_order precisions = [] for (references, translations) in zip(refe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bleu_score(references, generated, n_gram=4, smooth=False):\r\n formatted_ref = [[ref] for ref in references]\r\n bleu_s, _, _, _, _, _ = compute_bleu(formatted_ref, generated, n_gram, smooth)\r\n return bleu_s * 100", "def calculate_bleu(output_lns, refs_lns):\n return round(corpus_bleu(output_ln...
[ "0.74093115", "0.6367269", "0.62644315", "0.6251968", "0.61092013", "0.6055221", "0.6055221", "0.60060614", "0.6000095", "0.59870803", "0.597151", "0.5941071", "0.59349793", "0.59248674", "0.5910593", "0.57739943", "0.5773284", "0.5762745", "0.57584465", "0.57571113", "0.5705...
0.6329306
2
ROUGE2 F1 score computation between labels and predictions. This is an approximate ROUGE scoring method since we do not glue word pieces or decode the ids and tokenize the output.
def rouge_2_fscore(logits, labels): predictions = tf.cast(tf.argmax(input=logits, axis=-1), dtype=tf.int32) # TODO: Look into removing use of py_func rouge_2_f_score = tf.compat.v1.py_func(rouge_n, (predictions, labels), tf.float32) return rouge_2_f_score, tf.constant(1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_f1_score(actual_labels, preds_labels, binary_classifcation, pos_label=\"malaria\", confusion_matrix_title=\"\"):\n # demonstration of calculating metrics for a neural network model using sklearn\n if not binary_classifcation:\n # For multiclass classification.\n accuracy = accuracy_scor...
[ "0.71954495", "0.71191156", "0.6963033", "0.69378823", "0.6911759", "0.6779604", "0.6772857", "0.6724274", "0.67095697", "0.6671175", "0.6646141", "0.6631684", "0.660936", "0.66015124", "0.6600215", "0.6514463", "0.6501403", "0.6496312", "0.6494798", "0.64848906", "0.6475837"...
0.59118205
58
Computes ROUGEN f1 score of two text collections of sentences.
def rouge_n(eval_sentences, ref_sentences, n=2): f1_scores = [] for eval_sentence, ref_sentence in zip(eval_sentences, ref_sentences): eval_ngrams = _get_ngrams(n, eval_sentence) ref_ngrams = _get_ngrams(n, ref_sentence) ref_count = len(ref_ngrams) eval_count = len(eval_ngrams) # Count the over...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordSimilarityRatio(sent_1,sent_2):", "def compare_word_selection(selection1,selection2):\n\n num_extra=0;\n num_total=0;\n total_score=0;\n for k in selection1.keys():\n num_total+=1;\n if k not in selection2:\n num_extra+=1;\n else:\n score=compare_sen...
[ "0.6674491", "0.66676176", "0.66379195", "0.66306865", "0.65985924", "0.65764666", "0.63913876", "0.6372906", "0.63459545", "0.6281768", "0.6273304", "0.62707555", "0.62299347", "0.6229132", "0.6220144", "0.6207237", "0.6142732", "0.61302173", "0.6130169", "0.6127994", "0.610...
0.0
-1
ROUGE scores computation between labels and predictions. This is an approximate ROUGE scoring method since we do not glue word pieces or decode the ids and tokenize the output.
def rouge_l_fscore(predictions, labels): outputs = tf.cast(tf.argmax(input=predictions, axis=-1), dtype=tf.int32) rouge_l_f_score = tf.compat.v1.py_func(rouge_l_sentence_level, (outputs, labels), tf.float32) return rouge_l_f_score, tf.constant(1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, target_tokens, prediction_tokens):\n result = {}\n\n for rouge_type in self.rouge_types:\n if rouge_type == \"rougeL\":\n # Rouge from longest common subsequences.\n scores = _score_lcs(target_tokens, prediction_tokens)\n elif re.match(r\"rouge[0-9]$\", rouge_type):\n ...
[ "0.67164266", "0.6673074", "0.6545491", "0.65359217", "0.65239596", "0.6493723", "0.64730954", "0.6470353", "0.6446105", "0.64450943", "0.64450467", "0.641691", "0.6371628", "0.63209", "0.6273009", "0.62670004", "0.6264034", "0.62606454", "0.62603366", "0.62595165", "0.625553...
0.61701393
28
Computes ROUGEL (sentence level) of two collections of sentences.
def rouge_l_sentence_level(eval_sentences, ref_sentences): f1_scores = [] for eval_sentence, ref_sentence in zip(eval_sentences, ref_sentences): m = float(len(ref_sentence)) n = float(len(eval_sentence)) lcs = _len_lcs(eval_sentence, ref_sentence) f1_scores.append(_f_lcs(lcs, m, n)) return np.mea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rouge_l_sentence_level(evaluated_sentences, reference_sentences):\n if len(evaluated_sentences) <= 0 or len(reference_sentences) <= 0:\n raise ValueError(\"Collections must contain at least 1 sentence.\")\n reference_words = _split_into_words(reference_sentences)\n evaluated_words = _split_into_words(eva...
[ "0.6562477", "0.6535288", "0.6080566", "0.6073384", "0.5944744", "0.5769236", "0.57410604", "0.56901485", "0.5615614", "0.556189", "0.55066365", "0.55035615", "0.5495382", "0.54569256", "0.54294115", "0.54145795", "0.5409134", "0.5398293", "0.5385837", "0.5370661", "0.5333738...
0.66352373
0
Returns the length of the Longest Common Subsequence between two seqs.
def _len_lcs(x, y): table = _lcs(x, y) n, m = len(x), len(y) return table[n, m]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longestCommonSubsequence(self, text1: str, text2: str) -> int:\n if len(text1) == 0 or len(text2) == 0:\n return 0\n if text1[0] == text2[0]:\n return 1 + self.longestCommonSubsequence(text1[1:], text2[1:])\n else:\n return max(self.longestCommonSubsequence...
[ "0.793082", "0.78713226", "0.78309524", "0.7427125", "0.73440653", "0.7278892", "0.7266744", "0.71712285", "0.7093681", "0.6894858", "0.68482155", "0.6788144", "0.67197895", "0.6692162", "0.6673714", "0.6666056", "0.6649898", "0.6628876", "0.66177297", "0.6613877", "0.6545006...
0.6606945
21
Computes the length of the LCS between two seqs. The implementation below uses a DP programming algorithm and runs in O(nm) time where n = len(x) and m = len(y).
def _lcs(x, y): n, m = len(x), len(y) table = dict() for i in range(n + 1): for j in range(m + 1): if i == 0 or j == 0: table[i, j] = 0 elif x[i - 1] == y[j - 1]: table[i, j] = table[i - 1, j - 1] + 1 else: table[i, j] = max(table[i - 1, j], table[i, j - 1]) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def _len_lcs(x, y):\n table = _lcs(x, y)\n n, m = len(x), len(y)\n return table[n, m]", "def lcs_len(x, y):\r\n \r\n if len(x) == 0 or len(y) == 0:\r\n return 0\r\n \r\n xx = x[:-1] # xx = sequence x w...
[ "0.8111537", "0.8111537", "0.805192", "0.8049781", "0.79654235", "0.7889462", "0.77578354", "0.77516085", "0.762071", "0.7560494", "0.735811", "0.72106427", "0.6993349", "0.6856335", "0.67487043", "0.66640663", "0.6648296", "0.6540758", "0.654009", "0.6442203", "0.6368005", ...
0.6708936
16
Computes the LCSbased Fmeasure score.
def _f_lcs(llcs, m, n): r_lcs = llcs / m p_lcs = llcs / n beta = p_lcs / (r_lcs + 1e-12) num = (1 + (beta ** 2)) * r_lcs * p_lcs denom = r_lcs + ((beta ** 2) * p_lcs) f_lcs = num / (denom + 1e-12) return f_lcs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeFScores(self, targetLabels, actualLabels):\r\n if self.prMeasures is None:\r\n self.prMeasures = self.computePRMeasures(targetLabels, actualLabels)\r\n if self.prMeasures[0] == 0:\r\n return 0\r\n self.f1score = 2 * self.prMeasures[0] * self.prMeasures[...
[ "0.72489244", "0.6807921", "0.67379725", "0.653737", "0.619838", "0.6129479", "0.6101997", "0.60964715", "0.6069985", "0.60437524", "0.59976935", "0.5977477", "0.59438634", "0.5916483", "0.5908706", "0.5908706", "0.5908706", "0.5908706", "0.58445996", "0.5814258", "0.58096695...
0.5989499
11
Lists all files in a folder that match the clipping.json format.
def _listdir(folder): filePattern = r"^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])\-clipping\-[\d]*\.json$" filenames = [f for f in os.listdir(folder) if re.match(filePattern, f)] return filenames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_files_from_folder(folder: str) -> list:\n\n files = []\n for file_name in os.listdir(folder):\n splitted_filename = file_name.split(\".\")\n if splitted_filename[-1] == \"json\":\n files.append(file_name)\n return files", "def list_files(path):\n return list(sorted([...
[ "0.66877824", "0.60839224", "0.5914875", "0.5865345", "0.5820445", "0.58006823", "0.5798163", "0.5783536", "0.5780574", "0.57754827", "0.5738916", "0.5717606", "0.5713355", "0.56997764", "0.5660107", "0.56417465", "0.5632708", "0.56137383", "0.5609525", "0.55692714", "0.55671...
0.7092136
0
To handle exceptions. Some .jsons may not have the same keys.
def _get_clipping_value(clipping, key): if key in clipping: return clipping[key] return "N/A"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_json_failure_response_is_username_collision(self, response):\r\n self.assertEqual(400, response.status_code)\r\n payload = json.loads(response.content)\r\n self.assertFalse(payload.get('success'))\r\n self.assertIn('already exists', payload.get('value'))", "def check_repeat...
[ "0.6223973", "0.59830946", "0.59771997", "0.5899925", "0.5856975", "0.5799147", "0.5791387", "0.57734907", "0.57483834", "0.57410455", "0.57091707", "0.5696217", "0.56931484", "0.5691315", "0.5677174", "0.56699157", "0.5655964", "0.5650639", "0.5624103", "0.5604085", "0.55974...
0.0
-1
Onetime use function. Method for rebasing .json files. Previous file versions did not include the base64 prefix.
def rebase_add_encoding_prefix(): filenames, clippings = load_clippings(inFolder) for file, clip in zip(filenames, clippings): img = clip["imgEncoding"] str = "data:image/png;base64," if str not in img: clip["imgEncoding"] = str + img with open(file, "w") as outfile: json.dump(clip, outfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_gen(self):\r\n current_path = os.path.join(self.settings.save_path, 'current.json')\r\n current_folder_path = os.path.join(self.settings.save_path, 'current')\r\n history_path = os.path.join(self.settings.save_path, 'history')\r\n archive_folder_path = os.path.join(history_p...
[ "0.6086128", "0.6033686", "0.59726596", "0.59672356", "0.5949546", "0.5894795", "0.58688366", "0.5825079", "0.5788089", "0.5704787", "0.5688017", "0.56608254", "0.559506", "0.55057395", "0.54784393", "0.5455468", "0.54384154", "0.5428078", "0.5389018", "0.53759176", "0.536490...
0.6098598
0
Onetime use function. Method for rebasing .json files. Add a "clipDate" key to clippings.
def rebase_add_date(): filenames, clippings = load_clippings(inFolder) for file, clip in zip(filenames, clippings): date = "-".join(file.split("-")[:3]) date = date.split("/")[-1] clip["clipDate"] = date with open(file, "w") as outfile: json.dump(clip, outfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_files_json():\n # chdir into beep root\n pwd = os.getcwd()\n os.chdir(os.environ.get(\"BEEP_ROOT\", \"/\"))\n\n meta_list = list(filter(lambda x: '_Metadata.csv' in x, os.listdir(SRC_DIR)))\n file_list = list(filter(lambda x: '.csv' in x if x not in meta_list else None, os.listdir(SRC_DI...
[ "0.57587606", "0.55869764", "0.53467065", "0.52671915", "0.5242644", "0.5208656", "0.51642597", "0.5124621", "0.50885236", "0.5050152", "0.5046206", "0.5035444", "0.5032294", "0.5019946", "0.50142884", "0.5002037", "0.49930683", "0.49280834", "0.49243683", "0.49133766", "0.49...
0.7519383
0
Plots the piezo trace from piezo 0 and PMT pulse sizes near the acoustic signal on one figure. The green line indicates the time of acoustic t0. The red line indicates the time and size of the PMT t0 chosen by Matt's analysis. The yellow lines indicate the times and sizes of other PMT pulses. Also plots in separate win...
def PMTandPiezoPlot(datadir,run,event,gain): en = event mu = gain e = sbc.DataHandling.GetSBCEvent.GetEvent(datadir+'/'+run,en) print(e["fastDAQ"].keys()) cgate = e["fastDAQ"]["CAMgate"] dcam = np.diff(cgate) p0=e["fastDAQ"]["Piezo1"] p1 = e["fastDAQ"]["Piezo2"] fdt = e["fast...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plots(self, events=None, title=None):\n data = self.data\n P = PH.regular_grid(3 , 1, order='columnsfirst', figsize=(8., 6), showgrid=False,\n verticalspacing=0.08, horizontalspacing=0.08,\n margins={'leftmargin': 0.07, 'rightmargin': 0.20, 'topmarg...
[ "0.6307774", "0.6264446", "0.6067582", "0.5951146", "0.594318", "0.59195983", "0.59024936", "0.5900452", "0.5894213", "0.5889887", "0.58874977", "0.5886258", "0.58600056", "0.58458775", "0.58402437", "0.5836458", "0.5819858", "0.57920396", "0.5785791", "0.5773497", "0.577211"...
0.72579896
0
Return content without the comments. If filter_multiline_comment is set to False, only the one line comment will be filtered out. If keep_content_size is set to True, the size of the content is preserved.
def filter_comments( content, filter_multiline_comment=True, keep_content_size=False ): def _replace_comment(element): """Replace matched *element* in content.""" replacement = "" matched = element.group() # Ensure that only the comment part is being replaced if not matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_comments(file_contents):\n lines_without_comments = []\n for line in file_contents:\n comment_position = line.find(COMMENT_INDICATOR)\n if comment_position != -1:\n lines_without_comments.append(line[:comment_position])\n else:\n lines_without_comments.ap...
[ "0.5167605", "0.51409805", "0.4917135", "0.4830618", "0.46820927", "0.46535304", "0.46266067", "0.46166417", "0.4502041", "0.44980857", "0.44534415", "0.4443194", "0.44398215", "0.44346082", "0.43637702", "0.43127203", "0.4308069", "0.42852294", "0.42846525", "0.42836487", "0...
0.7138743
0
Replace matched element in content.
def _replace_comment(element): replacement = "" matched = element.group() # Ensure that only the comment part is being replaced if not matched.startswith("/"): replacement += matched[0] matched = matched[1:] count = matched.count("\n") # Add emp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_element(element):\n # Guess line number\n count = element.group().count(\"\\n\")\n\n # Ensure that the replacement string keep the same length that\n # the original content to be able to use the match positions\n _buffer = len(element.group()) - count - 2\n\n ...
[ "0.6922728", "0.6515308", "0.6332452", "0.62553614", "0.61960304", "0.6170884", "0.6162246", "0.6047259", "0.60279584", "0.60038835", "0.5947182", "0.58738005", "0.5823154", "0.5736322", "0.5640052", "0.5575298", "0.55390126", "0.5501876", "0.5462999", "0.5449665", "0.5448195...
0.0
-1
Return tuple of content with the top level elements only and dictionary containing the collapsed content associated with the line number. If filter_comment is set to True, all comment are removed from the content before collapsing the elements. The collapsed content dictionary preserve the comments.
def collapse_all(content, filter_comment=False): _initial_content = content collapsed_content = {} if filter_comment: # Filter comment before collapsing elements to prevent comment analysis content = filter_comments(content, keep_content_size=True) def _replace_element(element): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_comments(\n content, filter_multiline_comment=True, keep_content_size=False\n):\n def _replace_comment(element):\n \"\"\"Replace matched *element* in content.\"\"\"\n replacement = \"\"\n matched = element.group()\n\n # Ensure that only the comment part is being replace...
[ "0.53617066", "0.49494117", "0.48269865", "0.47749653", "0.47021854", "0.46672785", "0.46630976", "0.46363974", "0.45885256", "0.45649537", "0.45570302", "0.45216203", "0.44642898", "0.44569367", "0.44267008", "0.43709692", "0.43698663", "0.42966306", "0.4290518", "0.42780748",...
0.71825683
0
Replace matched element in content.
def _replace_element(element): # Guess line number count = element.group().count("\n") # Ensure that the replacement string keep the same length that # the original content to be able to use the match positions _buffer = len(element.group()) - count - 2 if len(element.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_content(self, content, siteurl):\n if not content:\n return content\n\n hrefs = self._get_intrasite_link_regex()\n return hrefs.sub(lambda m: self._link_replacer(siteurl, m), content)", "def string_replace_xml_text(element, pattern, value):\n if element.text:\n ...
[ "0.6515308", "0.6332452", "0.62553614", "0.61960304", "0.6170884", "0.6162246", "0.6047259", "0.60279584", "0.60038835", "0.5947182", "0.58738005", "0.5823154", "0.5736322", "0.5640052", "0.5575298", "0.55390126", "0.5501876", "0.5462999", "0.5449665", "0.54481953", "0.542928...
0.6922728
0
Return docstrings for an element at a specific line_number. Loop into the file lines in reverse, starting from the element's line_number in order to parse the docstring if available.
def get_docstring(line_number, lines): docstring = None for index in reversed(range(line_number-1)): line = lines[index].strip() if len(line) == 0 or line.startswith("//"): # Do not look for docstring when more than two blank lines precede # the element. if i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_doxygen_docstring(lines, name):\n\n lines = lines[:]\n newlines = []\n indent = 0\n reading_desc = False\n\n while lines:\n line = lines.pop(0)\n if line.startswith(\"////\"):\n continue\n\n line = line.rstrip()\n if line.startswith('///<'):\n ...
[ "0.59708744", "0.5864023", "0.57362026", "0.5729538", "0.5353018", "0.5304556", "0.52516913", "0.5187537", "0.51576215", "0.5119893", "0.4906234", "0.4906234", "0.4906234", "0.48642772", "0.4851124", "0.48384303", "0.47899288", "0.47810355", "0.4746727", "0.4719589", "0.47194...
0.67731166
0
Return a list of schedd ads representing all the schedds in the pool.
def get_schedds(args=None): schedd_query = classad.ExprTree('!isUndefined(CMSGWMS_Type)') collectors = ["cmssrv221.fnal.gov:9620", "cmsgwms-collector-tier0.cern.ch:9620", "cmssrv276.fnal.gov"] schedd_ads = {} for host in collectors: coll = htcondor.Collector(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ads():\n return coll_ad.distinct(KEY_AD_ID)", "def get_scnlist_all(self):\n logger.debug(\"Creating Database Engine and Session.\")\n db_engine = sqlalchemy.create_engine(self.db_info_obj.dbConn)\n session_sqlalc = sqlalchemy.orm.sessionmaker(bind=db_engine)\n ses = session...
[ "0.6366169", "0.58527523", "0.55230117", "0.5514247", "0.5457407", "0.5414462", "0.537656", "0.5369209", "0.53689307", "0.53553814", "0.53361785", "0.5334375", "0.53261983", "0.53052175", "0.5293422", "0.5286213", "0.5268966", "0.5263969", "0.525932", "0.5256553", "0.5237803"...
0.59305084
1
Driver method for the spider script.
def main_driver(args): starttime = time.time() # Get all the schedd ads schedd_ads = get_schedds(args) logging.warning("&&& There are %d schedds to query.", len(schedd_ads)) pool = multiprocessing.Pool(processes=args.query_pool_size) if not args.skip_history: htcondor_es.history.proce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_spider(self, spider):\n pass", "def open_spider(self,Spider):\n pass", "def _scrape(self):", "def scrape(self):\n pass", "def runSpider(spiderClass):\n\n\tprocess = CrawlerProcess({\n\t\t# 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'\n\t})\n\n\tprocess.cr...
[ "0.69789076", "0.6779831", "0.6693511", "0.6653942", "0.6546695", "0.6390095", "0.62781423", "0.6225595", "0.61060053", "0.60984313", "0.59596026", "0.59464854", "0.5914226", "0.5914064", "0.5889635", "0.5883018", "0.5883018", "0.5883018", "0.58060247", "0.5801764", "0.578676...
0.0
-1
Main method for the spider_cms script. Parses arguments and invokes main_driver
def main(): parser = argparse.ArgumentParser() parser.add_argument("--process_queue", action='store_true', dest="process_queue", help="Process also schedd queue (Running/Idle/Pending jobs)") parser.add_argument("--feed_es", action='store_true', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n from scrapy.crawler import CrawlerProcess\n from scrapy.utils.project import get_project_settings\n\n process = CrawlerProcess(get_project_settings())\n process.crawl(NCBIGeoSpider)\n process.start()", "def main():\n # get input params\n args = parm_parser.get_args()\n # i...
[ "0.70166576", "0.69471085", "0.6813321", "0.66161793", "0.6571456", "0.63922524", "0.6328098", "0.63057745", "0.62522024", "0.6190267", "0.6187147", "0.61624885", "0.6162456", "0.6151359", "0.6139654", "0.6124047", "0.6120733", "0.6099212", "0.6035318", "0.60084355", "0.59966...
0.0
-1
Prepare inputs for GTN, topo input and feat input together.
def gen_input(args, datareader, bkd_gids): As = {} Xs = {} for gid in bkd_gids: if gid not in As: As[gid] = torch.tensor(datareader.data['adj_list'][gid], dtype=torch.float) if gid not in Xs: Xs[gid] = torch.tensor(datareader.data['features'][gid], dtype=torch.float) Ainputs = {} Xin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_inputs(\n cls,\n training_data: Dict[str, SupervisedDataset],\n task_feature: int,\n rank: Optional[int] = None,\n **kwargs: Any,\n ) -> Dict[str, Any]:\n inputs = super().construct_inputs(\n training_data=training_data, task_feature=task_featur...
[ "0.625194", "0.61816275", "0.59840703", "0.5956487", "0.59521675", "0.5821427", "0.57861555", "0.57474005", "0.5709486", "0.57022744", "0.570068", "0.569275", "0.56124747", "0.5574784", "0.55706114", "0.5532864", "0.55202353", "0.5518523", "0.5515399", "0.55153596", "0.551356...
0.5643953
12
Test that the package provides customization_data that defines the function
def test_function_definition(self): func = get_function_definition(PACKAGE_NAME, FUNCTION_NAME) assert func is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_confirm_customization_details(self):\n pass", "def pytest_funcarg__generate_golden_data(request):\r\n return request.config.option.generate_golden_data", "def test_function_definition(self):\n func = get_function_definition(PACKAGE_NAME, FUNCTION_NAME)\n assert func", "def test...
[ "0.6494149", "0.62934417", "0.62290233", "0.62290233", "0.60117173", "0.5846331", "0.57936054", "0.5786965", "0.5635037", "0.56308526", "0.5616144", "0.5589976", "0.5589475", "0.55771124", "0.55632764", "0.55560976", "0.55560976", "0.55545074", "0.55533385", "0.5547361", "0.5...
0.6025656
12
Test calling with sample values for the parameters
def test_success(self, worksheet, circuits_app, attachment_id, incident_id, task_id, excel_ranges, excel_defined_names, expected_results): function_params = { "attachment_id": attachment_id, "excel_ranges": excel_ranges, "excel_defined_names": excel_defin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, params):\r\n return self.sample(params)", "def sample(self, *args, **kwargs):", "def test_function_callparams(self):\n\n @Configurable(conf=category('', Parameter('test', value=True)))\n def twist(test=None):\n return test\n\n value = twist()\n\n ...
[ "0.74978554", "0.7458379", "0.6806208", "0.67182815", "0.66871434", "0.66065896", "0.6550513", "0.6408485", "0.63945335", "0.63945335", "0.6393947", "0.63818336", "0.6375116", "0.6333833", "0.6326504", "0.6301726", "0.6289962", "0.62281895", "0.6223233", "0.6222367", "0.62067...
0.0
-1
Uses the Win32 registry to return a iterator of serial (COM) ports existing on this computer.
def _enumerate_serial_ports(): path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM' try: key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path) except WindowsError: raise IterationError for i in itertools.count(): try: val = winreg.EnumVal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerate_serial_ports():\n path = 'HARDWARE\\\\DEVICEMAP\\\\SERIALCOMM'\n try:\n key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path)\n except WindowsError:\n raise IterationError\n\n for i in itertools.count():\n try:\n val = winreg.EnumValue(key, i)\n# ...
[ "0.86018956", "0.8531883", "0.7983318", "0.7983318", "0.7980792", "0.7802933", "0.77502596", "0.7742627", "0.7668107", "0.764201", "0.7632164", "0.7632164", "0.7631555", "0.75972277", "0.75972277", "0.75972277", "0.75972277", "0.7596552", "0.75547063", "0.7551492", "0.7501493...
0.860505
0
Create scatter error plot to compare the Prediction. There is an example of how to use it in the main function below
def scatter_error_plot(y_true, y_predict, datelist, xlab='Dates', ylab='Units sold', title='Error analysis', ticks_separation='weeks'): plt.style.use('seaborn') #create plot fig=plt.figure(figsize=(15,10)) #plot things plt.plot(datelist,y_true, lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_errors(self):\n\n plt.title(\"Prediction Error\")\n plt.plot(self.errors)\n plt.ylabel(\"MSE (Mean Squared Error)\")\n plt.xlabel(\"Iteration\")\n plt.show()", "def plotPredictedError():\n\tglobal normalized\n\n\twarmthPred = []\n\twarmthObserved = []\n\tcompPred = []\...
[ "0.74629337", "0.73333055", "0.7297354", "0.72578835", "0.71555036", "0.69879824", "0.6962361", "0.6863958", "0.68618965", "0.6843908", "0.68003273", "0.67923915", "0.6791393", "0.6774523", "0.6764563", "0.6723646", "0.67137504", "0.6705686", "0.66826", "0.664954", "0.6558499...
0.72337556
4
Function that plots a Calendar Map
def plot_calmap(df_serie, title='Calendar 2018'): plt.style.use('seaborn') fig = plt.figure(figsize=(15,6)) ax = fig.add_subplot(111) cax = calmap.yearplot(df_serie, ax=ax )#, cmap='YlGn') cb=fig.colorbar(cax.get_children()[1], ax=cax, orientation='horizontal') plt.title(title) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_calmap(df, yr, s3_resource_bucket):\n calmap_data = pd.Series(df['Miles'].values, index=df['Date'])\n plt.figure(figsize=(15, 5))\n plt.title(f'CALENDAR HEATMAP')\n calmap.yearplot(calmap_data,\n year=int(yr),\n fillcolor='lightgrey')\n plt.savefig(f'...
[ "0.69210756", "0.6444934", "0.6395161", "0.6322168", "0.6316235", "0.6248", "0.62450975", "0.62378526", "0.62311244", "0.62179315", "0.6160899", "0.6084357", "0.60731095", "0.60508186", "0.60447294", "0.6003607", "0.5985491", "0.5948202", "0.593896", "0.59218866", "0.5912166"...
0.7201914
0
counts reviewer comments, checks for protm tag, counts rxns
def calc_comments(self): for comment in self.pull_request.get_comments(): self._users.add(comment.user.login) lowercase_body = comment.body.lower() if "protm" in lowercase_body: self.num_protm += 1 self.num_comments += 1 if comment.body...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_conv_comments(self):\n for conv_comment in self.pull_request.get_issue_comments():\n self._users.add(conv_comment.user.login)\n lowercase_body = conv_comment.body.lower()\n if \"protm\" in lowercase_body:\n self.num_protm += 1\n self.num_co...
[ "0.6474507", "0.6455249", "0.6259978", "0.62172806", "0.61330706", "0.60819334", "0.6049567", "0.6044032", "0.5932042", "0.59275013", "0.5864903", "0.5854539", "0.5774755", "0.57618237", "0.57519615", "0.5748041", "0.5737438", "0.57298326", "0.5722486", "0.57208025", "0.57045...
0.668312
0
counts conversational comments, checks for protm tag, counts rxns
def calc_conv_comments(self): for conv_comment in self.pull_request.get_issue_comments(): self._users.add(conv_comment.user.login) lowercase_body = conv_comment.body.lower() if "protm" in lowercase_body: self.num_protm += 1 self.num_conv_comments +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_comments(self):\n return self.run_query(f\"count({self.r}/comment)\")", "def calc_comments(self):\n for comment in self.pull_request.get_comments():\n self._users.add(comment.user.login)\n lowercase_body = comment.body.lower()\n if \"protm\" in lowercase_b...
[ "0.66587913", "0.6579101", "0.6395755", "0.6311714", "0.6095312", "0.6047312", "0.5910355", "0.5901797", "0.5876962", "0.5855314", "0.58521634", "0.5803708", "0.57817703", "0.5762721", "0.57504636", "0.5726828", "0.5711957", "0.57052165", "0.57052165", "0.57011557", "0.569478...
0.68003654
0
finds issues in PR
def issues(self): if self.pull_request.body is not None: regex = r"(?<=closes: #|elated: #)\d{5}" issue_strs = re.findall(regex, self.pull_request.body) self.issue_nums = [eval(s) for s in issue_strs]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_list_issues(self):\n pass", "def get_issues(): # pragma: no cover\n global issue_data\n team = {\n 'stevex196x': 0,\n 'TheSchaft': 0,\n 'melxtru': 0,\n 'aylish19': 0,\n 'connormlewis': 0,\n 'tsukkisuki': 0\n }\n all_issues = 0\n whil...
[ "0.70138097", "0.6760061", "0.66123015", "0.66048265", "0.65544665", "0.6547893", "0.64266086", "0.63871706", "0.63705385", "0.6270671", "0.62466", "0.6183235", "0.61762655", "0.61605066", "0.61473805", "0.6101282", "0.60798544", "0.6076719", "0.6035414", "0.602907", "0.60161...
0.7080025
0
counts reactions to issue comments
def issue_reactions(self): if self.issue_nums: repo = self.g.get_repo("apache/airflow") for num in self.issue_nums: try: issue = repo.get_issue(num) except UnknownObjectException: continue for reactio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_num_reactions(comment_object: Dict[str, Any]) -> int:\n return comment_object.get('reactions', {}).get('total_count', 0)", "def test_issue_get_comment_reactions(self):\n pass", "def github_num_positive_reactions(comment_object: Dict[str, Any]) -> int:\n num_positive_reactions = 0\n p...
[ "0.76340306", "0.74687517", "0.7269382", "0.6970428", "0.6815051", "0.67963237", "0.6664741", "0.6631019", "0.65597695", "0.64880365", "0.6383443", "0.63385135", "0.6307957", "0.6293642", "0.6261808", "0.62437093", "0.619304", "0.618121", "0.6169378", "0.6130174", "0.6072496"...
0.7240344
3
Initiate a password reset with a complex token, multi step
def create_password_reset_token(self, user_id): try: self.logger.debug('Password Reset attempt %s', user_id) password_reset_token = '' nosqldb = self.pers.nosql_db db_user_record = nosqldb['users'].find_one( { '$or': [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_password_reset():", "def password_resetenter(request, uidb64=None, token=None):\n\n\tcontext_dict = {}\n\tif request.method == 'POST':\n\t\tassert uidb64 is not None and token is not None\n\t\tuid = urlsafe_base64_decode(uidb64)\n\t\tuser = models.Teacher.objects.get(\n\t\t\tsoft_delete=False, pk=uid...
[ "0.74162245", "0.70615184", "0.6827222", "0.6698908", "0.6595932", "0.6443836", "0.6400114", "0.63979876", "0.63826585", "0.63694924", "0.6352916", "0.63482845", "0.6347419", "0.6342296", "0.63396615", "0.63304526", "0.63268495", "0.6316747", "0.6214706", "0.6172585", "0.6138...
0.56647867
72