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
from the sen retrieved, score= exp(score) and then normalize according to sum normalization file is an output file claim num, alpha, beta for each alpha beta, create and than add to it the different claims' doc scores
def normalize_sen_scores_corpus_smoothing(): param_len = 10*11# for alpha*beta =110 k_len = 1 # sen_res_files_path = linux_base_path+r"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_"+str(corpus_beta) sen_res_files_path = base_path+r"\claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_doc_scores():\n# doc_res_files_path = base_path+r\"claimLM_docLM_doc_ret_output\"\n claims_file_counters_dict = {} #for each claim numas key, have the val a counter - if not 110 per claim -> problem!\n doc_res_files_path = linux_base_path+\"/claimLM_docLM_doc_ret_output\"\n# doc_res_fil...
[ "0.7415285", "0.707976", "0.66742116", "0.5899873", "0.5807724", "0.5787788", "0.57867104", "0.5783012", "0.57770485", "0.56916255", "0.56486267", "0.5600242", "0.5599083", "0.55359215", "0.5517576", "0.55115044", "0.5456102", "0.54504824", "0.54460424", "0.5435197", "0.54262...
0.7378386
1
from the sen retrieved, score= exp(score) and then normalize according to sum normalization file is an output file claim num, alpha, beta for each alpha beta, create and than add to it the different claims' doc scores
def normalize_sen_scores_adj_sen(): param_len = 10*11*55# alpha*beta*delta1*delta2, else just for alpha*beta =110 k_len = 1 # sen_res_files_path = linux_base_path+r"/claimLM_senLM_adjacent_sen_ret_output_corpus_beta_"+str(corpus_beta)+"/" #norm_sen_res_path = linux_base_path+r"/sen_norm_scores_dicts_ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_doc_scores():\n# doc_res_files_path = base_path+r\"claimLM_docLM_doc_ret_output\"\n claims_file_counters_dict = {} #for each claim numas key, have the val a counter - if not 110 per claim -> problem!\n doc_res_files_path = linux_base_path+\"/claimLM_docLM_doc_ret_output\"\n# doc_res_fil...
[ "0.7414821", "0.7377976", "0.66732913", "0.58997655", "0.58076227", "0.5788475", "0.57850957", "0.5782094", "0.5777022", "0.56907845", "0.5647315", "0.5600143", "0.55983925", "0.55360234", "0.5516335", "0.5511713", "0.5454892", "0.5449778", "0.5445213", "0.5434749", "0.542638...
0.7078911
2
for each alpha and beta values, Get the top k =[50,100,500] docs from which sentences will be retrieved As one of the setups is a according to the LM of the sen and the corpus alone (as done with usual sentence retieval in Indri) then I will create a file for Indri as done in pool creation n ret' process add the top do...
def get_top_k_docs(): # doc_res_dicts_path = base_path+"\\docs_norm_scores_dicts" # sen_ret_input_path = base_path+"\\claimLM_senLM_sen_ret_input" doc_res_dicts_path = linux_base_path+"/docs_norm_scores_dicts" sen_ret_input_path = linux_base_path+"/claimLM_senLM_sen_ret_input" claims_no_SW_dict = re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.7060057", "0.6779933", "0.6676571", "0.66038054", "0.65266526", "0.61835426", "0.61230075", "0.6115115", "0.60696673", "0.60688215", "0.6056709", "0.6049824", "0.603279", "0.6032701", "0.60288477", "0.6004372", "0.598134", "0.5977768", "0.5961952", "0.5930355", "0.59214824...
0.77609736
0
for each alpha, beta value turn the docs norms dicts to a single dict for all claims sen_norm_scores_dicts_path = base_path+"\\sen_norm_scores_dicts" for each alpha,beta, k value turn the sens norms dicts to a single dict for all claims
def merge_all_claims_norm_dicts_for_docs(): # docs_norm_scores_dicts_path = base_path+"\\docs_norm_scores_dicts" docs_norm_scores_dicts_path = linux_base_path+"/docs_norm_scores_dicts" # all_claims_norms_scores_merged_dict = base_path +"\\all_claims_norms_scores_merged_dict" all_claims_norms_scores...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.7088313", "0.67298317", "0.65189683", "0.61524886", "0.5593098", "0.55304724", "0.5519807", "0.54319054", "0.5411976", "0.53833836", "0.53432316", "0.5338235", "0.5274585", "0.526474", "0.5180783", "0.5180489", "0.51749146", "0.51542217", "0.51415366", "0.5109483", "0.5080...
0.76682496
0
after sen retrieval for each alpha and beta, interpolate with the weight between as free param and rank according to lambda value
def interpolate_doc_sen_score_adj_sen(): print "started interpolate_doc_sen_score" # all_claims_norms_scores_merged_dict_docs = linux_base_path +"/all_claims_norms_scores_merged_dict_docs" # all_claims_norms_scores_merged_dict_sen = linux_base_path +"/all_claims_norms_scores_merged_dict_adjacent_sen_corpus_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self, alpha, ind):\n inside = -alpha * self.labels * self.predictions[ind, :]\n new_weights = self.weights * np.exp(inside)\n self.weights = new_weights / np.sum(new_weights)", "def obj(k_next) : \n \n if method==1 :\n value_vec = -1 * (log(A*k_cur...
[ "0.6074115", "0.60367084", "0.5989218", "0.5975552", "0.576305", "0.5743471", "0.57288766", "0.57013637", "0.5695949", "0.5693833", "0.5673339", "0.563869", "0.5598247", "0.5595677", "0.5590343", "0.5588766", "0.55849355", "0.5582929", "0.5582796", "0.55817425", "0.5571087", ...
0.54549414
46
compute the nDCG for all claims, based on the ranking of each baseline
def convert_true_support_to_relevance(): clm_as_key_sen_support_score_val_wiki = read_pickle("clm_as_key_sen_support_score_val_wiki") #key is a claim num, value is a list of tuple - sen and their 0/1/2 support score) claim_sen_true_relevance_dict = {} claim_dict = read_pickle("claim_dict") #t Dead Poets...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndcg(relevances, rank=10):\n best_dcg = dcg(sorted(relevances, reverse=True), rank)\n if best_dcg == 0:\n return 0.\n return dcg(relevances, rank) / best_dcg", "def ndcg(preds, labels):\n \n #find positions where the prediction matches the label\n relv_pos = np.where(np.equal(preds, ...
[ "0.67754275", "0.6628465", "0.6593899", "0.64596516", "0.64169276", "0.6408325", "0.63335246", "0.631509", "0.61704683", "0.615062", "0.6136275", "0.6125998", "0.61198425", "0.6093542", "0.60783464", "0.6061076", "0.606081", "0.6028799", "0.6009129", "0.59800285", "0.59335095...
0.0
-1
A doc is relevant if it has a relevant sentence, according to the true rel annotation.
def create_rel_doctitle_dict(): claim_rel_docno_dict = {} #key is claim text, value is a set of doc_title that are relevant clm_sen_doc_title_dict = read_pickle("sen_doc_title_dict") claim_sen_true_relevance_dict = read_pickle("claim_sen_relevance_dict_"+curr_source) exclude = set(string.punctuation) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsDocumentRelated(self, *args, **kwargs):\n pass", "def test_doc1(self):\n assert models.review.__doc__ is not None", "def is_lyrics_approved():", "def has_doc() -> None:", "def allow_relation(self, obj1, obj2, **hints):\n if obj1._meta.app_label == 'researcherquery' and obj2._meta...
[ "0.6288269", "0.62236005", "0.6089288", "0.58728105", "0.5830102", "0.5629541", "0.5613132", "0.559914", "0.5593776", "0.55932766", "0.5588624", "0.5546527", "0.5536408", "0.5524622", "0.54359573", "0.5395747", "0.5385224", "0.53797835", "0.53793937", "0.53676057", "0.5354059...
0.0
-1
on the document retrieval results, calc the MAP
def calc_doc_ret_MAP(): # docs_norm_scores_dicts_path = linux_base_path+"/docs_norm_scores_dicts" claim_rel_docno_dict = read_pickle("claim_rel_docno_dict") #key is clm, value is a set of the relevant docno # nDCG_MAP_res = base_path +"\\nDCG_MAP_res\\" # docs_norms_path = base_path+"\\docs_norm_sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _docMapping(self):\n doc2quests = defaultdict(list)\n for q, d in self.quest2doc.items():\n doc2quests[d].append(q)\n return doc2quests", "def map():", "def getResults():", "def _apply_mapping(self, document, mapping):\n if not mapping:\n return document\...
[ "0.6114611", "0.6031638", "0.59947586", "0.5955202", "0.58502626", "0.5790254", "0.57628024", "0.5761751", "0.5743886", "0.57371366", "0.5696955", "0.5681318", "0.56573915", "0.56136465", "0.5600608", "0.5599281", "0.55984145", "0.5586433", "0.5571157", "0.55652666", "0.55601...
0.64025724
0
for each ranked list of sentences for alpha, beta (the lambda doesnt matter), calculate the numebr of sentences that in the true_pridiction list for the claim
def calc_intersection_true_data_baselines_data_cnt(): # final_sen_scores = linux_base_path + "/final_sen_scores/" final_sen_scores = base_path + "\\final_sen_scores\\" top_k_docs_values = [50] lambda_f = "1" claim_sen_true_relevance_dict = read_pickle("claim_sen_relevance_dict_"+curr_source) cla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, n, sents, corpus='', beta=None, addone=True):\n self.n = n\n self.beta = beta\n self.corpus = corpus\n self.beta_flag = True\n self.addone = addone\n self.smoothingtechnique = 'Back Off (Katz) with Discounting Smoothing'\n self.counts = counts = d...
[ "0.6603899", "0.6272677", "0.6156917", "0.6153438", "0.6046044", "0.6021674", "0.5953508", "0.5943219", "0.5927122", "0.5906488", "0.58450556", "0.5834747", "0.58299893", "0.58284515", "0.58246076", "0.58082694", "0.58082694", "0.5799289", "0.5791235", "0.5764125", "0.5757760...
0.5704174
26
for every configuration, calc the std of the measures
def calc_std_nDCG_AP_corpus_smoothing(p): # nDCG_MAP_res = base_path +"\\nDCG_MAP_res\\" measures_res = linux_base_path+ "/measures_res"+setup+"/" k_val = 50 NDCG_AP_all_claims_all_param_values = read_pickle(measures_res+"NDCG_AP_prec_at_k_all_claims_all_param_values_top_k_docs_"+str(k_val)+"_at_"+...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def std(self):\n return self._summarize(lambda c: c.std)", "def std(self, dset):\n avg = self.mean(dset)\n variance = sum([math.pow(x - avg, 2) for x in dset])\n std = math.sqrt(variance)\n return std", "def std(self):\n variance, mean = self.variance()\n standa...
[ "0.72832054", "0.7275002", "0.7248711", "0.72363716", "0.72285056", "0.7219676", "0.71546847", "0.711142", "0.7090396", "0.70886666", "0.7055412", "0.70186174", "0.70143723", "0.6981223", "0.6968023", "0.6966007", "0.69231254", "0.6908948", "0.69009334", "0.6878737", "0.68759...
0.0
-1
1. Leave one out each claim, 2. For every possible value of alpha,beta,lambda calc the nDCG,MAP on the train claims (without the left out) 3. Find the configuration that maximises the measures 4. report the meatures of th e left out claim with this configuration
def find_best_free_param_configuration_LOO_adj_sen(p): measures_res = linux_base_path+ "/measures_res"+setup+"/" # measures_res = base_path +"\\measures_res"+setup+"\\" # nDCG_MAP_res = base_path +"\\nDCG_MAP_res\\" claim_dict = read_pickle("claim_dict") claim_num_list = [4,7,17,21,36,37,39,40,41,4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_free_param_configuration_LOO_corpus_smoothing(p,alpha_range,beta_range,lambda_range):\n measures_res = linux_base_path+ \"/measures_res_corpus_smoothing_corpus_beta_\"+str(corpus_beta)+\"/\"\n# measures_res = \"/IBM_STORAGE/USERS_DATA/liorab/baseline_ret/sen_ret_corpus_smoothing_res/nDCG_MAP_r...
[ "0.6862903", "0.6270026", "0.62612617", "0.599234", "0.5982573", "0.5976929", "0.58862674", "0.58170885", "0.5773099", "0.57533056", "0.57435113", "0.571662", "0.56960785", "0.5683166", "0.5602618", "0.559545", "0.5578115", "0.5569379", "0.5545015", "0.5527642", "0.5518251", ...
0.70153874
0
1. Leave one out each claim, 2. For every possible value of alpha,beta,lambda calc the nDCG,MAP on the train claims (without the left out) 3. Find the configuration that maximises the measures 4. report the meatures of th e left out claim with this configuration
def find_best_free_param_configuration_LOO_corpus_smoothing(p,alpha_range,beta_range,lambda_range): measures_res = linux_base_path+ "/measures_res_corpus_smoothing_corpus_beta_"+str(corpus_beta)+"/" # measures_res = "/IBM_STORAGE/USERS_DATA/liorab/baseline_ret/sen_ret_corpus_smoothing_res/nDCG_MAP_res_corpus_sm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_free_param_configuration_LOO_adj_sen(p):\n\n measures_res = linux_base_path+ \"/measures_res\"+setup+\"/\"\n# measures_res = base_path +\"\\\\measures_res\"+setup+\"\\\\\"\n# nDCG_MAP_res = base_path +\"\\\\nDCG_MAP_res\\\\\"\n claim_dict = read_pickle(\"claim_dict\")\n claim_num_lis...
[ "0.7014755", "0.6269574", "0.6260426", "0.59911776", "0.5981472", "0.597715", "0.5884376", "0.58172673", "0.5771162", "0.5752471", "0.57429314", "0.5715644", "0.56959563", "0.5682965", "0.5601803", "0.55960995", "0.55781525", "0.55682933", "0.5544764", "0.5527773", "0.5518287...
0.68619835
1
After results, compare to different setups with the alpha,beta weighting settings.
def claim_document_baseline(): param_range = namedtuple('param_range','start, end') alpha_settings = param_range(0,1)#,param_range(10,11) beta_settings = param_range(0,1)#,param_range(9,10)] #as it finished at beta=0.9 lambda_settings = param_range(0,11) claim_document_baseline_LOO(alpha_settin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_additive_alpha_beta(self):\n np.random.seed(912838)\n\n param_pairs = [(1.0, 0.0), (0.0, 1.0), (1.0, 1.0)]\n tmax = 4*self.dt\n\n self.conductor.out_step = np.random.randn(self.Nc)\n self.tutor.out_step = np.random.randn(self.Ns)\n\n sim = simulation.Simulation(self.conductor, self.stude...
[ "0.611615", "0.611615", "0.6114931", "0.609811", "0.6080122", "0.598481", "0.59555906", "0.5920266", "0.58922756", "0.58922756", "0.58922756", "0.58922756", "0.5883654", "0.5871668", "0.5863644", "0.58578783", "0.5856136", "0.58423", "0.58423", "0.5835598", "0.5834205", "0....
0.0
-1
call the loo function
def claim_document_baseline_LOO(alpha_setting, beta_setting, lambda_settings): find_best_free_param_configuration_LOO_corpus_smoothing(10, alpha_setting, beta_setting, lambda_settings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loan(self):", "def loo(trace, model=None, pointwise=False, reff=None, progressbar=False):\n model = modelcontext(model)\n\n if reff is None:\n if trace.nchains == 1:\n reff = 1.\n else:\n eff = pm.effective_n(trace)\n eff_ave = pm.stats.dict2pd(eff, 'eff')...
[ "0.61510205", "0.5998763", "0.59260106", "0.5722653", "0.5680222", "0.5623486", "0.5571951", "0.5565588", "0.5565588", "0.5565588", "0.5565588", "0.5565588", "0.5533538", "0.5505728", "0.5433628", "0.540592", "0.5388204", "0.53445035", "0.5337844", "0.5270219", "0.5263789", ...
0.0
-1
Update a source Docker image with environment config and publish it to deisregistry.
def publish_release(self, source, config, target, deis_registry): # get the source repository name and tag src_name, src_tag = docker.utils.parse_repository_tag(source) # get the target repository name and tag name, tag = docker.utils.parse_repository_tag(target) # strip any "htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, source, config, repo, tag):\n check_blacklist(repo)\n env = ' '.join(\"{}='{}'\".format(\n k, v.encode('unicode-escape').replace(\"'\", \"\\\\'\")) for k, v in config.viewitems())\n dockerfile = \"FROM {}\\nENV {}\".format(source, env)\n f = io.BytesIO(dockerf...
[ "0.610328", "0.5974144", "0.5876449", "0.57455844", "0.5714578", "0.57040226", "0.5610458", "0.5601322", "0.5594505", "0.5568667", "0.54921347", "0.54339135", "0.5416365", "0.5412983", "0.54030377", "0.53847176", "0.53753495", "0.5353201", "0.5352105", "0.5350578", "0.5342924...
0.6775295
0
Add a "lastmile" layer of environment config to a Docker image for deisregistry.
def build(self, source, config, repo, tag): check_blacklist(repo) env = ' '.join("{}='{}'".format( k, v.encode('unicode-escape').replace("'", "\\'")) for k, v in config.viewitems()) dockerfile = "FROM {}\nENV {}".format(source, env) f = io.BytesIO(dockerfile.encode('utf-8')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializeSystem():\n dockerapi.writeDockerConfig()", "def add_new_last_layer(base_model, nb_classes):\r\n x = base_model.output\r\n x = AveragePooling2D((8, 8), border_mode='valid', name='avg_pool')(x)\r\n x = Dropout(0.25)(x)\r\n x = Flatten()(x)\r\n predictions = Dense(7, activation='sof...
[ "0.49154678", "0.48906717", "0.48791206", "0.4833639", "0.4813655", "0.48127934", "0.47168905", "0.4642947", "0.45713437", "0.45476964", "0.454493", "0.4542153", "0.45378584", "0.45290574", "0.450392", "0.44974288", "0.448868", "0.4449875", "0.4443322", "0.44422632", "0.44383...
0.0
-1
Pull a Docker image into the local storage graph.
def pull(self, repo, tag): check_blacklist(repo) logger.info("Pulling Docker image {}:{}".format(repo, tag)) with SimpleFlock(self.FLOCKFILE, timeout=1200): stream = self.client.pull(repo, tag=tag, stream=True, insecure_registry=True) log_output(stream)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_image(image):\n\n subprocess.check_call(['docker', 'pull', image])", "def _pull_image(self, docker_client: \"DockerClient\"):\n image, tag = self._get_image_and_tag()\n\n return docker_client.images.pull(image, tag)", "def fetch_image(client, name):\n try:\n image = client.i...
[ "0.75792754", "0.72861683", "0.6884008", "0.6882427", "0.6866366", "0.6799547", "0.67634326", "0.6614292", "0.65722054", "0.6526053", "0.6421416", "0.63941723", "0.63735044", "0.6344396", "0.63258123", "0.62319577", "0.6221783", "0.6129149", "0.60782826", "0.60653406", "0.600...
0.6688671
7
Push a local Docker image to a registry.
def push(self, repo, tag): logger.info("Pushing Docker image {}:{}".format(repo, tag)) stream = self.client.push(repo, tag=tag, stream=True, insecure_registry=True) log_output(stream)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_image(image):\n\n subprocess.check_call(['docker', 'push', image])", "def push(images, tag, registry):\n manager = Manager('push', tag, images=images, registry_url=registry)\n manager.run()", "def Push(self, docker_client):\n docker_client.tag(self.id, self.repo_tag, force=True)\n log.i...
[ "0.81385744", "0.7947424", "0.7744581", "0.74444735", "0.73166674", "0.7316662", "0.72692245", "0.7238543", "0.71569896", "0.7097341", "0.6858782", "0.67677134", "0.65243113", "0.64571184", "0.6349448", "0.6315263", "0.6307589", "0.6149461", "0.614088", "0.6092131", "0.607589...
0.7845292
2
Tag a local Docker image with a new name and tag.
def tag(self, image, repo, tag): check_blacklist(repo) logger.info("Tagging Docker image {} as {}:{}".format(image, repo, tag)) if not self.client.tag(image, repo, tag=tag, force=True): raise docker.errors.DockerException("tagging failed")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, repo, tag):\n logger.info(\"Pushing Docker image {}:{}\".format(repo, tag))\n stream = self.client.push(repo, tag=tag, stream=True, insecure_registry=True)\n log_output(stream)", "def update(tag_name: str):\n\n image_full_name = f\"{GITLAB_IMAGE_URL}:{tag_name}\"\n _buil...
[ "0.65464705", "0.65072083", "0.64666855", "0.6431756", "0.6422313", "0.62344396", "0.6217048", "0.6179603", "0.61187536", "0.6083696", "0.6049853", "0.60115", "0.6009453", "0.5975412", "0.5973849", "0.59461796", "0.5944714", "0.5910567", "0.5837", "0.5825065", "0.58246857", ...
0.71745235
0
Check a Docker repository name for collision with deis/ components.
def check_blacklist(repo): blacklisted = [ # NOTE: keep this list up to date! 'builder', 'cache', 'controller', 'database', 'logger', 'logspout', 'publisher', 'registry', 'router', 'store-admin', 'store-daemon', 'store-gateway', 'store-metadata', 'store-monitor', 'swarm', 'mesos-master', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_repo_field(value, name):\n if not DOCKER_REPO_RE.match(value):\n raise ValueError((\"Invalid %s. Must start with a lower case, \"\n \"alphanumeric character, and contain only the \"\n \"additional characters '-', '_' and '.'\") % name)\n ret...
[ "0.6755347", "0.6468596", "0.6273505", "0.5908212", "0.58465743", "0.58431125", "0.57671696", "0.57315993", "0.573047", "0.5721501", "0.57143027", "0.56826484", "0.56826484", "0.56549484", "0.56091887", "0.5582749", "0.55753964", "0.55694026", "0.5562148", "0.55573213", "0.55...
0.0
-1
Log a stream at DEBUG level, and raise DockerException if it contains "error".
def log_output(stream): for chunk in stream: logger.debug(chunk) # error handling requires looking at the response body if '"error"' in chunk.lower(): raise docker.errors.DockerException(chunk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream_error(self,err):\n self.__logger.debug(\"Stream error: condition: %s %r\"\n % (err.get_condition().name,err.serialize()))", "def debug(log):\n write(syslog.LOG_DEBUG, 'debug', '{log}'.format(log=log))", "def debug(msg, resource=None, stream_id=None):\n engine = get_engine...
[ "0.59884083", "0.5917202", "0.5891739", "0.56892204", "0.56684613", "0.5657212", "0.55786264", "0.55449605", "0.55404776", "0.55256677", "0.5513519", "0.5486321", "0.5478189", "0.5445965", "0.54356295", "0.54103154", "0.53925633", "0.53724486", "0.53709", "0.53615487", "0.535...
0.72306085
0
Checks inputs and forks between implicit/backprop exec of Sinkhorn.
def _sinkhorn( geom: geometry.Geometry, a: Optional[jnp.ndarray] = None, b: Optional[jnp.ndarray] = None, tau_a: float = 1.0, tau_b: float = 1.0, threshold: float = 1e-3, norm_error: int = 1, inner_iterations: int = 10, min_iterations: int = 0, max_iterations: int = 2000, mom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_input(self):\n\n inputs = self.inputs\n inputs_ok = True\n\n if not 'kkrimp_remote' in inputs:\n if not ('host_imp_startpot' in inputs and 'remote_data' in inputs):\n inputs_ok = False\n self.ctx.exit_code = self.exit_codes.ERROR_HOST_IMP_P...
[ "0.62660146", "0.5898407", "0.58596665", "0.58210665", "0.5779729", "0.573997", "0.5686902", "0.5649694", "0.5615524", "0.56127435", "0.5544417", "0.5505252", "0.54916924", "0.5482584", "0.5474087", "0.5440653", "0.5435655", "0.54212564", "0.5415849", "0.5412049", "0.5387389"...
0.0
-1
The jittable Sinkhorn loop, that uses a custom backward or not.
def _sinkhorn_iterations( tau_a: float, tau_b: float, inner_iterations: int, min_iterations: int, max_iterations: int, momentum_default: float, chg_momentum_from: int, lse_mode: bool, implicit_differentiation: bool, threshold: float, norm_error: Sequence[int], geom: geome...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_iter_backward(self, runner):\n runner.optimizer.zero_grad()\n runner.loss.backward()\n runner.optimizer.step()", "def backward(self, *output_grads):\n raise NotImplementedError", "def post_backward_generator(self):\n pass", "def backward(self, dout):\n \n #####...
[ "0.70739937", "0.6807868", "0.67775184", "0.6762841", "0.6524559", "0.64676994", "0.64280504", "0.6413513", "0.63601685", "0.62899834", "0.6265906", "0.6244667", "0.6244667", "0.6244667", "0.6242385", "0.6242385", "0.6242385", "0.62321997", "0.621499", "0.6193118", "0.6178678...
0.0
-1
Carries out sinkhorn iteration.
def body_fn(iteration, const, state, compute_error): geom, a, b, _ = const errors, f_u, g_v = state # compute momentum term if needed, using previously seen errors. w = jax.lax.stop_gradient(jnp.where(iteration >= ( inner_iterations * chg_momentum_from + min_iterations), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self):\n pass", "def run(self):\n self.running = True\n for channel in self:\n sleep(self.hop_interval)\n if self.running is False:\n return\n self.hop_channel(channel)", "def simple_sink(riter):\n for r in riter:\n pass", "def...
[ "0.64314777", "0.6394602", "0.62053657", "0.6161966", "0.6158346", "0.61251426", "0.606128", "0.6059073", "0.60076135", "0.59654975", "0.5962125", "0.59553146", "0.59256214", "0.5917795", "0.5866112", "0.58040047", "0.5802265", "0.5798182", "0.5782615", "0.5779526", "0.573078...
0.0
-1
Runs forward pass of the Sinkhorn algorithm storing side information.
def _sinkhorn_iterations_taped( tau_a: float, tau_b: float, inner_iterations: int, min_iterations: int, max_iterations: int, momentum_default: float, chg_momentum_from: int, lse_mode: bool, implicit_differentiation: bool, threshold: float, norm_error: Sequence[int], geom:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_pass(self):", "def forward(self):\n pass", "def forward(self):\n pass", "def forward(self, features, features_lengths, spkids):\n pass", "def forward(self, obs):\n\t\tpass", "def forward(self)->None:", "def forward(self, input):\n\n common = self.common_tower(inp...
[ "0.60292", "0.5702385", "0.5702385", "0.5681689", "0.5644615", "0.5601841", "0.5557204", "0.5541835", "0.55348027", "0.5484265", "0.5484265", "0.5469709", "0.5469709", "0.5469709", "0.5458874", "0.54275465", "0.54246515", "0.5411879", "0.5342686", "0.5322752", "0.5285507", ...
0.0
-1
Runs Sinkhorn in backward mode, using implicit differentiation.
def _sinkhorn_iterations_implicit_bwd( tau_a, tau_b, inner_iterations, min_iterations, max_iterations, momentum_default, chg_momentum_from, lse_mode, implicit_differentiation, res, gr) -> Tuple[Any, Any, geometry.Geometry, jnp.ndarray, jnp.ndarray]: del inner_iterations, min_iterations, max_iterations, mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward(self, *output_grads):\n raise NotImplementedError", "def backward(self, dout):\n \n ########################\n # PUT YOUR CODE HERE #\n #######################\n for l in range(len(self.layers)-1,-1,-1):\n act_dout = self.activations[l].backward(dout)\n dout = self.l...
[ "0.69852996", "0.68194205", "0.6752031", "0.6567173", "0.6535789", "0.65302145", "0.65302145", "0.65216994", "0.6514366", "0.644436", "0.6381626", "0.63740325", "0.6360264", "0.63470936", "0.6304719", "0.6304719", "0.6304719", "0.6304719", "0.6304719", "0.6304719", "0.6304719...
0.0
-1
Computes vector of first order conditions for the regOT problem. The output of this vector should be close to zero at optimality. Upon completion of the Sinkhorn forward pass, its norm (as computed using the norm_error setting) should be below the threshold parameter. This error will be itself assumed to be close to ze...
def first_order_conditions(geom: geometry.Geometry, a: jnp.ndarray, b: jnp.ndarray, fg: jnp.ndarray): grad_a, grad_b = grad_of_marginal_fit( a, b, fg[:n], fg[n:], tau_a, tau_b, geom) return jnp.concatenate(( j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_initial_condition(self):\n X0 = np.array([0.5, 0.5])\n XB = self.bary\n q0 = 1 + np.exp(-0.5*(np.sum((XB-X0[np.newaxis])**2., axis=1))/0.1**2)\n q1 = np.zeros(q0.shape)\n #import pdb; pdb.set_trace()\n return np.array([q0, q1, q1]).T", "def buildWPriorTerm(self):...
[ "0.5671115", "0.5641746", "0.5570537", "0.5496455", "0.5372268", "0.53037494", "0.5230425", "0.51915425", "0.5160275", "0.50784904", "0.50669193", "0.50549674", "0.5047859", "0.50226414", "0.5003567", "0.49921483", "0.49834663", "0.4970644", "0.49686915", "0.49627993", "0.494...
0.0
-1
Conputes marginal error, the stopping criterion used to terminate Sinkhorn.
def marginal_error(geom: geometry.Geometry, a: jnp.ndarray, b: jnp.ndarray, tau_a: float, tau_b: float, f_u: jnp.ndarray, g_v: jnp.ndarray, norm_error: int, lse_mode) -> jnp.ndarray: if tau_b == 1.0: err = geom.error(f_u, g_v, b, 0, norm_error, lse_mode) elif tau_a == 1.0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _computeError(self, inputs, targets):\n return .5*np.sum((targets-self._pcnfwd(inputs))**2)", "def calc_error_dist(self):\n pass", "def cps_err(self):\n return np.sqrt(self.totalcounts) / self.exptime", "def calcError(self, inherited_error):\r\n\t\tif inherited_error == None:\t\t# ou...
[ "0.55752885", "0.55262184", "0.53878623", "0.53458256", "0.5242713", "0.5219906", "0.51388973", "0.513811", "0.51329106", "0.51179904", "0.50959706", "0.5045472", "0.5027726", "0.501926", "0.50111884", "0.5003115", "0.4994308", "0.49891266", "0.49881127", "0.49779963", "0.496...
0.6124
0
Computes objective of regularized OT given dual solutions f,g. In all sums below, jnp.where handle situations in which some coordinates of a and b are zero. For those coordinates, their potential is inf. This leads to inf inf or inf x 0 operations which result in NaN. These contributions are discarded when computing th...
def ent_reg_cost(geom: geometry.Geometry, a: jnp.ndarray, b: jnp.ndarray, tau_a: float, tau_b: float, f: jnp.ndarray, g: jnp.ndarray) -> jnp.ndarray: if tau_a == 1.0: div_a = jnp.sum( jnp.where(a > 0, (f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objective_func(self, topology, grad_func, tmax, eta):\n f = objective_function_numpy\n x_func = partial(self._optimize_form, topology=topology, tmax=tmax, eta=eta)\n return partial(f, x_func=x_func, grad_func=grad_func)", "def dual_objective_expression_rule(_m):\r\n\r\n # Buil...
[ "0.60246664", "0.58848155", "0.584778", "0.58339036", "0.576397", "0.5628816", "0.5617787", "0.560414", "0.5598312", "0.55587715", "0.55584806", "0.5530736", "0.5519905", "0.5510261", "0.5503501", "0.54910654", "0.5487054", "0.548219", "0.5477244", "0.54708964", "0.5469146", ...
0.561347
7
Computes grad of terms linked to marginals a, b in objective. Computes gradient w.r.t. f and g of terms in
def grad_of_marginal_fit(a, b, f, g, tau_a, tau_b, geom): if tau_a == 1.0: grad_a = a else: rho_a = geom.epsilon * tau_a / (1 - tau_a) grad_a = jnp.where(a > 0, a * derivative_phi_star(-f, rho_a), 0.0) if tau_b == 1.0: grad_b = b else: rho_b = geom.epsilon * tau_b / (1 - tau_b) grad_b =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad(self,w):\n # Calculate the vector -sigma(-y_i * x_i.w)\n s = -np.array([sigmoid(-yi * np.dot(xi,w)) for xi,yi in zip(self.x,self.y)])\n # Multiply it by xy\n g = np.array([np.dot(xyj,s) for xyj in self.xy.transpose()])\n # Add regularisation\n g += self.alpha*w\n return g\n #g = np...
[ "0.70722276", "0.69424504", "0.6891617", "0.6874898", "0.6870639", "0.68621045", "0.68616676", "0.68609214", "0.6854778", "0.68153954", "0.6803334", "0.680243", "0.6780593", "0.6712635", "0.66944325", "0.6691906", "0.6669815", "0.6658177", "0.6646453", "0.6594153", "0.6582312...
0.7828975
0
Derivative of Legendre transform of KL, see phi_star.
def derivative_phi_star(f: jnp.ndarray, rho: float) -> jnp.ndarray: return jnp.exp(f / rho)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Kgradients(self):\r\n dL_dfhat, I_KW_i = self._shared_gradients_components()\r\n dlp = self.noise_model.dlogpdf_df(self.f_hat, self.data, extra_data=self.extra_data)\r\n\r\n #Explicit\r\n #expl_a = np.dot(self.Ki_f, self.Ki_f.T)\r\n #expl_b = self.Wi_K_i\r\n #expl = 0...
[ "0.61092794", "0.61055094", "0.6030606", "0.5972036", "0.5966971", "0.59054434", "0.5902631", "0.58994365", "0.58914834", "0.5864667", "0.5842159", "0.5837313", "0.582848", "0.5810532", "0.5781278", "0.5744244", "0.57416415", "0.5712278", "0.57101023", "0.57049537", "0.567282...
0.52620405
73
Actualize the snake through time, making it older and more hungryat each game iteration, sorry snek
def update(self): self.age += 1 self.starve -= 1 if self.starve < 1: self.alive = False self.move()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_draw(delta_time):\n # draws all our objects\n arcade.start_render()\n\n generate_grid()\n apple()\n snake(on_draw.snake_part_x, on_draw.snake_part_y, 20, 20, snake_color)\n snake(on_draw.snake_part2_x, on_draw.snake_part2_y, 20, 20, snake_color)\n snake(on_draw.snake_part3_x, on_draw.sn...
[ "0.6826523", "0.6738613", "0.66854745", "0.6468907", "0.6377065", "0.6312511", "0.63061565", "0.621615", "0.61987853", "0.6187258", "0.61799073", "0.6174087", "0.61577815", "0.6136083", "0.6125809", "0.61203724", "0.609418", "0.6085315", "0.60353434", "0.6017452", "0.600701",...
0.55258
98
Makes snake grow one block longer Called by map.update() when snake's head is in collision with food
def grow(self): self.starve = 500 # useful to avoid looping AI snakes (they die younger -> bad fitness) self.body.append(self.old_tail) # that's why I keep old_tail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n head = (\n (self.snake[0][0] + self.xv * self.ac),\n (self.snake[0][1] + self.yv * self.ac),\n )\n self.snake.insert(0, head)\n\n if head == self.apple:\n self.score += 10\n self.apple = None\n while not self.app...
[ "0.7277614", "0.66949636", "0.66329545", "0.6514946", "0.65060645", "0.65026385", "0.6497427", "0.6453022", "0.63167936", "0.6293433", "0.6293245", "0.6209517", "0.6101574", "0.6066382", "0.6060743", "0.60461587", "0.604199", "0.60198057", "0.6012406", "0.59504473", "0.592508...
0.6535498
3
Makes the snake move, head moves in current direction and each blocks replace its predecessor
def move(self): self.old_tail = self.body[-1][:] # save old position of last block self.head[0] += self.direction[0] # moves head self.head[1] += self.direction[1] self.head[0] = (self.head[0] + self.xMaxSize) % self.xMaxSize self.head[1] = (self.head[1] + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __snake_move(self):\n self.__eat_candy()\n # move tail and body\n n_snake = len(self.__snake)\n for i in range(1, n_snake):\n s2 = self.__snake[n_snake - i]\n s1 = self.__snake[n_snake - i - 1]\n s2.move(s1.pos())\n # move head\n pos = ...
[ "0.7895844", "0.7185265", "0.7008609", "0.67999005", "0.6541893", "0.6265843", "0.6260639", "0.62456954", "0.62426347", "0.6241239", "0.62059575", "0.6096831", "0.6057173", "0.60542494", "0.6027465", "0.59052736", "0.58953947", "0.5891848", "0.5857788", "0.584062", "0.5828308...
0.79912674
0
Makes the snake direction to the right of the current direction Current direction = [x,y], turn_right gives [y,x]
def turn_right(self): temp = self.direction[0] self.direction[0] = -self.direction[1] self.direction[1] = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction > 7:\n self.facing_direction -= 8\n self.x, self.y = self.compute_positions()", "def turn_ship_right(self):\n self.degrees -= movement", "def turn_right(self):\n pass", "def t...
[ "0.7601584", "0.75017947", "0.74439204", "0.7421596", "0.7255912", "0.7253135", "0.7243722", "0.7217155", "0.71768004", "0.715687", "0.7089985", "0.7026401", "0.69998384", "0.69393873", "0.69342035", "0.6932262", "0.6792831", "0.6776827", "0.6776374", "0.6773701", "0.67681515...
0.8202334
0
Makes the snake direction to the right of the current direction Current direction = [x,y], turn_right gives [y,x]
def turn_left(self): temp = self.direction[0] self.direction[0] = self.direction[1] self.direction[1] = -temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direction[1]\n self.direction[1] = temp", "def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction > 7:\n self.facing_direction -= 8\n self.x, self.y =...
[ "0.82036936", "0.7602102", "0.7502819", "0.74446523", "0.7422422", "0.72565275", "0.7254244", "0.72445714", "0.7218234", "0.7176285", "0.71571696", "0.70907134", "0.7026792", "0.70008147", "0.6939965", "0.69347", "0.6932813", "0.6794251", "0.67778355", "0.6777165", "0.6773733...
0.65929574
28
Makes decision for the snake direction according to its current vision Vision is given to the NeuralNetwork and most activated output neuron is considered as decision
def AI(self): decision = np.argmax(self.neural_net.feed_forward(self.vision)) if decision == 1: self.turn_right() elif decision == 2: self.turn_left()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_Utility(self):\n # Shape the input that we give to the neural network with the value of sensors, the previous actions the life of the agent \n # Get the results from the sensors according the different movement executed by the agent \n sensors_result_N = self.agent.sensors(self, d...
[ "0.6688485", "0.6361603", "0.59948283", "0.5954132", "0.58629715", "0.58203393", "0.5806262", "0.5754885", "0.5748835", "0.57286066", "0.5708874", "0.5706578", "0.5691866", "0.5690479", "0.56737447", "0.56602836", "0.5638474", "0.56360745", "0.5631764", "0.5631183", "0.562801...
0.70886225
0
Measures how well the snake is doing as a function of its length and age
def fitness(self): return (len(self.body)**2) * self.age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length_score( canvas ):\n score = 0\n for seqpos, nt in canvas.nucleotides.iteritems():\n if seqpos + 1 not in canvas.nucleotides.keys(): continue\n\n d = distance( nt, canvas.nucleotides[seqpos+1] )\n #print \"Distance between %d and %d is %f\" % (seqpos, seqpos+1, d)\n #scor...
[ "0.60380936", "0.57333344", "0.54979473", "0.5467171", "0.5467171", "0.5467171", "0.544647", "0.54396564", "0.538005", "0.5369122", "0.53458786", "0.5312285", "0.53122807", "0.53094715", "0.53053826", "0.5291157", "0.5266947", "0.5255792", "0.52374715", "0.52374715", "0.52200...
0.5414438
8
Renders the map (background, walls and food) on the window surface and calls render() of snake Very very very unoptimized since render does not affect the genetic algorithm
def render(self, window): body = pygame.image.load(IMAGE_SNAKE).convert_alpha() # loading image for block in self.body: window.blit(body, (block[0]*SPRITE_SIZE, block[1]*SPRITE_SIZE)) # painting a beautiful snek if self.neural_net: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render():\n screen.blit(background ,[0,0]) # paint the background with white colour\n for position in wall_positions:\n screen.blit(wall_surface , position)\n for position in hole_positions:\n screen.blit(hole_surface , position) \n for position in food_positions: \n scre...
[ "0.7684691", "0.730828", "0.72512734", "0.7219235", "0.706247", "0.7059873", "0.7053361", "0.7049064", "0.7045334", "0.7005095", "0.686253", "0.6850011", "0.6842687", "0.67898893", "0.67864984", "0.67463654", "0.67366016", "0.6717466", "0.67080384", "0.6699559", "0.667331", ...
0.70831907
4
pddf_fanutil Command line utility for providing FAN information
def cli(): global platform_fanutil global platform_chassis if os.geteuid() != 0: click.echo("Root privileges are required for this operation") sys.exit(1) # Load the helper class helper = UtilHelper() if not helper.check_pddf_mode(): click.echo("PDDF mode should be su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_fan_util(fan_data):\n sdata = fan_data.split(\"\\n\")\n for line in sdata:\n m = re.match(r\"Fan .*\\sSpeed:\\s+(\\d+)\\s\", line)\n if m is not None:\n return int(m.group(1))\n return -1", "def usage():", "def usage():", "def setup_fan():\n global dev_fan\n ...
[ "0.6178414", "0.6018657", "0.6018657", "0.59550864", "0.58940756", "0.5803944", "0.5769445", "0.5760094", "0.5700807", "0.5637864", "0.56191415", "0.5610372", "0.56093544", "0.5562641", "0.54855925", "0.5466351", "0.54559624", "0.5426739", "0.54131746", "0.54064846", "0.53905...
0.55828595
13
Display number of FANs installed on device
def numfans(): click.echo(_wrapper_get_num_fans())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_count():\n _check_init()\n return _pypm.CountDevices()", "def get_num_fans(self):\n return len(self._fan_list)", "def get_number_of_devices(self):\n return self.drt_manager.get_number_of_devices()", "def get_display_devs_count(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetDisplayD...
[ "0.6714575", "0.644456", "0.6435766", "0.59978145", "0.58996135", "0.58919", "0.58656466", "0.5776997", "0.5773106", "0.56975675", "0.56902885", "0.5675769", "0.5651405", "0.56348354", "0.5632863", "0.56094426", "0.56056833", "0.55822414", "0.55681175", "0.55310243", "0.55297...
0.6648106
1
Display FAN airflow direction
def direction(index): supported_fan = list(range(1, _wrapper_get_num_fans() + 1)) fan_ids = [] if (index < 0): fan_ids = supported_fan else: fan_ids = [index] header = ['FAN', 'Direction'] status_table = [] for fan in fan_ids: fan_name = _wrapper_get_fan_name(fan) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_direction(self, feats):\n if feats.name == \"ARNC\":\n if feats[\"z-score\"] < -1.5:\n return Directions.long_dir\n elif feats[\"z-score\"] > 1.5:\n return Directions.short_dir\n elif feats.name == \"UNG\":\n if feats[\"z-scor...
[ "0.571697", "0.570948", "0.56856555", "0.55924267", "0.55637264", "0.55029374", "0.55010337", "0.54541796", "0.5447349", "0.5428513", "0.5391463", "0.5365725", "0.5363149", "0.52824366", "0.52821505", "0.5261962", "0.52349085", "0.5229372", "0.52178097", "0.51884", "0.5187201...
0.66997015
0
Display FAN speed in RPM
def getspeed(index): supported_fan = list(range(1, _wrapper_get_num_fans() + 1)) fan_ids = [] if (index < 0): fan_ids = supported_fan else: fan_ids = [index] if platform_chassis is not None: header = ['FAN', 'SPEED (RPM)'] else: header = ['FAN', 'Front Fan RPM', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fan_speed(self):\n return self.__fan_speed", "def get_fan_speed(self):\n response = self.parent.fancoolers.get_speed()\n if response is not None:\n response = response[0]\n return response", "def get_fan_speed_volts(self):\n return self.__fan_speed_raw ...
[ "0.6203536", "0.59481585", "0.59469396", "0.58515924", "0.5779223", "0.5757819", "0.57366604", "0.5703687", "0.56516325", "0.5622664", "0.5622664", "0.56049806", "0.5601598", "0.5575566", "0.5564433", "0.5561737", "0.5548297", "0.5547397", "0.55427736", "0.5536652", "0.553567...
0.6414959
0
Set FAN speed in percentage
def setspeed(speed): if speed is None: click.echo("speed value is required") raise click.Abort() for fan in range(_wrapper_get_num_fans()): status = _wrapper_set_fan_speed(fan, speed) if not status: click.echo("Failed") sys.exit(1) click.echo("Succes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fan_speed(self, value):\n self.parent.fancoolers.set_speed(value)", "async def async_set_percentage(self, percentage: int) -> None:\n self._device.fan_speed = math.ceil(\n percentage_to_ranged_value(self._device.fan_speed_limits, percentage)\n )", "def set_pwm(self, fan,...
[ "0.6955172", "0.6838897", "0.66531014", "0.66170365", "0.640071", "0.6399659", "0.62479794", "0.6239728", "0.62061906", "0.61876327", "0.6170493", "0.6122558", "0.6093277", "0.6079112", "0.6059065", "0.60427785", "0.60256606", "0.5981594", "0.5981594", "0.59630585", "0.595412...
0.6423588
4
Dump all Fan related SysFS paths
def dump_sysfs(): for fan in range(_wrapper_get_num_fans()): status = _wrapper_dump_sysfs(fan) if status: for i in status: click.echo(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_sysfs():\n for psu in range(_wrapper_get_num_psus()):\n status = _wrapper_dump_sysfs(psu)\n\n if status:\n for i in status:\n click.echo(i)", "def get_file_systems(self):\n result = {}\n if os.access('/proc/mounts', os.R_OK):\n file = o...
[ "0.6681959", "0.55133736", "0.53833324", "0.5353859", "0.5342153", "0.53066385", "0.5271987", "0.5269195", "0.52592564", "0.5256507", "0.52527386", "0.5240411", "0.5195627", "0.51453215", "0.5107888", "0.50829154", "0.5072956", "0.5066273", "0.5066273", "0.5060286", "0.503605...
0.71562386
0
Waldencompatible view of this dataset's metadata.
def metadata(self): return { "namespace": self.namespace, "short_name": f"{self.namespace}_{self._dataset_metadata['DatasetCode']}", "name": f"{self._dataset_metadata['DatasetName']} - FAO ({self.publication_year})", "description": self._dataset_metadata["DatasetD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata(self):\n return self.meta.metadata", "def metadata(self):\r\n return self._metadata", "def db_metadata(self):\n return self.metadata", "def metadata(self):\n return self._metadata", "def metadata(self):\n return self._metadata", "def metadata(self):\n ...
[ "0.7639628", "0.7538726", "0.75340915", "0.75079805", "0.75079805", "0.75079805", "0.75079805", "0.75079805", "0.7485954", "0.73242635", "0.73177975", "0.72954065", "0.72666806", "0.7258335", "0.7184078", "0.7184078", "0.7171556", "0.7165001", "0.7161704", "0.7132985", "0.712...
0.73774046
9
Run faostat > walden pipeline. Downloads the dataset from source, uploads it to Walden (DO/S3), creates the corresponding metadata file and places it in the walden local project repository.
def to_walden(self): with tempfile.NamedTemporaryFile() as f: # fetch the file locally files.download(self.source_data_url, f.name) # add it to walden, both locally, and to our remote file cache add_to_catalog(self.metadata, f.name, upload=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(unused_argv):\n make_dir(FLAGS.raw_dir)\n\n # Get paths of download/extracted training and evaluation files.\n print(\"Downloading data from source\")\n train_files = get_raw_files(FLAGS.raw_dir, constants.TRAIN_DATA_SOURCES)\n eval_files = get_raw_files(FLAGS.raw_dir, constants.EVAL_DATA_SOURCES)", ...
[ "0.6101038", "0.59202915", "0.58754313", "0.57625264", "0.5744202", "0.5728764", "0.5715347", "0.56936353", "0.5672364", "0.5663005", "0.5636707", "0.5596809", "0.5572518", "0.55700964", "0.5529982", "0.55235684", "0.5514555", "0.55031085", "0.549753", "0.5478355", "0.5470127...
0.6103682
0
Analyze the TIFF image header, which is "specific" for Philips/FEI 30XL microscope control software (running under WinNT from early 2000s)
def analyze_header_XL30(imname, allow_underscore_alias=True): try: with open(imname, encoding = "ISO-8859-1") as of: # TODO seek for [DatabarData] first, then count the 194 lines! ih = dict(l.strip().split(' = ') for l in of.read().split('\n')[:194] if '=' in l) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_header (filename, htypes=None):\n\n # dictionary\n dict_head = {\n # raw header\n # commenting out SIMPLE, BSCALE and BZERO - basic keywords\n # that will be present in images but not in binary fits tables\n #'SIMPLE': {'htype':'raw', 'dtype':bool, 'DB':False, 'None_...
[ "0.6709758", "0.63940704", "0.6387472", "0.6311921", "0.627738", "0.62717474", "0.62314963", "0.62271684", "0.61668515", "0.61574554", "0.60508275", "0.6018981", "0.60126644", "0.6010723", "0.59902763", "0.593532", "0.5927394", "0.5897869", "0.57868385", "0.57868385", "0.5757...
0.66334915
1
For a given set of dimensionless heat capacity data `Cvlist` corresponding to temperature list `Tlist` in K, fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes. External and other previouslyknown modes should have already been removed from `Cvlist` prior to calling this function. You must provide a...
def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None): # You must specify at least 7 heat capacity points to use in the fitting; # you can specify as many as you like above that minimum if len(Tlist) < 7: raise StatmechFitError('You must specify at least 7 heat capacity points to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechDirect(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # Construct the lower and upper bounds for each variable\n bounds = []\n # Bounds for harmonic oscillator frequencies\n for i in range(Nvib):\n bounds.append((hoFreqLowerBound, hoFreqUpperBound))\n # Bounds for hindered roto...
[ "0.6258205", "0.59177995", "0.57747304", "0.53855324", "0.52379996", "0.5189323", "0.51705194", "0.5094938", "0.5057895", "0.49590996", "0.49028978", "0.48883164", "0.4881741", "0.48618186", "0.48579624", "0.4830536", "0.47857985", "0.47836864", "0.47786778", "0.47585952", "0...
0.6634018
0
Fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes to the provided dimensionless heat capacities `Cvlist` at temperatures `Tlist` in K. This method assumes that there are enough heat capacity points provided that the vibrational frequencies and hindered rotation frequency barrier pairs can be fit d...
def fitStatmechDirect(Tlist, Cvlist, Nvib, Nrot, molecule=None): # Construct the lower and upper bounds for each variable bounds = [] # Bounds for harmonic oscillator frequencies for i in range(Nvib): bounds.append((hoFreqLowerBound, hoFreqUpperBound)) # Bounds for hindered rotor frequencie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # You must specify at least 7 heat capacity points to use in the fitting;\n # you can specify as many as you like above that minimum\n if len(Tlist) < 7:\n raise StatmechFitError('You must specify at least 7 heat capacity ...
[ "0.7132348", "0.6019964", "0.57076234", "0.5255491", "0.5208966", "0.50486803", "0.49962127", "0.49387914", "0.48546904", "0.47602648", "0.4752867", "0.47441545", "0.47350878", "0.47301233", "0.4673184", "0.46208584", "0.46154496", "0.46078372", "0.45996413", "0.45746738", "0...
0.6103077
1
Fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes to the provided dimensionless heat capacities `Cvlist` at temperatures `Tlist` in K. This method assumes that there are enough heat capacity points provided that the vibrational frequencies can be fit directly, but the hindered rotors must be combi...
def fitStatmechPseudoRotors(Tlist, Cvlist, Nvib, Nrot, molecule=None): # Construct the lower and upper bounds for each variable bounds = [] # Bounds for harmonic oscillator frequencies for i in range(Nvib): bounds.append((hoFreqLowerBound, hoFreqUpperBound)) # Bounds for pseudo-hindered rot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # You must specify at least 7 heat capacity points to use in the fitting;\n # you can specify as many as you like above that minimum\n if len(Tlist) < 7:\n raise StatmechFitError('You must specify at least 7 heat capacity ...
[ "0.7044471", "0.6196605", "0.60360116", "0.50493073", "0.50484276", "0.5042975", "0.48713553", "0.47226658", "0.46531764", "0.4640844", "0.46398926", "0.45862988", "0.45844907", "0.45613056", "0.4558295", "0.45362642", "0.4533591", "0.45092642", "0.4467235", "0.44669557", "0....
0.6537572
1
Fit `Nvib` harmonic oscillator and `Nrot` hindered internal rotor modes to the provided dimensionless heat capacities `Cvlist` at temperatures `Tlist` in K. This method assumes that there are relatively few heat capacity points provided, so the vibrations must be combined into one real vibration and two "pseudovibratio...
def fitStatmechPseudo(Tlist, Cvlist, Nvib, Nrot, molecule=None): # Construct the lower and upper bounds for each variable bounds = [] # x[0] corresponds to the first harmonic oscillator (real) frequency bounds.append((hoFreqLowerBound, hoFreqUpperBound)) # x[1] corresponds to the degeneracy of the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitStatmechToHeatCapacity(Tlist, Cvlist, Nvib, Nrot, molecule=None):\n\n # You must specify at least 7 heat capacity points to use in the fitting;\n # you can specify as many as you like above that minimum\n if len(Tlist) < 7:\n raise StatmechFitError('You must specify at least 7 heat capacity ...
[ "0.68661004", "0.631563", "0.6123873", "0.5089853", "0.50879455", "0.49770182", "0.4871406", "0.48591155", "0.484959", "0.47010407", "0.4681783", "0.46318635", "0.45723057", "0.45695278", "0.45665184", "0.4564709", "0.45531625", "0.4551914", "0.45249", "0.4496649", "0.4472451...
0.5910316
3
Return the heat capacity in J/molK at the given set of temperatures `Tlist` in K for the harmonic oscillator with a frequency `freq` in cm^1.
def harmonicOscillator_heatCapacity(T, freq): x = freq / (0.695039 * T) # kB = 0.695039 cm^-1/K exp_x = math.exp(x) one_minus_exp_x = 1.0 - exp_x return x * x * exp_x / one_minus_exp_x / one_minus_exp_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeatCapacity(self, Tlist):\n\t\treturn _modes.harmonicoscillator_heatcapacity(Tlist, self.frequency) * self.degeneracy", "def harmonicOscillator_d_heatCapacity_d_freq(T, freq):\n x = freq / (0.695039 * T) # kB = 0.695039 cm^-1/K\n exp_x = math.exp(x)\n one_minus_exp_x = 1.0 - exp_x\n re...
[ "0.7163064", "0.71257627", "0.68290627", "0.6795192", "0.6786145", "0.6622097", "0.64092433", "0.62078923", "0.6155763", "0.60118943", "0.5884279", "0.5819744", "0.5750861", "0.57141733", "0.56468594", "0.5608937", "0.5543009", "0.5515287", "0.5447956", "0.53431475", "0.53323...
0.7431342
0
Return the first derivative of the heat capacity with respect to the harmonic oscillator frequency in J/molK/cm^1 at the given set of temperatures `Tlist` in K, evaluated at the frequency `freq` in cm^1.
def harmonicOscillator_d_heatCapacity_d_freq(T, freq): x = freq / (0.695039 * T) # kB = 0.695039 cm^-1/K exp_x = math.exp(x) one_minus_exp_x = 1.0 - exp_x return x * exp_x / one_minus_exp_x / one_minus_exp_x * (2.0 + x + 2.0 * x * exp_x / one_minus_exp_x) * x / freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def harmonicOscillator_heatCapacity(T, freq):\n x = freq / (0.695039 * T) # kB = 0.695039 cm^-1/K\n exp_x = math.exp(x)\n one_minus_exp_x = 1.0 - exp_x\n return x * x * exp_x / one_minus_exp_x / one_minus_exp_x", "def hinderedRotor_d_heatCapacity_d_freq(T, freq, barr):\n x = constants.h * c...
[ "0.66852283", "0.6590223", "0.621406", "0.61375594", "0.58432394", "0.5664569", "0.5585242", "0.55327094", "0.5501561", "0.5434934", "0.5308666", "0.5281351", "0.5243485", "0.52303797", "0.5228673", "0.51834196", "0.5166179", "0.51437104", "0.51344746", "0.5100388", "0.508913...
0.75777584
0
Return the heat capacity in J/molK at the given set of temperatures `Tlist` in K for the 1D hindered rotor with a frequency `freq` in cm^1 and a barrier height `barr` in cm^1.
def hinderedRotor_heatCapacity(T, freq, barr): x = constants.h * constants.c * 100. * freq / constants.kB / T exp_x = math.exp(x) one_minus_exp_x = 1.0 - exp_x z = 0.5 * constants.h * constants.c * 100. * barr / constants.kB / T BB = scipy.special.i1(z) / scipy.special.i0(z) return x * x * exp_x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hinderedRotor_d_heatCapacity_d_barr(T, freq, barr):\n z = 0.5 * constants.h * constants.c * 100. * barr / constants.kB / T\n BB = scipy.special.i1(z) / scipy.special.i0(z)\n return z * (1 - 2 * z * BB + BB * BB + 2 * z * BB * BB * BB) * z / barr", "def hinderedRotor_d_heatCapacity_d_freq(T, freq, ba...
[ "0.6776927", "0.6629585", "0.6302823", "0.6265761", "0.6249234", "0.6213433", "0.61068034", "0.59889144", "0.5958544", "0.59443885", "0.58387303", "0.5672785", "0.5489304", "0.535626", "0.5331149", "0.5270583", "0.5189233", "0.5121388", "0.49093267", "0.48052287", "0.47886142...
0.68888056
0
Return the first derivative of the heat capacity with respect to the hindered rotor frequency in J/molK/cm^1 at the given set of temperatures `Tlist` in K, evaluated at the frequency `freq` in cm^1 and a barrier height `barr` in cm^1.
def hinderedRotor_d_heatCapacity_d_freq(T, freq, barr): x = constants.h * constants.c * 100. * freq / constants.kB / T exp_x = math.exp(x) one_minus_exp_x = 1.0 - exp_x return x * exp_x / one_minus_exp_x / one_minus_exp_x * (2 + x + 2 * x * exp_x / one_minus_exp_x) * x / freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hinderedRotor_d_heatCapacity_d_barr(T, freq, barr):\n z = 0.5 * constants.h * constants.c * 100. * barr / constants.kB / T\n BB = scipy.special.i1(z) / scipy.special.i0(z)\n return z * (1 - 2 * z * BB + BB * BB + 2 * z * BB * BB * BB) * z / barr", "def hinderedRotor_heatCapacity(T, freq, barr):\n ...
[ "0.71285737", "0.6478923", "0.6444968", "0.5749547", "0.56793684", "0.5572982", "0.54065436", "0.53827864", "0.5258031", "0.5257182", "0.52520823", "0.519607", "0.50965065", "0.49622813", "0.49369383", "0.49278474", "0.48772767", "0.4856664", "0.48498905", "0.48304605", "0.47...
0.7382771
0
Return the first derivative of the heat capacity with respect to the hindered rotor frequency in J/molK/cm^1 at the given set of temperatures `Tlist` in K, evaluated at the frequency `freq` in cm^1 and a barrier height `barr` in cm^1.
def hinderedRotor_d_heatCapacity_d_barr(T, freq, barr): z = 0.5 * constants.h * constants.c * 100. * barr / constants.kB / T BB = scipy.special.i1(z) / scipy.special.i0(z) return z * (1 - 2 * z * BB + BB * BB + 2 * z * BB * BB * BB) * z / barr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hinderedRotor_d_heatCapacity_d_freq(T, freq, barr):\n x = constants.h * constants.c * 100. * freq / constants.kB / T\n exp_x = math.exp(x)\n one_minus_exp_x = 1.0 - exp_x\n return x * exp_x / one_minus_exp_x / one_minus_exp_x * (2 + x + 2 * x * exp_x / one_minus_exp_x) * x / freq", "def hinderedR...
[ "0.73835194", "0.64815336", "0.64464134", "0.57504225", "0.5682341", "0.557329", "0.54102564", "0.53866494", "0.5260977", "0.5259946", "0.5251516", "0.5194793", "0.5095279", "0.49629185", "0.4936573", "0.49281287", "0.48756847", "0.48563507", "0.48486865", "0.4834765", "0.479...
0.71289545
1
compute the n period relative strength indicator
def relative_strength(prices, n): deltas = np.diff(prices) seed = deltas[:n+1] # takes the last 1 price differences? 12 market days? up = seed[seed>=0].sum()/n down = -seed[seed<0].sum()/n rs = up/down rsi = np.zeros_like(prices) rsi[:n] = 100. - 100./(1.+rs) for i in range(n, len(pric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateRelativeStrengthIndex(self, series, interval=14):\n\n if not isinstance(series, pd.Series):\n raise TypeError('Pandas Series required.')\n\n if not isinstance(interval, int):\n raise TypeError('Interval integer required.')\n\n if(len(series) < interval):\n ...
[ "0.62993854", "0.6251063", "0.62505263", "0.61611295", "0.6143028", "0.5975309", "0.5954106", "0.58517736", "0.5804187", "0.57787424", "0.57643014", "0.5751086", "0.5728138", "0.5679147", "0.56747293", "0.5648136", "0.56302524", "0.56128484", "0.55958307", "0.556552", "0.5563...
0.66415566
0
r"""Encodes the input by passing through the encoder network and returns the latent codes.
def encode(self, inputs): result = self.encoder(inputs) # [N x 512 x 4 x 4] result = torch.flatten(result, start_dim=1) # [N x 8192] return self.fc_mu(result), self.fc_var(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoder(self, inputs):\n pass", "def encode(self):\n with tf.name_scope(\"encode\"):\n self.encoder_inputs = tf.layers.dense(\n inputs=self.encoder_inputs,\n units=self.options['hidden_size'], activation=None, use_bias=True,\n kernel_initi...
[ "0.7359279", "0.715711", "0.7042397", "0.6925385", "0.67847055", "0.6707564", "0.6687429", "0.66821134", "0.66587514", "0.6600888", "0.65923876", "0.65555626", "0.6519889", "0.64369076", "0.6398737", "0.634382", "0.6303421", "0.6291561", "0.6290792", "0.6282953", "0.6275337",...
0.65906525
11
r"""Maps the given latent codes onto the image space.
def decode(self, z): result = self.decoder_input(z) result = result.view(-1, 512, 4, 4) result = self.decoder(result) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, latent_codes, **kwargs):\n raise NotImplementedError(f'Should be implemented in derived class!')", "def prepare_map(self):\n for y_coord, row in enumerate(self.contents):\n for x_coord, tile in enumerate(row):\n bit_map = self.get_tile_bitmap(tile)\n ...
[ "0.6005514", "0.5933257", "0.5838075", "0.5818631", "0.5656862", "0.56560636", "0.56560636", "0.56314653", "0.5581515", "0.55739915", "0.55533266", "0.55513483", "0.55221444", "0.54776543", "0.5458927", "0.5432332", "0.5427928", "0.53670174", "0.5355888", "0.53041667", "0.530...
0.0
-1
r"""Reparameterization trick to sample from N(mu, var) from N(0,1).
def reparameterize(self, mu, log_var): std = torch.exp(0.5 * log_var) eps = torch.randn_like(std) return eps * std + mu
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reparameterized_sample(self, mean, std):\n eps = torch.zeros(std.size(), device=self.device, dtype=torch.float32).normal_()\n eps = eps.requires_grad_()\n return eps.mul(std).add_(mean)", "def sample_low_rank(self, n_samples, mu, logvar, F):\n #F = torch.unsqueeze(F, dim=1).repea...
[ "0.6662356", "0.65233475", "0.65074307", "0.644771", "0.6394351", "0.6394351", "0.6386821", "0.63468987", "0.6301969", "0.6298426", "0.62799734", "0.62720144", "0.6258597", "0.6256825", "0.6253637", "0.6253637", "0.6253637", "0.6253637", "0.6253637", "0.6240244", "0.62155056"...
0.6309882
8
r"""Computes the VAE loss function. KL(N(\mu, \sigma), N(0, 1)) = \log \frac{1}{\sigma} + \frac{\sigma^2 + \mu^2}{2} \frac{1}{2}
def loss_fn(self, recons, inputs, mu, log_var, **kwargs): # kld_weight = kwargs['M_N'] # Account for the minibatch samples from the dataset recons_loss = F.mse_loss(recons, inputs) # recons_loss = F.binary_cross_entropy(recons, inputs) KLD = torch.mean(-0.5 * torch.sum(1 + log_var - mu**...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vae_loss(recon_x, x, mu_logvar):\n mu = mu_logvar[:, 0:int(mu_logvar.size()[1]/2)]\n logvar = mu_logvar[:, int(mu_logvar.size()[1]/2):]\n# KLD = -0.5 * torch.sum(1 + 2 * logvar - mu.pow(2) - (2 * logvar).exp())\n KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())\n# BCE = F.binary_c...
[ "0.71050805", "0.6940623", "0.6602319", "0.6597178", "0.6597178", "0.6597178", "0.6597178", "0.6519826", "0.6477681", "0.64758873", "0.64575756", "0.64531076", "0.64357793", "0.63821673", "0.63579816", "0.631307", "0.6311189", "0.6289294", "0.62851536", "0.6265628", "0.625308...
0.6408748
13
r"""Samples from the latent space and return the corresponding image space map.
def sample(self, num_samples, current_device, **kwargs): z = torch.randn(num_samples, self.latent_dim) z = z.to(current_device) samples = self.decode(z) return samples
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_to_latent_space(data_sample, model) -> np.ndarray: # [N x Z]\n\n latent_coords = []\n\n for batch in data_sample:\n # run encoder\n coords = model.encoder(batch)\n latent_coords.append(coords)\n\n # return latent (per jet?)\n return np.concatenate(latent_coords, axis=0)", ...
[ "0.61733603", "0.6100167", "0.60555536", "0.59709185", "0.59704363", "0.5918826", "0.5892295", "0.58649856", "0.5847293", "0.581955", "0.58138406", "0.5768181", "0.5711329", "0.57023966", "0.5692044", "0.56795436", "0.5646572", "0.5634537", "0.5623634", "0.5615229", "0.561106...
0.5777933
11
r"""Given an input image x, returns the reconstructed image
def generate(self, x): return self.forward(x)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_image(x):\n reverse_mean = [-0.485, -0.456, -0.406]\n reverse_std = [1/0.229, 1/0.224, 1/0.225]\n in_channel = x.shape[-1]\n recreated_im = copy.copy(x) # C, H, W\n if in_channel == 3:\n for c in range(in_channel):\n recreated_im[:, :, c] /= reverse_std[c]\n ...
[ "0.7366667", "0.6921181", "0.6734784", "0.6608169", "0.6577374", "0.64686996", "0.64662826", "0.6452119", "0.6434497", "0.62245506", "0.62063634", "0.62025005", "0.6197715", "0.6181233", "0.61551434", "0.6153792", "0.61470103", "0.6140627", "0.6138117", "0.61186534", "0.61101...
0.0
-1
Get account data from SWAG (via S3)
def get_swag(): swag_opts = { 'swag.type': 's3', 'swag.bucket_name': CONFIG.swag_bucket, 'swag.data_file': CONFIG.swag_data_file, 'swag.region': CONFIG.swag_region, 'swag.cache_expires': 0 } return SWAGManager(**parse_swag_config_options(swag_opts))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_usofa_data(bucketname):\n client = boto3.client('s3')\n result = client.get_object(Bucket=bucketname, Key='accounts.json')\n return json.loads(result['Body'].read().decode('utf-8'))", "def s3_read_data(self):\n\n self.k.open()\n self.k.read()", "def __retrieve_from_bucket(fname):\n b...
[ "0.678359", "0.67407", "0.65665984", "0.64687663", "0.62724787", "0.6271271", "0.61905503", "0.6168407", "0.6160477", "0.6136951", "0.613336", "0.6129173", "0.61195844", "0.61035234", "0.6100174", "0.60862297", "0.6084497", "0.60571164", "0.6030108", "0.5998103", "0.59974277"...
0.0
-1
Given a network G, a dict of characteristics chars for node IDs, and dict of node IDs for each node in the network, find the homophily of the network.
def homophily(G, chars, IDs): num_same_ties = 0 num_ties = 0 for n1, n2 in G.edges(): if IDs[n1] in chars and IDs[n2] in chars: if G.has_edge(n1, n2): num_ties += 1 if chars[IDs[n1]] == chars[IDs[n2]]: num_same_ties += 1 return (num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_Motifs(H, m):\n\t#This function will take each possible subgraphs of gr of size 3, then\n\t#compare them to the mo dict using .subgraph() and is_isomorphic\n\t\n\t#This line simply creates a dictionary with 0 for all values, and the\n\t#motif names as keys\n\n\t##paper source \"Higher-order organization ...
[ "0.63757825", "0.61899877", "0.60356104", "0.6001322", "0.59994", "0.5963691", "0.59627503", "0.5926058", "0.5918671", "0.59054536", "0.582346", "0.5799736", "0.5697312", "0.5679989", "0.5668", "0.5662608", "0.5636551", "0.5565752", "0.5540963", "0.553925", "0.5511987", "0....
0.6105953
2
Agent which implements Q Learning
def __init__(self, state_shape: tuple, action_shape: tuple, name: str, side: str = "up", epsilon: float = 0.0, intervall_turns_train: int = np.Inf, intervall_turns_load: int = np.Inf, save_path: str = "../data/modeldata/q/model.ckpt", caching: bool = False, config: Con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, epsilon=0.05,gamma=0.8,alpha=0.2, numTraining=0, **args):\n args['epsilon'] = epsilon\n args['gamma'] = gamma\n args['alpha'] = alpha\n args['numTraining'] = numTraining\n QLearningAgent.__init__(self, **args)", "def __init__(self, epsilon=0.05,gamma=0.8,alpha=0.2, numTraining=0...
[ "0.7534157", "0.72916085", "0.7178249", "0.70445454", "0.7", "0.6985736", "0.6985736", "0.6985736", "0.689876", "0.68947405", "0.6880697", "0.68613094", "0.6834198", "0.6831387", "0.6820141", "0.6799026", "0.6772288", "0.6765899", "0.67192644", "0.6704822", "0.66806555", "0...
0.0
-1
triggered by get play turn method of super class. This is the method were the magic should happen that chooses the right action
def decision(self, state_space: np.ndarray, action_space: ActionSpace): # preprocess state space # normalizing state space between zero and one ( 2 is max value of stone and -2 is min value of stone state_space = min_max_scaling(state_space) state_space = state_space.reshape(1, multiply(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn(self):\n pass", "def play(self, player, game): \n super().play(player, game)\n game.set_action(\"SLEEP_CODER\")", "def game_play(self):", "def play(self, player, game):\n super().play(player, game)\n game.set_action(\"STEAL_CODER\")", "def begin_turn(self)...
[ "0.7292713", "0.7109823", "0.7075418", "0.7049332", "0.695085", "0.68663824", "0.6862658", "0.67548853", "0.67518234", "0.67462504", "0.67203665", "0.6714001", "0.66854596", "0.66723174", "0.6632199", "0.65679246", "0.6557006", "0.6557006", "0.65565354", "0.6540824", "0.65384...
0.0
-1
pick actions given qvalues. Uses epsilongreedy exploration strategy.
def _sample_actions(self, qvalues: np.ndarray, action_space: ActionSpace): epsilon = self.epsilon batch_size, x = qvalues.shape dim = int(x ** 0.25) qvalues_reshaped = np.reshape(qvalues, (dim, dim, dim, dim)) if random.random() < epsilon: keys = [key for key in actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self, q_values):\n assert q_values.ndim == 1\n q_values = q_values.astype('float64')\n nb_actions = q_values.shape[0]\n\n exp_values = np.exp(np.clip(q_values / self.tau, self.clip[0], self.clip[1]))\n probs = exp_values / np.sum(exp_values)\n action = np...
[ "0.760534", "0.75458944", "0.7489394", "0.7308543", "0.7302607", "0.7277997", "0.7277997", "0.7277997", "0.70307344", "0.68159276", "0.6684784", "0.6582526", "0.6519748", "0.6445827", "0.6419524", "0.64174616", "0.6408558", "0.6391456", "0.63895744", "0.6350018", "0.6345844",...
0.65002364
13
takes agent's observation, returns qvalues. Both are tf Tensors
def _get_qvalues(self, state_t): qvalues = self.network(state_t) return qvalues
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_q_values(self, observations, twin_q=False):\n if twin_q:\n q_model = self.twin_q_model\n else:\n q_model = self.main_q_model\n\n q_vals = q_model([observations[self.vf_obs_key]])\n return tf.reshape(q_vals, [-1, self.num_outputs])", "def get_qvalues(self,...
[ "0.75412387", "0.7281996", "0.71252626", "0.69886816", "0.6963875", "0.6963875", "0.69577503", "0.68997633", "0.65830016", "0.6473342", "0.6445998", "0.64198893", "0.63429874", "0.6339201", "0.63150895", "0.63051134", "0.63030916", "0.6275476", "0.62655336", "0.6251307", "0.6...
0.64679205
10
assign target_network.weights variables to their respective agent.weights values.
def load_weigths_into_target_network(self): logging.debug("Transfer Weight!") self.network.save_weights(self._save_path) self.target_network.load_weights(self._save_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_target_network(self):\n self.target.set_weights(self.policy.get_weights()) # Update weights of target network with weights of policy network", "def transfer_weights(self):\n W, target_W = self.model.get_weights(), self.target_model.get_weights()\n for i in range(len(W)):\n ...
[ "0.74298966", "0.7240756", "0.7069389", "0.70639586", "0.6890794", "0.6858491", "0.68172055", "0.67953044", "0.66856223", "0.6684053", "0.6666912", "0.66301864", "0.66301864", "0.66301864", "0.6627997", "0.6626138", "0.66244763", "0.6613709", "0.6606935", "0.65739423", "0.657...
0.7086991
2
relative if true, the exclusion of the ratios (relative to the inputs given) are plotted. If False, these ratios are multiplied by the SM cross sections and branching ratios into gamma gamma inputIsAbs is a list (set) of file names which should be treated as if they had ABSOLUTE limits on cross sections rather than rel...
def makePlot(csvFnames, relative, includeExpected = True, fermiophobic = None, ymax = None, inputIsAbs = None, drawXsectBR = False, minMass = None, maxMass = None, plotLog = False ): #-------------------- # read the files #--------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotBatch(inp,output='spectra_plot.pdf',comparisons=None,classify=False,normalize=False,normrange=[0.9,1.4],layout=[2,2],basecolors=['k','m'],legend=[],fontscale=0.7,classify_kwargs={},plot_kwargs={},**kwargs):\n\n# alt keyword check\n for k in ['file','filename']: \n if kwargs.get(k,'') != '': outpu...
[ "0.5534918", "0.515236", "0.51322854", "0.49179512", "0.48812607", "0.48483542", "0.4839429", "0.47949347", "0.47881106", "0.47665024", "0.47452495", "0.4722007", "0.47154492", "0.46393847", "0.462126", "0.46191898", "0.460472", "0.46012208", "0.4596538", "0.4591982", "0.4580...
0.60177034
0
Generates a string of chuncks from an initial chunk.
def chunk_seq(f, text, order=3, length=50): next_chunk = text[-1] chunklist = next_chunk.split() while len(text) * order < length: candidates = gather_next_chunks(f, chunklist, order) #1 candidates_edited = edit_chunks(candidates) #print candidates_edited ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunkify(msg):\n return [\"%s %s\" % (i, msg[i*158 : (i+1)*158]) for i in range(len(msg)/158 + 1)]", "def getChunks():", "def full_chromosomes(reader):\n for line in reader.header.get_lines(\"contig\"):\n if line.id in CHROMS:\n name = line.id\n length = line.length or 1_...
[ "0.54023075", "0.5305364", "0.5266323", "0.52563137", "0.5210865", "0.51348937", "0.5116953", "0.50660634", "0.5042289", "0.50343066", "0.5030568", "0.5028163", "0.50268525", "0.5004204", "0.49979058", "0.4997518", "0.49932313", "0.49587467", "0.4947032", "0.49435583", "0.491...
0.0
-1
Test the CommandList class
def test_CommandList(): from paradrop.confd.command import CommandList clist = CommandList() clist.append(20, "b") clist.append(20, "c") clist.append(10, "a") commands = list(clist.commands()) assert commands == ["a", "b", "c"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arg_parser_list(self):\n args = self.parser.parse_args(['list'])\n self.assertEqual(args.command, 'list')", "def test_listCommand(self):\n acli = ArmiCLI()\n\n origout = sys.stdout\n try:\n out = io.StringIO()\n sys.stdout = out\n acli....
[ "0.7797336", "0.7349881", "0.72588724", "0.72235614", "0.72235614", "0.7143625", "0.71298486", "0.70965886", "0.68910056", "0.68389577", "0.68290025", "0.6811658", "0.67939836", "0.6771567", "0.6757199", "0.6725292", "0.669489", "0.6669298", "0.65990645", "0.6597851", "0.6595...
0.81857985
0
Test the Command.execute method
def test_Command_execute(Popen, out): from paradrop.confd.command import Command proc = MagicMock() proc.stdout = ["output"] proc.stderr = ["error"] Popen.return_value = proc command = Command(["callme"]) command.parent = MagicMock() command.execute() assert out.verbose.called_onc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute():\n pass", "def test_command(self):\n output, _error = self.executor.command(['echo', 'hello']).batch()\n self.assertEqual(output, 'hello\\n')", "def execute_command(self):\n raise Exception(\"Not implemented\")", "def test_command(self):\n\n expected = \"PyFun...
[ "0.76571196", "0.76401484", "0.76354915", "0.7635409", "0.75945634", "0.73478067", "0.73478067", "0.73478067", "0.73478067", "0.73478067", "0.73478067", "0.73469025", "0.7315164", "0.7250304", "0.7222985", "0.72060025", "0.72060025", "0.72060025", "0.72060025", "0.72033477", ...
0.6589691
69
Test the KillCommand class
def test_KillCommand(execute): from paradrop.confd.command import KillCommand # Test with a numeric pid. command = KillCommand(12345) assert command.getPid() == 12345 expected = ["kill", "12345"] command.execute() assert execute.called_once_with(expected) execute.reset_mock() pid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kill(self):\n A = ConwayAgent(23, True)\n self.assertTrue(A.status() == 1)\n A.kill()\n self.assertTrue(A.status() == 0)", "def remote_kill():", "def test_build_kill_command(self):\n actual_result = IperfKillCommandBuilder(SERVER_USER)\\\n .set_ip_address(...
[ "0.7480365", "0.71652985", "0.6940902", "0.6931124", "0.6846783", "0.6776122", "0.6691397", "0.6687754", "0.6556142", "0.6425788", "0.64247656", "0.6313827", "0.6313541", "0.6313541", "0.63063496", "0.62784046", "0.6265679", "0.6265679", "0.62479097", "0.6243085", "0.6227352"...
0.7495398
0
A hook to start the Selenium Server provided with SeleniumLibrary. `logfile` must be either an opened file (or filelike object) or None. If not None, Selenium Server log will be written to it. `jarpath` must be either the absolute path to the seleniumserver.jar or None. If None, the jar file distributed with the librar...
def start_selenium_server(logfile=None, jarpath=None, *params): if not subprocess: raise RuntimeError('This function requires `subprocess` module which ' 'is available on Python/Jython 2.5 or newer.') cmd = _server_startup_command(jarpath, *params) try: subprocess....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_selenium_server(self, *params):\n params = ('-port', str(self._server_port)) + params\n logpath = os.path.join(self._get_log_dir(), 'selenium_server_log.txt')\n self._selenium_log = open(logpath, 'w')\n start_selenium_server(self._selenium_log, self._jar_path, *params)\n ...
[ "0.6576157", "0.59147495", "0.551453", "0.5020369", "0.4867105", "0.48326635", "0.48120183", "0.48082626", "0.4748094", "0.4661346", "0.4636292", "0.46114662", "0.4580532", "0.4558185", "0.45508748", "0.45206273", "0.45122933", "0.44885132", "0.4487213", "0.44591105", "0.4454...
0.81625164
0
Shuts down the Selenium Server. `host` and `port` define where the location of Selenium Server. Does not fail even if the Selenium Server is not running.
def shut_down_selenium_server(host='localhost', port=4444): try: selenium(host, port, '', '').shut_down_selenium_server() except socket.error: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_selenium_server(self):\n shut_down_selenium_server(self._server_host, self._server_port)\n self._selenium = NoBrowserOpen()\n if self._selenium_log:\n self._selenium_log.close()", "def shutdown(self):\n # TODO: Build a certificate chain so we can verify our localho...
[ "0.6310834", "0.6110192", "0.6078012", "0.59138757", "0.57922274", "0.5763965", "0.56827766", "0.566105", "0.55425066", "0.55398613", "0.5532105", "0.5505663", "0.54810226", "0.5456112", "0.5435537", "0.5409633", "0.5404485", "0.5392909", "0.53838885", "0.53706366", "0.532538...
0.8380863
0
SeleniumLibrary can be imported with optional arguments. `timeout` is the default timeout used to wait for page load actions. It can be later set with `Set Selenium Timeout` `server_host` and `server_port` are used to connect to Selenium Server. Browsers opened with this SeleniumLibrary instance will be attached to tha...
def __init__(self, timeout=5.0, server_host='localhost', server_port=4444, jar_path=None, run_on_failure='Capture Screenshot'): self._cache = utils.ConnectionCache() self._selenium = NoBrowserOpen() self.set_selenium_timeout(timeout or 5.0) self._server_host, self._serve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, driver_path: str = None, waiter_timeout: int = 3, options: List[str] = None):\n\n # selecting driver\n if not driver_path:\n driver = webdriver.Firefox\n driver_options = FireFoxOptions()\n else:\n driver = webdriver.Chrome\n drive...
[ "0.5883255", "0.5759221", "0.57567716", "0.5650392", "0.5649762", "0.55207306", "0.5444826", "0.53997815", "0.535544", "0.5268799", "0.5228582", "0.5209584", "0.5167454", "0.5134206", "0.50916547", "0.50906485", "0.505967", "0.5057035", "0.50250274", "0.49927777", "0.49799502...
0.5961083
0
The selenium remote control instance of currently active browser.
def selenium(self): return self._selenium
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_webdriver_instance():\n return selenium._current_browser()\n # return PageBase.get_selenium2library_instance()._current_browser()", "def remote_control(self) -> interface.RemoteControl:\n return cast(interface.RemoteControl, self._interfaces[interface.RemoteControl])", "def get_ins...
[ "0.71983075", "0.6925138", "0.64066046", "0.6203262", "0.6168742", "0.5982635", "0.5981238", "0.5977537", "0.58916575", "0.5799441", "0.57358706", "0.572651", "0.57153845", "0.5688557", "0.5687891", "0.56801546", "0.56783015", "0.5634735", "0.5615675", "0.5575124", "0.5522626...
0.62758404
3
Starts the Selenium Server provided with SeleniumLibrary. `params` can contain additional command line options given to the Selenium Server. This keyword uses some command line options
def start_selenium_server(self, *params): params = ('-port', str(self._server_port)) + params logpath = os.path.join(self._get_log_dir(), 'selenium_server_log.txt') self._selenium_log = open(logpath, 'w') start_selenium_server(self._selenium_log, self._jar_path, *params) self._ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_selenium_server(logfile=None, jarpath=None, *params):\n if not subprocess:\n raise RuntimeError('This function requires `subprocess` module which '\n 'is available on Python/Jython 2.5 or newer.')\n cmd = _server_startup_command(jarpath, *params)\n try:\n ...
[ "0.62242675", "0.58627564", "0.56516945", "0.56402934", "0.56345683", "0.56059575", "0.56059575", "0.5513187", "0.5233649", "0.5220939", "0.51877004", "0.51692015", "0.51691693", "0.5165994", "0.51010007", "0.50910467", "0.50774854", "0.5061027", "0.50559413", "0.5016454", "0...
0.6509325
0
Stops the selenium server (and closes all browsers).
def stop_selenium_server(self): shut_down_selenium_server(self._server_host, self._server_port) self._selenium = NoBrowserOpen() if self._selenium_log: self._selenium_log.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_browser(self):\n self.driver.quit()", "def shut_down_selenium_server(host='localhost', port=4444):\n try:\n selenium(host, port, '', '').shut_down_selenium_server()\n except socket.error:\n pass", "def __exit__(self, exc_type, exc_val, exc_tb):\n self.server.stop()\n ...
[ "0.7995364", "0.7863133", "0.7835495", "0.74924666", "0.7464111", "0.7453941", "0.7446109", "0.7424754", "0.7343588", "0.73252535", "0.7277652", "0.72618127", "0.7260277", "0.7200706", "0.71930265", "0.71509975", "0.7085253", "0.70522535", "0.7039435", "0.7002137", "0.699096"...
0.83716977
0
Sets the timeout used by various keywords. Keywords that expect a page load to happen will fail if the page is not loaded within the timeout specified with `seconds`. Starting from SeleniumLibrary 2.6, this timeout is also the default timeout with various `Wait ...` keywords. See `introduction` for more information abo...
def set_selenium_timeout(self, seconds): timeout = utils.timestr_to_secs(seconds) old = getattr(self, '_timeout', timeout) self._timeout = timeout self._selenium.set_timeout(timeout * 1000) return utils.secs_to_timestr(old)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(self, seconds):\n self._timeout = seconds", "def timeout_seconds(self, timeout_seconds):\n\n self._timeout_seconds = timeout_seconds", "def timeout_seconds(self, timeout_seconds):\n\n self._timeout_seconds = timeout_seconds", "def set_timeout(self, timeout_secs):\n sel...
[ "0.7244905", "0.7077083", "0.7077083", "0.6927818", "0.6727418", "0.6487171", "0.63730776", "0.63308954", "0.6328697", "0.632715", "0.63181335", "0.6302803", "0.61149293", "0.5976687", "0.5967412", "0.5945675", "0.59285706", "0.5925558", "0.592076", "0.58889365", "0.5865888",...
0.6873225
4
Sets the delay that is waited after each Selenium command. This is useful mainly in slowing down the test execution to be able to view the execution. `seconds` may be given in Robot Framework time format. Returns the previous speed value.
def set_selenium_speed(self, seconds): old = self._selenium.get_speed() seconds = str(int(utils.timestr_to_secs(seconds)*1000)) self._selenium.set_speed(seconds) return utils.secs_to_timestr(float(old)/1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay(seconds):\n\n # Perform the delay\n time.sleep(seconds)", "def set_selenium_timeout(self, seconds):\n timeout = utils.timestr_to_secs(seconds)\n old = getattr(self, '_timeout', timeout)\n self._timeout = timeout\n self._selenium.set_timeout(timeout * 1000)\n ret...
[ "0.66323715", "0.6297846", "0.6280223", "0.62300897", "0.6206175", "0.6159071", "0.6082828", "0.60776395", "0.60160977", "0.60102314", "0.59985185", "0.59399515", "0.5932031", "0.5910213", "0.5898481", "0.58874804", "0.5863831", "0.5814787", "0.5781439", "0.5781439", "0.56741...
0.6863085
0
Calls a method in the Selenium remote control API directly. This keyword can be used if some functionality provided by Selenium is not yet exposed as a keyword. `method_name` is the name of the method to call in the Selenium API and `args` specify the arguments it expects. The keyword first tries to find a method in Se...
def call_selenium_api(self, method_name, *args): try: method = getattr(self._selenium, method_name) except AttributeError: method = lambda *args: self._selenium.do_command(method_name, args) return method(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_command_method(self, name, original_method, args, kwargs):\n if threadprop.current_controller() is not self:\n action=self._direct_comm_call_action\n if action==\"warning\":\n if name not in self._command_warned:\n print(\"Warning: direct cal...
[ "0.64679945", "0.6191388", "0.6156052", "0.614689", "0.6126066", "0.61218405", "0.6005276", "0.59827995", "0.59674746", "0.5966414", "0.5953731", "0.5952385", "0.5854593", "0.576358", "0.5734514", "0.5709739", "0.5668814", "0.56597054", "0.5618796", "0.55931056", "0.5582841",...
0.7929701
0
Adds a custom location strategy. `strategy_name` is the name of the strategy; a prefix used when addressing an element. `function_definition` is the JavaScript that will be called. It must return a DOM reference, an array with DOM references, or null. Together with the modified seleniumserver.jar it can provide a new m...
def add_location_strategy(self, strategy_name, function_definition): self._locator_parser.add_strategy(strategy_name) self._selenium.add_location_strategy(strategy_name, function_definition)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strategy(func):\n strategies.append(func)\n return func", "def strategy(strategy_name: str):\r\n def wrapper(finder_class):\r\n global strategies\r\n strategies[strategy_name] = finder_class\r\n return finder_class\r\n return wrapper", "def _apply_hooks(\n context: HookC...
[ "0.5778675", "0.5589892", "0.47768068", "0.4705223", "0.46349427", "0.45650652", "0.44619638", "0.44110903", "0.43347523", "0.42556694", "0.42554522", "0.4228382", "0.41904864", "0.41884336", "0.41832274", "0.41638365", "0.4158864", "0.4145258", "0.41342977", "0.41133204", "0...
0.85643756
0
Squash deeply nested dictionary.
def squash(data, parent_key="", sep="."): items = [] for k, v in data.items(): k = str(k) if k[0] == "_": k = k[1:] new_key = parent_key + sep + k if parent_key else k if isinstance(v, collections.abc.MutableMapping): items.extend(squash(v, new_key, sep=s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_squeeze(dictlike):\n out = {}\n for k, v in dictlike.items():\n if isinstance(v, dict):\n out[k] = recursive_squeeze(v)\n else:\n out[k] = np.squeeze(v)\n return out", "def unflatten(\n d: Dict[str, Any],\n base: Dict[str, Any] = None,\n) -> Dict[s...
[ "0.6798054", "0.6370052", "0.63272715", "0.62804824", "0.6247005", "0.6229685", "0.6208201", "0.62053543", "0.6178594", "0.61608326", "0.6072516", "0.6069942", "0.5972645", "0.5956857", "0.59553653", "0.5934359", "0.59289074", "0.59246", "0.5923879", "0.5918683", "0.5888782",...
0.6701361
1
Logarithm of the hyperbolic cosine of the prediction error. `log(cosh(x))` is approximately equal to `(x 2) / 2` for small `x` and to `abs(x) log(2)` for large `x`. This means that 'logcosh' works mostly like the mean squared error, but will not be so strongly affected by the occasional wildly incorrect prediction.
def logcosh(y_true, y_pred): def _logcosh(x): return x + nn.softplus(-2. * x) - math_ops.log(2.) return K.mean(_logcosh(y_pred - y_true), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_cosh(y_true, y_pred):\n y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)\n y_true = math_ops.cast(y_true, y_pred.dtype)\n\n def _logcosh(x):\n return x + math_ops.softplus(-2. * x) - math_ops.cast(\n math_ops.log(2.), x.dtype)\n\n return backend.mean(_logcosh(y_pred - y_t...
[ "0.76132387", "0.72645205", "0.70176494", "0.6731372", "0.6226951", "0.62121165", "0.6074388", "0.6073056", "0.59627014", "0.5937668", "0.5929191", "0.5901009", "0.58072233", "0.5728377", "0.5656887", "0.5649234", "0.5644657", "0.5626796", "0.56044716", "0.55885035", "0.55826...
0.74146074
1
Restarts the current program.
def get(self): #python = sys.executable #os.execl(python, python, * sys.argv) os.execl(sys.executable, *([sys.executable] + sys.argv))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart(self):\n print \"Restarting \" + executable + \" \" + str(argv) \n execl(executable, *([executable]+argv))", "def restart_program():\r\n\tpython = sys.executable\r\n\tos.execl(python, python, * sys.argv)\r\n\troot = tk.Tk()", "def Restart(self):\n handler = self.get_command_obj...
[ "0.81809056", "0.77184916", "0.7704029", "0.76525164", "0.76247376", "0.7567915", "0.75503725", "0.75503725", "0.75476766", "0.7467852", "0.7454058", "0.7446032", "0.7443567", "0.7435153", "0.7336499", "0.7296281", "0.7243043", "0.72082216", "0.71947414", "0.7190868", "0.7169...
0.0
-1
Returns the pascal triangle of n.
def pascal_triangle(n): if n <= 0: return [] l = [[0 for x in range(i + 1)] for i in range(n)] l[0] = [1] for i in range(1, n): l[i][0] = 1 for j in range(1, i + 1): if j < len(l[i - 1]): l[i][j] = l[i - 1][j - 1] + l[i - 1][j] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pascal_triangle(self, n):\r\n if n == 0:\r\n return list()\r\n\r\n return [self.gen_triangle_level(i)\r\n for i\r\n in range(1, n + 1, 1)]", "def pascal_triangle(n):\n if n <= 0:\n return []\n\n a = [[1 for i in range(1, j + 1)] for j...
[ "0.83876556", "0.8313631", "0.8303543", "0.82191485", "0.8042562", "0.8002575", "0.7965688", "0.7950681", "0.7875324", "0.7869357", "0.78521544", "0.7814328", "0.7648985", "0.7577198", "0.7450272", "0.7302716", "0.71677047", "0.7041317", "0.6824642", "0.6618727", "0.659417", ...
0.83408237
1
Read simulation parameters and coordinate file
def __init__(self): self.read_input_file() self.read_simulation_files()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_simulation_files(self):\n\n # Check if simulation files exist in current directory, if not kill process\n if not os.path.isfile('{}.xyz'.format(self.prefix)):\n print('Cannot find simulation file \"{}.xyz\"'.format(self.prefix))\n sys.exit()\n if not os.path.isfi...
[ "0.6841979", "0.6729605", "0.66394055", "0.66348255", "0.64284354", "0.6424802", "0.64047414", "0.6300033", "0.62991303", "0.6293398", "0.624105", "0.62298125", "0.6183919", "0.6102133", "0.609614", "0.60784197", "0.6073304", "0.6040738", "0.5993862", "0.59910494", "0.5977948...
0.5666166
60
Read visualise setup file
def read_input_file(self): # Check if input file exists in current directory, if not kill process if not os.path.isfile('./visualise.inpt'): print('Cannot find input file "visualise.inpt" in current directory') sys.exit() # Read input file and analysis options and param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_setup(inifile):\n # inifile = os.path.join(spathy_path, inifile)\n print(inifile)\n cfg = configparser.ConfigParser()\n cfg.read(inifile)\n\n pp = {}\n for s in cfg.sections():\n section = s.encode('ascii', 'ignore')\n pp[section] = {}\n for k, v in cfg.items(section...
[ "0.6377754", "0.60416627", "0.5966378", "0.5848778", "0.57741296", "0.57032096", "0.564497", "0.5521531", "0.54921776", "0.5488427", "0.544995", "0.5425102", "0.5385421", "0.5385421", "0.53816396", "0.5381369", "0.5374962", "0.5364246", "0.5362655", "0.53585416", "0.535645", ...
0.59166896
3
Read XYZ and visualisation files from simulation
def read_simulation_files(self): # Check if simulation files exist in current directory, if not kill process if not os.path.isfile('{}.xyz'.format(self.prefix)): print('Cannot find simulation file "{}.xyz"'.format(self.prefix)) sys.exit() if not os.path.isfile('{}_vis2d....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_simulation_results(self,\n fname_sims, \n fname_pareto = None, \n fname_cull = None):\n\n \n self.fname_sims = fname_sims\n self.__read_file(fname_sims, 'sim_results')\n \n if fname_pareto is no...
[ "0.61848754", "0.6042058", "0.59669006", "0.59361804", "0.58964205", "0.5878065", "0.58193845", "0.57807654", "0.57697374", "0.57643694", "0.5762156", "0.5759421", "0.57102454", "0.56983227", "0.56967455", "0.569428", "0.56905067", "0.5686337", "0.56723523", "0.5671769", "0.5...
0.74568313
0
Visualise particles and polygons
def visualise(self): # Initialise figure params = {"figure.figsize": (5, 5)} pylab.rcParams.update(params) self.fig = plt.figure() self.ax = self.fig.add_subplot(111) # Add particles if selected print(self.crds) cmap=cm.get_cmap('coolwarm') norm=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(title, particles):\n\n plt.figure(figsize=(10,10))\n plt.title(\"Best configuration for \" + str(len(particles)) + \" particles\", size=25)\n plt.xlabel(\"xcoordinate\", size=18)\n plt.ylabel(\"ycoordinate\", size=18)\n\n plt.xticks(size=13)\n plt.yticks(size=13)\n\n circle = plt...
[ "0.717661", "0.68778163", "0.67623657", "0.65606654", "0.65092915", "0.64102745", "0.6362865", "0.63186747", "0.6282361", "0.6227061", "0.6184886", "0.616295", "0.61177635", "0.6107491", "0.6087164", "0.6042589", "0.59876037", "0.59707433", "0.5968525", "0.5959219", "0.594656...
0.72570527
0
When called with an instance of L{bytes}, L{bytes_to_str} decodes its input using I{ascii} and returns the resulting str string as an instance of L{str}.
def test_bytes(self): self.assertRaises( UnicodeDecodeError, lambda: bytes_to_str("\N{SNOWMAN}".encode("utf-8")), ) decoded = bytes_to_str(b"hello world") self.assertIsInstance(decoded, str) self.assertEqual(decoded, "hello world")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_string(_bytes: bytes)-> str:\n # print('input bytes: ', _bytes)\n # print('string: ', binascii.hexlify(_bytes))\n # print('string2: ', _bytes.hex())\n # print('string3: ', \" \".join([\"{:02x}\".format(x) for x in _bytes]))\n return \" \".join([\"{:02x}\".format(x) for x in _bytes])",...
[ "0.7246639", "0.7208778", "0.7151885", "0.71390045", "0.7111041", "0.7110607", "0.7110607", "0.70306545", "0.70047045", "0.6990467", "0.6975962", "0.6801189", "0.6800496", "0.6777518", "0.6772956", "0.6617866", "0.65932745", "0.65838194", "0.652744", "0.6471219", "0.6455923",...
0.7150879
3
When called with an instance of L{str}, L{bytes_to_str} returns its input unmodified.
def test_str(self): self.assertEqual( "\N{SNOWMAN}", bytes_to_str("\N{SNOWMAN}"), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def always_str(str_or_bytes: Union[None, str, bytes], *decode_args) -> Union[None, str]:\n if str_or_bytes is None or isinstance(str_or_bytes, str):\n return str_or_bytes\n elif isinstance(str_or_bytes, bytes):\n return str_or_bytes.decode(*decode_args)\n else:\n raise TypeError(\"Exp...
[ "0.6703084", "0.6667159", "0.665698", "0.66231215", "0.65923953", "0.6549901", "0.6501315", "0.6458548", "0.64560145", "0.6408117", "0.6405631", "0.6373941", "0.63643", "0.62835956", "0.62750614", "0.6263772", "0.62543184", "0.6227834", "0.62072873", "0.6200505", "0.61952037"...
0.0
-1
When called with L{None}, L{to_xml} returns a L{Deferred} that fires with C{b""}.
def test_none(self): self.assertEqual(b"", self.successResultOf(to_xml(None)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(self):\n with io.StringIO() as string:\n string.write(ET.tostring(self.root, encoding=\"unicode\"))\n return string.getvalue()", "def xml_string(self):\r\n if self._xml_string is not None:\r\n return self._xml_string\r\n\r\n return etree.tostring(...
[ "0.6010409", "0.5807119", "0.5803181", "0.57231146", "0.5688771", "0.5660354", "0.54970235", "0.5462216", "0.54385936", "0.538115", "0.53393245", "0.5326203", "0.5314152", "0.53080094", "0.5306955", "0.52890134", "0.52495795", "0.5163723", "0.5145049", "0.513027", "0.5113245"...
0.70309347
0
When called with an instance of L{txaws.route53._util.Tag}, L{to_xml} returns a L{Defered} giving the result of flattening it as an instance of L{bytes} with an xml doctype prepended.
def test_something(self): self.assertEqual( b"""<?xml version="1.0" encoding="UTF-8"?>\n<Foo>bar</Foo>""", self.successResultOf(to_xml(tags.Foo("bar"))), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(self):\n with io.StringIO() as string:\n string.write(ET.tostring(self.root, encoding=\"unicode\"))\n return string.getvalue()", "def to_xml(self):\r\n if self.alias_hosted_zone_id != None and self.alias_dns_name != None:\r\n # Use alias\r\n b...
[ "0.6391548", "0.61091745", "0.6022592", "0.58278495", "0.56610465", "0.5652941", "0.56497854", "0.5648577", "0.5553133", "0.55280334", "0.55280334", "0.5448845", "0.5372592", "0.5368684", "0.53555965", "0.53358155", "0.5322113", "0.5322113", "0.5310961", "0.530388", "0.530242...
0.0
-1
in this page teacher can see all of the forum posts
def teacher_forum_landing_page(request, page): # Deleting admin-typed user session # Deleting programmer-typed-user session # Get the current users current_basic_user = get_current_user(request, User, ObjectDoesNotExist) current_basic_user_profile = get_current_user_profile( request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_list(request):\n\timage_post_list = list(ImagePost.objects.all())\n\tvideo_post_list = list(VideoPost.objects.all())\n\tall_post = image_post_list + video_post_list\n\treturn render(request,'devblog/post_list.html', {'posts':all_post})", "def view_blog(self):", "def forum(request, forum_id):\n topi...
[ "0.65342", "0.6510963", "0.6504755", "0.6503333", "0.6503325", "0.65012", "0.6413255", "0.636724", "0.6361781", "0.63528556", "0.634705", "0.6344606", "0.62456393", "0.6225456", "0.62220657", "0.62189585", "0.61770386", "0.6170098", "0.61636835", "0.61625767", "0.6136682", ...
0.6446999
6
in this view the teacher can create a forum post
def teacher_forum_create(request): # Deleting admin-typed user session # Deleting programmer-typed-user session # Get the current users current_basic_user = get_current_user(request, User, ObjectDoesNotExist) current_basic_user_profile = get_current_user_profile( request, User, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n teacher = self.request.get(\"teacher\")\n student = self.request.get(\"student\")\n lessondate = self.request.get(\"lessondate\")\n reason = self.request.get(\"reason\")\n comment = self.request.get(\"comment\")\n\n if teacher and student and lessondate a...
[ "0.7329339", "0.7162002", "0.70594895", "0.7003851", "0.6994737", "0.6979558", "0.6978259", "0.691917", "0.6845622", "0.68156683", "0.67997193", "0.6753117", "0.67289805", "0.6726166", "0.67195654", "0.66782594", "0.66578925", "0.6632889", "0.6628704", "0.6607489", "0.660156"...
0.8074095
0