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
Compute the KL divergence KL[q || p] between q(x) = N(q_mu, q_sqrt^2) and p(x) = N(0, K) We assume N multiple independent distributions, given by the columns of q_mu and the last dimension of q_sqrt. Returns the sum of the divergences. q_mu is a matrix (M x N), each column contains a mean. q_sqrt can be a 3D tensor (M ...
def gauss_kl(q_mu, q_sqrt, K=None): #print(q_sqrt._tf_array) #q_sqrt = q_sqrt._tf_array #q_mu = q_mu._tf_array if K is None: white = True alpha = q_mu else: white = False Lp = tf.cholesky(K) alpha = tf.matrix_triangular_solve(Lp, q_mu, lower=True) if q_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl_divergence(self, params_q, params_p):\n means_q = params_q[:, :, 0]\n log_std_q = params_q[:, :, 1]\n\n means_p = params_p[:, :, 0]\n log_std_p = params_p[:, :, 1]\n\n std_q = torch.exp(log_std_q)\n std_p = torch.exp(log_std_p)\n\n kl_div = log_std_p - log_st...
[ "0.71765184", "0.7019512", "0.6987265", "0.69375336", "0.69356835", "0.6904298", "0.689787", "0.6729169", "0.6645247", "0.65512383", "0.6495925", "0.64693046", "0.6374325", "0.63563484", "0.6350259", "0.6266845", "0.6263321", "0.6241391", "0.62203217", "0.6207716", "0.6193783...
0.67699784
7
Testing if paths are constructed correctly
def test_paths(self): # minify and combine js_source = javascript_link('/deep/a.js', '/b.js', combined=True, minified=True) css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True) self.assert_('"/a.b.COMBINED.min.css"' in css_source) self.assert_('"/a....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_path_7(self):\n result = basic.verify_path(str(self.test_directory1), \"invalid\")\n self.assertFalse(result)", "def test__build_paths():\n files1 = [\"file1\", \"file2\"]\n userdefined_path = classifier_module.DATA_PATH + classifier_module.USER_DIR\n\n expected_out_files1 ...
[ "0.7151249", "0.71028125", "0.704526", "0.70197225", "0.69946885", "0.6940732", "0.68837845", "0.6856557", "0.68369985", "0.68248403", "0.6765043", "0.6747541", "0.67444754", "0.6742994", "0.6723944", "0.6718389", "0.67026347", "0.66905177", "0.6668439", "0.66664594", "0.6648...
0.0
-1
Testing for proper beaker kwargs usage
def test_beaker_kwargs(self): css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True) from fixtures import beaker_container self.assertEqual(beaker_container, beaker_kwargs) css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_020_kwargs(self):\n caller = self.get_caller([KwargsTaskOverride])\n self.assertEqual([\"A\", \"B\"], caller(\"A\", \"B\"))", "def test_kwargs(self):\n kwargs = forge.kwargs\n assert isinstance(kwargs, forge._signature.VarKeyword)\n assert kwargs.name == 'kwargs'\n ...
[ "0.7301403", "0.72157216", "0.69301623", "0.6644783", "0.65698075", "0.65681475", "0.65209633", "0.6470704", "0.6410706", "0.6393279", "0.6379091", "0.6320997", "0.6313386", "0.6237101", "0.6231931", "0.621528", "0.62060726", "0.6202357", "0.6099443", "0.6098508", "0.6097881"...
0.7554935
0
test that timestamp is really remembered
def test_timestamp(self): # apply real memoize to do proper testing minwebhelpers.beaker_cache = memoize css_source_1 = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True, timestamp=True) time.sleep(1) css_source_2 = stylesheet_link('/deep/a.css', '/b.css', co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isFresh(self, timestamp):\n pass;", "def __expired_timestamp(self, timestamp):\n return int(time.time()) > timestamp + self.__ttl", "def test_last_used(self, monkeypatch):\n monkeypatch.setenv('ENABLE_AUTO_EXPIRE', 'true')\n monkeypatch.setenv('INACTIVITY_AGE', '10')\n cr...
[ "0.7103609", "0.7088542", "0.6672816", "0.65801454", "0.64244413", "0.641137", "0.64082605", "0.63636667", "0.63623965", "0.6352042", "0.6347807", "0.6344862", "0.6342813", "0.6341419", "0.6334243", "0.6309578", "0.62998533", "0.62858075", "0.62832284", "0.6267803", "0.624547...
0.59452564
49
Call first_move() after good key was pressed. Good key will be saved in self.first_key
def wait_first_move(self): self.env.keyboard.listen_once(self.catch_key_first, key_down)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_move(self):\n self.play_sound(self.first_key)\n self.make_blink()\n self.wait_second_move()", "def key_handler(self, event):\n if event.type == pygame.KEYUP: \n self.done = True", "def wait_second_move(self):\n self.qr_unregister()\n self.env.ke...
[ "0.7691176", "0.69349104", "0.68719256", "0.68288636", "0.6766883", "0.6606569", "0.6452956", "0.63939595", "0.63457495", "0.6345322", "0.6335956", "0.63320196", "0.6313395", "0.6303774", "0.6273421", "0.6273016", "0.62193775", "0.6212796", "0.61779016", "0.616101", "0.615977...
0.7749387
0
Responses for first_key press.
def first_move(self): self.play_sound(self.first_key) self.make_blink() self.wait_second_move()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_first_move(self):\n self.env.keyboard.listen_once(self.catch_key_first, key_down)", "def keypress_callback():\n data = request.get_json()\n buttonid = data['buttonid']\n assert buttonid in pyautogui.KEYBOARD_KEYS, \"Unknown buttonid received\"\n pyautogui.press(buttonid)\n return j...
[ "0.65326923", "0.6267843", "0.62426716", "0.6083045", "0.6003534", "0.5993124", "0.59164053", "0.5813882", "0.5776835", "0.5767592", "0.57570904", "0.5756149", "0.5752199", "0.5737215", "0.5722572", "0.57125866", "0.5695015", "0.5670828", "0.56411684", "0.5629136", "0.5627699...
0.6002405
5
Call second_move() after good key was pressed. Good key will be saved in self.second_key
def wait_second_move(self): self.qr_unregister() self.env.keyboard.listen_once(self.catch_key_second, key_down)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_move(self):\n self.play_sound(self.second_key)\n self.end_move()", "def first_move(self):\n self.play_sound(self.first_key)\n self.make_blink()\n self.wait_second_move()", "def wait_first_move(self):\n self.env.keyboard.listen_once(self.catch_key_first, key_...
[ "0.7825597", "0.7296097", "0.7028338", "0.67003924", "0.66919225", "0.6691698", "0.65923977", "0.6526897", "0.6478581", "0.64533395", "0.6391608", "0.63787925", "0.63162094", "0.63137877", "0.62750816", "0.6266099", "0.62504405", "0.62090117", "0.6191794", "0.61795557", "0.61...
0.7450435
1
Responses for second_key press.
def second_move(self): self.play_sound(self.second_key) self.end_move()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_second_move(self):\n self.qr_unregister()\n self.env.keyboard.listen_once(self.catch_key_second, key_down)", "def goto_second():\n\tglobal c2\n\tglobal a2\n\tglobal BUF_SIZE\n\tglobal state\n\n\tmsg = c2.recv(BUF_SIZE) # wait for the taken off message\n\tprint a2, ' >> ', msg\n\tif msg != ...
[ "0.6041951", "0.58219993", "0.57078713", "0.567378", "0.55835176", "0.55665016", "0.55074126", "0.55048704", "0.5473432", "0.5445047", "0.5436347", "0.54057235", "0.5393213", "0.5380113", "0.53439146", "0.5318712", "0.5311537", "0.52885514", "0.5287942", "0.5277704", "0.52646...
0.63019663
0
Plot a histogram of the pnorms of the solutions
def plot_p_norm(p=2, bins=500): plt.title(f"{p}-norms of solutions for lattice point quaternion polynomials") plt.hist([sum(abs(x)**p for x in abcd)**(1/p) for abcd in solutions], bins=bins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_imag_p_norm(p=2, bins=500):\n plt.title(f\"{p}-norms of imaginary parts of solutions to polynomials with quaternion coefficients\")\n plt.hist([sum(abs(x) ** p for x in abcd[1:]) ** (1 / p) for abcd in solutions], bins=bins)", "def test_normal(self):\r\n s = np.random.normal(-0.42, 0.55, 50...
[ "0.765192", "0.68404233", "0.66037804", "0.65835", "0.6533649", "0.64928544", "0.6461779", "0.645999", "0.6441155", "0.6404364", "0.6345734", "0.6342641", "0.6324178", "0.63204044", "0.62690324", "0.62213695", "0.61868656", "0.6182514", "0.6176014", "0.61743295", "0.6171994",...
0.8222845
0
Plot a histogram of the pnorms of the imaginary parts of the solutions
def plot_imag_p_norm(p=2, bins=500): plt.title(f"{p}-norms of imaginary parts of solutions to polynomials with quaternion coefficients") plt.hist([sum(abs(x) ** p for x in abcd[1:]) ** (1 / p) for abcd in solutions], bins=bins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_p_norm(p=2, bins=500):\n plt.title(f\"{p}-norms of solutions for lattice point quaternion polynomials\")\n plt.hist([sum(abs(x)**p for x in abcd)**(1/p) for abcd in solutions], bins=bins)", "def show_histogram(im):\n\n if im.ndim == 2:\n # Input image is single channel\n ...
[ "0.777749", "0.6434252", "0.6400417", "0.62809926", "0.6274087", "0.62183875", "0.6199149", "0.61816305", "0.6179878", "0.6179878", "0.6179878", "0.61471015", "0.6140279", "0.6139242", "0.6112178", "0.6104909", "0.60622525", "0.60274523", "0.5973794", "0.59647155", "0.5960954...
0.83347857
0
First Python implementation method of the Levenshtein distance between strings
def levenshtein(s1, s2): if len(s1) < len(s2): return levenshtein(s2, s1) # len(s1) >= len(s2) if len(s2) == 0: return len(s1) previous_row = range(len(s2) + 1) for i, c1 in enumerate(s1): current_row = [i + 1] for j, c2 in enumerate(s2): insertions = pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levenshtein_distance(s1,s2):\n\n\t\tif len(s1) < len(s2):\n\t\t\treturn Searcher.levenshtein_distance(s2, s1)\n\n\t\t# len(s1) >= len(s2)\n\t\tif len(s2) == 0:\n\t\t\treturn len(s1)\n\n\t\tprevious_row = range(len(s2) + 1)\n\t\tfor i, c1 in enumerate(s1):\n\t\t\tcurrent_row = [i + 1]\n\t\t\tfor j, c2 in enumer...
[ "0.81522393", "0.79750335", "0.7954744", "0.7949555", "0.78139377", "0.7758564", "0.7698071", "0.7673589", "0.7605972", "0.7590628", "0.7568366", "0.7530191", "0.74639803", "0.7419249", "0.739178", "0.7367446", "0.7348473", "0.7338631", "0.73206055", "0.7319021", "0.7293537",...
0.80752313
1
Use Gensim package to find relation triplet similarities between Ntriplets based on wordmover distance.
def wmd_matrix( triplet_list: Iterable[dict], model: gensim.models.keyedvectors.Word2VecKeyedVectors) -> dict and Iterable[Iterable[float]]: # Concatenate subj-pred-obj into single sentence document, indexed triplets_idx = {idx: trip for idx, trip in enumerate(triplet_list)} triplets = {id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordNet_similarity(sentence1, sentence2):\r\n # Tokenize and tag\r\n \r\n # sentence1 = pos_tag(word_tokenize(sentence1))\r\n sentence1=st_tagger.tag(word_tokenize(sentence1))\r\n \r\n # sentence2 = pos_tag(word_tokenize(sentence2))\r\n sentence2=st_tagger.tag(word_tokenize(sentence2))\r\n...
[ "0.6340076", "0.60962826", "0.5978031", "0.589854", "0.57848215", "0.575694", "0.5731846", "0.5714283", "0.56484836", "0.56170404", "0.5613912", "0.5593854", "0.5553895", "0.55014926", "0.54705215", "0.53969795", "0.5396031", "0.53880775", "0.5378547", "0.5377828", "0.5369617...
0.0
-1
Leverage Pythonwrapper to Stanford CoreNLP Java engine for purpose of relationtriplet extractions.
def __init__(self): # Initialise class attributes (visibility ease) self.__corpus__ = None self.__pron_det_pos_words__ = None self.__triples_corpus__ = None self.__entities_in_doc__ = None self.__wvmodel__ = None # For purpose of parsing relation triplets...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseSentences(jobidsentences):\n\n jobid, docs, Config = jobidsentences\n\n #start stanford server, we need to find an open port through guessing\n maxtries = 12\n tries=0\n err=[]\n while tries <maxtries:\n try:\n np.random.seed()\n jobid = np.random.randint(0, ...
[ "0.5475957", "0.543991", "0.5417777", "0.537119", "0.53507733", "0.5336107", "0.52587", "0.52349573", "0.5205756", "0.51611793", "0.51351035", "0.51071185", "0.5032567", "0.50286174", "0.50137883", "0.499988", "0.49943662", "0.49602225", "0.4914728", "0.49007335", "0.4897188"...
0.50233644
14
It is reccommended that preprocessing has taken place before loading directly into object class in iterable format level to avoid inconsistencies due to document delimitation from the puctuations. Upon calling method `.fit()` on corpus, collection sets on entities and PoS will be identified to harmonise the extracted r...
def fit(self, corpus: Union[str, Iterable[str]], sent_delim: str='\.\s+|\r|\n', preferred_spacy_core: str='en_core_web_sm' ) -> None: # Initialise corpus if type(corpus) == str: self.__corpus__ = [sent+'.' if ('\.' in sent_delim and sent[-1] != '.') else sent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess(self):\n self.data['sentences'] = self.data['text'].apply(self._tokenize_sent)\n self.data['nouns'] = self.data['sentences'].apply(self._get_nouns)\n # self._get_frequent_features()\n # self._compactness_pruning()\n # self._redundancy_pruning()\n # self._ge...
[ "0.6566442", "0.64008427", "0.6272306", "0.6270147", "0.6244757", "0.62283623", "0.61422414", "0.6133686", "0.6117981", "0.6093613", "0.60885054", "0.60684276", "0.6040109", "0.60277957", "0.6005362", "0.59342384", "0.59225696", "0.59128237", "0.5904542", "0.58896387", "0.588...
0.64138544
1
Starts a java server powering CoreNLP backend to obtain triplets. Sentences (documents) will be joined with a `\s` to form a continuous string for purpose of triplettext annotation.
def extract_triplets(self) -> Iterable[dict]: stg_corpus = [txt.strip()+"." if txt.strip()[-1]!="." else txt.strip() for txt in self.__corpus__] stg_corpus = ' '.join(self.__corpus__) with StanfordOpenIE() as client: triples_corpus = client.annotate(stg_corpus) self.__tripl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, corenlp_path=CORENLP_PATH, memory=\"3g\", serving=False,\n annotators=[\"tokenize\", \"ssplit\", \"pos\", \"lemma\", \"ner\", \"parse\", \"dcoref\"], **kwargs):\n\n # spawn the server\n self.serving = serving\n self.corenlp_path = corenlp_path\n self.m...
[ "0.6039067", "0.58356154", "0.5720516", "0.5653867", "0.5537428", "0.5528703", "0.54213464", "0.54019606", "0.5283025", "0.5274211", "0.5274211", "0.5243562", "0.52289236", "0.5215304", "0.51969665", "0.5168834", "0.51489794", "0.51383555", "0.50998783", "0.5063674", "0.50617...
0.45885175
100
Parse relation triplets over the following conditions 1. Remove triplets with pronouns and determinants in subj/obj; i.e. "we", "she" "I", "their", etc. 2. Harmonise duplicated triplets, return only the superset triplet Semantic comparison option using word mover distance & agglomerative clustering FastText via Gensim ...
def parse_triplets(self, levenshtein_thold: float=20., coph_scr: float=2.) -> Iterable[dict]: # Remove pronoun and determiners parse_triples = [triple for triple in self.__triples_corpus__ if (triple['subject'] not in self.__pron_det_pos_words__ and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_data_from_input_file(triplet):\n\n sentence = triplet.subject + ' ' + triplet.predicate + ' ' + triplet.object\n doc = nlp(unicode(sentence))\n root = doc[0]\n for t in doc:\n if t.pos_ == 'VERB' and t.head == t:\n root = t\n # elif t.pos_ == 'NOUN'\n\n # also, i...
[ "0.61057407", "0.56719995", "0.55161005", "0.5455312", "0.5447199", "0.5435746", "0.5421998", "0.5421532", "0.53770727", "0.5327237", "0.53150713", "0.5306053", "0.52893126", "0.52765054", "0.52570033", "0.5234349", "0.5214712", "0.5208659", "0.5204619", "0.5195088", "0.51826...
0.61369044
0
iterate through all the columns of a dataframe and modify the data type to reduce memory usage.
def reduce_mem_usage(df): start_mem = df.memory_usage().sum() / 1024**2 print('Memory usage of dataframe is {:.2f} MB'.format(start_mem)) for col in df.columns: col_type = df[col].dtype if col_type != object: c_min = df[col].min() c_max = df[col].max() i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_memory_footprint(df):\n for col in df.columns:\n if df[col].dtypes == 'float64':\n df[col] = df[col].astype('float32')\n elif df[col].dtypes == 'int64':\n df[col] = df[col].astype('int32')\n \n return df", "def assign_column_types(self):\n type_list ...
[ "0.7273015", "0.7129629", "0.6986671", "0.6947576", "0.6945362", "0.6894538", "0.68647027", "0.684416", "0.6794204", "0.66469336", "0.6535974", "0.65137196", "0.6412989", "0.6380717", "0.6350639", "0.6318383", "0.62952274", "0.62595475", "0.6252028", "0.6232626", "0.6206035",...
0.5701764
55
Set defaul config to app
def configure_app(self, defaults: t.Optional[DefaultConfig]) -> None: self.config = Config(defaults)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_config(app):\n # set config from config.py\n app.config.from_object('config')\n\n # override config from secret conf files\n pi_home = os.path.dirname(app.config['ENVPATH']) # /home/pi\n secret_conf_dir = os.path.join(pi_home, 'CONFIG_CHAUDIERE') # /home/pi/CONFIG_...
[ "0.7135407", "0.6767803", "0.67038256", "0.6664277", "0.65583634", "0.6471732", "0.6440063", "0.64349705", "0.64288706", "0.63906646", "0.6379789", "0.63641423", "0.63625246", "0.6274701", "0.627201", "0.6265376", "0.6263423", "0.6263423", "0.62554973", "0.6252563", "0.624745...
0.7263818
0
A temporary method that puts the current class object into context
def init_context(self, obj: object) -> None: self.context = Context.init_curent_app_context(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, context):\n self.__context = context", "def __init__(self, context):\n self.__context = context", "def __init__(self):\n self._context = {}", "def context(self) -> Any:\n ...", "def context(self) -> CONTEXT:", "def context(self, context):\n self._context ...
[ "0.7450737", "0.70434624", "0.7007259", "0.6924677", "0.691949", "0.6833353", "0.6827452", "0.67908674", "0.6757111", "0.67294806", "0.67294806", "0.6697211", "0.66805935", "0.6665369", "0.6659875", "0.66362715", "0.66362715", "0.66362715", "0.66362715", "0.66362715", "0.6636...
0.62170887
37
Special decorator. Apends route to all routes list.
def route(self, path: str, **args: t.Any) -> t.Callable: def decorator(f: t.Callable) -> None: RouteMap.add_route(Route(path, f, args.get('methods', ['GET']))) return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_routes(self):\n pass", "def decorator(self, decorator: Route.Decorator):\n pass", "def routes(self, body):\n pass", "def add_route(app, *args):\n for route in args:\n app.router.add_route(route[0], route[1], route[2])", "def add_routes(self, mapper):\n pass", ...
[ "0.71331024", "0.6906696", "0.68637866", "0.6778305", "0.6636988", "0.661092", "0.65922093", "0.65910494", "0.6576909", "0.65327954", "0.6525126", "0.6481399", "0.64676505", "0.64033693", "0.63921976", "0.6354994", "0.6352109", "0.6248349", "0.6196869", "0.61872745", "0.61815...
0.68121827
3
Posts the product data into the ProductData Model.
def setUpClass(self): self.content_type = "application/json" self.product_payload = {"name": "Olive Oil"}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n data = request.json\n new_product = ProductModel(**data)\n new_product.save()\n response_object = {\n 'status': 'success',\n 'message': 'Product successfully created.',\n 'product_id': new_product.id\n }\n return response_...
[ "0.6956942", "0.6889219", "0.67746776", "0.6755537", "0.6738365", "0.65107906", "0.63893867", "0.6386395", "0.6373849", "0.61861396", "0.6185986", "0.61542445", "0.61542445", "0.6140429", "0.61243504", "0.6106736", "0.61011493", "0.6093553", "0.60679495", "0.6036408", "0.5984...
0.0
-1
SetUp method will be called before executing each test case. Validating with Post request by providing valid data
def setUp(self): # Request the Product Id by posting it response = self.client.post('/api/productsdata/', data=json.dumps(self.product_payload), content_type=self.content_type) # Checking the response self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.app = app\n self.client = self.app.test_client(self)\n self.app.testing = True\n self.order = mock_data['order']\n data = json.dumps(mock_data['admin'])\n response = self.client.post(\n 'api/v1/login', content_type=\"application/json\", d...
[ "0.7155883", "0.714143", "0.70978665", "0.705759", "0.7048931", "0.7033783", "0.70278466", "0.7015345", "0.6962825", "0.69618106", "0.6950066", "0.6931418", "0.6914347", "0.6913533", "0.68996364", "0.68958426", "0.68958426", "0.68958426", "0.68882835", "0.6876467", "0.6873621...
0.6510264
64
Resets the default values
def tearDownClass(self): self.product_id = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset(self):\n self._value = self._default", "def reset(self):\n self.data = self._defaults", "def reset(self):\r\n # TODO: have reset flag such that it forces all the bottom changes\r\n self.pwm_freq = self._default[\"pwm_freq\"]\r\n self.gate_logic = self._default[...
[ "0.8205602", "0.8185284", "0.8134978", "0.7798123", "0.77967864", "0.76986134", "0.7528179", "0.7445453", "0.73893666", "0.7374498", "0.7374498", "0.7374498", "0.7374498", "0.7344047", "0.7329444", "0.73153704", "0.73153704", "0.73153704", "0.7301515", "0.72893625", "0.728936...
0.0
-1
Validating ProductsDataViewSet by giving Invalid data
def test_ProductsDataViewSet_with_post_Invalid_data(self): payload = { "name": "1234" } # Request the data by API call. response = self.client.post('/api/productsdata/', data=json.dumps(payload), content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_dataset(self):\n pass", "def is_valid(self, dataset):\n pass", "def test_ProductsDataViewSet_with_get_request_Invalid_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(-1))\n\n # Checking the response\n ...
[ "0.6795187", "0.6527712", "0.62331474", "0.62078047", "0.6093575", "0.6072888", "0.5991253", "0.5977534", "0.59747654", "0.5947358", "0.5937604", "0.5932143", "0.59246784", "0.5910832", "0.58964", "0.5830329", "0.5815245", "0.5773554", "0.5771487", "0.57573295", "0.57554066",...
0.73469806
0
Validating ProductsDataViewSet using get request method
def test_ProductsDataViewSet_with_get_request(self): # Request the data by API call. response = self.client.get('/api/productsdata/') # Checking the response self.assertEqual(response.status_code, 200) self.assertEqual(response.json()['count'], 1) self.assertEqual(respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(\n self.product_id))\n\n # Checking the response\n self.assertEqual(response.status_code, 200)\n self.assertIsNotNone(r...
[ "0.7251704", "0.6607075", "0.6369387", "0.5741582", "0.5719708", "0.5598621", "0.55916286", "0.55769634", "0.5567388", "0.5546251", "0.55135393", "0.5474931", "0.5474357", "0.5402799", "0.5396396", "0.5390451", "0.5390293", "0.5374702", "0.5366535", "0.53604525", "0.5345702",...
0.7067096
1
Validating ProductsDataViewSet using get request method with Id
def test_ProductsDataViewSet_with_get_request_id(self): # Request the data by API call. response = self.client.get('/api/productsdata/{}/'.format( self.product_id)) # Checking the response self.assertEqual(response.status_code, 200) self.assertIsNotNone(response.json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_Invalid_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(-1))\n\n # Checking the response\n self.assertEqual(response.status_code, 404)\n self.assertEqual(response.json()['detail'...
[ "0.7191686", "0.673298", "0.59211195", "0.585185", "0.58161724", "0.5667275", "0.5570321", "0.5554077", "0.5522598", "0.5515945", "0.5448646", "0.5404771", "0.53977585", "0.53932184", "0.5391353", "0.53493273", "0.53440976", "0.5339966", "0.533051", "0.53057694", "0.5302475",...
0.7739606
0
Validating ProductsDataViewSet using get request method with Invalid Id
def test_ProductsDataViewSet_with_get_request_Invalid_id(self): # Request the data by API call. response = self.client.get('/api/productsdata/{}/'.format(-1)) # Checking the response self.assertEqual(response.status_code, 404) self.assertEqual(response.json()['detail'], 'Not fou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ProductsDataViewSet_with_get_request_id(self):\n # Request the data by API call.\n response = self.client.get('/api/productsdata/{}/'.format(\n self.product_id))\n\n # Checking the response\n self.assertEqual(response.status_code, 200)\n self.assertIsNotNone(r...
[ "0.73838174", "0.650162", "0.6430197", "0.6365987", "0.59624434", "0.5900515", "0.5785338", "0.5644582", "0.5601564", "0.55595815", "0.5494436", "0.5453852", "0.5401711", "0.5401711", "0.5401711", "0.53924847", "0.5382707", "0.537352", "0.5360401", "0.5338085", "0.53339374", ...
0.77829665
0
Map towers to 412 integer Examples >>> state([[1], [3], [5, 4], [2]]) 668 = 0 40 + 2 41 + 1 42 + 2 43 + 2 44
def state(towers): ret = 0 for i, row in enumerate(towers): for val in row: ret += i * 4**(val-1) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_to_locations(state: list) -> list:\n\n locations = []\n for i in range(0, 16):\n locations.append((0, 0))\n # Each tuple represents a location on the board as (row, column)\n\n \"\"\" \"locations\" keeps track of all fifteen numbers in the given state and the goal \n state. The ...
[ "0.5918972", "0.58628327", "0.5638546", "0.56378", "0.55551183", "0.55406606", "0.5532196", "0.5530488", "0.55285954", "0.5523649", "0.5497859", "0.54556745", "0.5416261", "0.5404722", "0.53601176", "0.53601176", "0.53426325", "0.53384787", "0.53346574", "0.53269804", "0.5321...
0.70966303
0
Compile a Keras model for training.
def compile_model(arch='unet', input_shape=(512, 512, 3), base_depth=64, lr=0.0001, optimizer='Adam', loss_func='binary_crossentropy', additional_metrics=[], verbose=False, **model_args): if arch == 'unet': model = vanilla_unet(input_shape=input_shape, base_depth=base_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model(self):\n self.model = Sequential()\n # print self.layers[0].identifier\n # print self.layers[0].parameters\n for layer in self.layers:\n # print layer.identifier\n # print layer.parameters\n self.model.add(layer.toKerasFn())\n\n\n ...
[ "0.75971025", "0.73542714", "0.7245603", "0.72389716", "0.7190872", "0.7189013", "0.7189013", "0.7041905", "0.70105064", "0.7008368", "0.6986616", "0.69407946", "0.69306886", "0.6893068", "0.6885908", "0.6857928", "0.6855142", "0.68523884", "0.68522537", "0.68383485", "0.6812...
0.6354171
71
Keras implementation of untrained TernausNet model architecture.
def ternausnetv1(input_shape=(512, 512, 3), base_depth=64): inputs = Input(input_shape) conv1 = Conv2D(base_depth, 3, activation='relu', padding='same')(inputs) pool1 = MaxPooling2D(pool_size=(2, 2))(conv1) conv2_1 = Conv2D(base_depth*2, 3, activation='relu', padding='same')(pool1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_model(self, inputs, is_training):\n with tf.variable_scope('ResNet50'):\n x = conv2d(inputs, 64, [7, 7], strides=[1, 2, 2, 1], name='conv1') # size 1/2\n x = bn(x, is_training)\n x = relu(x)\n x = max_pool(x, ksize=[1, 3, 3, 1], name='pool1') ...
[ "0.68659437", "0.6799533", "0.67096835", "0.65879214", "0.6583436", "0.6571797", "0.65467453", "0.6540808", "0.6535172", "0.6508968", "0.64964247", "0.64894855", "0.6482305", "0.6459471", "0.6444903", "0.6442067", "0.6426774", "0.64207906", "0.6405138", "0.6398822", "0.639816...
0.65226
9
Keras vanilla unet architecture implementation.
def vanilla_unet(input_shape=(512, 512, 3), base_depth=32, drop_rate=0, seed=1337): input = Input(input_shape) conv1 = Conv2D(base_depth, 3, activation='relu', padding='same')(input) bn1 = BatchNormalization()(conv1) drop1 = Dropout(drop_rate, seed=seed)(bn1) conv2 = Conv2D(base_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mobile_unet(\n inputs, \n depth=3,\n filters=64,\n out_channels=None,\n out_activation=None,\n kernel_initializer=None,\n dtype=None,\n name=None,\n seed=None,\n):\n\n name_scope = name\n if name_scope:\n name = lambda n: '{}/{}'.format(name_scope, n)\n else:\n name = lambda n: n\n kernel_in...
[ "0.7285625", "0.6758433", "0.66565907", "0.6478514", "0.6467221", "0.64668006", "0.6460222", "0.64068955", "0.63583106", "0.6349955", "0.62737465", "0.62671775", "0.62398577", "0.62321264", "0.62173873", "0.61882025", "0.6175658", "0.6164245", "0.6078906", "0.6075447", "0.606...
0.6500072
3
Builds a CoverMultiWaySearchTree of n nodes with all the currency codes in the standard
def build_tree(n=None) -> CoverMultiWaySearchTree: tree = CoverMultiWaySearchTree() codes = [currency.code for currency in cur] shuffle(codes) currencies = [Currency(code) for code in codes] if n is None: n = len(currencies) for currency in currencies[:n]: tree[currency._code] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree(n, d, name=defaultname):\n return build_tree_helper(1, n, 1, d, name)", "def build(n):\n if n not in memo:\n res = []\n if n % 2 != 0:\n for i in range(1, n - 1):\n left = i\n right = n - 1...
[ "0.5964563", "0.5795323", "0.5791167", "0.5771873", "0.55232745", "0.5508132", "0.5490907", "0.5467991", "0.5449655", "0.53897923", "0.53540474", "0.5349767", "0.53464985", "0.53308815", "0.5326568", "0.5323885", "0.5319227", "0.5293522", "0.5292058", "0.5261324", "0.52417105...
0.8640555
0
Find the number of items in nodes in range [a, b]
def get_number_of_useful_items(nodes, a: str, b: str) -> int: return sum(int(a <= item.key <= b) for node in nodes for item in node.elements)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f02_03_countElemBetween(l, a, b):\n return sum([a < x < b for x in l])", "def numberOfNodes(i):\n \n if (i == 1 or i == 2):\n i = RANGE\n else:\n i = i + RANGE\n return i", "def countNodes(epr):\n result = 1\n argLst = epr.args\n for arg in argLst:\n ...
[ "0.69374925", "0.6823391", "0.65383244", "0.6350672", "0.6334986", "0.6127555", "0.6124622", "0.6086067", "0.6057941", "0.6051697", "0.6039297", "0.5993141", "0.59556144", "0.59417903", "0.59389144", "0.5936251", "0.59148836", "0.5914569", "0.5904718", "0.5901973", "0.5877726...
0.8006855
0
Tries to compute the (k, c1, c2)cover of tree with the minimum number of nodes. It follows a greedylike approach.
def compute_cover(tree: CoverMultiWaySearchTree, k: int, c1: str, c2: str) -> Optional[Set[CoverMultiWaySearchTree.Position.Node]]: # Step 1: Find nodes useful for the (k, c1, c2)-cover nodes = tree.find_nodes_in_range(c1, c2) # Step 2: Count number of items in range [c1, c2] n = get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Trees__LCA_LowestCommonDenominator():\n # Python2 ported to Python3 via 2to3-3.7\n # URL:# URL:https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem\n '''\n class Node:\n def __init__(self,info): \n self.info = info \n self.left ...
[ "0.58355105", "0.5734315", "0.5723906", "0.56961703", "0.55900025", "0.55862707", "0.5409351", "0.53967494", "0.53904384", "0.53811276", "0.5372247", "0.53711116", "0.536589", "0.5354127", "0.53164554", "0.52926135", "0.529009", "0.5275919", "0.5232045", "0.52311265", "0.5228...
0.7809844
0
given 2d image, lidar and camera as well as the current scan message, localizes the pixel against the lidar data
def localize_pixel(img_pos,camera : Camera,lidar : Lidar, scan : LaserScan) -> tuple: # ---OBJ-- # x r1 /\ r2 x # / \ #cam_ray / \ average_ray # / \ # / \ # CAM ----> LID # # has to be 2d assert (img_pos.size == 2) cam_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localize(image):\n\n # Call the vision function in order to have the grid with the obstacle and the goal coordinate\n object_grid, occupancy_grid, world = vision(image)\n\n # Correction of the goal coordinate in order to fit the A* coordinate\n goal_x = object_grid[0][1]\n goal_y = WIDTH_G - o...
[ "0.5971704", "0.59564734", "0.5860076", "0.57806957", "0.57335377", "0.56992394", "0.5685931", "0.56329805", "0.5621531", "0.5617687", "0.5521019", "0.5454433", "0.54460114", "0.5421576", "0.5418019", "0.53956425", "0.5381104", "0.53777224", "0.53671235", "0.53640884", "0.534...
0.80712897
0
dataset should be an numpy array
def create_dataset(dataset,time_step=1): dataX,dataY=[],[] for i in range(len(dataset)-time_step): a=dataset[i:i+time_step] dataX.append(a) dataY.append(dataset[i+time_step]) return np.asarray(dataX),np.asarray(dataY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_data(path_dataset):\n\n X=np.array(pd.read_hdf(path_dataset))\n\n print('Data set shape:',np.shape(X))\n print('#####################################')\n \n return X", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def normalize_dataset(self):", "def test_...
[ "0.67377925", "0.66809493", "0.66608226", "0.66065985", "0.6585924", "0.6566672", "0.64988893", "0.6468879", "0.6449775", "0.63172317", "0.6311449", "0.6303254", "0.62615097", "0.6236997", "0.621917", "0.62086684", "0.6187008", "0.61858666", "0.6175827", "0.6150293", "0.61375...
0.6350002
9
Check that the response is cached.
def test_cache_page(self): content = self.unique() calls = [] def get(self, request, *args, **kwargs): calls.append(None) return http.HttpResponse(content) self.assertViewBehavior( {"get": get}, repeat=2, status_code=200, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def _check_cache(self):\n return os.path.exists(self._cache_key)", "def is_cacheable(...
[ "0.8405517", "0.7709429", "0.7438877", "0.74282634", "0.72732776", "0.7268804", "0.724536", "0.7205072", "0.7148417", "0.71081144", "0.70911866", "0.6916305", "0.686247", "0.686158", "0.6831019", "0.6830744", "0.675096", "0.67503", "0.6729999", "0.67271733", "0.6707089", "0...
0.6797344
16
Check that the response is not cached when the behavior is disabled.
def test_cache_page_disabled(self): content = self.unique() calls = [] def get(self, request, *args, **kwargs): calls.append(None) return http.HttpResponse(content) self.assertViewBehavior( {"cache_page": False, "get": get}, repeat=2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior(\n ...
[ "0.81057525", "0.76422733", "0.75728554", "0.7479882", "0.7288173", "0.7107524", "0.7067377", "0.7039522", "0.68838865", "0.6812274", "0.676797", "0.6756619", "0.6708938", "0.6700436", "0.6537605", "0.65188557", "0.65129423", "0.65013593", "0.64976686", "0.6464215", "0.645495...
0.7505479
3
Check that the default HTTP method name protection takes precedence.
def test_cache_page_precedence(self): self.assertViewBehavior( status_code=405)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _method_check(self, request, allowed=None):\n if allowed is None:\n allowed = []\n\n request_method = request.method.lower()\n allows = ','.join(map(str.upper, allowed))\n\n if request_method == \"options\":\n response = HttpResponse(allows)\n respon...
[ "0.7103364", "0.70686543", "0.70461714", "0.69518584", "0.68466485", "0.6784883", "0.6704716", "0.67026776", "0.66991746", "0.6694735", "0.66651976", "0.65623546", "0.65139705", "0.64794755", "0.64261013", "0.64012486", "0.63546383", "0.6338937", "0.6317658", "0.63083893", "0...
0.0
-1
Check that the defaults do not set any cache control headers on the response.
def test_defaults(self): content = self.unique() self.assertViewBehavior( {"get": content}, status_code=200, content=content, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def never_cache_preview(response):\n response.cache_control.max_age = 0\n response.cache...
[ "0.7360473", "0.7291879", "0.72360945", "0.7173469", "0.704552", "0.70238", "0.69512165", "0.68105143", "0.67153543", "0.6714631", "0.6711166", "0.6690023", "0.66247284", "0.6617076", "0.6613454", "0.6605222", "0.6562822", "0.6557137", "0.6548916", "0.6548916", "0.6537977", ...
0.6132521
68
Check that the public cache control header is set on the resopnse.
def test_public(self): content = self.unique() self.assertViewBehavior( {"cache_control_public": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "public"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surrogate_control(self):\n def on_update(surrogate_control):\n if not surrogate_control and \"surrogate-control\" in self.headers:\n del self.headers[\"surrogate-control\"]\n elif surrogate_control: # pragma: no cover\n self.headers[\"Surrogate-Contro...
[ "0.6707758", "0.6568386", "0.64592665", "0.6406012", "0.63427687", "0.6286725", "0.6247568", "0.6247568", "0.6219212", "0.61471593", "0.6057611", "0.59990674", "0.5977669", "0.5969899", "0.5969899", "0.5955601", "0.59221154", "0.5918134", "0.59029275", "0.589787", "0.5883854"...
0.6245776
8
Check that the private cache control header is set on the resopnse.
def test_private(self): content = self.unique() self.assertViewBehavior( {"cache_control_public": False, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "private"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def surrogate_control(self):\n def on_update(surrogate_control):\n if not su...
[ "0.66482395", "0.65089506", "0.63601464", "0.6351916", "0.6276832", "0.62689084", "0.6260363", "0.6110769", "0.6093864", "0.6089491", "0.6072236", "0.6028623", "0.59268093", "0.5891261", "0.5891261", "0.5782495", "0.5728541", "0.5728541", "0.57169425", "0.57111984", "0.570364...
0.63673204
2
Check that the no_cache cache control header is set on the resopnse.
def test_no_cache(self): content = self.unique() self.assertViewBehavior( {"cache_control_no_cache": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "no-cache"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def nocache(response):\n response.headers['Cache-Control'] = 'no-store, no-cache, m...
[ "0.7414972", "0.6805398", "0.67788416", "0.67497075", "0.6657216", "0.6639991", "0.6516709", "0.6489518", "0.6489176", "0.64887327", "0.644979", "0.6448329", "0.6426001", "0.63928515", "0.63785326", "0.6366645", "0.63470674", "0.63470674", "0.63428575", "0.6316757", "0.628442...
0.7025476
1
Check that the no_transform cache control header is set on the resopnse.
def test_no_transform(self): content = self.unique() self.assertViewBehavior( {"cache_control_no_transform": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "no-transform"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def test_not_modified_headers(self):\n\n def get_response(req):\n resp = sel...
[ "0.6575073", "0.62584645", "0.6253825", "0.61756957", "0.6135134", "0.61045665", "0.6085116", "0.6053426", "0.6017882", "0.58883804", "0.5885764", "0.5883365", "0.58609915", "0.58609915", "0.577764", "0.5760166", "0.57544553", "0.5737813", "0.5737813", "0.5734081", "0.5727316...
0.72058463
0
Check that the must_revalidate cache control header is set on the resopnse.
def test_must_revalidate(self): content = self.unique() self.assertViewBehavior( {"cache_control_must_revalidate": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "must-revalidate"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n if response else True)", "def has_cached(self,ourmod,etag=None):\n if \"If-Modified-Since\" in self.request.heade...
[ "0.70986366", "0.67210567", "0.6683338", "0.6584366", "0.6584366", "0.6293861", "0.62422216", "0.62041104", "0.6199004", "0.6124973", "0.6101025", "0.608115", "0.6053864", "0.60428745", "0.60428745", "0.6038889", "0.6029584", "0.6014237", "0.600515", "0.5989785", "0.59765875"...
0.7850928
0
Check that the proxy_revalidate cache control header is set on the response.
def test_proxy_revalidate(self): content = self.unique() self.assertViewBehavior( {"cache_control_proxy_revalidate": True, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "proxy-revalidate"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_must_revalidate(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"cache_control_must_revalidate\": True, \"get\": content},\n status_code=200,\n content=content,\n headers_exact={\"Cache-Control\": \"must-revalidate\"})", "def _may...
[ "0.72086537", "0.7039436", "0.6617241", "0.65517527", "0.6426039", "0.6425563", "0.6400477", "0.63885456", "0.63592887", "0.6339059", "0.6339059", "0.6319922", "0.6256228", "0.6244743", "0.62436944", "0.6205305", "0.6193491", "0.6190335", "0.6190335", "0.612926", "0.6054342",...
0.7780337
0
Check that the max_age cache control header is set on the resopnse.
def test_max_age(self): content = self.unique() self.assertViewBehavior( {"cache_control_max_age": 1, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "max-age=1"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_max_age_3600(self, sess):\r\n r = sess.get(self.url)\r\n assert self.cache.get(self.url) == r.raw\r\n\r\n # request that we don't want a new one unless\r\n r = sess.get(self.url, headers={'Cache-Control': 'max-age=3600'})\r\n assert r.from_cache is True\r\n\r\n ...
[ "0.72107726", "0.6873612", "0.68624157", "0.66889685", "0.6536094", "0.6532378", "0.6311946", "0.62280434", "0.6197227", "0.61068356", "0.61068356", "0.6103469", "0.60647094", "0.6050893", "0.5995915", "0.5928432", "0.58629507", "0.58624345", "0.5841793", "0.5827531", "0.5821...
0.7228714
0
Check that the s_maxage cache control header is set on the response.
def test_s_maxage(self): content = self.unique() self.assertViewBehavior( {"cache_control_s_maxage": 1, "get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "s-maxage=1"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_max_age(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"cache_control_max_age\": 1, \"get\": content},\n status_code=200,\n content=content,\n headers_exact={\"Cache-Control\": \"max-age=1\"})", "def test_client_max_age_3600(self...
[ "0.7056533", "0.69589156", "0.6764175", "0.6662597", "0.6601882", "0.6553718", "0.6453501", "0.640816", "0.6405672", "0.63611406", "0.63209236", "0.63209236", "0.63096035", "0.6251666", "0.6251313", "0.6150831", "0.6150831", "0.6129807", "0.6030514", "0.6019444", "0.60143363"...
0.71437556
0
Check that the behavior is disabled when cache_control is falsy.
def test_disabled(self): content = self.unique() self.assertViewBehavior({ "cache_control": False, "cache_control_public": True, "get": content}, status_code=200, content=content, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior(\n {\"never_cache\": False, \"get\": content},\n status_code=200,\n content=content,\n headers_exclude=\"Cache-Control\")", "def test_no_cache(self):\n content = self.uniq...
[ "0.6935497", "0.6439297", "0.6283687", "0.62281615", "0.62020856", "0.6143714", "0.61050105", "0.6087825", "0.59735376", "0.58653027", "0.57895696", "0.5783289", "0.5764132", "0.57436347", "0.57417667", "0.5730427", "0.5700605", "0.5676634", "0.5612492", "0.5606958", "0.55914...
0.70288587
0
Check that the default HTTP method name protection takes precedence and that no cache control headers are set on the response.
def test_precedence(self): self.assertViewBehavior( {"cache_control_public": True}, status_code=405, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_precedence(self):\n self.assertViewBehavior(\n status_code=405,\n headers_exclude=\"Cache-Control\")", "def test_cache_page_precedence(self):\n self.assertViewBehavior(\n status_code=405)", "def filter_request():\n if request.method not in ALLOWED_...
[ "0.7021219", "0.6748958", "0.65596247", "0.64970404", "0.6401734", "0.6361947", "0.6359896", "0.6333692", "0.6294945", "0.62907964", "0.626692", "0.6196885", "0.6187532", "0.6166396", "0.61391157", "0.6137009", "0.6135213", "0.6134873", "0.6127822", "0.6123319", "0.6056474", ...
0.7186979
0
Check that the defaults set the never cache control headers on the response.
def test_defaults(self): content = self.unique() self.assertViewBehavior( {"get": content}, status_code=200, content=content, headers_exact={"Cache-Control": "max-age=0"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_modified_headers(self):\n\n def get_response(req):\n resp = self.client.get(req.path_info)\n resp[\"Date\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Last-Modified\"] = \"Sat, 12 Feb 2011 17:35:44 GMT\"\n resp[\"Expires\"] = \"Sun, 13 Feb 2011 17:3...
[ "0.74749523", "0.730792", "0.72691476", "0.7204676", "0.7196334", "0.71114993", "0.70886433", "0.7050699", "0.70001507", "0.69911003", "0.69644284", "0.69644284", "0.68751776", "0.68522364", "0.6808271", "0.6753384", "0.67490506", "0.672789", "0.67168194", "0.66634655", "0.66...
0.64401513
65
Check that the behavior is disabled when never_cache is falsy.
def test_disabled(self): content = self.unique() self.assertViewBehavior( {"never_cache": False, "get": content}, status_code=200, content=content, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_disabled(self) -> bool:\n return True", "def test_disabled(self):\n content = self.unique()\n self.assertViewBehavior({\n \"cache_control\": False,\n \"cache_control_public\": True,\n \"get\": content},\n status_code=200,\n ...
[ "0.6629997", "0.6369304", "0.6163698", "0.6107162", "0.60885584", "0.60602385", "0.6041304", "0.60086805", "0.59680194", "0.5952674", "0.5931698", "0.5891131", "0.5890093", "0.5888327", "0.58407855", "0.58371407", "0.5833242", "0.58196545", "0.57784563", "0.57356924", "0.5717...
0.66546726
0
Check that the defualt HTTP method name protection takes precedence and that no cache control headers are set on the response.
def test_precedence(self): self.assertViewBehavior( status_code=405, headers_exclude="Cache-Control")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_precedence(self):\n self.assertViewBehavior(\n {\"cache_control_public\": True},\n status_code=405,\n headers_exclude=\"Cache-Control\")", "def test_cache_page_precedence(self):\n self.assertViewBehavior(\n status_code=405)", "def filter_reques...
[ "0.7131305", "0.6643577", "0.6529459", "0.6490842", "0.63628715", "0.6359141", "0.6331613", "0.62303495", "0.6216774", "0.62062776", "0.6205969", "0.619509", "0.6160482", "0.6113934", "0.6082911", "0.6071884", "0.6065874", "0.6062073", "0.6059281", "0.6055744", "0.6038644", ...
0.6926853
1
Gets the next expiration date for controller init
def get_expiration_date(): dt = datetime.now() bdays_indx = pd.bdate_range( dt.strftime("%Y-%m-%d"), (dt + timedelta(days=20)).strftime("%Y-%m-%d"), freq=pd.offsets.CustomBusinessDay(calendar=USFederalHolidayCalendar()), ).tolist() expiration = [x.strftime("%Y-%m-%d") for x in bd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_expiration_date(self):\n return self.expiration_date", "def new_token_expiry_date():\n\treturn timezone.now() + datetime.timedelta(days=TOKEN_VALID_DATE)", "def expireDate(self)->datetime:\n return self.firstAccessDate + timedelta(seconds=self.expirePeriodInSeconds)", "def default_expir...
[ "0.7094592", "0.7065402", "0.69285613", "0.69055295", "0.689841", "0.68810546", "0.673245", "0.6552515", "0.6523685", "0.6479755", "0.64234036", "0.63735986", "0.6339951", "0.63121927", "0.63121927", "0.62286556", "0.6214449", "0.62109494", "0.6199436", "0.6199257", "0.619664...
0.5652823
51
Gets the parameters of a controller's `__init__` signature. If required parameters are missing, we get the type and use a default value for it.
def get_parameters( controller_cls: BaseController, name: str, df_loaded: pd.DataFrame, symbol: str ) -> Dict[str, Any]: signature = inspect.signature(controller_cls) # type: ignore kwargs: Dict[str, Any] = {} for param in signature.parameters.values(): if param.name in ("ticker", "symbol", "c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_controller_parameters(self):\n pass", "def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:\n trainer_default_params = inspect.signature(cls).parameters\n name_type_default = []\n for arg in trainer_default_params:\n arg_type = trainer_default_params[arg].annotat...
[ "0.68228567", "0.6067612", "0.60517603", "0.5950492", "0.5941824", "0.59053797", "0.5816272", "0.57345223", "0.5695107", "0.5673528", "0.565494", "0.56521165", "0.56392384", "0.56297624", "0.5618912", "0.5572611", "0.5571474", "0.55582863", "0.5550893", "0.5530791", "0.551558...
0.58957845
6
Get parser information from source
def _get_parser(self, command: str) -> None: self.image_exportable[command] = False def mock_func(fparser: argparse.ArgumentParser, *args, **kwargs): """Mock function to get the parser""" allowed = [EXPORT_BOTH_RAW_DATA_AND_FIGURES, EXPORT_ONLY_FIGURES_ALLOWED] expor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_info(self,fname):\n\t\t# Has this source file already been parsed?\n\t\tif fname in self.src_info:\n\t\t\t# if yes return the previous parse-result\n\t\t\treturn self.src_info[fname]\n\t\t\n\t\t# Create a source file parse-info-container and ast-parse the sourcefile\n\t\tself.src_info[fname] = {}\n\t\ts...
[ "0.6904902", "0.6440271", "0.6395715", "0.6365495", "0.60317427", "0.6026721", "0.60110956", "0.60086006", "0.59582776", "0.5948747", "0.59301144", "0.5928795", "0.5908244", "0.5893313", "0.5880123", "0.5827625", "0.5825661", "0.5821086", "0.5819807", "0.57932854", "0.5792863...
0.0
-1
Mock function to get the parser
def mock_func(fparser: argparse.ArgumentParser, *args, **kwargs): allowed = [EXPORT_BOTH_RAW_DATA_AND_FIGURES, EXPORT_ONLY_FIGURES_ALLOWED] export = kwargs.get("export_allowed", NO_EXPORT) if export in allowed: self.image_exportable[command] = True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_parser_fcn(s):", "def mock_parser_fcn(s):\n return s", "def get_parser_test():\n copy.get_parser()", "def test_gen_parser(self):\n pass", "def test_parser_patch_______(parser):\n pass", "def test_basic_parsers():", "def test_simple_parse(self):\n pass", "def test_parse...
[ "0.84827256", "0.8188624", "0.7934197", "0.7360252", "0.7231253", "0.69312716", "0.68654865", "0.68405986", "0.6748091", "0.6636669", "0.66233593", "0.65562665", "0.65125597", "0.64893055", "0.6411233", "0.63841695", "0.6341068", "0.6321437", "0.63205254", "0.6290101", "0.627...
0.0
-1
Get all command parsers
def get_all_command_parsers(self) -> None: for command in self.commands: self.get_command_parser(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_parsers():\n return [OptimizerFactory.get_parser(optimizer) for optimizer in OptimizerFactory.optimizers]", "def get_parsers(self):\n return tuple([getattr(self, '_{}'.format(i)) for i in self.parsers_available])", "def list_parsers(self, *args):\n print('==== Available parsing...
[ "0.7812656", "0.76759416", "0.7401005", "0.715044", "0.68813735", "0.6622853", "0.65283746", "0.6448501", "0.63693243", "0.6357003", "0.63433", "0.629923", "0.62847006", "0.6254544", "0.6221769", "0.62131053", "0.61972797", "0.617932", "0.6152421", "0.6145008", "0.61301106", ...
0.8496855
0
Checks if controller has commands
def has_commands(self) -> bool: return len(self.commands) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commands(self):\n pass", "def check_commands(self):\n self.check_subsystem_commands()\n self._select_mode()", "def check_subsystem_commands(self):\n self.communications.check_controls()\n self.__check_video()\n self.__check_picture()\n self.__check_pin...
[ "0.78209513", "0.69910705", "0.6867466", "0.6849808", "0.6793685", "0.67325574", "0.6730906", "0.66486543", "0.65833414", "0.6539244", "0.65337753", "0.65301454", "0.65070695", "0.64574474", "0.6441197", "0.6439012", "0.643634", "0.6421861", "0.6406352", "0.6401896", "0.63948...
0.78347164
0
Gets all controllers modules
def _get_modules(self) -> Dict[str, ModuleType]: modules = {} terminal_path = Path(openbb_terminal.__file__).parent for file in terminal_path.glob("**/*controller.py"): spec = spec_from_file_location(file.stem, file) if spec is not None and spec.loader is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modules(self):\n return self._modules.values()", "def get_controllers(self):\n s = self._NDL_API('getcontrollers', {})\n return s.split(\",\")", "def modules(self):\n return self._modules.keys()", "def modules(self):\n return self._modules", "def init_controllers(self...
[ "0.6834421", "0.6675395", "0.6673012", "0.6617", "0.65380013", "0.65167725", "0.6488117", "0.635962", "0.62996364", "0.62916434", "0.6280447", "0.6221304", "0.62206507", "0.6197537", "0.61878586", "0.6163962", "0.61522275", "0.61329126", "0.6120377", "0.6109719", "0.610647", ...
0.6716505
1
Get the ControllerDoc instance for a controller
def get_controller_doc(self, controller_name: str) -> ControllerDoc: if controller_name not in self.controller_docs: raise KeyError(f"Controller {controller_name} not found") return self.controller_docs[controller_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_controller(self):\n return self.__controller", "def getController(self):\n return self.__controller", "def controller( self ):\n\t\ttry:\n\t\t\treturn self._controller\n\t\texcept Exception as e:\n\t\t\tself.logToConsole( \"controller: %s\" % str(e) )", "def get_controller(cls):\n i...
[ "0.741653", "0.7332534", "0.7241322", "0.7156778", "0.69970584", "0.67327803", "0.66837436", "0.6661715", "0.6410457", "0.6287942", "0.6268927", "0.62614125", "0.6155133", "0.59957176", "0.5957962", "0.59505653", "0.5928965", "0.58955836", "0.5859399", "0.58194286", "0.570986...
0.8244815
0
Create your Flask app here, with any configuration you need
def create_app(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l...
[ "0.8607028", "0.8580267", "0.84813267", "0.8429017", "0.8415944", "0.8400027", "0.83875513", "0.83820134", "0.8361291", "0.8326353", "0.8321436", "0.8311477", "0.83113503", "0.8264292", "0.82542884", "0.82488364", "0.82475644", "0.82314956", "0.82283074", "0.8227069", "0.8216...
0.0
-1
Does the required setup, doing it here means you don't have to call super.setUp in subclasses.
def __call__(self, result=None): self._pre_setup() super(TestCase, self).__call__(result) self._post_tearDown()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n BaseTest.setUp(self)", "def setUp(self):\n\n self._set_up()", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def setUp(self):\n super(BasicTestCase, self).setUp()", ...
[ "0.86375827", "0.84891623", "0.8426224", "0.83878005", "0.8345125", "0.8325611", "0.83032525", "0.82992846", "0.82351387", "0.82132673", "0.82132673", "0.8207163", "0.8206046", "0.81811917", "0.81789845", "0.8178328", "0.8178328", "0.813938", "0.813938", "0.81383854", "0.8138...
0.0
-1
Checks if a HTTP 404 returned e.g. resp = self.client.get("/") self.assert404(resp)
def assert404(self, response): self.assertTrue(response.status_code == 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertHttpNotFound(self, resp):\r\n return self.assertEqual(resp.status_code, 404)", "def assert404(self, response):\n self.assertEqual(response.status_code, 404)", "def test_404_not_found(self):\n response = self.client.get('/testPage404')\n self.assertEqual(response.status_cod...
[ "0.9120416", "0.8772316", "0.83236855", "0.8294703", "0.8184818", "0.8164809", "0.8145341", "0.8111421", "0.8110962", "0.81032133", "0.80804664", "0.80263186", "0.801481", "0.8005329", "0.79936945", "0.79776466", "0.7923277", "0.79124707", "0.77978474", "0.7754215", "0.772836...
0.8698492
2
Return n random Gaussian mixtures, each of length m.
def layers(n, m): def bump(a): x = 1 / (.1 + np.random.random()) y = 2 * np.random.random() - .5 z = 10 / (.1 + np.random.random()) for i in range(m): w = (i / float(m) - y) * z a[i] += x * np.exp(-w * w) a = np.zeros((m, n)) for i in range(n): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(mu1,cov,number_of_samples):\n samples = np.random.multivariate_normal(mu1, cov,number_of_samples)\n return samples", "def gen_mixture():\n npr.seed(0)\n num_exp = int(1e4)\n x_dim = 2\n z_dim = 2\n mu1 = [5, 5,]\n mu2 = [-5, -5]\n theta = np.array([[2,1],[-1,-2]])\...
[ "0.68880814", "0.6878117", "0.68643713", "0.6842355", "0.67705274", "0.67523295", "0.66760635", "0.6578122", "0.6500326", "0.6500326", "0.6487499", "0.646933", "0.6437274", "0.64274", "0.63682324", "0.63277197", "0.6299529", "0.62947476", "0.6261145", "0.62566286", "0.6222994...
0.0
-1
Delivers HTML for the index (search) page
def get(self): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search():\r\n return render_template(\"/home/search.html\")", "def index(self) -> HTMLBody:\n\t\treturn render_template(\"index.jinja2\")", "def index(self):\n\t\treturn render_template('index.html')", "def search_page():\n return render_template('page_query.html', search_label=g_search_type)", "...
[ "0.7677268", "0.73201054", "0.72925377", "0.7237074", "0.7205405", "0.7118157", "0.7075616", "0.7043515", "0.7043515", "0.7014733", "0.7010515", "0.70035577", "0.6989658", "0.6979827", "0.6978994", "0.69691384", "0.69691384", "0.6959514", "0.6951294", "0.6951294", "0.6951294"...
0.66266
98
Return the mongodb session document or None
def _get_mongo_session(self, sid): return self.coll.find_one({'sid': sid})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def find_session_by_id(id: int, mongo: MongoDB = mongodb) -> SessionOutModel:\n if session := await mongo.session_coll.find_one({\"id\": id}):\n return SessionOutModel(**session)\n else:\n return SessionOutModel()", "def document(self):\n query = {\"_id\": ObjectId(self.document_...
[ "0.68857235", "0.6614606", "0.6558535", "0.6487476", "0.64846057", "0.6472054", "0.6447504", "0.6445352", "0.6444354", "0.64425755", "0.64312917", "0.6427674", "0.6427674", "0.6384613", "0.63736564", "0.636652", "0.636652", "0.63567775", "0.62485236", "0.61746705", "0.6169451...
0.7997712
0
Find most similar restaurants to the given restaurant id.
def find_most_similar(topMatches, unique_ids, business_id_to_name, id1, destCity, contributing_words, k=15): topMatchesRow = topMatches[id1][destCity] # max_indices = np.argpartition(rel_row, -k)[-k:] # most_similar_scores_and_ids = [(rel_row[x], business_id_to_name[unique_ids[x]]) for x in max_indices] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knearest( self, restaurant_id, set_of_restaurants, k = 7, reg = 3.0 ):\t\t\n\t\tsimilar = []\t\t\n\t\tfor other_rest_id in set_of_restaurants:\n\t\t\tif other_rest_id != restaurant_id:\n\t\t\t\tsim, n_common = self.get( other_rest_id, restaurant_id )\n\t\t\t\tsim = self.shrunk_sim( sim = sim, n_common = n_comm...
[ "0.6971912", "0.61779565", "0.58842546", "0.5853193", "0.58256835", "0.5704557", "0.5649172", "0.55321133", "0.5525376", "0.5499993", "0.5454", "0.5446497", "0.543819", "0.53923166", "0.53886646", "0.5385439", "0.5318487", "0.5313097", "0.5302046", "0.52968377", "0.5293707", ...
0.516834
28
Constructor takes a function implementing
def __init__(self, target, size=1, disable_result=False, max_backlog=None): super(UnorderedStage, self).__init__(_Worker, size, disable_result, input_tube=TubeQ(maxsize=max_backlog) if max_backlog else None, task_fn=target...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n function: Callable):\n\n self._function = function", "def __init__(self, fn: callable):\n self.fn = fn", "def __init__(self, function, **kwargs):\n self.function = function\n self.kwargs = kwargs", "def __init__(self, function: Optional[Callabl...
[ "0.8293008", "0.81340635", "0.783096", "0.77749276", "0.77566177", "0.7748299", "0.7734389", "0.770646", "0.7631844", "0.75551623", "0.7547969", "0.75283885", "0.75283885", "0.7436056", "0.74256027", "0.74251497", "0.7334676", "0.72538793", "0.720251", "0.71191573", "0.711218...
0.0
-1
Used for users choice to abort execution
def user_exit(cls): cls.exit_program(ErrorCodes.E_USER_EXIT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abort(self):\n print(\"abort\")", "def aborting(self):\n \n pass", "def abort() -> NoReturn:\n raise AbortSignal", "def abort(self):\r\n LOG(\"Aborting execution\")\r\n self.controller.abort()", "def abort(self):\n raise NotImplementedError", "def Abort(self):...
[ "0.81656134", "0.80324596", "0.7812907", "0.7759768", "0.7715282", "0.75887483", "0.7499933", "0.7460148", "0.7410472", "0.7264979", "0.7194431", "0.7194431", "0.7194431", "0.7179388", "0.7179388", "0.7112557", "0.7080062", "0.7078822", "0.7020458", "0.701344", "0.701344", ...
0.0
-1
Useed when aborting in error
def error_exit(cls, error_code): cls.exit_program(error_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aborting(self):\n \n pass", "def abort(self):\n print(\"abort\")", "def abort(self):\n raise NotImplementedError", "def finalize_error():\n print('')\n exit(-1)", "def fatal(self, *args, **kwargs):", "def ERR(self):", "def failed(self):\n\t\tpass", "def handle_err(se...
[ "0.7865947", "0.72063535", "0.7203983", "0.71698415", "0.7069497", "0.6951282", "0.6933891", "0.69055516", "0.6844137", "0.681956", "0.6798855", "0.6763129", "0.6727556", "0.67188966", "0.66756785", "0.6650366", "0.663791", "0.65903723", "0.65489334", "0.6545612", "0.65073806...
0.0
-1
Helper method for standardizing exit routines
def exit_program(cls, return_code): print("Exiting due to: %s" % (ErrorMessages.verbose(return_code))) sys.exit(return_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exit(msg):\n __exit(msg)", "def finalize_error():\n print('')\n exit(-1)", "def __exit(self, *args):\n sys.exit(0)", "def exit(status=None): # real signature unknown; restored from __doc__\n pass", "def exit():\n sys.exit(1)", "def dummy_exit():\r\n def dummy_exit(_exitcode=...
[ "0.75113183", "0.73528576", "0.73165536", "0.72860515", "0.7231626", "0.707343", "0.7060248", "0.703285", "0.69615054", "0.693568", "0.6898283", "0.68836755", "0.68731815", "0.6870767", "0.6852176", "0.6847975", "0.68277407", "0.6815739", "0.6809839", "0.6800383", "0.67857563...
0.64677787
55
Returns array of all symbols that IEX Cloud supports for API calls
def get_symbols(**kwargs): return Symbols(**kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_iex_symbols(**kwargs):\n return IEXSymbols(**kwargs).fetch()", "async def get_symbols(self):\n uri = \"/v3/spot/symbols\"\n success, error = await self.request(\"GET\", uri)\n return success, error", "def get_tickers_IEX():\n iex_token = os.getenv(\"IEX_TOKEN\")\n \n if...
[ "0.7311484", "0.69377726", "0.684967", "0.68196577", "0.6682733", "0.66792375", "0.6649474", "0.663225", "0.6602125", "0.62015605", "0.6174994", "0.617182", "0.6117978", "0.61011267", "0.6100854", "0.6094222", "0.6056894", "0.6051363", "0.60039604", "0.59178466", "0.59129816"...
0.64378136
9
Returns array of all symbols the Investor's Exchange supports for trading
def get_iex_symbols(**kwargs): return IEXSymbols(**kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_symbols(self):\n return self._call_txtrader_api('query_symbols', {'data': False})", "def getSymbols(self):\n return self.alpha.getSymbols()", "def query_all_symbols(self):\n return self._call_txtrader_api('query_symbols', {'data': True})", "def get_instrument_symbols(self):\n\n...
[ "0.6964469", "0.6938037", "0.6910915", "0.6800684", "0.64778215", "0.6415556", "0.6412698", "0.6327654", "0.6232211", "0.6206617", "0.6046996", "0.5954076", "0.59358066", "0.58985454", "0.58625966", "0.58343506", "0.58019054", "0.5789877", "0.57768756", "0.5752643", "0.572558...
0.608002
10
Returns IEX Corporate Actions from the refdata endpoints
def get_iex_corporate_actions(start=None, **kwargs): return CorporateActions(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions(self) -> List[str]:\n return list(self.__endpoints.keys())", "def _get_cloud_functions_actions(self, namespace_id):\n\n res = requests.get(\n f\"{self.cf_namespaces_url}/{namespace_id}/actions?limit=200\",\n headers=self.get_headers(),\n )\n return js...
[ "0.578277", "0.5591671", "0.55305415", "0.546881", "0.5408633", "0.5356158", "0.5350876", "0.53415024", "0.53084", "0.5253717", "0.5253717", "0.5253717", "0.5253487", "0.524838", "0.52430826", "0.52192104", "0.51942307", "0.51654327", "0.51577294", "0.51444995", "0.5118404", ...
0.6782529
0
Returns IEX Dividends from the refdata endpoints
def get_iex_dividends(start=None, **kwargs): return Dividends(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_endpoints(self):\n endpoints = []\n\n # Get the far end of the last path segment\n path, split_ends, position_stack = self.trace()\n endpoint = path[-1][2]\n if split_ends is not None:\n for termination in split_ends:\n endpoints.extend(term...
[ "0.57260317", "0.570597", "0.5704981", "0.5656375", "0.5609971", "0.542474", "0.5416715", "0.54091465", "0.5392832", "0.53809077", "0.5363819", "0.53049743", "0.52954215", "0.5283466", "0.5228727", "0.52135223", "0.51494527", "0.5141439", "0.51192796", "0.5101566", "0.5099677...
0.60407233
0
Returns IEX Next Day Ex Date from the refdata endpoints
def get_iex_next_day_ex_date(start=None, **kwargs): return NextDay(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_day(self):\n pass", "def next_day(isotext):\n as_arrow = arrow.get(isotext)\n return as_arrow.replace(days=+1).isoformat()", "def next_day(isotext):\n as_arrow = arrow.get(isotext)\n return as_arrow.replace(days=+1).isoformat()", "def _get_date(self, relative_idx):\r\n ...
[ "0.6659892", "0.6455671", "0.6455671", "0.5981699", "0.57411253", "0.56931394", "0.5636958", "0.5636958", "0.562946", "0.55402404", "0.5531359", "0.5511678", "0.54665154", "0.5407168", "0.538642", "0.5366092", "0.5354358", "0.5353504", "0.5346452", "0.53019017", "0.5287904", ...
0.71448374
0
Returns IEX Listed Symbol Directory from the refdata endpoints
def get_iex_listed_symbol_dir(start=None, **kwargs): return ListedSymbolDir(start=start, **kwargs).fetch()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_entries(self):", "async def Available_Endpoints() -> List[Dict[str, str]]:\n return [{\"path\": endpoint} for endpoint in busylightapi.endpoints]", "def uri(self) -> list:\n raise NotImplementedError(\"ErddapArgoDataFetcher.uri not implemented\")", "def build_filelist(basepath):\n log.i...
[ "0.52443194", "0.52027243", "0.51738554", "0.50811166", "0.507001", "0.5039871", "0.5038013", "0.5036818", "0.5025535", "0.5022163", "0.5022163", "0.4984427", "0.4979942", "0.49156174", "0.48973256", "0.48810825", "0.48625612", "0.48537242", "0.48472953", "0.48335177", "0.483...
0.67579544
0
Stores the start or end time depending on which call. Prints the execution time.
def mark(self, message=''): if message not in self.start: self.start[message] = -1 self.end[message] = -1 if self.start[message] is -1: self.start[message] = timer() else: if self.end[message] is -1: self.end[message] = time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_execution_time(self):\n self.execution_time = self.end_time - self.start_time\n\n print('\\n')\n self.message('**[OPERATION COMPLETE]**********************************************************************')\n if self.arg_data:\n self.message(' Execution Time: {} ms'.fo...
[ "0.7140009", "0.69303364", "0.68803954", "0.6845913", "0.6787339", "0.67645544", "0.67532915", "0.67017174", "0.6616614", "0.6606172", "0.6602709", "0.6592854", "0.6588501", "0.65421814", "0.6496357", "0.64860296", "0.6475452", "0.64733225", "0.64631885", "0.6398203", "0.6392...
0.0
-1
Converts a string into a returned boolean.
def string_to_bool(arg): if arg.lower() == 'true': arg = True elif arg.lower() == 'false': arg = False else: raise ValueError('ValueError: Argument must be either "true" or "false".') return arg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toBool( string ):\r\n return string == 'true'", "def __str_to_bool(self, s):\n if s == 'True':\n return True\n elif s == 'False':\n return False\n else:\n raise ValueError", "def strToBool(s):\n\tassert type(s) == str or type(s) == unicode\n\treturn ...
[ "0.84717965", "0.84081817", "0.82726616", "0.8180654", "0.8157958", "0.81277066", "0.81115925", "0.8042077", "0.8028196", "0.8024185", "0.80018777", "0.7945584", "0.7944686", "0.79419595", "0.79260886", "0.792579", "0.7923662", "0.7874771", "0.78647715", "0.7845575", "0.78369...
0.7726734
27
Configures CUDA environment variable and returns tensorflow GPU config.
def set_gpu(gpu): os.environ['CUDA_VISIBLE_DEVICES'] = gpu tf_config = tf.ConfigProto() tf_config.gpu_options.allow_growth = True return tf_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_gpu_tf():\n\n try:\n # locate available devices & set required environment variables\n available_device_ids = GPUtil.getFirstAvailable(order='first', maxLoad=0.7, maxMemory=0.7, attempts=1, interval=10)\n available_device_id = available_device_ids[0]\n os.environ['CUDA_...
[ "0.7806248", "0.71696466", "0.7148312", "0.7142579", "0.69135433", "0.686044", "0.6859421", "0.6798698", "0.6659943", "0.66523975", "0.6578853", "0.64233935", "0.6382924", "0.63151455", "0.62676334", "0.6249967", "0.6245296", "0.620838", "0.6173646", "0.6164236", "0.61608374"...
0.78912264
0
Initializes params dictionary to be used in most functions.
def set_parameters(api_name='', targeted_flag='true', tv_flag='false', hinge_flag='true', cos_flag='false', interpolation='bilinear', model_type='large', loss_type='triplet', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_params(self, params):\n pass", "def init_params(self):\n blah", "def getInitParams(self):\n paramDict = super().getInitParams()\n paramDict['workingDir'] = self.workingDir\n paramDict['dataFilename'] = self.dataFilename\n paramDict['functionID'] = self.functionID\n param...
[ "0.84140587", "0.8211438", "0.767338", "0.7606534", "0.757486", "0.75057864", "0.7484527", "0.7381143", "0.7344505", "0.7301356", "0.72852105", "0.7271599", "0.7269397", "0.72342885", "0.7229577", "0.71677095", "0.7143791", "0.7110839", "0.70676434", "0.70676434", "0.70661026...
0.0
-1
gets the event_id to be used for updating the NR history
def _get_next_event_id(oracle_cursor, transaction_type): # -> (int) oracle_cursor.execute("""select event_seq.NEXTVAL from dual""") row = oracle_cursor.fetchone() event_id = int(row[0]) oracle_cursor.execute(""" INSERT INTO event (event_id, event_type_cd, event_timestamp) VALUES (:event_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_id(self):\n return self._event_id", "def id(self) -> str:\n return self._event.get('id')", "def _get_next_event_id():\n VenueCrawler._event_id += 1\n return VenueCrawler._event_id", "def GetEventIdentifier(self):\n return self._event_identifier", "def getUniqueID(ev...
[ "0.7380551", "0.6994781", "0.69346756", "0.6788159", "0.67672545", "0.6624493", "0.6550354", "0.6521109", "0.65177155", "0.6485925", "0.6348875", "0.6325851", "0.6303582", "0.62975746", "0.6296188", "0.62841356", "0.6223792", "0.6218612", "0.61961144", "0.6065413", "0.6057378...
0.5865381
29
find the current name instance, set it's end_event_id to event_id if the name was deleted, nothing more needs to be done. otherwise, create a new name_instance and set its start_event_id to event_id
def _consume_nro_names(oracle_cursor, nr, event_id, corp_num): for name in nr.names: oracle_cursor.execute(""" SELECT ni.name_instance_id, ni.name_id FROM name_instance ni LEFT OUTER JOIN name nm ON nm.name_id = ni.name_id WHERE nm.request_id = :request_id AND ni.cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_instance_name(self, name):\n self.__instance_name = name", "def __assign_name_id(self):\n if not self.name_id:\n self.name_id = str(BaseTicketing.objects.create())", "def find_or_add_event(name, owner, **kwargs):\n res = Event.objects.filter(event_name=name)\n if res.exi...
[ "0.57359993", "0.55851823", "0.5272143", "0.5252561", "0.5185405", "0.50811505", "0.5004009", "0.49299312", "0.49113548", "0.49069375", "0.4889691", "0.48329812", "0.48328593", "0.4809183", "0.4782595", "0.47754022", "0.4768552", "0.47577935", "0.47520742", "0.47374955", "0.4...
0.47233048
21
Create baseline convolutional recurrent model. Arguments
def create_baseline_model(filters, gru_units, dropout, bias, mels, nb_classes): inp = Input(shape=(259, mels, 1)) x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=bias)(inp) x = MaxPooling2D(pool_size=(1,5))(x) x = Conv2D(filters, (3,3), padding='same', activation='relu', use_bias=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_baseline(cls: Type['ResNet'], *, d_in: int, n_blocks: int, d_main: int, d_hidden: int, dropout_first: float, dropout_second: float, d_out: int) ->'ResNet':\n return cls(d_in=d_in, n_blocks=n_blocks, d_main=d_main, d_hidden=d_hidden, dropout_first=dropout_first, dropout_second=dropout_second, normal...
[ "0.647522", "0.6304403", "0.6284953", "0.6194349", "0.60414153", "0.5895362", "0.587735", "0.58602476", "0.58557093", "0.5830293", "0.5820108", "0.5811813", "0.5765692", "0.576528", "0.5761624", "0.57612926", "0.5757742", "0.5744773", "0.573896", "0.57358533", "0.573499", "...
0.64495075
1
Create save folder and return the path. Arguments
def save_folder(date_time, sfid, logs_folder, checkpoints_folder): date_now = str(date_time.date()) time_now = str(date_time.time()) sf = "saved_models/" + date_now + "_" + time_now + "_" \ + os.path.basename(__file__).split('.')[0] + '_' + sfid if not os.path.isdir(sf): os.makedirs(sf) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_save_folder(self):\n absolute_output = os.path.abspath(self.output).replace(\"\\\\\", \"/\")\n if self.paddle_length_factor is not None:\n self.save_folder = f\"{absolute_output}/{self.env_name}/PaddleLength_\" \\\n f\"{self.paddle_length_factor}/se...
[ "0.7928659", "0.7695204", "0.76085055", "0.7281233", "0.71740186", "0.7165479", "0.70561624", "0.6956532", "0.6895045", "0.68900746", "0.683801", "0.68368167", "0.6809364", "0.6801099", "0.6799192", "0.67921394", "0.6790769", "0.6772145", "0.67521167", "0.67416507", "0.672368...
0.75882685
3
Saves model and history file. Arguments
def save_model(save_folder): model.save(save_folder + '/savedmodel' + '.h5') with open(save_folder +'/history.pickle', 'wb') as f_save: pickle.dump(model_fit.history, f_save)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, filename):\r\n pass", "def save_model(model, model_filepath):", "def save(path_to_model):\n pass", "def save_model(self, model_path: str):", "def do_save(self, arg):\n try:\n args = self.saveparser.parseString(arg)\n except pyparsing.ParseException:\n...
[ "0.78629273", "0.7653769", "0.73715615", "0.7215964", "0.7110899", "0.70959747", "0.7047263", "0.7046574", "0.7008128", "0.70005685", "0.6987576", "0.6981723", "0.6968098", "0.6932804", "0.69116753", "0.6904762", "0.68979573", "0.68828714", "0.68811744", "0.68712103", "0.6836...
0.6840933
20
Plot the accuracy during training for the train and val datasets. Arguments
def plot_accuracy(model_fit, save_folder): train_acc = model_fit.history['binary_accuracy'] val_acc = model_fit.history['val_binary_accuracy'] epoch_axis = np.arange(1, len(train_acc) + 1) plt.title('Train vs Validation Accuracy') plt.plot(epoch_axis, train_acc, 'b', label='Train Acc') plt.plot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_accuracy(self):\n plot_title, img_title = self.prep_titles(\"\")\n test_legend = ['training data', 'test data']\n\n # Data for plotting x- and y-axis\n x = np.arange(1, CFG.EPOCHS + 1)\n y = [self.tr_accuracy, self.test_accuracy]\n\n # prints x and y-axis values\n...
[ "0.82207394", "0.7538035", "0.7494659", "0.74623656", "0.7418454", "0.7315145", "0.72615117", "0.72388804", "0.7238736", "0.71817374", "0.7173168", "0.71567535", "0.7148802", "0.71439624", "0.7055238", "0.70549214", "0.7051441", "0.7018947", "0.70176554", "0.70033777", "0.700...
0.7705123
1
Plot the loss during training for the train and val datasets. Arguments
def plot_loss(model_fit, save_folder): train_loss = model_fit.history['loss'] val_loss = model_fit.history['val_loss'] epoch_axis = np.arange(1, len(train_loss) + 1) plt.title('Train vs Validation Loss') plt.plot(epoch_axis, train_loss, 'b', label='Train Loss') plt.plot(epoch_axis, val_loss,'r'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loss_plot(train_loss, val_loss, filename):\n\tplt.plot(train_loss)\n\tplt.plot(val_loss)\n\tplt.ylabel('Loss')\n\tplt.xlabel('Epochs')\n\tplt.legend(['Train', 'Val'], loc='upper right')\n\tplt.savefig(filename)\n\tplt.close()", "def plot_loss():\n df = pd.read_csv('data/loss.csv', encoding='utf-8')\n l...
[ "0.81466526", "0.80646133", "0.80406374", "0.79073626", "0.7877066", "0.78295696", "0.77334934", "0.7585977", "0.7578295", "0.7422468", "0.735688", "0.73400354", "0.72983456", "0.7278823", "0.7261395", "0.72606814", "0.72324854", "0.71921957", "0.71786606", "0.71336514", "0.7...
0.75181407
9
Plot and save the ROC with AUC value. Arguments
def plot_ROC(model, x_test, y_test, save_folder): predicted = model.predict(x_test).ravel() actual = y_test.ravel() fpr, tpr, thresholds = roc_curve(actual, predicted, pos_label=None) roc_auc = auc(fpr, tpr) plt.title('Test ROC AUC') plt.plot(fpr, tpr, 'b', label='AUC = %0.3f' % roc_auc) pl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_roc(X,y,test_preds,fname=\"res/roc.png\"):\n\t#Retrieve multiple fpr and tpr values for different thresholds\n\tfpr, tpr, thresholds = roc_curve(y,test_preds)\n\tplt.plot(fpr, tpr)\n\tplt.title(auc(fpr, tpr))\n\tplt.savefig(fname, bbox_inches='tight')\n\tplt.close()", "def plot_roc_acc(self,x_test,y_tes...
[ "0.7867306", "0.7626776", "0.732372", "0.7319301", "0.73173314", "0.7298921", "0.7294701", "0.7286847", "0.71924317", "0.71809953", "0.71744895", "0.7162829", "0.71388173", "0.712525", "0.70957816", "0.7076601", "0.70679814", "0.70641404", "0.706279", "0.69863737", "0.6980341...
0.78781956
0
Calculate the TPR, TNR, FPR, FNR and F1 score. Arguments
def metrics(x, y, save_folder, threshold, ds_name): predicted = model.predict(x) predicted[predicted > threshold] = 1 predicted[predicted <= threshold] = 0 actual = y TP = np.sum(np.logical_and(predicted == 1, actual == 1)) FN = np.sum(np.logical_and(predicted == 0, actual == 1)) TN = np.sum...
{ "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.6962998", "0.6783924", "0.6656604", "0.6580796", "0.6549494", "0.6458977", "0.64446396", "0.6435898", "0.64287984", "0.64278877", "0.6422356", "0.64145064", "0.6384937", "0.6361993", "0.6317291", "0.6312312", "0.6308689", "0.62624353", "0.6238393", "0.6236581", "0.62225837...
0.0
-1
Saves the network architecture as a .txt file. Arguments
def save_arch(model, save_folder): with open(save_folder + '/architecture.txt','w') as a_save: model.summary(print_fn=lambda x: a_save.write(x + '\n'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, path=\"\"):\n path = path + \"model_\" + str(self.name) + \".txt\"\n if os.path.isfile(path):\n os.remove(path)\n f = open(path, \"w+\")\n for ident in self.networks:\n f.write(ident + \"_\" + self.networks[ident].descriptor.codify_components() + \"_...
[ "0.7442755", "0.6993565", "0.69844145", "0.69380265", "0.69357723", "0.6913174", "0.6849668", "0.6798643", "0.66806936", "0.65847754", "0.6535876", "0.6521386", "0.64706856", "0.6424189", "0.6404124", "0.6398808", "0.63774717", "0.6374491", "0.6335782", "0.6327243", "0.629258...
0.7138623
1
Reformat data into a suitable format. Arguments
def reformat(dataset): x = dataset[:, 1] x = np.stack(x) # reshape to (n, mel bands, timesteps) x = np.expand_dims(np.moveaxis(x, 1, -1), axis=3) # reformat x to (n, timesteps, mel bands, 1) y = dataset[:, 2] y = np.moveaxis(np.stack(y), 1, -1) # reformat y to (n, timesteps, 8) return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(self, data):", "def format(self, data):", "def _normalize(self, data):\n norm_data = []\n\n for row in data:\n norm_row = []\n\n for column in row:\n # custom format strings for specific objects\n if isinstance(column, float):\n ...
[ "0.7618255", "0.7096688", "0.6632938", "0.6506588", "0.6437094", "0.63554853", "0.6353619", "0.63322175", "0.6280301", "0.6274984", "0.626859", "0.626859", "0.6263245", "0.624401", "0.62409395", "0.61382896", "0.61014044", "0.6049214", "0.60481143", "0.6002033", "0.5962946", ...
0.56401306
40
Find scaling value. Arguments
def scale(original_train, new_train): # find magnitude original training data o_mag = np.linalg.norm(np.stack(original_train[:,1])) # find magnitude new data n_mag = np.linalg.norm(np.stack(new_train[:,1])) # scale new data scale = o_mag / n_mag return scale
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetScale(self):\n ...", "def get_scale():\r\n\r\n \r\n return 0.5", "def scale(self):\n return self.distribution.scale", "def FindScale(self):\n\n ## 6 and from the cv code the distance is 6 then we are good\n print(\"TODO: Very hard\")", "def get_scaled_value(self, value)...
[ "0.7423413", "0.73347855", "0.73237866", "0.73164004", "0.7237661", "0.71535647", "0.71269476", "0.70387477", "0.7011061", "0.7011061", "0.6986615", "0.6979968", "0.6975686", "0.695767", "0.69401443", "0.69075817", "0.68978745", "0.6861623", "0.68483704", "0.6829874", "0.6802...
0.0
-1
Computes the outcome of a single key by applying thresholding.
def _thresholding(qc_value, thresholds=None): MAX_BOUND, MIN_BOUND = (1, 0) if not thresholds: thresholds = TaskQC.criteria['default'].copy() if qc_value is None or np.isnan(qc_value): return int(-1) elif (qc_value > MAX_BOUND) or (qc_value < MIN_BOUND): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_thresholding(x):\n return x > threshold_otsu(x)", "def global_threshold(img, threshold_method):\n pass", "def binary_predict(probs, threshold = 0.5):\n return (probs >= threshold) * np.ones(len(probs))", "def get_predict(prediction, threshold):\n\n prediction[prediction < threshold] = 0\n...
[ "0.6783998", "0.67353284", "0.63087225", "0.6274074", "0.61894006", "0.61030537", "0.61008376", "0.60762995", "0.6047671", "0.60170645", "0.59696436", "0.59311014", "0.5793961", "0.57806987", "0.57802975", "0.57697934", "0.5745665", "0.5731439", "0.5718352", "0.5692189", "0.5...
0.0
-1
Extract the data from raw data files Extracts all the required task data from the raw data files.
def load_data(self, bpod_only=False, download_data=True): self.extractor = TaskQCExtractor( self.session_path, one=self.one, download_data=download_data, bpod_only=bpod_only)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract(self):\r\n self._data = []\r\n for fname in self.files:\r\n meta = dict(filename=fname)\r\n\r\n # Perform the actual metadata extraction\r\n fname = os.path.splitext(self.filter_filename(fname))[0]\r\n values = fname.split(self.sep)\r\n\r\n ...
[ "0.6336488", "0.6332432", "0.62876016", "0.61459774", "0.6088567", "0.60835356", "0.60774356", "0.6022968", "0.59951735", "0.59720063", "0.5907739", "0.59039", "0.5902059", "0.5858731", "0.5857515", "0.5839464", "0.58262634", "0.5805191", "0.58041966", "0.57704633", "0.576746...
0.0
-1
Compute and store the QC metrics Runs the QC on the session and stores a map of the metrics for each datapoint for each test, and a map of which datapoints passed for each test
def compute(self, **kwargs): if self.extractor is None: kwargs['download_data'] = kwargs.pop('download_data', self.download_data) self.load_data(**kwargs) self.log.info(f"Session {self.session_path}: Running QC on behavior data...") self.metrics, self.passed = get_bpodqc_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, download_data=None):\n if self.extractor is None:\n # If download_data is None, decide based on whether eid or session path was provided\n ensure_data = self.download_data if download_data is None else download_data\n self.load_data(download_data=ensure_dat...
[ "0.6188606", "0.6146431", "0.6113068", "0.60673046", "0.59287566", "0.5926206", "0.5902293", "0.5877014", "0.5784998", "0.573546", "0.5707369", "0.5694776", "0.56773263", "0.5656921", "0.5625058", "0.5584204", "0.55599093", "0.5556537", "0.55550545", "0.55543596", "0.5553796"...
0.61870587
1
Given a dictionary of results, computes the overall session QC for each key and aggregates in a single value
def compute_session_status_from_dict(results): indices = np.zeros(len(results), dtype=int) for i, k in enumerate(results): if k in TaskQC.criteria.keys(): indices[i] = TaskQC._thresholding(results[k], thresholds=TaskQC.criteria[k]) else: indices[i]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_results(results):\n\n for (config,con,dec),folds in results.iteritems():\n m = MODEL_PATTERN.match(config)\n if m:\n mode = m.groupdict()['mode'] # mle, rl, mrt, ...\n model = m.groupdict()['model'] # haem, hacm, hard, ...\n align = m.groupdict()['a...
[ "0.6222572", "0.60406405", "0.5990933", "0.5945015", "0.58555114", "0.5849532", "0.5788227", "0.57747865", "0.5715895", "0.5701647", "0.56428385", "0.5619109", "0.5589009", "0.55545366", "0.5523717", "0.5481006", "0.5478383", "0.545642", "0.54334474", "0.53829503", "0.5372924...
0.6752876
0
Computes the overall session QC for each key and aggregates in a single value
def compute_session_status(self): if self.passed is None: raise AttributeError('passed is None; compute QC first') # Get mean passed of each check, or None if passed is None or all NaN results = {k: None if v is None or np.isnan(v).all() else np.nanmean(v) for k, v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate(self):\n data_to_track = {}\n for possession in self.possessions_to_track_aggregate:\n data_to_track[possession] = self._haves[possession]\n\n for variable in self.variables_to_track_aggregate:\n try:\n data_to_track[variable] = self.__dict__[...
[ "0.5516195", "0.5445356", "0.5358602", "0.5349585", "0.5333742", "0.5271777", "0.52661145", "0.5255679", "0.5213781", "0.5190634", "0.51589733", "0.51226103", "0.51122093", "0.50610095", "0.5024973", "0.501899", "0.50044125", "0.49149823", "0.49074388", "0.48728678", "0.48719...
0.5601444
0
Compute and store the QC metrics Runs the QC on the session and stores a map of the metrics for each datapoint for each test, and a map of which datapoints passed for each test
def compute(self, download_data=None): if self.extractor is None: # If download_data is None, decide based on whether eid or session path was provided ensure_data = self.download_data if download_data is None else download_data self.load_data(download_data=ensure_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, **kwargs):\n if self.extractor is None:\n kwargs['download_data'] = kwargs.pop('download_data', self.download_data)\n self.load_data(**kwargs)\n self.log.info(f\"Session {self.session_path}: Running QC on behavior data...\")\n self.metrics, self.passed =...
[ "0.61865723", "0.61484236", "0.6111889", "0.6068964", "0.59302425", "0.5927652", "0.5902292", "0.5878314", "0.5785274", "0.5735238", "0.57067233", "0.56961745", "0.56763333", "0.5656826", "0.5624611", "0.5584238", "0.55624455", "0.55575174", "0.5555539", "0.5554058", "0.55537...
0.6186402
1