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
Resets all the contents stored
def tile38_setup(): client.flushall yield None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self._data = []", "def reset(self):\n self.temp_data.clear()", "def reset(self):\n # FIXME: this state does not make sense\n self.reset_creation_info()\n self.reset_document()\n self.reset_package()\n self.reset_file_stat()\n self.reset...
[ "0.79640114", "0.79449594", "0.7942509", "0.79245305", "0.78824085", "0.78824085", "0.78824085", "0.78803", "0.78803", "0.78803", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "0.7834564", "...
0.0
-1
return the correctness and confidences of predictions
def correct_and_confidence(model, loader, device, with_energy=True): with torch.no_grad(): model.eval() confidences = [] corrects = [] for inputs, labels in loader: inputs, labels = inputs.to(device), labels.to(device) if with_energy: logits =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction():\r\n\r\n\r\n\tpredictVal = []\r\n\taccuracy = 0.0\r\n\r\n\t# Calculate accuracy for each class in testData\r\n\tfor item in testData:\r\n\t\tclass0Prediction = posProb / 100\r\n\t\tclass1Prediction = negProb / 100\r\n\t\t\r\n\t\t# Multiply the prior probablities for negative and positive reviews b...
[ "0.7893121", "0.7871008", "0.76539403", "0.7412509", "0.73162645", "0.72805506", "0.7263658", "0.7257417", "0.71888185", "0.7166795", "0.71611714", "0.7130664", "0.7118593", "0.7114675", "0.71143824", "0.7077957", "0.7068769", "0.7055071", "0.7054077", "0.6949678", "0.6939620...
0.0
-1
compute expected calibration error (ECE)
def expected_calibration_error(data_length, bucket_accs, bucket_confs, bucket_totals): # TODO: If the docstring is longer than the function logic, usually the docstring should be shorter or it shouldn't # be a function. # Remember that the point of a function is to be an abstraction: something that hides co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_of_errors(self):\n self.e_of_e = self.azimuth_error - self.altitude_error\n return self.e_of_e", "def calculate_energy_conservation_error(self):\n assert self.data is not None\n # calculate total energy at start and end of simulation\n energy_start = self.measure_total...
[ "0.7079219", "0.6710523", "0.6705349", "0.66143274", "0.6573631", "0.64684534", "0.64388514", "0.64110225", "0.6364667", "0.63354135", "0.6307564", "0.62935024", "0.6287445", "0.62517846", "0.6240687", "0.61839724", "0.6173702", "0.6167329", "0.61644596", "0.61461425", "0.613...
0.6969385
1
Execute a command and return its value.
def delegator(): import delegator def run(command): if "|" in command: res = delegator.chain(command) else: res = delegator.run(command) if res.return_code == 127: raise FileNotFoundError(res.err) if res.return_code != 0: raise Run...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self, command, user_context=None):\n return self.parse(command, user_context).execute()", "def execute_command(self, command):\n return self.ssh.exec_command(command)", "def _execute_command(self, cmd):\n LOG.info(\"Executing: %s\" % cmd)\n status, stdout, stderr = self....
[ "0.75513715", "0.73304343", "0.73241794", "0.72709864", "0.7242012", "0.71793664", "0.7133625", "0.7099978", "0.70719355", "0.7040908", "0.69573665", "0.6923248", "0.69084376", "0.6903973", "0.69022304", "0.6891859", "0.68201387", "0.6804588", "0.67375743", "0.6724226", "0.66...
0.0
-1
A delegator to ``git`` setting the appropriate ``gitdir``.
def git_command(delegator, git_directory): def run(cmd, **kwargs): cmd = "git --git-dir={} {}".format(quote(git_directory), cmd) return delegator(cmd, **kwargs) return run
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_directory(delegator):\n return delegator(\"git rev-parse --git-dir\")", "def mock_git(mocker):\n from demisto_sdk.commands.common.content import Content\n\n # Mock git working directory\n mocker.patch.object(Content, 'git')\n Content.git().working_tree_dir = TEST_CONTENT_REPO\n yield", ...
[ "0.72769815", "0.6641427", "0.6349675", "0.6286185", "0.6276211", "0.61569196", "0.6130058", "0.61011934", "0.60696644", "0.60047036", "0.59994465", "0.59891456", "0.5951636", "0.5927444", "0.58606523", "0.5830278", "0.5823502", "0.58090305", "0.5806452", "0.579807", "0.57860...
0.66274726
2
The ``.git`` directory for the current project.
def git_directory(delegator): return delegator("git rev-parse --git-dir")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGitPath() -> osp:\n current_dir = osp.dirname(osp.realpath(__file__))\n git_dir = osp.dirname(osp.dirname(current_dir))\n return git_dir", "def get_git_dir(tree):\n\n return os.path.join(tree, \".git\")", "def git_dir():\n return subprocess.check_output([\"git\", \"rev-parse\", \"--git-di...
[ "0.83023816", "0.8015751", "0.7522234", "0.74142706", "0.70690876", "0.7059461", "0.70178574", "0.6930033", "0.68814874", "0.6830864", "0.67350674", "0.6637658", "0.64931214", "0.64922035", "0.6490604", "0.64626306", "0.646249", "0.64517623", "0.6420175", "0.63963944", "0.638...
0.66105205
12
Calculates shade by converting the time passed since the start of the game to a percentage of the current day/night cycle.
def update(self): super().update() time_since_start = self.time_since_start() curr_mod = time_since_start%self.game.time_cycle_secs grade = abs(curr_mod - self.game.time_cycle_secs/2) / (self.game.time_cycle_secs/2) color_value = grade*(255-self.game.max_darkness) + self.game.ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colour_time_based(self):\n\t\treturn self.get_hex_from_rgb(0, 0, int(255.0 * (get_elapsed_seconds_simulated() / SECONDS_PER_DAY)))", "def report_rest_percentage(self):\n self._logger.info(\"Running report for device {}\".format(self.name))\n tot_time_since_bday = (datetime.utcnow() - self.b...
[ "0.6328449", "0.5682314", "0.5677854", "0.5432159", "0.5369359", "0.53085834", "0.5219234", "0.5206503", "0.520525", "0.5153342", "0.5086756", "0.5010156", "0.5008131", "0.50076133", "0.5004993", "0.5000146", "0.49980986", "0.49826407", "0.49760562", "0.49475768", "0.4946041"...
0.578151
1
Displays the time in the game relative to the time cycle
def message(self): if self.display_time: return "Time: {}".format(int(self.physics_engine.time_since_start()%self.time_cycle_secs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_time(self, time):\n pygame.draw.rect(self.screen, self.font_fgcolor, self.time_rect)\n self.screen.blit(self.small_font.render(\"Elapsed time: %.0f s\" % time, -1, (0, 0, 0)), (5, 720))\n pygame.display.update(self.time_rect)\n return", "def ShowTime():\n ClearDisplay()...
[ "0.80268294", "0.7536709", "0.7264826", "0.71524316", "0.709622", "0.7039029", "0.70333403", "0.6958243", "0.6939595", "0.69334245", "0.693148", "0.68405247", "0.6725378", "0.6715109", "0.66588914", "0.66478723", "0.6636626", "0.6634973", "0.66332513", "0.6627094", "0.6620326...
0.7924845
1
Creates a model, given the type of model and the output method. Adds the output layer with activation corresponding to the output type after the constructed model. This allows for easy switching between binary and multiclass classification, and prevents us from having to implement two types of each model. The model is ...
def create_model(model_type: str, input_size: Tuple[int, ...], output='binary', summary=True) -> keras.Model: if model_type in MODELS: inputs, outputs = MODELS[model_type](input_size) else: raise ValueError(f'Model type "{model_type}" not supported') if output == 'binary': activatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model(input_dim, hidden_neurons, output_dim):\n\tmodel = Sequential([\n \tDense(hidden_neurons, input_dim=input_dim),\n Activation('relu'),\n Dropout(0.2),\n Dense(hidden_neurons),\n Activation('relu'),\n Dropout(0.2),\n Dense(output_dim, activation='softmax')...
[ "0.6704527", "0.66973925", "0.66615975", "0.66041964", "0.6572064", "0.6570199", "0.6549063", "0.647823", "0.6476947", "0.6459976", "0.6454561", "0.6407263", "0.64054805", "0.638561", "0.63830036", "0.63781667", "0.63442785", "0.6344052", "0.6315975", "0.6313631", "0.63134235...
0.71340376
0
process response get from requests
def process_resp(self, msg, operation, status, index): metric = "%s.%d.%s" % (METRIC_NAME, index, operation) self.results.append(Event(TIMESTAMP_MILLIS(), "opentsdb", metric, msg, status)) if status == "0": self.cause.extend(msg) metric = "%s.%d.%s" % (METRIC_NAME, index,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _processGETResp(self, output, request):\r\n msg = {'key' : output}\r\n\r\n self._render_GET(request, httplib.OK,\r\n 'application/json; charset=utf-8', json.dumps(msg))", "def _process_request(self, request, response):\n ...", "def _process_request(protocol, dom...
[ "0.73667425", "0.692869", "0.66959393", "0.66323155", "0.66323155", "0.6591454", "0.65617144", "0.65557534", "0.65041816", "0.6460191", "0.643903", "0.6426434", "0.6426434", "0.64241606", "0.6421691", "0.6381393", "0.6347633", "0.6323247", "0.63002414", "0.6279552", "0.625061...
0.0
-1
Create UID for metric, tag_key and tag_value
def create_uid(self, host, index): msg = [] operation = "WRITE" url = "%s%s%s" % ("http://", host, "/api/uid/assign") payload = {"metric": [METRIC_NAME], "tagk": [TAGK], "tagv": ["%s.%d" % (TAGV, index)]} headers = {"content-type": "application/json"} m_uuid = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tag_id():\n return uuid.uuid1().int", "def create_uid():\n return random_string(5, string.hexdigits.lower())\n # return (\"%x\" % (int(time.time()) * 0x10 % 0x1000000000)\n # + random_string(7, string.hexdigits.lower()))", "def uid_gen(prefix: str = \"\") -> str:\n uid: str = ...
[ "0.622496", "0.5914397", "0.5869701", "0.5807702", "0.5769845", "0.5710975", "0.56788355", "0.56183344", "0.56085813", "0.5602032", "0.5578855", "0.5568348", "0.555802", "0.553758", "0.5533039", "0.54645866", "0.54295546", "0.5413362", "0.54101545", "0.53708315", "0.53593594"...
0.6909411
0
Data will be inserted into tsdb table
def write(self, host, index): msg = [] operation = "WRITE" if not self.create_uid(host, index): return False url = "%s%s%s" % ("http://", host, "/api/put") payload = {"metric": METRIC_NAME, "timestamp": TIMESTAMP_MILLIS(), \ "value": METRIC_VAL, "tags":{TAGK: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_insert_data(self, *args):\n print(\"Provide data to insert\")\n self.connection_obj.insert_into_table(**self.__class__.populate_data())\n print(\"Data Insertion Successful\")", "def insert(self,table,values):\n self.connect.execute(self.insert_disc[table],values)\n self....
[ "0.72514176", "0.7214033", "0.70906794", "0.70481104", "0.7026284", "0.70220715", "0.7020377", "0.69829357", "0.69679713", "0.6887554", "0.68298614", "0.6821573", "0.6820573", "0.6811746", "0.6759082", "0.6737531", "0.6731064", "0.67139596", "0.67029476", "0.669869", "0.66986...
0.0
-1
Inserted data will be read
def read(self, host, index): msg = [] operation = "READ" url = "%s%s%s" % ("http://", host, "/api/query") payload = {"start": self.test_start_timestamp, "end": TIMESTAMP_MILLIS(), "queries": [{"aggregator": "none", \ "metric": METRIC_NAME, "tags": {TAGK: "%s.%d" % (TAGV, index)}}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_data(self):\n\n pass", "def insert_data(self) -> None:\n if self.min_insert_size > self.insert_count:\n LOG.debug(\"Not enough data for insert....\")\n return\n LOG.debug(f'Inserting {self.insert_count} records...')\n self.insert.write(self.copy_traile...
[ "0.75751936", "0.7198535", "0.6850029", "0.6821989", "0.68143404", "0.64528984", "0.64384943", "0.64332664", "0.6369282", "0.6364045", "0.6362229", "0.6341396", "0.6312636", "0.6263611", "0.6248877", "0.623441", "0.6233147", "0.62074935", "0.61562264", "0.6149473", "0.6142653...
0.0
-1
Analyze ok and ko status on hosts
def analyze_results(self, results): ok_c = 0 ko_c = 0 for row in results: if "opentsdb.health" not in row[2] and ".health" in row[2]: if row[4] == "ERROR": ko_c += 1 else: ok_c += 1 return ok_c, ko_c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _status(self, host):\n pass", "def remote_status():", "def check_ping(self):\n # Print ping status of all of your hosts, minimum padding of 8 spaces\n padding_size = max(len(max(self.hosts, key=len)) + 4, 8)\n print('{:{padding_size}}{}'.format('Host', 'Status', padding_size=pad...
[ "0.71723616", "0.7033423", "0.6631784", "0.6572632", "0.64127666", "0.63266665", "0.623772", "0.6207528", "0.619318", "0.6136378", "0.60922295", "0.6076038", "0.6061462", "0.6061255", "0.60085744", "0.59968966", "0.5984662", "0.59797204", "0.59797204", "0.594375", "0.59303474...
0.5727689
40
Copula transformation (empirical CDF).
def ctransform(x): xr = np.argsort(np.argsort(x)).astype(float) xr += 1. xr /= float(xr.shape[-1] + 1) return xr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conToCelc(faren):\n return (faren - 32)*(5/9)", "def compute_clade_probabilities():\n command = \"phyltr cat -b 10 indoeuropean.nex | phyltr clades > clades.txt\"\n subprocess.call(command, shell=True)", "def cepstrum(input, nceps):\n # apply the Discrete Cosine Transform\n output = dct(inpu...
[ "0.5663744", "0.56464165", "0.55928284", "0.5529018", "0.5462121", "0.5460687", "0.53793234", "0.53748983", "0.5368778", "0.5362352", "0.53609055", "0.5357859", "0.53566635", "0.53391796", "0.53169805", "0.5315485", "0.5315349", "0.5314555", "0.5309568", "0.5291648", "0.52612...
0.0
-1
Copula normalization for a single vector.
def copnorm_1d(x): assert isinstance(x, np.ndarray) and (x.ndim == 1) return ndtri(ctransform(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n self.vector /= np.linalg.norm(self.vector)", "def normalize(v):\n return v / np.linalg.norm(v)", "def normalize(vector):\n return vector / np.linalg.norm(vector)", "def normalize(v):\n return np.array(v) / np.linalg.norm(v)", "def normalize(v):\n\tdim = v.shape \n...
[ "0.7618007", "0.74454015", "0.73818594", "0.7324582", "0.723282", "0.7182667", "0.71597224", "0.70688415", "0.70092964", "0.70035326", "0.6974502", "0.6947041", "0.6946004", "0.6910571", "0.6910143", "0.69073325", "0.69067377", "0.6889483", "0.68736905", "0.6866754", "0.68652...
0.0
-1
Categorical Copula normalization for a single vector. This function apply the copnorm per categories.
def copnorm_cat_1d(x, y): assert isinstance(x, np.ndarray) and (x.ndim == 1) assert isinstance(y, np.ndarray) and (x.ndim == 1) assert y.dtype in CONFIG['INT_DTYPE'] x_cop = np.zeros_like(x) y_u = np.unique(y) for yi in y_u: _idx = y == yi x_cop[_idx] = copnorm_1d(x[_idx]) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_comp(cvec):\n return cvec / cvec.norm()", "def copnorm_1d(x):\n assert isinstance(x, np.ndarray) and (x.ndim == 1)\n return ndtri(ctransform(x))", "def copnorm_1d(x):\n assert isinstance(x, np.ndarray) and (x.ndim == 1)\n return ndtri(ctransform(x))", "def normalize(vector):\n ...
[ "0.6994723", "0.61327696", "0.61327696", "0.610969", "0.61016935", "0.6088704", "0.60741276", "0.6062895", "0.6050322", "0.6033933", "0.60321313", "0.60171866", "0.60040766", "0.5986567", "0.5978743", "0.5921216", "0.5875921", "0.58606005", "0.5827847", "0.5823671", "0.581396...
0.6042691
9
Copula normalization for a multidimentional array.
def copnorm_nd(x, axis=-1): assert isinstance(x, np.ndarray) and (x.ndim >= 1) return np.apply_along_axis(copnorm_1d, axis, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_array(array):\n\n return array / np.sum(array, axis=1)[:, np.newaxis]", "def __normalize_after_fft(arr):\n\n n1, n2 = arr.shape[0], arr.shape[1]\n for i in range(n1):\n for j in range(n2):\n arr[i, j] *= n1 * n2\n\n return arr", "def _normalize(X:...
[ "0.7164983", "0.6876631", "0.6776384", "0.6739342", "0.6689978", "0.6635549", "0.6580354", "0.65614873", "0.65260637", "0.6514676", "0.6426658", "0.64239883", "0.63720423", "0.63630325", "0.6362653", "0.6353261", "0.63378096", "0.62933934", "0.6270285", "0.62699866", "0.62672...
0.0
-1
Categorical Copula normalization for multidimentional array. This function apply the copnorm per categories.
def copnorm_cat_nd(x, y, axis=-1): assert isinstance(x, np.ndarray) and (x.ndim >= 1) if y is None: return copnorm_nd(x, axis=axis) return np.apply_along_axis(copnorm_cat_1d, axis, x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copnorm_cat_1d(x, y):\n assert isinstance(x, np.ndarray) and (x.ndim == 1)\n assert isinstance(y, np.ndarray) and (x.ndim == 1)\n assert y.dtype in CONFIG['INT_DTYPE']\n x_cop = np.zeros_like(x)\n y_u = np.unique(y)\n for yi in y_u:\n _idx = y == yi\n x_cop[_idx] = copnorm_1d(x[...
[ "0.63591534", "0.5967849", "0.5967849", "0.5897528", "0.58845794", "0.5782783", "0.5721007", "0.5717328", "0.56614244", "0.56499016", "0.56471413", "0.56471413", "0.5636114", "0.5636114", "0.5629407", "0.560048", "0.5600006", "0.55716574", "0.55567706", "0.55072486", "0.54970...
0.62532276
1
Gets training data that includes tagged sentences. Returns a dictionary that maps every word in the training set to its most frequent tag. The dictionary should have a default value.
def most_frequent_train(train_data): ### YOUR CODE HERE tags_counts_for_each_word = {} # Filling a dictionary from words and tag tags to their counters # Going over the words and counting their tags appearances for sentance in train_data: for word, tag in sentance: # If first tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MostCommonClassBaseline(training_set, test_set):\n pos_counts_dict = defaultdict(dict)\n max_pos_dict = dict()\n test_common_tags = []\n\n # Dictionary \"pos_counts_dict\" stores a dictionary for each word that stores counts of each pos of the word\n # This loop runs for each sentence (word, pos...
[ "0.62998277", "0.61069524", "0.60696596", "0.6068922", "0.6001002", "0.5926774", "0.5912238", "0.58869374", "0.58837795", "0.5883664", "0.5861991", "0.58473736", "0.5844703", "0.58288777", "0.5826551", "0.58042777", "0.5799191", "0.57924163", "0.5788701", "0.5764574", "0.5759...
0.7100879
0
Gets test data and tag prediction map. Returns an evaluation of the accuracy of the most frequent tagger.
def most_frequent_eval(test_set, pred_tags): gold_tag_seqs = [] pred_tag_seqs = [] for sent in test_set: words, true_tags = zip(*sent) gold_tag_seqs.append(true_tags) ### YOUR CODE HERE DEFAULT_TAG = 'O' pred_tags_list = [] for word in words: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, test_X, test_Y):\n correct = 0\n total = 0.0\n\n for i, ((word_indices, word_char_indices), gold_tag_indices) in enumerate(zip(test_X, test_Y)):\n\n output = self.predict(word_indices, word_char_indices)\n predicted_tag_indices = [np.argmax(o.value()) f...
[ "0.68569124", "0.66788125", "0.6602641", "0.647516", "0.6442005", "0.64303696", "0.63846743", "0.63640356", "0.6305632", "0.63004315", "0.6276655", "0.6212785", "0.6211638", "0.61958474", "0.61904263", "0.6182075", "0.6165822", "0.61639893", "0.6145034", "0.6125559", "0.61052...
0.6525517
3
The function ``is_admin`` detects whether the calling process is running with administrator/superuser privileges. It works crossplatform on either Windows NT systems or Unixbased systems.
def is_admin(): if os.name == 'nt': try: # Only Windows users with admin privileges can read # the C:\windows\temp directory. os.listdir(os.sep.join([os.environ.get('SystemRoot','C:\\windows'),'temp'])) except: return False else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin():\n if platform_is(WINDOWS):\n return windll.shell32.IsUserAnAdmin()\n return os.getuid() == 0", "def is_admin():\n # type: () -> bool\n current_os_name = os.name\n\n # Works with XP SP2 +\n if current_os_name == \"nt\":\n try:\n return IsUserAnAdmin()\n ...
[ "0.8821815", "0.8732962", "0.8634657", "0.80681646", "0.78383905", "0.7656703", "0.75744766", "0.7562517", "0.75570256", "0.74586576", "0.74525267", "0.74387234", "0.74240386", "0.74240386", "0.74135554", "0.73537236", "0.7341056", "0.73286927", "0.7305158", "0.7260963", "0.7...
0.79539204
4
Create a new tag
def create_a_tag(self, tag_id, contact_id): data = {"contactTag":{"contact":str(contact_id),"tag":str(tag_id)}} return self.client._post("/contactTags", json=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createTag(self, authenticationToken, tag):\r\n pass", "def create(self, name, tag):\n\n\t\turl_json = urllib.urlencode({\"name\": name, \"tag\": tag})\n\t\treturn self._create(\"/tag?json_hash=%s\" % url_json, \"tag\")", "def make_new_tag():\n return render_template('tags/new_tag.html')", "def add_...
[ "0.8043615", "0.77951604", "0.7368651", "0.7363008", "0.7346278", "0.72604716", "0.7207542", "0.7113458", "0.7074937", "0.70454365", "0.7003208", "0.69938636", "0.69363683", "0.6916433", "0.68520314", "0.68380255", "0.67701113", "0.67701113", "0.67611784", "0.6748694", "0.674...
0.6495886
33
Retrieve an existing user
def delete_a_tag(self, contact_tag_id): return self.client._delete(f"/contactTags/{str(contact_tag_id)}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n\n user_id = get_jwt_identity()\n user = user_crud.get(user_id)\n if not user:\n abort(404, message=\"User not Found\")\n\n return user", "def get(self, id):\n\t\ttry:\n\t\t\tflask_app.logger.debug('We are getting the user: %d', id)\n\t\t\treturn user_servic...
[ "0.8212961", "0.7848171", "0.7845886", "0.7653362", "0.75199753", "0.7491075", "0.74858", "0.74727863", "0.7465673", "0.746224", "0.7382637", "0.73640716", "0.73251826", "0.73248845", "0.7324632", "0.73170745", "0.7291248", "0.72907436", "0.7288322", "0.7282303", "0.72667825"...
0.0
-1
This decorator starts the coroutine for us.
def coroutine(f, *a, **kw): i = f(*a, **kw) i.next() return i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coroutine(func):\n def start(*args, **kwargs):\n cr = func(*args, **kwargs)\n next(cr)\n return cr\n return start", "def coroutine(func):\n def start(*args, **kwargs):\n cr = func(*args, **kwargs)\n next(cr)\n return cr\n return start", "def coroutine(f...
[ "0.73506445", "0.73506445", "0.73506445", "0.73420984", "0.73402673", "0.7286279", "0.70205104", "0.69449747", "0.68627673", "0.6845239", "0.6845239", "0.67451215", "0.6707592", "0.65871006", "0.63496244", "0.6304423", "0.62721074", "0.6268496", "0.6251403", "0.6251403", "0.6...
0.0
-1
converting json_bytes to dict or dict to json_bytes
def convert(data): result = None if isinstance(data, bytes): try: result = json.loads(data.decode(CODING)) except: print('wrong data format!') finally: return result elif isinstance(data, dict): try: result = json.dumps(data).en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_decode(data):\n if isinstance(data, bytes):\n data = data.decode(\"utf-8\")\n\n return json.loads(data)", "def _decode(self, data: bytes):\n\n return json.loads(data.decode('utf-8'))", "def json_loads(s: Union[bytes, str]) -> Dict[str, Any]:\n return json.loads(ensure_text(s, \"...
[ "0.6704753", "0.6599705", "0.6597806", "0.6580214", "0.6572985", "0.65350634", "0.6337056", "0.6297806", "0.62290484", "0.6216683", "0.62112856", "0.6185201", "0.6179623", "0.6128823", "0.6126266", "0.6124865", "0.6116758", "0.6101291", "0.60905", "0.609006", "0.6081644", "...
0.71246356
0
Return a list of latest build packages that are tagged with certain tag
def koji_tag2pkgs(kapi, tag): ret = [] for rpminfo in kapi.listTagged(tag, inherit=True, latest=True): pkg = _koji_buildinfo2pkg(kapi, rpminfo) ret.append(pkg) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_build(tag, package):\n proc = Popen([\"osg-koji\", \"-q\", \"list-tagged\", \"--latest\", tag, package],\n stdout=PIPE)\n out = proc.communicate()[0] or b''\n ret = proc.returncode\n\n latest_build_line = out.decode(\"latin-1\").strip()\n\n if ret != 0 or not latest_b...
[ "0.6766918", "0.64562565", "0.6202034", "0.61146486", "0.59529054", "0.5890708", "0.58779067", "0.57897514", "0.5786915", "0.5756531", "0.57446975", "0.57202804", "0.57058716", "0.56544155", "0.5646688", "0.5629611", "0.5629158", "0.56251156", "0.557942", "0.55721", "0.556434...
0.6693938
1
Return a the build pacakges from a package id
def koji_pkgid2pkgs(kapi, pkgid): ret = [] for binfo in kapi.listBuilds(packageID=pkgid): pkg = _koji_buildinfo2pkg(kapi, binfo) ret.append(pkg) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_buildrequire_pkgs_from_build(build_id, session, config):\n print(\"Retriewing build metadata from: \", config.koji_host)\n build = session.getBuild(build_id)\n if not build:\n raise Exception(\"Build with id '{id}' has not been found.\".format(id=build_id))\n\n print(\"Build with the ID\...
[ "0.7184097", "0.6101216", "0.6087045", "0.60699105", "0.60417914", "0.6040838", "0.5977515", "0.5934301", "0.5913", "0.58773243", "0.58617723", "0.58331734", "0.5806986", "0.5787779", "0.5784125", "0.5781364", "0.5760907", "0.574403", "0.5714784", "0.5705453", "0.56750613", ...
0.6947734
1
Return a list of latest packages that are in the given compose
def composed_url2pkgs(baseurl): import compose c = compose.Compose(baseurl) cid = c.data_id() cstat = c.data_status() pdata = c.json_rpms() p = compose.packages_from_compose(pdata) pb = compose.packages_bin_from_compose(pdata) return p, pb, cid, cstat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages():\n\n packages = find_packages()\n packages = ['{}.{}'.format('uniq', package) for package in packages]\n packages.append('uniq')\n return packages", "def get_package_list():\n pip_freeze = subprocess.check_output(('pip', 'freeze')).decode('utf8')\n package_list = [x.strip().s...
[ "0.61419404", "0.59497553", "0.58131677", "0.57777905", "0.5700319", "0.5460036", "0.54240966", "0.540263", "0.5388916", "0.537803", "0.5358507", "0.53547126", "0.53445446", "0.53266305", "0.53051114", "0.5303987", "0.52810436", "0.5273311", "0.52719593", "0.52524483", "0.525...
0.5837896
2
Return a list of latest modules that are in the given compose
def composed_url2modules(baseurl): import compose c = compose.Compose(baseurl) cid = c.data_id() cstat = c.data_status() print('Mod Compose:', cid) print(' Status:', cstat) mdata = c.json_modules() m = compose.modules_from_compose(mdata) return compose.dedup_modules(m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modules(self):\n return sorted([module for module in self._registry.values()],\n key=lambda scomp: (scomp.order, scomp.label))", "def _list_all(root_pkg, prog):\n res = \"\\n\".join(\n sorted(\n pkinspect.package_module_names(_import(root_pkg)),\n k...
[ "0.5734544", "0.5620557", "0.5515039", "0.54573196", "0.5440216", "0.5403242", "0.54014957", "0.5378393", "0.53708357", "0.5353265", "0.53318167", "0.53174704", "0.5289548", "0.52598995", "0.5258763", "0.52493656", "0.5242129", "0.5224267", "0.5214835", "0.5213591", "0.520834...
0.5680556
1
Get positive diagonals, going from bottomleft to topright.
def diagonalsPos (matrix, cols, rows): for diagonal in ([(j, i - j) for j in range(cols)] for i in range(cols + rows -1)): yield [matrix[i][j] for i, j in diagonal if i >= 0 and j >= 0 and i < cols and j < rows]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonals(self):\n left_top_shifts = map(lambda i: (-(i + 1), -(i + 1)), range(min(\n self.left_distance, self.top_distance)))\n left_bottom_shifts = map(lambda i: (-(i + 1), +(i + 1)), range(min(\n self.left_distance, self.bottom_distance)))\n right_top_shifts = map(...
[ "0.7523506", "0.7055278", "0.70287716", "0.69674146", "0.6805341", "0.67695767", "0.67601824", "0.67326593", "0.6724137", "0.66729164", "0.6666689", "0.66343945", "0.66061187", "0.66051644", "0.6519829", "0.64941293", "0.64686644", "0.646446", "0.6461399", "0.64447653", "0.63...
0.7020545
3
Get negative diagonals, going from topleft to bottomright.
def diagonalsNeg (matrix, cols, rows): for diagonal in ([(j, i - cols + j + 1) for j in range(cols)] for i in range(cols + rows - 1)): yield [matrix[i][j] for i, j in diagonal if i >= 0 and j >= 0 and i < cols and j < rows]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonals(self):\n left_top_shifts = map(lambda i: (-(i + 1), -(i + 1)), range(min(\n self.left_distance, self.top_distance)))\n left_bottom_shifts = map(lambda i: (-(i + 1), +(i + 1)), range(min(\n self.left_distance, self.bottom_distance)))\n right_top_shifts = map(...
[ "0.74394697", "0.70225304", "0.6999749", "0.6986131", "0.69826496", "0.68484116", "0.68346524", "0.6826511", "0.6775777", "0.6718986", "0.66814524", "0.6667113", "0.65236944", "0.65159935", "0.6481205", "0.6473899", "0.6424914", "0.6395643", "0.6351728", "0.6312667", "0.62737...
0.74049544
1
Create a new game.
def __init__ (self, cols = 6, rows = 7, requiredToWin = 4): self.cols = cols self.rows = rows self.win = requiredToWin self.board = [[NONE] * rows for _ in range(cols)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_new():\n posted = request.get_json()\n\n # Parse out the settings from the post\n settings = {}\n possible_settings = Game.DEFAULT_SETTINGS.keys()\n for setting in possible_settings:\n if setting in posted:\n settings[setting] = int(posted[setting])\n\n # Create and sta...
[ "0.78133714", "0.7810131", "0.7777821", "0.7729321", "0.7605243", "0.75777143", "0.7482669", "0.7363624", "0.7306845", "0.7306757", "0.72615993", "0.7260527", "0.72555196", "0.7236042", "0.7222994", "0.7206253", "0.7193306", "0.71824133", "0.71792173", "0.7131112", "0.7102228...
0.0
-1
Insert the figure in the given column.
def insert (self, column, figure): c = self.board[column] if c[0] != NONE: raise Exception('Column is full') i = -1 while c[i] != NONE: i -= 1 c[i] = figure self.checkForWin()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_disc(self, column):\n stdout.write(\"place_disc %d\\n\" % column)\n stdout.flush()", "def addColumn(self, *column):\n self.insertColumn(self._width, *column)", "def insert_after(self, text, line, col):\n col = self.canonicalize_column_index(line, col)\n col_off = se...
[ "0.663612", "0.66170853", "0.63207686", "0.6298038", "0.62482417", "0.6247075", "0.6229078", "0.6151331", "0.6122636", "0.61149824", "0.610697", "0.61038834", "0.6098983", "0.60879403", "0.60723233", "0.60662925", "0.6054099", "0.60376287", "0.60324526", "0.59339696", "0.5914...
0.8167265
0
Check the current board for a winner.
def checkForWin (self): w = self.getWinner() if w: self.printBoard() raise Exception(w + ' won!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_winner(self):\n pass", "def check_for_winner(self):\r\n\r\n # Iterate through the rows\r\n for row in range(self.height):\r\n if self.board[row][0] == self.board[row][1] == self.board[row][2] and self.board[row][0] != None:\r\n return Board.WIN if self.boa...
[ "0.7888144", "0.78121245", "0.77188283", "0.7654055", "0.7651377", "0.7618898", "0.759551", "0.7593995", "0.75508547", "0.75505865", "0.7549655", "0.75481594", "0.74787205", "0.7476814", "0.7443378", "0.7436571", "0.74264586", "0.73948514", "0.73858464", "0.73742837", "0.7348...
0.733567
22
Get the winner on the current board.
def getWinner (self): lines = ( self.board, # columns zip(*self.board), # rows Board.diagonalsPos(self.board, self.cols, self.rows), Board.diagonalsNeg(self.board, self.cols, self.rows) ) for line in chain(*lines): for figure, group in groupby(line): if figure != NONE and len(list(g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_winner(self, board):\r\n ids = self.player_ids\r\n board_size = self.board_size\r\n return self.get_winner_c(board, ids, board_size)", "def get_winner(self):\n \n current_board_state = self.get_board_state()\n current_board_state_winner = self.state_winner_map.ge...
[ "0.84933585", "0.8486584", "0.8465523", "0.83231235", "0.83130556", "0.83130556", "0.83039725", "0.8224555", "0.8214615", "0.8096653", "0.80511385", "0.8001037", "0.7956043", "0.7904712", "0.7889448", "0.78768945", "0.7862174", "0.7825047", "0.7724497", "0.77161705", "0.76997...
0.74699986
34
Create an organization in the test database
def setUp(self): #Inheriting the base class functionality super(CreateTaskAPITestCase, self).setUp() # Create the org using serializer create_org_data = { 'name': 'Ecell NITRR Open Source', 'tagline': 'We love open source.' } serializer = CreateOrg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_organization(self):\n pass", "def test_create_org(session): # pylint:disable=unused-argument\n user = factory_user_model()\n org = OrgService.create_org(TestOrgInfo.org1, user_id=user.id)\n assert org\n dictionary = org.as_dict()\n assert dictionary['name'] == TestOrgInfo.org1...
[ "0.81322205", "0.77501535", "0.76315355", "0.76039594", "0.7451626", "0.724363", "0.71316046", "0.6978583", "0.69309694", "0.68478835", "0.6826861", "0.67564154", "0.6742396", "0.67277336", "0.6576727", "0.6567349", "0.65031064", "0.64968556", "0.6489674", "0.64821607", "0.64...
0.6963344
8
To be run in a directory with LOTAAS classifier out files. Determines which pulsars are in at least 3 of the 5 models provided and lists them in a file
def categorize_classifier_files(out_dir): #sort all of the classifier files into a dictionary class_files = glob.glob("feature_extraction_m*") class_file_dict = {"positive":[], "negative":[]} class_cand_dict = {"m1":class_file_dict, "m2":class_file_dict, "m3":class_file_dict, "m4":class_file_dict, "m5"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_example(models, examples_path):\n frame_list = get_lidc_dataframes(examples_path, len(models))\n malignant_files = []\n for frame in frame_list:\n files = frame[\"File\"]\n for model, file in zip(models, files):\n prediction = np.argmax(model.predict(file))\n i...
[ "0.6200996", "0.58896387", "0.5857481", "0.5760066", "0.57523656", "0.5741391", "0.57344854", "0.5728773", "0.56916726", "0.568332", "0.56797236", "0.56721956", "0.56310445", "0.5614847", "0.558532", "0.5576366", "0.5574889", "0.557381", "0.5571876", "0.55642986", "0.55564094...
0.68747187
0
r"""Return data used for tests in this file.
def test_data(): x = np.array([8, 67, 79, 10, 52, 53, 98, 34, 15, 58], dtype=float) y = np.array([24, 87, 48, 94, 98, 66, 14, 24, 60, 16], dtype=float) z = np.array([0.064, 4.489, 6.241, 0.1, 2.704, 2.809, 9.604, 1.156, 0.225, 3.364], dtype=float) return x, y, z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data(self):\n return self._test_data", "def getTestData(self):\n raise NotImplementedError", "def GetTestData():\n return os.path.join(GetSrc(), 'chrome', 'test', 'data')", "def _test_template_data(self):\n chars=string.ascii_uppercase + string.digits\n id = ''.join(rand...
[ "0.8199515", "0.7520647", "0.72175485", "0.71363693", "0.7092907", "0.70007837", "0.69980794", "0.67899525", "0.6782763", "0.6782763", "0.6779165", "0.67096573", "0.67096573", "0.67096573", "0.668133", "0.6639849", "0.6627223", "0.6610728", "0.6577204", "0.65460837", "0.65398...
0.0
-1
r"""Return grid locations used for tests in this file.
def test_grid(): with get_test_data('interpolation_test_grid.npz') as fobj: data = np.load(fobj) return data['xg'], data['yg']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid_position(self):\n tile_size_x = constants.WINDOW_WIDTH / constants.GRID_TILE_LENGTH\n tile_size_y = constants.WINDOW_HEIGHT / constants.GRID_TILE_LENGTH\n grid_x = tile_size_x / self.host.x\n grid_y = tile_size_y / self.host.y\n return grid_x, grid_y", "def generat...
[ "0.6918649", "0.63132507", "0.63131356", "0.6228707", "0.615756", "0.6123201", "0.6111844", "0.60771805", "0.60724473", "0.60664034", "0.6015367", "0.60129166", "0.6007126", "0.6001071", "0.5990227", "0.59845644", "0.5919908", "0.5914542", "0.5877363", "0.58720917", "0.586397...
0.6534552
1
r"""Test natural neighbor interpolation function.
def test_natural_neighbor(test_data, test_grid): xp, yp, z = test_data xg, yg = test_grid img = natural_neighbor(xp, yp, z, xg, yg) with get_test_data('nn_bbox0to100.npz') as fobj: truth = np.load(fobj)['img'] assert_array_almost_equal(truth, img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nn_point(test_data):\n xp, yp, z = test_data\n\n tri = Delaunay(list(zip(xp, yp)))\n\n sim_gridx = [30]\n sim_gridy = [30]\n\n members, tri_info = find_natural_neighbors(tri,\n list(zip(sim_gridx, sim_gridy)))\n\n val = nn_point(xp, yp, z, [s...
[ "0.68133557", "0.6289575", "0.6225868", "0.62149423", "0.6126334", "0.60409766", "0.60360444", "0.5988397", "0.59295636", "0.59061944", "0.587684", "0.5838663", "0.5803554", "0.5777474", "0.5770294", "0.569739", "0.567572", "0.5646712", "0.5637545", "0.5592249", "0.5589785", ...
0.6973079
0
r"""Test inverse distance interpolation function.
def test_inverse_distance(method, test_data, test_grid): xp, yp, z = test_data xg, yg = test_grid extra_kw = {} if method == 'cressman': extra_kw['r'] = 20 extra_kw['min_neighbors'] = 1 test_file = 'cressman_r20_mn1.npz' elif method == 'barnes': extra_kw['r'] = 40 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__inverse_transform_continuous(self):", "def testInverted(self):\n invertedClass = xyTransformRegistry[\"inverted\"]\n invertedConfig = invertedClass.ConfigClass()\n affineClass = xyTransformRegistry[\"affine\"]\n invertedConfig.transform.retarget(affineClass)\n affineC...
[ "0.64221805", "0.6114815", "0.6088234", "0.60316193", "0.59683204", "0.58155304", "0.58098304", "0.5610405", "0.56054175", "0.56038624", "0.5599341", "0.5583385", "0.55830747", "0.558048", "0.55263007", "0.55263007", "0.5525398", "0.55220234", "0.55166364", "0.55103624", "0.5...
0.71566653
0
r"""Test find natural neighbors for a point interpolation function.
def test_nn_point(test_data): xp, yp, z = test_data tri = Delaunay(list(zip(xp, yp))) sim_gridx = [30] sim_gridy = [30] members, tri_info = find_natural_neighbors(tri, list(zip(sim_gridx, sim_gridy))) val = nn_point(xp, yp, z, [sim_gridx[0], sim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_natural_neighbor(test_data, test_grid):\n xp, yp, z = test_data\n xg, yg = test_grid\n\n img = natural_neighbor(xp, yp, z, xg, yg)\n\n with get_test_data('nn_bbox0to100.npz') as fobj:\n truth = np.load(fobj)['img']\n\n assert_array_almost_equal(truth, img)", "def problem5(self, s):...
[ "0.6897055", "0.6649428", "0.6639052", "0.6530777", "0.64982593", "0.63480467", "0.6291873", "0.62584484", "0.6234219", "0.62292683", "0.6225094", "0.6086198", "0.60818624", "0.6075852", "0.6039569", "0.60207516", "0.6012348", "0.6010177", "0.6008167", "0.5977195", "0.5965110...
0.73872244
0
r"""Test Barnes weights function.
def test_barnes_weights(): kappa = 1000000 gamma = 0.5 dist = np.array([1000, 2000, 3000, 4000])**2 weights = barnes_weights(dist, kappa, gamma) * 10000000 truth = [1353352.832366126918939, 3354.626279025118388, .152299797447126, .000000126641655] asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_breeding(self):\n Herbivore.set_parameters({\"gamma\": 1})\n self.herb.weight = 50\n newborn_weight = self.herb.breeding(10)\n nt.assert_not_equal(None, newborn_weight)", "def c_test_weighting_bias(self, function):\r\n return general_weighting_bias(self.verbosity, func...
[ "0.7263572", "0.72594935", "0.72594935", "0.72594935", "0.69900525", "0.68501157", "0.6781213", "0.6605773", "0.6576652", "0.6557013", "0.6512069", "0.64957434", "0.6486371", "0.6484919", "0.646704", "0.6454388", "0.6386876", "0.6384625", "0.6384625", "0.63698995", "0.6315728...
0.7957706
1
r"""Test Cressman weights function.
def test_cressman_weights(): r = 5000 dist = np.array([1000, 2000, 3000, 4000])**2 weights = cressman_weights(dist, r) truth = [0.923076923076923, 0.724137931034482, 0.470588235294117, 0.219512195121951] assert_array_almost_equal(truth, weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic(self):\n result = NonLinearWeights(0.85)\n self.assertAlmostEqual(result.cval, 0.85)", "def test_feeding_weight_carn(self):\n original = self.carn.weight\n self.carn.fitness = 1\n herb = [Herbivore(age=90) for _ in range(50)]\n self.carn.feeding(herb)\n ...
[ "0.67748266", "0.6498026", "0.6415541", "0.6391458", "0.637254", "0.6250476", "0.6250476", "0.6250476", "0.6240067", "0.62005264", "0.61936164", "0.61265564", "0.6121124", "0.6113677", "0.6018572", "0.60182", "0.601679", "0.599509", "0.59852964", "0.59660983", "0.5918179", ...
0.8282531
1
r"""Test Cressman interpolation for a point function.
def test_cressman_point(test_data): xp, yp, z = test_data r = 40 obs_tree = cKDTree(list(zip(xp, yp))) indices = obs_tree.query_ball_point([30, 30], r=r) dists = dist_2(30, 30, xp[indices], yp[indices]) values = z[indices] truth = 1.05499444404 value = cressman_point(dists, values,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fixed_point(testFunctions, tol, printFlag): \n pass", "def test_fixed_point_system(testFunctions, tol, printFlag): \n pass", "def check_interp(self):\n\n points = np.loadtxt(\"skeleton_temp/\" + cell + \"_points.txt\", delimiter=',')\n\n self.initial_scatter = ax.scatter(poin...
[ "0.6262889", "0.6127593", "0.60630435", "0.59690744", "0.59616745", "0.59546226", "0.5874195", "0.58734214", "0.58238226", "0.58026075", "0.57872707", "0.5775866", "0.5738318", "0.5729117", "0.5704638", "0.5668535", "0.56655055", "0.5663175", "0.5661966", "0.56616485", "0.566...
0.72067887
0
r"""Test Barnes interpolation for a point function.
def test_barnes_point(test_data): xp, yp, z = test_data r = 40 obs_tree = cKDTree(list(zip(xp, yp))) indices = obs_tree.query_ball_point([60, 60], r=r) dists = dist_2(60, 60, xp[indices], yp[indices]) values = z[indices] truth = 4.08718241061 ave_spacing = np.mean((cdist(list(zip(x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_point_bspline_radius() -> None:\n control_points = np.array([(0.0, 0.0, 0.0)])\n knot_vector = np.array([0, 0, 1, 1])\n curve = BSplineCurve(control_points, knot_vector)\n for parameter in np.linspace(0.0, 1.0, num=5):\n np.testing.assert_allclose(\n curve.radius_at(pa...
[ "0.65393716", "0.62299854", "0.621912", "0.6113236", "0.5917149", "0.5852951", "0.5850865", "0.5846754", "0.5818286", "0.58133703", "0.58133703", "0.57956046", "0.57805043", "0.5778642", "0.575499", "0.5752062", "0.57458085", "0.57200813", "0.5705935", "0.56873363", "0.568733...
0.7259133
0
Add metrealstation_no & metforecaststation_no to rl_kpis_df data
def add_met_real_forecast_station_col_to_rlkpis(self): rl_kpi_siteId_df = pd.DataFrame(self.rlkpi.imputed_rl_kpis_df.site_id.unique(), columns=['site_id']) # Assign the nearest station from met-real to the site Id rl_kpi_siteId_df['met-real-station_no'] = \ rl_kpi_siteId_df['si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_train_data(self):\r\n ## Impute rlkpis\r\n print(\"Imputing rlKPI df\")\r\n self.rlkpi.add_target_labels(1)\r\n self.rlkpi.impute_rl_kpis()\r\n\r\n print(\"Add 'met-real-station_no' & met-forecast-station_no to rl_kpis_df\")\r\n self.add_met_real_forecast_stati...
[ "0.66093993", "0.53555703", "0.53393054", "0.533251", "0.53289", "0.5301145", "0.5197288", "0.5096265", "0.50771284", "0.5050672", "0.50454473", "0.50402033", "0.5028574", "0.50062984", "0.4998292", "0.49721038", "0.4968566", "0.4958544", "0.49429664", "0.49366996", "0.493378...
0.7614396
0
1 Add 'metrealstation_no' & metforecaststation_no to rl_kpis_df so that metforecast and metreal data can be merged easily 2 merge metreal resample data 3 merge metforecast data
def prepare_train_data(self): ## Impute rlkpis print("Imputing rlKPI df") self.rlkpi.add_target_labels(1) self.rlkpi.impute_rl_kpis() print("Add 'met-real-station_no' & met-forecast-station_no to rl_kpis_df") self.add_met_real_forecast_station_col_to_rlkpis() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_met_real_forecast_station_col_to_rlkpis(self):\r\n rl_kpi_siteId_df = pd.DataFrame(self.rlkpi.imputed_rl_kpis_df.site_id.unique(), columns=['site_id'])\r\n\r\n # Assign the nearest station from met-real to the site Id\r\n rl_kpi_siteId_df['met-real-station_no'] = \\\r\n rl_k...
[ "0.76217365", "0.5724756", "0.5574119", "0.5542644", "0.5527173", "0.5513221", "0.55130845", "0.5508425", "0.5384717", "0.5348086", "0.5330485", "0.5295532", "0.52790254", "0.52596587", "0.52467704", "0.5236038", "0.520138", "0.51984364", "0.5197946", "0.51753104", "0.5171422...
0.67931956
1
Compute the Mahalanobis Distance between each row of x and the data
def mahalanobis(self, x=None, data=None, cov=None): x_minus_mu = x - np.mean(data) if not cov: cov = np.cov(data.values.T) inv_covmat = sp.linalg.inv(cov) left_term = np.dot(x_minus_mu, inv_covmat) mahal = np.dot(left_term, x_minus_mu.T) return mahal.di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mahalanobis_distance(self, x: np.ndarray) -> float:\n # this method could be vectorized for efficient calls\n error = x - self.mean\n mahalanobis_distance = error.T @ nla.solve(self.cov, error)\n return mahalanobis_distance", "def mahalanobis_distance(x, y):\r\n diff = x - np.m...
[ "0.8095588", "0.75557333", "0.70927775", "0.7065423", "0.68101835", "0.6714455", "0.66829896", "0.6671637", "0.6317888", "0.63015944", "0.61623526", "0.6118895", "0.61179835", "0.61020434", "0.6095306", "0.5993222", "0.5977249", "0.59567136", "0.59101474", "0.59001976", "0.57...
0.6563914
8
Apply principle component analysis to the Xarray to 3 dimensions and visualise the resulting matrix
def visualise_data_set(x_arr, y_arr): # Instantiate a PCA object for the sake of easy visualisation pca = PCA(n_components=3) # Fit and transform x to visualise inside a 3D feature space x_visualisation = pca.fit_transform(x_arr) figure = plt.figure() axis = Axes3D(figure) axis.scatter(x_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def principal_component_analysis(X, num_components):\n components = []\n for _ in range(num_components):\n component = first_principal_component(X)\n components.append(component)\n X = remove_projection(X, component)\n \n return components", "def principle_component_analysis(data...
[ "0.6146485", "0.60670024", "0.56167203", "0.559021", "0.5509418", "0.54846156", "0.5475294", "0.54682386", "0.54289496", "0.5405009", "0.53256935", "0.53170615", "0.52998364", "0.5298442", "0.5297327", "0.529588", "0.527562", "0.526715", "0.52493393", "0.5245872", "0.52402586...
0.63614935
0
Apply principle component analysis to the two Xarray"s to 3 dimensions and visualise the resulting matrices
def visualise_two_data_sets(x_arr, y_arr, x_arr_two, y_arr_two): # Instantiate a PCA object for the sake of easy visualisation pca = PCA(n_components=3) # Fit and transform x to visualise inside a 3D feature space x_visualisation = pca.fit_transform(x_arr) figure = plt.figure() axis = Axes3D(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_data_set(x_arr, y_arr):\n # Instantiate a PCA object for the sake of easy visualisation\n pca = PCA(n_components=3)\n\n # Fit and transform x to visualise inside a 3D feature space\n x_visualisation = pca.fit_transform(x_arr)\n\n figure = plt.figure()\n axis = Axes3D(figure)\n\n ...
[ "0.60191256", "0.5515485", "0.541513", "0.53996515", "0.5396888", "0.5376275", "0.53691566", "0.5345294", "0.53282833", "0.5317449", "0.5285818", "0.52789575", "0.52583647", "0.52462524", "0.52080536", "0.51868224", "0.5168219", "0.51670533", "0.5163496", "0.5150325", "0.5136...
0.6886152
0
Plots a ROC curve for each classifier
def plot_mean_roc_curve_of_classifiers(classifier_roc_list, data_set_description): if const.RECORD_RESULTS is True: fig = plt.figure(figsize=(8, 6.66)) monochrome = (cycler("color", ["k"]) * cycler("marker", [""]) * cycler("linestyle", ["-", "--", "-."])) color_arr = ["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_ROC():\r\n fpr = dict()\r\n tpr = dict()\r\n roc_auc = dict()\r\n threshold = dict()\r\n \r\n for i in range(n_classes):\r\n \r\n fpr[i], tpr[i], threshold[i] = roc_curve(y_test[:, i], y_pred[:, i])\r\n \r\n roc_auc[i] = auc(fpr[i], tpr[i])\r\n\r...
[ "0.7881746", "0.7821903", "0.77732265", "0.7735024", "0.77113014", "0.7636098", "0.7608597", "0.7540226", "0.74923337", "0.74565345", "0.7433374", "0.7372081", "0.7259865", "0.72583896", "0.7231202", "0.72264963", "0.7219714", "0.7154107", "0.71430546", "0.7135938", "0.712159...
0.7588352
7
Plots a histogram of balancer results for a specific metric to file
def plot_balancer_results_per_classifier(data_balancer_results_per_classifier, parameter=(2, "Balanced Accuracy")): classifier_arr = [] color = iter(cm.Set1(np.linspace(0, 1, len(data_balancer_results_per_classifier) + 1))) mean_classifier_arr = [0] * len(data_balancer_results_per_classifier[0][1]) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_histogram(hist, outname, xlabel=\"\", ylabel=\"frequency\"):\n plt.bar(hist[:,0], hist[:,1])\n plt.xlabel(xlabel)\n plt.ylabel(ylabel)\n plt.savefig(outname)\n plt.close()", "def histogram(histo,nbr_launch,file):\n with open(\"Results/Histogram_{}_{}.txt\".format(nbr_launch,file.strip(...
[ "0.6530286", "0.65231216", "0.649234", "0.64292675", "0.6372478", "0.6277188", "0.6113853", "0.61108017", "0.60909116", "0.6079042", "0.6041105", "0.6036437", "0.59583956", "0.59488505", "0.59182066", "0.5886027", "0.5879379", "0.58783364", "0.5867552", "0.5864914", "0.582034...
0.6124033
6
Plots a Kaplan Meier graph of time to default to file
def plot_kaplan_meier_graph_of_time_to_default(time_to_default, data_set_description=""): kmf = KaplanMeierFitter() kmf.fit(time_to_default, event_observed=[1] * len(time_to_default)) ax = kmf.plot(title="{0} Kaplan Meier analysis of time to default".format(data_set_description).replace("_", " ")) ax.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_time_frames(self):\n\n fig = plt.figure()\n plt.grid(True)\n\n plt.ylim([-1.5,1.5])\n plt.xlim([0,1])\n\n for key in self.timeframes.keys():\n if key == 0:\n plt.plot(self.x, self.timeframes[key], label=\"time: \" + str(round(key*self.dt, 3)), l...
[ "0.6950117", "0.6604719", "0.6425373", "0.6411647", "0.62945455", "0.62930465", "0.6272661", "0.61956865", "0.6073431", "0.60684174", "0.60633975", "0.60579836", "0.6050537", "0.6033914", "0.6004738", "0.6001769", "0.59888655", "0.5988027", "0.5968159", "0.5948308", "0.594171...
0.7070033
0
A generic function which plots the difference between the first entry and the rest of the entries to file
def plot_percentage_difference_graph(results, datasets, name_suffix="", parameter="BACC", x_label="Feature selection approach", difference_from="no feature selection", figsize=(16, 5), legend_y=None, label_rotation=0, y_label_pos=None, y_ticks=None, x_label_replacement_dict=None, fe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_diff(self, ax, d0, d1):\n i1 = 0\n for i0 in range(d0.shape[0]):\n try:\n while d0[i0,0] > d1[i1,0]:\n print((d0[i0,0], d1[i1,0]))\n i1 += 1\n except IndexError:\n break\n if d0[i0,0] == d1[i...
[ "0.6217327", "0.61763155", "0.61288965", "0.6023296", "0.6011869", "0.5955028", "0.5901663", "0.5797355", "0.577714", "0.57608503", "0.5745395", "0.5700119", "0.5661348", "0.5626618", "0.56228036", "0.5606026", "0.5561598", "0.55449283", "0.5531544", "0.54875207", "0.545747",...
0.0
-1
Plots the time to default graph of results to file
def plot_time_to_default_results(time_to_default_results_per_classifier, parameter="Balanced accuracy"): color = iter(cm.Set1(np.linspace(0, 1, len(time_to_default_results_per_classifier[0][1]) + 1))) classifier_arr = [] for i in range(len(time_to_default_results_per_classifier[0][1]) + 1): classifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotPerTimeStamp(options):\n name = options['name'] + '_' + options['scan'] + '_perTime'\n if options['extra']:\n name += '_' + options['extra']\n f = openRootFileR(options['name']+'_perTime')\n histname = plotName(name, timestamp=False)\n filename = plotName(name, timestamp=True)\n fi...
[ "0.70562994", "0.6904556", "0.68536395", "0.6678135", "0.66616327", "0.66491324", "0.6602544", "0.6593051", "0.65195054", "0.6446045", "0.6383599", "0.63769704", "0.63568395", "0.6311244", "0.6310854", "0.6298991", "0.62926877", "0.62676895", "0.6264268", "0.62527686", "0.623...
0.0
-1
Plots difference to median TPR and TNR on an x and y axis for multiple datasets
def visualise_dataset_classifier_results(dataset_results): current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") file_name = "raw_dump_{0}.txt".format(current_time) with open(os.path.dirname(os.path.realpath(__file__)) + "/../results/" + file_name, "wb") as output_file: output_file.write(str(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotTimeDelta(data, type_plot, device):\n mean = data.mean()\n std = data.std()\n max_data = data.max()\n min_data = data.min()\n max_indx = np.argmax(data) # max value index\n min_indx = np.argmin(data) # min value index\n x = np.arange(min_data, max_data, 0.1)\n y = normfun(x, mean,...
[ "0.64062333", "0.6103581", "0.60293597", "0.6005076", "0.60047275", "0.59661716", "0.59610087", "0.5950974", "0.59288114", "0.592674", "0.5894661", "0.588506", "0.5852047", "0.58322114", "0.5823186", "0.5814672", "0.5804783", "0.5800278", "0.57631016", "0.57512337", "0.574488...
0.55366945
55
Plots difference from no balancer for different classifiers and data balancing schemes
def visualise_dataset_balancer_results(results, range=(-0.5, 0.5), colors=("#64B3DE", "#1f78b4", "#B9B914", "#FBAC44", "#bc1659", "#33a02c", "grey", "#b15928", "#6a3d9a", "#e31a1c", "#6ABF20", "#ff7f00", "#6a3d9a"), exclude=("SVM (linear)", "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_balancer_results_per_classifier(data_balancer_results_per_classifier, parameter=(2, \"Balanced Accuracy\")):\n classifier_arr = []\n color = iter(cm.Set1(np.linspace(0, 1, len(data_balancer_results_per_classifier) + 1)))\n mean_classifier_arr = [0] * len(data_balancer_results_per_classifier[0][1]...
[ "0.69392395", "0.6658223", "0.65169877", "0.64943475", "0.628095", "0.62724614", "0.61827344", "0.61158895", "0.60847265", "0.6029901", "0.5979186", "0.5974841", "0.5973415", "0.5971678", "0.59669495", "0.5962603", "0.59477496", "0.5941426", "0.59301496", "0.59257036", "0.591...
0.6860829
1
Plots aggregate data balancer results by combining all classifier results for the particular data balancer.
def visualise_dataset_balancer_results_multi_dataset(dataset_results): current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") file_name = "raw_dump_{0}.txt".format(current_time) with open(os.path.dirname(os.path.realpath(__file__)) + "/../results/" + file_name, "wb") as output_file: output_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_balancer_results_per_classifier(data_balancer_results_per_classifier, parameter=(2, \"Balanced Accuracy\")):\n classifier_arr = []\n color = iter(cm.Set1(np.linspace(0, 1, len(data_balancer_results_per_classifier) + 1)))\n mean_classifier_arr = [0] * len(data_balancer_results_per_classifier[0][1]...
[ "0.75818884", "0.671413", "0.6578102", "0.6018402", "0.5996524", "0.5993794", "0.5987738", "0.59610283", "0.59337884", "0.5889667", "0.58879936", "0.58794236", "0.5878393", "0.58589953", "0.58403677", "0.58308715", "0.58304363", "0.5776435", "0.5768485", "0.5756904", "0.57507...
0.746169
1
Simulates green blindness in a color Arguments
def deuteranomaly(c): cc = np.zeros(3) cc[0] = (4211 + 0.677*(255*c[1])**2.2 + 0.2802*(255*c[0])**2.2)**(1.0/2.2) cc[1] = (4211 + 0.677*(255*c[1])**2.2 + 0.2802*(255*c[0])**2.2)**(1.0/2.2) cc[2] = (4211 + 0.95724*(255*c[2])**2.2 + 0.02138*(255*c[1])**2.2 \ - 0.02138*(255*c[0])**2.2)**(1.0/2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightness(color):\n\n strongest = max(color.red, color.green, color.blue)\n weakest = min(color.red, color.green, color.blue)\n return 0.5 * (strongest + weakest) / 255", "def setColorDiffuse(*args):", "def _color(self, args):", "def compute_luminosity(red, green, blue):\r\n return (0.299 *...
[ "0.668433", "0.66246545", "0.66212654", "0.6615543", "0.64932907", "0.6433904", "0.6395846", "0.627033", "0.62459433", "0.6244545", "0.6229325", "0.622143", "0.6183974", "0.61690986", "0.614985", "0.6148988", "0.6143495", "0.61352485", "0.60831016", "0.6057762", "0.6054294", ...
0.0
-1
Simulates red blindness in a color Arguments
def protanomaly(c): cc = np.zeros(3) cc[0] = (782.7 + 0.8806*(255*cc[1])**2.2 + 0.1115*(255*cc[0])**2.2)**(1.0/2.2) cc[1] = (782.7 + 0.8806*(255*cc[1])**2.2 + 0.1115*(255*cc[0])**2.2)**(1.0/2.2) cc[2] = (782.7 + 0.992052*(255*cc[2])**2.2 - 0.003974*(255*cc[1])**2.2 \ + 0.003974*(255*cc[0])**...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _color(self, args):", "def lightness(color):\n\n strongest = max(color.red, color.green, color.blue)\n weakest = min(color.red, color.green, color.blue)\n return 0.5 * (strongest + weakest) / 255", "def compute_luminosity(red, green, blue):\r\n return (0.299 * red) + (0.587 * green) + (0.114 ...
[ "0.6916326", "0.66381216", "0.66007376", "0.65724105", "0.65425265", "0.6514243", "0.6462543", "0.6461585", "0.6320996", "0.63075715", "0.6278275", "0.626712", "0.6259189", "0.6233183", "0.62251776", "0.61820674", "0.6140597", "0.6137846", "0.6115421", "0.61151356", "0.609398...
0.0
-1
Returns a build for compiling typescript files. Using the out directive, typescript will emit a js file with all the included references, so just create a base file that performs all the required includes. A default output file .d.ts is also generated in the output folder.
def compile(base, output, source, bind=True, skip=False): # Paths path = lambda *x: r.path(*[base] + list(x)) tsc_path = path('node_modules', 'typescript', 'bin', 'tsc.js') output_path = path(*output) source_path = path(*source) source_folder = path(*source[:-1]) # Build build = r.buil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Build(self, out_file):\n raise NotImplementedError", "def compile_files(base, output, source, bind=True, amd=False):\n\n # Paths\n path = lambda *x: r.path(*[base] + list(x))\n tsc_path = path('node_modules', 'typescript', 'bin', 'tsc.js')\n output_folder = path(*output)\n source_folder = p...
[ "0.6553955", "0.5779977", "0.5724019", "0.5666004", "0.54626364", "0.5448146", "0.53711534", "0.53711534", "0.5339161", "0.5291656", "0.52618027", "0.52588505", "0.5244529", "0.5209851", "0.51751953", "0.5151105", "0.51451707", "0.51408684", "0.514047", "0.51372755", "0.50789...
0.5712727
3
Compiles a target, then invokes it using node.
def test(base, output, source, bind=True): # Paths path = lambda *x: r.path(*[base] + list(x)) runner = 'node' output_path = path(*output) source_path = path(*source) output_folder = path(*output[:-1]) # Build build = compile(base, output, source, bind=False, skip=True) build.notic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(cls, node, filename):\n compiler = cls(filename)\n compiler.visit(node)\n return compiler.stack.pop()", "def _pyCompile ( target, source, env ) :\n if len(target) != 1 :\n fail ( \"unexpected number of targets for pyCompile: \"+str(target) )\n if len(source) != 1 :\...
[ "0.6068002", "0.6013169", "0.5963838", "0.5867764", "0.58265406", "0.559987", "0.5526865", "0.552637", "0.55262053", "0.54664874", "0.5444324", "0.5436896", "0.5435432", "0.54198766", "0.5417057", "0.54145837", "0.53992826", "0.53654575", "0.53342557", "0.5288225", "0.5267427...
0.5295578
19
Returns a build for compiling multiple typescript modules This works exactly like compile_files with amd = True.
def compile_modules(base, output, source, bind=True): return compile_files(base, output, source, bind, amd=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_files(base, output, source, bind=True, amd=False):\n\n # Paths\n path = lambda *x: r.path(*[base] + list(x))\n tsc_path = path('node_modules', 'typescript', 'bin', 'tsc.js')\n output_folder = path(*output)\n source_folder = path(*source)\n\n # Compile each file. Sometimes --module see...
[ "0.7168874", "0.59924674", "0.5815421", "0.5812318", "0.5812318", "0.5750447", "0.5671063", "0.5620077", "0.55134124", "0.5502796", "0.5469034", "0.54557586", "0.5427786", "0.5426478", "0.53992474", "0.5392173", "0.53844976", "0.5356187", "0.53483844", "0.5321252", "0.5311751...
0.71308005
1
Returns a build for compiling multiple typescript files. Every matching.ts file will be processed separately. If bind is set, the result is bound internally; you typically want to do this, but some ops (eg. rebuild) may want to run the build.execute() manually.
def compile_files(base, output, source, bind=True, amd=False): # Paths path = lambda *x: r.path(*[base] + list(x)) tsc_path = path('node_modules', 'typescript', 'bin', 'tsc.js') output_folder = path(*output) source_folder = path(*source) # Compile each file. Sometimes --module seems to screw u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_modules(base, output, source, bind=True):\n return compile_files(base, output, source, bind, amd=True)", "def compile(base, output, source, bind=True, skip=False):\n\n # Paths\n path = lambda *x: r.path(*[base] + list(x))\n tsc_path = path('node_modules', 'typescript', 'bin', 'tsc.js')\n ...
[ "0.6088479", "0.56501824", "0.5504514", "0.5331496", "0.5290386", "0.52033865", "0.5071304", "0.50649625", "0.5030966", "0.49910313", "0.49463353", "0.49420282", "0.49213454", "0.49104938", "0.4905638", "0.49018425", "0.48995948", "0.48995948", "0.48929653", "0.48861158", "0....
0.6061279
1
sends an email when lead saved successfully
def send_lead_task(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website): logger.info("in send lead mail task") return send_lead_email(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, fail_silently=False):\n send_mail(fail_silently=fail_silently, **self.get_message_dict())", "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has bee...
[ "0.67478585", "0.64101136", "0.61686337", "0.61469436", "0.61077154", "0.61048436", "0.60561985", "0.6044016", "0.60433817", "0.5962845", "0.59153545", "0.5879812", "0.5870707", "0.5869888", "0.58417296", "0.5837118", "0.5825478", "0.58196616", "0.57915473", "0.5787865", "0.5...
0.6403527
2
sends an email when lead saved successfully
def send_ext_customer_task(email,name,password,phone,shop,address,lead_mail,mem_mail,website): print("member email",mem_mail) logger.info("in sending existing customer mail task") return send_ext_customer_mail(email,name,password,phone,shop,address,lead_mail,mem_mail,website)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, fail_silently=False):\n send_mail(fail_silently=fail_silently, **self.get_message_dict())", "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has bee...
[ "0.67478585", "0.64101136", "0.6403527", "0.61686337", "0.61469436", "0.61077154", "0.61048436", "0.60561985", "0.6044016", "0.60433817", "0.5962845", "0.59153545", "0.5879812", "0.5870707", "0.5869888", "0.58417296", "0.5837118", "0.5825478", "0.58196616", "0.57915473", "0.5...
0.54872906
51
sends an email when lead saved successfully
def send_new_credentials(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website): logger.info("in send lead mail task") return send_lead_generate(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, fail_silently=False):\n send_mail(fail_silently=fail_silently, **self.get_message_dict())", "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has bee...
[ "0.67476535", "0.6409794", "0.64040166", "0.6167846", "0.61461926", "0.61059725", "0.61046255", "0.605578", "0.6043292", "0.6042979", "0.5960896", "0.59149146", "0.5868797", "0.5867584", "0.58403814", "0.58367157", "0.58244336", "0.5819981", "0.57925284", "0.57854337", "0.576...
0.5880153
12
Render each drawing by converting the drawing to image ink and then applying broaden & blur filters
def forward(self, drawings, blur_sigma=None, epsilon=None): # draw the strokes (this part on cpu) if not isinstance(drawings[0], list): single = True drawings = [drawings] else: single = False pimgs = self.painter(drawings) pimgs = self.broade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n self.bufferX = (self.appWidth/2) - self.viewX\n self.bufferY = (self.appHeight/2) - self.viewY\n anwp.sl.engine.clear()\n anwp.sl.engine.drawImage(0, 0, self.appWidth, self.appHeight, self.backgroundImage)\n self.drawWarpLines()\n \n # render engin...
[ "0.62051916", "0.608807", "0.60164183", "0.5994042", "0.5974199", "0.5956731", "0.59398204", "0.5916923", "0.5856512", "0.582398", "0.5776995", "0.57500255", "0.57297295", "0.57178104", "0.570983", "0.5693524", "0.5684857", "0.5681157", "0.5680937", "0.5669405", "0.5637934", ...
0.69175744
0
In this version, we include all partial canvas renders in addition to the final renders
def forward_partial(self, drawing, blur_sigma=None, epsilon=None, concat=False): if isinstance(drawing[0], list): pimgs = [self.painter.forward_partial(d) for d in drawing] lengths = [len(p) for p in pimgs] pimgs = torch.cat(pimgs) pimgs = self.broaden_and_blur(pi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_draw(self):\n\t\tself.render()", "def on_draw(self):\n\t\tself.render()", "def dspyRender(self):\n pass", "def on_draw(self):\n # draw everything", "def render(self):\n self.axial.Render()\n self.coronal.Render()\n self.sagittal.Render()\n #self.isosurface.R...
[ "0.62798715", "0.62798715", "0.6229959", "0.62175214", "0.62031156", "0.6023987", "0.5880108", "0.58327454", "0.58257514", "0.5803622", "0.5789395", "0.57692194", "0.5759491", "0.57456064", "0.57041544", "0.5677518", "0.5677518", "0.5677518", "0.5677518", "0.56731313", "0.567...
0.0
-1
In this version, we include all partial canvas renders in addition to the final renders
def forward_partial(self, drawing): assert not self.is_cuda drawing = drawings_to_cpu(drawing) ns = len(drawing) pimgs = torch.zeros(ns+1, *self.imsize) canvas = torch.zeros(*self.imsize) for i, stk in enumerate(drawing): canvas, _ = self.add_stroke(canvas, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_draw(self):\n\t\tself.render()", "def on_draw(self):\n\t\tself.render()", "def dspyRender(self):\n pass", "def on_draw(self):\n # draw everything", "def render(self):\n self.axial.Render()\n self.coronal.Render()\n self.sagittal.Render()\n #self.isosurface.R...
[ "0.628021", "0.628021", "0.62287074", "0.6217737", "0.6203357", "0.60232645", "0.5878731", "0.58328944", "0.58255154", "0.5802863", "0.5789068", "0.57696724", "0.5759943", "0.5747099", "0.5704188", "0.56780964", "0.56780964", "0.56780964", "0.56780964", "0.5672039", "0.567181...
0.5282165
88
Get property value from object.
def get(self, obj): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value_from_object(obj, key):\n if is_dict(obj):\n return obj.get(key)\n return getattr(obj, key, None)", "def get(self, prop):\r\n prop_parts = prop.split(\".\")\r\n val = None\r\n for part in prop_parts:\r\n if val is None:\r\n val = self.obj.g...
[ "0.7294242", "0.7260294", "0.72458637", "0.7177455", "0.71202344", "0.6993076", "0.69180053", "0.6906648", "0.6891664", "0.68564713", "0.68375313", "0.6823808", "0.6799708", "0.6789528", "0.67803353", "0.67259824", "0.67239094", "0.6705578", "0.6705456", "0.66965705", "0.6668...
0.6502106
26
Set property value on object.
def set(self, obj, value): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, obj, value):\n pass", "def set_value ( self, object, value ):\n target, name = self.target_name( object )\n setattr( target, name, value )", "def __set__(self, obj, value):\r\n pass", "def set_property(self, name, value):\n self.properties[name] = value", "def _...
[ "0.80547476", "0.77362704", "0.76287323", "0.76190275", "0.75847745", "0.7426509", "0.73941714", "0.72769517", "0.726904", "0.72673047", "0.7146816", "0.7140176", "0.7101052", "0.7087965", "0.7087463", "0.7041664", "0.69987345", "0.69987345", "0.6997965", "0.69783264", "0.695...
0.79016274
1
Set `password_hash` only when `password` is not set.
def _create(cls, model_class, *args, **kwargs): assert 'password' in kwargs assert 'passwd_hash' in kwargs if kwargs.get('password'): kwargs.pop('passwd_hash') return super()._create(model_class, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(password.encode(), salt)", "def hash_password(self, password):\n self.password_hash = generate_password_hash(password)", "def set_password(self, password):\n self.password = self.ha...
[ "0.7201298", "0.7091728", "0.70867187", "0.6961345", "0.69605434", "0.69136447", "0.6894837", "0.6894837", "0.68855447", "0.6867788", "0.68643236", "0.6862712", "0.68401206", "0.68401206", "0.68401206", "0.68401206", "0.67581147", "0.6730123", "0.6710391", "0.6706543", "0.668...
0.0
-1
Create a room history entry, which is required for consistency reasons.
def room_history_entries(self, create, extracted, **kwargs): if create and self.room is not None: # Set room history entry begin to registration date rhe = RoomHistoryEntry.q.filter_by(user=self, room=self.room).one() rhe.active_during = starting_from(self.registered_at) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_room_history(self, room):\n pass", "def create_historical_record(self, instance, history_type):\n history_date = getattr(instance, '_history_date', now())\n history_changeset = self.get_history_changeset(instance)\n manager = getattr(instance, self.manager_name)\n attrs...
[ "0.66256154", "0.62829894", "0.62376595", "0.6034511", "0.6028819", "0.6023105", "0.6000676", "0.5989488", "0.59509176", "0.5908362", "0.582105", "0.5779776", "0.5768183", "0.5764454", "0.5743833", "0.57111114", "0.57085574", "0.56982267", "0.56964606", "0.5662375", "0.564588...
0.7202129
0
If the input URL contains a port number, strip it out
def rewrite_url(line): url_list = line.split(' ') old_url = url_list[0] new_url = '\n' # http://192.168.1.13/biedronka_logo.jpg 192.168.1.100/192.168.1.100 - GET myip=- myport=3128 if old_url.endswith('jpg') or old_url.endswith('.jpeg'): filename = str(uuid.uuid4())+".jpg" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_empty_port():\n assert (normalize_url(\"http://www.example.com:/\") ==\n \"http://www.example.com/\")", "def test_remove_default_port():\n assert (normalize_url(\"http://www.example.com:80/bar.html\") ==\n \"http://www.example.com/bar.html\")\n assert (normalize_url...
[ "0.7776715", "0.7397051", "0.6689824", "0.6589313", "0.650951", "0.650275", "0.6461937", "0.6428155", "0.64266", "0.6361706", "0.6282323", "0.62341475", "0.61968756", "0.6188919", "0.6155203", "0.6127684", "0.61132604", "0.60064256", "0.59795815", "0.5977992", "0.5977227", ...
0.0
-1
MLP Block in Transformer Encoder
def __init__(self, hidden_layers, dropout=0.1, activation='gelu'): super(MLPBlock, self).__init__() layers = [] for num_units in hidden_layers: layers.extend([ Dense(num_units, activation=activation), Dropout(dropout) ]) self.mlp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, num_layers, num_heads, D, mlp_dim, dropout=0.1, norm_eps=1e-12):\n super(TransformerEncoder, self).__init__()\n\n # Create num_layers of TransformerBlock\n self.encoder = Sequential(\n [\n TransformerBlock(num_heads=num_heads,\n ...
[ "0.63641286", "0.61162806", "0.6006187", "0.59183264", "0.56983024", "0.5687006", "0.5635837", "0.56081927", "0.55380064", "0.5521205", "0.54553306", "0.5424783", "0.5420473", "0.54017746", "0.53908736", "0.5378384", "0.5374217", "0.5369382", "0.5336188", "0.5329734", "0.5307...
0.5075871
54
Pass output of multihead attention to mlp block
def call(self, inputs, *args, **kwargs): outputs = self.mlp(inputs, *args, **kwargs) return outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attention_module_multi_head(roi_feat, position_embedding,\n nongt_dim, fc_dim, feat_dim,\n dim=(1024, 1024, 1024),\n group=16, index=1):\n dim_group = (dim[0] / group, dim[1] / group, dim[2] / group)\n nongt_roi_...
[ "0.63806444", "0.62879974", "0.61243266", "0.6001117", "0.59858584", "0.58377385", "0.57497156", "0.57036", "0.56529164", "0.56093395", "0.5535092", "0.55335355", "0.55295086", "0.54910344", "0.54799116", "0.5470056", "0.5456178", "0.54472595", "0.53975135", "0.53934085", "0....
0.0
-1
Transformer blocks which includes multihead attention layer and mlp block
def __init__(self, num_heads, D, hidden_layers, dropout=0.1, norm_eps=1e-12): super(TransformerBlock, self).__init__() # Attention self.attention = MultiHeadAttention( num_heads=num_heads, key_dim=D, dropout=dropout ) self.norm_attention = LayerNormalization(epsilon=n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model_multihead_attention_multiscaleCNN4_covermore(self,\n dim_attention,headnum,\n embedding_vec,\n load_weights=False, weight_dir=None,\n nb_filter...
[ "0.6663586", "0.6597379", "0.64268494", "0.6360674", "0.6338788", "0.6257444", "0.6235589", "0.6209039", "0.60610014", "0.59759337", "0.59740186", "0.59430027", "0.590821", "0.5900392", "0.58956826", "0.5895034", "0.58770245", "0.58639365", "0.5794944", "0.5788988", "0.576384...
0.6992421
0
Pass Embedded Patches through the layers
def call(self, inputs): # Feed attention norm_attention = self.norm_attention(inputs) attention = self.attention(query=norm_attention, value=norm_attention) # Skip Connection attention += inputs # Feed MLP outputs = self.mlp(self.norm_mlp(attention)) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(layers):", "def build_layers(self):\n raise NotImplementedError", "def layers(self): # -> LayerView:\n ...", "def UpdateLayers(self):\n pass", "def layers(self, layers):\n self._layers = layers\n prev = None\n for layer in layers:\n if not layer.inputs...
[ "0.64498407", "0.6189903", "0.6165279", "0.5999772", "0.5932045", "0.5875921", "0.5680412", "0.5599581", "0.5518509", "0.5489415", "0.5385347", "0.5311613", "0.53089815", "0.5294126", "0.5293941", "0.52928007", "0.5287579", "0.5253471", "0.52430594", "0.5234675", "0.5187667",...
0.0
-1
Transformer Encoder which comprises several transformer layers
def __init__(self, num_layers, num_heads, D, mlp_dim, dropout=0.1, norm_eps=1e-12): super(TransformerEncoder, self).__init__() # Create num_layers of TransformerBlock self.encoder = Sequential( [ TransformerBlock(num_heads=num_heads, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoder(enc_input, attn_bias, n_layer, n_head,\n d_key, d_value, d_model, d_inner_hid, pos_enc,\n preporstprocess_dropout, attention_dropout,\n relu_dropout, preprocess_cmd='n',\n postprocess_cmd='da'):\n for i in range(n_layer):\n enc_output = encoder_layer(enc_input, attn_bias, n_head,\...
[ "0.72634786", "0.7005841", "0.68940455", "0.68260175", "0.68099016", "0.6762681", "0.6706989", "0.66525126", "0.66428787", "0.6633862", "0.6610087", "0.6552235", "0.65452635", "0.6533876", "0.6485411", "0.64490217", "0.6430559", "0.64192617", "0.64069134", "0.638147", "0.6380...
0.63730127
21
Pass Embedded Patches through the layers
def call(self, inputs, *args, **kwargs): outputs = self.encoder(inputs, *args, **kwargs) return outputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(layers):", "def build_layers(self):\n raise NotImplementedError", "def layers(self): # -> LayerView:\n ...", "def UpdateLayers(self):\n pass", "def layers(self, layers):\n self._layers = layers\n prev = None\n for layer in layers:\n if not layer.inputs...
[ "0.6448038", "0.6187745", "0.6163194", "0.5998497", "0.5929416", "0.5873209", "0.56773156", "0.5597431", "0.5518665", "0.5488085", "0.5382779", "0.53090936", "0.53070503", "0.52928275", "0.5291836", "0.5291313", "0.5284668", "0.5253536", "0.5242199", "0.523257", "0.51847124",...
0.0
-1
Creates an upper confidence tree by simulating N games starting from the given state in order to select the move leading to the best results
def get_uct(self, state): root = ut.UCTree(state) for _ in range(self.N): moves = [] leaf = root.select(moves, state.courant) win = leaf.simulate(moves) root.back_propagate(leaf, moves, win) return root
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, s, n=1000):\n\n root = StateNode(None, s, self.game)\n \n if root.parent is not None:\n raise ValueError(\"Root's parent must be None.\")\n \n for _ in range(n):\n #selection\n node = _get_next_node(root, self.tree_polic...
[ "0.69618815", "0.65259063", "0.6470664", "0.6314135", "0.62374127", "0.6210219", "0.61834335", "0.6150433", "0.6120203", "0.6094854", "0.6084462", "0.60547906", "0.6046755", "0.6046614", "0.6031796", "0.5984574", "0.5967185", "0.59669054", "0.595718", "0.595556", "0.5952896",...
0.6509543
2
Return the last bytes of a file containing utf8 formatted text rather than the whole contents. The last bytes is determined by size_in_bytes
def read_last_bytes_of_file(file_path: str, size_in_bytes: int) -> str: with open(file_path, "rb") as file: # Note the minus sign file.seek(-size_in_bytes, os.SEEK_END) content = file.read().decode("utf-8") return content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_file_last_line(f, encoding=\"utf-8\"):\n f.seek(0, os.SEEK_END) # start at the second to last character, since text files should end in a newline\n if f.tell() < 2: return \"\"\n f.seek(-2, os.SEEK_END) # start at the second to last character, since text files should end in a newline\n while f...
[ "0.61801714", "0.5925", "0.59065217", "0.58524173", "0.5808898", "0.56951183", "0.5602501", "0.5586138", "0.55584174", "0.55470455", "0.55171245", "0.5497499", "0.5476367", "0.5474634", "0.54546565", "0.5451746", "0.5424187", "0.541994", "0.5400577", "0.53996587", "0.53982", ...
0.79039353
0
Test basic ranking page.
def test_northamerica_population(self): self.driver.get(self.url_ + '/ranking/Count_Person/Country/northamerica') subtitle_present = EC.text_to_be_present_in_element( (By.TAG_NAME, 'h3'), 'All Countries in North America') WebDriverWait(self.driver, self.TIME...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_rank(self):\n inv_search = 'rank:Postdoc'\n spi_search = 'find rank Postdoc'\n self._compare_searches(inv_search, spi_search)", "def test_something(self):\n\n allure.dynamic.title(\"Testing compute_ranks\")\n allure.dynamic.severity(allure.severity_leve...
[ "0.71264744", "0.6681979", "0.6591885", "0.6474593", "0.6324985", "0.6264448", "0.6260697", "0.6223638", "0.61334574", "0.61309284", "0.6111487", "0.61088467", "0.60755545", "0.6048969", "0.6043513", "0.5932428", "0.5879655", "0.58348274", "0.58152354", "0.5808058", "0.569797...
0.5600284
29
Test translations are displayed correctly in hindi, as well as bottom rankings rendered correctly.
def test_energy_consumption_bottom_ranking_hi(self): self.driver.get( self.url_ + '/ranking/Amount_Consumption_Energy_PerCapita/Country/?h=country%2FIND&unit=kg&hl=hi&bottom=' ) self.assertEqual( self.driver.find_elements_by_class_name('navbar-brand')[0].text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_i18n10(self):\n with translation.override('de'):\n output = self.engine.render_to_string('i18n10', {'bool': True})\n self.assertEqual(output, 'Ja')", "def test_i18n27(self):\n with translation.override(\"ru\"):\n output = self.engine.render_to_string(\"i18n27\"...
[ "0.66185194", "0.65907204", "0.65775216", "0.65519655", "0.65519655", "0.65463674", "0.6530294", "0.6447057", "0.64026135", "0.63868695", "0.6383359", "0.63773143", "0.63244116", "0.6323046", "0.6316519", "0.6313638", "0.63092667", "0.62892264", "0.62892264", "0.6254798", "0....
0.58505183
55
Test translations are displayed correctly in korean, as well as top rankings rendered correctly.
def test_energy_consumption_top_ranking_ko(self): self.driver.get( self.url_ + '/ranking/Amount_Consumption_Energy_PerCapita/Country/?h=country%2FKOR&unit=kg&hl=ko' ) self.assertEqual( self.driver.find_elements_by_class_name('navbar-brand')[0].text, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_i18n10(self):\n with translation.override('de'):\n output = self.engine.render_to_string('i18n10', {'bool': True})\n self.assertEqual(output, 'Ja')", "def test_i18n27(self):\n with translation.override(\"ru\"):\n output = self.engine.render_to_string(\"i18n27\"...
[ "0.70812863", "0.6640255", "0.6615368", "0.6592845", "0.6592845", "0.6576762", "0.65381277", "0.64886284", "0.64697886", "0.6454866", "0.642305", "0.63667893", "0.636136", "0.632902", "0.632902", "0.6252181", "0.61971015", "0.6178152", "0.61683005", "0.6137992", "0.6137528", ...
0.57219356
65
Create an instance of the FriCAS interpreter.
def __init__(self, name='fricas', command='fricas -nox -noclef', script_subdirectory=None, logfile=None, server=None, server_tmpdir=None, init_code=[')lisp (si::readline-off)']): PanAxiom.__init__(self, name, command, script_subdirectory, logfi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_execution_engine(self):\n target = self.binding.Target.from_default_triple()\n target_machine = target.create_target_machine()\n backing_mod = binding.parse_assembly(\"\")\n engine = binding.create_mcjit_compiler(backing_mod, target_machine)\n self.engine = engine", ...
[ "0.57146007", "0.56284124", "0.56038344", "0.55532616", "0.5481942", "0.54455805", "0.5445103", "0.54039806", "0.5394971", "0.5394971", "0.5394971", "0.5316189", "0.5302524", "0.5259621", "0.5259621", "0.52579147", "0.52550256", "0.52283067", "0.519386", "0.5180122", "0.51798...
0.6181505
0
Return the FriCASExpectFunction class.
def _function_class(self): return FriCASExpectFunction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _function_element_class(self):\n return FriCASFunctionElement", "def func(self):\n return self.__class__", "def choose_botorch_acqf_class() -> Type[AcquisitionFunction]:\n # NOTE: In the future, this dispatch function could leverage any\n # of the attributes of `BoTorchModel` or kwargs ...
[ "0.7460688", "0.55869156", "0.5528139", "0.5359988", "0.52939034", "0.52370685", "0.51732045", "0.5147477", "0.5134911", "0.51322496", "0.51305723", "0.5104154", "0.5016477", "0.5000046", "0.49879676", "0.4959492", "0.49496135", "0.49427474", "0.49407926", "0.49324685", "0.49...
0.8935946
0
Returns the FriCAS function element class.
def _function_element_class(self): return FriCASFunctionElement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _function_class(self):\n return FriCASExpectFunction", "def getFunctionClass(functionID):\n d = { 1: Linear,\n 2: LinearDrag,\n 11: Gaussian,\n 12: GaussianDrag,\n 21: Lorentzian,\n 22: LorentzianDrag }\n return d[functionID]", "def cfunc_type(sel...
[ "0.702561", "0.63299495", "0.5833264", "0.5420016", "0.53800005", "0.5317835", "0.52904075", "0.5280903", "0.52620566", "0.5225637", "0.5214052", "0.51871824", "0.5172217", "0.5167699", "0.51647925", "0.5153158", "0.51406175", "0.5124004", "0.51109064", "0.5101468", "0.509311...
0.8683575
0
Spawn a new FriCAS commandline session.
def console(self): fricas_console()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def main():\n # Parse arguments.\n parser = argparse.ArgumentParser(description='Console for cluster test.')\n parser.add_argument('-c', dest='command_config_file',\n default='command...
[ "0.60068893", "0.5865383", "0.5834904", "0.58237004", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", ...
0.0
-1
A helper function for converting FriCAS domains to the corresponding Sage object.
def _sage_domain(self): P = self._check_valid() name = str(self) if name == 'Integer': from sage.rings.all import ZZ return ZZ elif name == 'DoubleFloat': from sage.rings.all import RDF return RDF elif name.startswith('Fraction('): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain(self, domain):", "def convert_to(self, domain):\n if domain == self.domain:\n return self.copy()\n elif domain == QQ and self.domain == ZZ:\n return self._new(flint.fmpq_mat(self.rep), self.shape, domain)\n elif domain == ZZ and self.domain == QQ:\n ...
[ "0.5323861", "0.5196539", "0.5191682", "0.5174157", "0.5057873", "0.50186723", "0.50181675", "0.50177693", "0.5009062", "0.49185956", "0.49113917", "0.4876111", "0.48465654", "0.48391303", "0.48309028", "0.48160523", "0.48104942", "0.48038787", "0.47553554", "0.47521913", "0....
0.5950558
0
Return True if x is of type FriCASElement.
def is_FriCASElement(x): return isinstance(x, FriCASElement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_(t, x):\n return type(x) is t", "def _isinstance(cls, x):\n return isinstance(x, cls.PYTHON_TYPE_CHECK)", "def has_x(self):\n return any(map(lambda s: s.is_x, self))", "def is_my_case(self, type_):\n return (\n isinstance(self.__apply_sequence(type_), self.declaratio...
[ "0.6683116", "0.6371762", "0.6274012", "0.6056215", "0.5898661", "0.58613616", "0.58362883", "0.57680345", "0.56762767", "0.5658424", "0.56527305", "0.5597607", "0.5569221", "0.55410606", "0.55354494", "0.55278945", "0.552147", "0.54687995", "0.54323465", "0.54302615", "0.541...
0.8895811
0
Returns the FriCAS interface object defined in sage.interfaces.fricas.
def reduce_load_fricas(): return fricas
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fcigraph(self) -> 'FciGraph':\n return self._core", "def ICRFFile_Instance():\n return _gmat_py.ICRFFile_Instance()", "def copy(self):\n return FlorisInterface(self.floris.as_dict())", "def _get_fcoe_intf_port_type(self):\n return self.__fcoe_intf_port_type", "def get_fsurface(s...
[ "0.57734627", "0.52523446", "0.5242085", "0.52116334", "0.51110476", "0.5084472", "0.50731456", "0.5066771", "0.5064217", "0.5060581", "0.4997012", "0.49558657", "0.4905208", "0.4905208", "0.48911813", "0.4859921", "0.48593447", "0.48388115", "0.4777076", "0.4754972", "0.4744...
0.4545254
70
Spawn a new FriCAS commandline session.
def fricas_console(): from sage.repl.rich_output.display_manager import get_display_manager if not get_display_manager().is_in_terminal(): raise RuntimeError('Can use the console only in the terminal. Try %%fricas magics instead.') os.system('fricas -nox')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def main():\n # Parse arguments.\n parser = argparse.ArgumentParser(description='Console for cluster test.')\n parser.add_argument('-c', dest='command_config_file',\n default='command...
[ "0.60068893", "0.5865383", "0.5834904", "0.58237004", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", "0.5808352", ...
0.0
-1
optimise the order of matrixchain multiplication
def MatMulOrder(D): num = len(D)-1 # number of matrix in the chain print(f"There are {num} matrix to multiply") M = [[0 for _ in range(num)] for _ in range(num)] P = [[0 for _ in range(num)] for _ in range(num)] # i要从大到小 # i == j时, M[i][j]=0,所以不用更新 # i-th矩阵到j-th矩阵的乘的最优值初始化为inf for i in range(num-2, -1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _multi_matmul_chain_order(arrays):\n n = len(arrays)\n # p stores the dimensions of the matrices\n # Example for p: A_{10x100}, B_{100x5}, C_{5x50} --> p = [10, 100, 5, 50]\n # Using -2 to generalize for shapes that are more than 2 dimmensions\n p = [a.shape[-2] for a in arrays] + [arrays[-1].sh...
[ "0.72562563", "0.66338646", "0.65753275", "0.6564074", "0.65081275", "0.64550495", "0.644735", "0.64060277", "0.63821524", "0.6356483", "0.6325638", "0.62876886", "0.6280246", "0.6212008", "0.6144578", "0.6132298", "0.6067564", "0.6057658", "0.5975746", "0.5975746", "0.596742...
0.697833
1
Pick GPU if available, else CPU
def get_default_device(): if torch.cuda.is_available(): return torch.device('cuda') else: return torch.device('cpu')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gpu_device_if_present():\n d = dpctl.SyclDevice(\"gpu,cpu\")\n print(\"Selected \" + (\"GPU\" if d.is_gpu else \"CPU\") + \" device\")", "def return_free_GPU():\r\n if torch.cuda.is_available():\r\n gpu_num = torch.cuda.device_count()\r\n device = torch.device('cuda:{}'.format(g...
[ "0.764121", "0.7275213", "0.72637", "0.7186788", "0.7095117", "0.70836645", "0.7030326", "0.7010705", "0.6991861", "0.698923", "0.698923", "0.698923", "0.6968887", "0.6954786", "0.6902639", "0.6902639", "0.68919474", "0.6876222", "0.6868331", "0.6805084", "0.67924947", "0.6...
0.6680545
26
Move tensor(s) to chosen device
def to_device(data, device): if isinstance(data, (list,tuple)): return [to_device(x, device) for x in data] return data.to(device, non_blocking=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_device(input_tensors: List[torch.Tensor],\n target_device: Optional[torch.device],\n non_blocking: bool = False) -> Iterable[torch.Tensor]:\n return (tensor if tensor.device == target_device or target_device is None\n else tensor.to(target_device, non_b...
[ "0.6268374", "0.5992489", "0.58285815", "0.58246756", "0.5760445", "0.5746895", "0.56957227", "0.5695672", "0.5674205", "0.5668232", "0.5656621", "0.55133724", "0.5512487", "0.55118686", "0.54767984", "0.5452559", "0.54362", "0.5378659", "0.5353823", "0.5353823", "0.53118145"...
0.0
-1
Yield a batch of data after moving it to device
def __iter__(self): for b in self.dl: yield to_device(b, self.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for b in self.dl: \n yield to_device(b, self.device) # yield pauses the execution, not store values in memory, forgets about them once iterated\n # no need to remove batch of data from device, done automatically", "def __iter__(self):\n while True:\n ...
[ "0.80380756", "0.681836", "0.6770501", "0.6756917", "0.6754636", "0.67446125", "0.6652299", "0.6626395", "0.6621452", "0.65598935", "0.65336037", "0.6526245", "0.64669716", "0.6410819", "0.63767326", "0.63346195", "0.6315828", "0.63127494", "0.6302321", "0.6286355", "0.627287...
0.68135273
3