query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Sets the force_symmetric of this OneOfSolidNumericsSolver. | def force_symmetric(self, force_symmetric):
self._force_symmetric = force_symmetric | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_force(self, force):\n self.store[\"force\"] = force",
"def SetOperatorSymmetry(self, is_sym):\n return _hypre.HypreSmoother_SetOperatorSymmetry(self, is_sym)",
"def _apply_symmetry(self):\r\n self.command_stack.do(model.structure.ApplySymmetry(self._structure))",
"def is_symmetri... | [
"0.59803796",
"0.57306653",
"0.5726712",
"0.57097393",
"0.5703765",
"0.5702506",
"0.55567485",
"0.54915965",
"0.54616463",
"0.5420816",
"0.5402628",
"0.5160185",
"0.51129544",
"0.507831",
"0.50758404",
"0.5062904",
"0.505149",
"0.50375086",
"0.49710798",
"0.49707735",
"0.4942... | 0.84967124 | 0 |
Sets the precision_singularity_detection of this OneOfSolidNumericsSolver. | def precision_singularity_detection(self, precision_singularity_detection):
self._precision_singularity_detection = precision_singularity_detection | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_precision(self, precision) :\n self.__precision = self.parent().monoid().filter(precision)",
"def sparkline_decimal_precision(self, sparkline_decimal_precision):\n\n self._sparkline_decimal_precision = sparkline_decimal_precision",
"def change_precision(self, precision):\n if prec... | [
"0.59821254",
"0.57778054",
"0.5626338",
"0.5590415",
"0.54841596",
"0.5385266",
"0.5230607",
"0.5179348",
"0.51617527",
"0.51497173",
"0.5103238",
"0.50146294",
"0.48979315",
"0.46964014",
"0.46956527",
"0.46843532",
"0.45929563",
"0.45886877",
"0.45724285",
"0.4555075",
"0.... | 0.83565986 | 0 |
Sets the stop_if_singular of this OneOfSolidNumericsSolver. | def stop_if_singular(self, stop_if_singular):
self._stop_if_singular = stop_if_singular | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stopif(self, stop):\n if stop:\n self._stopsim = True",
"def set_stop(self):\n self.timer.stop=True\n final_message = \"Time %s: Interrupted %s\"%(self.sim.timestr(),\n self.timer.func.__name__)\n self._close(final_messa... | [
"0.5197008",
"0.4675085",
"0.4581584",
"0.45118767",
"0.44749933",
"0.44173616",
"0.4408216",
"0.43689603",
"0.4366131",
"0.43661186",
"0.4325135",
"0.43114015",
"0.42906848",
"0.4277394",
"0.42624864",
"0.42460838",
"0.42369586",
"0.42285982",
"0.42273188",
"0.42148164",
"0.... | 0.78414893 | 0 |
Sets the memory_percentage_for_pivoting of this OneOfSolidNumericsSolver. | def memory_percentage_for_pivoting(self, memory_percentage_for_pivoting):
self._memory_percentage_for_pivoting = memory_percentage_for_pivoting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memory_limit(memory_percentage: float):\n soft, hard = resource.getrlimit(resource.RLIMIT_AS)\n print(\"Memory Hard Limit: \" + str(hard) + \" Soft Limit: \" + str(soft) +\n \" Maximum of percentage of memory use: \" + str(memory_percentage))\n resource.setrlimit(resource.RLIMIT_AS, (get_memo... | [
"0.5484547",
"0.5347334",
"0.53430045",
"0.5321619",
"0.5263387",
"0.5226872",
"0.5226872",
"0.52249676",
"0.5197713",
"0.5197713",
"0.5197713",
"0.5197713",
"0.5189362",
"0.50953305",
"0.5085735",
"0.5083942",
"0.5058034",
"0.49903232",
"0.49559012",
"0.49338302",
"0.4904175... | 0.86614805 | 0 |
Sets the matrix_filtering_threshold of this OneOfSolidNumericsSolver. | def matrix_filtering_threshold(self, matrix_filtering_threshold):
self._matrix_filtering_threshold = matrix_filtering_threshold | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass",
"def filter_threshold(self, analyte, threshold, filt=False):\n params = locals()\n del(params['self'])\n\n # generate filter\n vals = trace = nominal_values(self.focus[analyte])\n ... | [
"0.54082084",
"0.5271619",
"0.5186315",
"0.5175228",
"0.5175228",
"0.5175228",
"0.5175228",
"0.5175228",
"0.51253873",
"0.5086968",
"0.49856767",
"0.49345338",
"0.49310824",
"0.4822208",
"0.48154563",
"0.48080784",
"0.4805389",
"0.47949004",
"0.47773662",
"0.47509274",
"0.474... | 0.85339105 | 0 |
Sets the single_precision of this OneOfSolidNumericsSolver. | def single_precision(self, single_precision):
self._single_precision = single_precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_precision(self, precision) :\n self.__precision = self.parent().monoid().filter(precision)",
"def change_precision(self, precision):\n if precision <= 0:\n print(\"Precision must be positive\")\n else:\n self.precision = precision\n self.input_equati... | [
"0.59180766",
"0.5558505",
"0.5555847",
"0.53544706",
"0.53195286",
"0.5231838",
"0.5208907",
"0.5093977",
"0.50499856",
"0.50241125",
"0.50184566",
"0.501102",
"0.50092643",
"0.5000527",
"0.49923727",
"0.49709862",
"0.48887622",
"0.48566163",
"0.481582",
"0.4788341",
"0.4780... | 0.81512314 | 0 |
Sets the distributed_matrix_storage of this OneOfSolidNumericsSolver. | def distributed_matrix_storage(self, distributed_matrix_storage):
self._distributed_matrix_storage = distributed_matrix_storage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_distributed():\r\n args = get_args()\r\n\r\n device_count = torch.cuda.device_count()\r\n if torch.distributed.is_initialized():\r\n\r\n if args.rank == 0:\r\n print('torch distributed is already initialized, '\r\n 'skipping initialization ...', flush=Tru... | [
"0.56007403",
"0.50806534",
"0.49683917",
"0.49654037",
"0.49493432",
"0.4947964",
"0.48905843",
"0.4884855",
"0.48576596",
"0.48379427",
"0.48239097",
"0.48217082",
"0.48182186",
"0.48145774",
"0.48071262",
"0.477266",
"0.4763774",
"0.46926704",
"0.46869937",
"0.46805042",
"... | 0.83973974 | 0 |
Sets the max_iterations of this OneOfSolidNumericsSolver. | def max_iterations(self, max_iterations):
if (self.local_vars_configuration.client_side_validation and
max_iterations is not None and max_iterations < 0): # noqa: E501
raise ValueError("Invalid value for `max_iterations`, must be a value greater than or equal to `0`") # noqa: E501
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_maximum_iterations(self, n):\n self.maximum_iterations = n\n return",
"def SetMaxIter(self, max_iter):\n return _hypre.HypreFGMRES_SetMaxIter(self, max_iter)",
"def SetMaxIter(self, max_iter):\n return _hypre.HypreAME_SetMaxIter(self, max_iter)",
"def SetMaxIter(self, max_... | [
"0.7254863",
"0.7109892",
"0.70228654",
"0.70005035",
"0.69306284",
"0.6886336",
"0.67247343",
"0.66506165",
"0.62541664",
"0.6229508",
"0.62243074",
"0.61504996",
"0.6127112",
"0.61162484",
"0.6110617",
"0.6110617",
"0.6110232",
"0.59537834",
"0.59391195",
"0.59193784",
"0.5... | 0.7312067 | 0 |
Sets the convergence_threshold of this OneOfSolidNumericsSolver. | def convergence_threshold(self, convergence_threshold):
if (self.local_vars_configuration.client_side_validation and
convergence_threshold is not None and convergence_threshold < 0): # noqa: E501
raise ValueError("Invalid value for `convergence_threshold`, must be a value greater th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass",
"def set_threshold(self, threshold):\n self._threshold = check_value_positive('threshold', threshold)",
"def setThreshold(self, v):\n self._set(threshold=v)\n return self",
"def setThreshol... | [
"0.5830455",
"0.56818306",
"0.55826205",
"0.55826205",
"0.55826205",
"0.55826205",
"0.55826205",
"0.5542767",
"0.54838496",
"0.53655994",
"0.53081685",
"0.52762955",
"0.5272556",
"0.52196765",
"0.5199777",
"0.51962775",
"0.5178573",
"0.5148943",
"0.5129967",
"0.51293653",
"0.... | 0.7302193 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, OneOfSolidNumericsSolver):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, OneOfSolidNumericsSolver):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026",
"0.80427635",
"0.80427635",
"0.80427635",
"0.80427635",
"0.80427635",
"0.80427635",
"0.8... | 0.0 | -1 |
Remueve las stopwords de del documento | def remove_stopwords(document):
return list(filter(lambda x: x not in BasicNL.words, document)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stop_words(document):\n\n stop_words = stopwords.words(... | [
"0.85952926",
"0.82386243",
"0.78232485",
"0.7807035",
"0.7775806",
"0.7771344",
"0.765445",
"0.76541865",
"0.7637416",
"0.7618049",
"0.75633353",
"0.75508624",
"0.7519818",
"0.7519818",
"0.7519818",
"0.7519818",
"0.7510415",
"0.7508168",
"0.75046253",
"0.74946064",
"0.746464... | 0.7879066 | 2 |
Assign gt to bboxes. This method assign a gt bbox to every point, each bbox will be assigned with 0, or a positive number. 0 means negative sample, positive number is the index (1based) of assigned gt. The assignment is done in following steps, the order matters. 1. assign every points to 0 2. for each gt box, we find ... | def assign(self, points, gt_bboxes, gt_contours, sizes):
num_gts, num_points = gt_contours.shape[0], points.shape[0]
if num_points == 0 or num_gts == 0:
# stores the assigned gt heatmap of each point
assigned_gt_ct = points.new_ones((num_points,), dtype=torch.long)
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign(self,\n bboxes,\n num_level_bboxes,\n cls_scores,\n bbox_preds,\n gt_bboxes,\n gt_bboxes_ignore=None,\n gt_labels=None):\n INF = 100000000\n bboxes = bboxes[:, :4]\n bbox_preds = bbox_p... | [
"0.66563284",
"0.6305584",
"0.5949687",
"0.5739721",
"0.5664677",
"0.5658408",
"0.5322915",
"0.5291147",
"0.5261393",
"0.52487814",
"0.5246882",
"0.5220316",
"0.5220175",
"0.521454",
"0.5165517",
"0.5159504",
"0.51479286",
"0.5141534",
"0.5131374",
"0.51162636",
"0.51148117",... | 0.67144775 | 0 |
Create a session with Spark. | def create_spark_session():
spark = SparkSession \
.builder \
.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \
.getOrCreate()
return spark | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()",
"def create_spark_session():\n return SparkSession.builder \\\n .appName(\"Dataframe Reader\") \\... | [
"0.86121714",
"0.8366601",
"0.83318555",
"0.83279526",
"0.8275977",
"0.8275977",
"0.8275977",
"0.8275977",
"0.8242653",
"0.81792605",
"0.809464",
"0.8083293",
"0.8015839",
"0.79131514",
"0.78531665",
"0.7842353",
"0.7833517",
"0.78273815",
"0.77935976",
"0.77886695",
"0.77674... | 0.82442313 | 15 |
Places a buy order in a given market. | def buy(self, currency_pair, rate, amount):
return self.api_query('buy', {"CurrencyPair": currency_pair, "rate": rate, "amount": amount}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def market_buy(self, symbol: Symbol, quantity: str,\n receive_window: Optional[int]):\n return self.new_order(symbol,\n OrderSide.BUY,\n OrderType.MARKET,\n quantity,\n price... | [
"0.7768029",
"0.76021147",
"0.7571626",
"0.7368429",
"0.72024375",
"0.7189186",
"0.7091368",
"0.70486635",
"0.7031931",
"0.70301086",
"0.6886766",
"0.68735737",
"0.6861968",
"0.6793604",
"0.67739433",
"0.67641896",
"0.67445296",
"0.6724305",
"0.6683134",
"0.6671896",
"0.66227... | 0.6244504 | 44 |
Places a sell order in a given market. | def sell(self, currency_pair, rate, amount):
return self.api_query('sell', {"currencyPair": currency_pair, "rate": rate, "amount": amount}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_sell_order(self):\n price = request.form[\"price\"]\n stocks = request.form[\"stocks\"]\n trader_id = request.form[\"trader_id\"]\n self.market.place_sell_order(trader_id, price, stocks)\n return \"\"",
"def market_sell(self, symbol: Symbol, quantity: str,\n ... | [
"0.7672995",
"0.765107",
"0.7438841",
"0.7228994",
"0.71784186",
"0.7139579",
"0.711239",
"0.7109477",
"0.7061465",
"0.7054314",
"0.7021705",
"0.70019287",
"0.68489563",
"0.681182",
"0.6802025",
"0.6764315",
"0.67248905",
"0.6724642",
"0.662788",
"0.65546346",
"0.65487665",
... | 0.6335414 | 32 |
Helper for getting layer output tensor | def T(layer):
return graph.get_tensor_by_name("import/%s:0" % layer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out",
"def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squeeze(self.model.get_tensor(output_details['index']))\n return tens... | [
"0.8122319",
"0.7690273",
"0.74574167",
"0.7428024",
"0.7426893",
"0.7324966",
"0.7305548",
"0.7291128",
"0.7252027",
"0.7252027",
"0.7252027",
"0.7233804",
"0.72127616",
"0.72018754",
"0.70702916",
"0.7044988",
"0.7025361",
"0.6995671",
"0.68668705",
"0.6855417",
"0.6846428"... | 0.6478305 | 48 |
Returns a function that gives the learning rate for this epoch taking as input the current epoch | def learning_rate_scheduler(self, lr_decay_schedule, lr_decay_parameters):
#Available learning rate decay schedules
self.lr_decay_schedules = ['constant', 'multiplication', 'exponential', 'power']
#Checks if asked schedule is implemented
assert lr_decay_schedule in self.lr_decay... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def __learning_rate(self, lr0, epoch):\n \n ... | [
"0.86763686",
"0.8509561",
"0.8509561",
"0.83330375",
"0.8294967",
"0.8059454",
"0.7870473",
"0.76855266",
"0.7606353",
"0.73940045",
"0.72747815",
"0.72708565",
"0.72522473",
"0.7216726",
"0.7181385",
"0.7169139",
"0.7169139",
"0.7169139",
"0.7169139",
"0.7152491",
"0.714897... | 0.0 | -1 |
Returns the traing gradient used in the optimizer | def train_fn_grad(self, theta_value, theta):
theta.set_value(theta_value, borrow=True)
train_grads = [self.batch_grad(i, self.n_train)
for i in xrange(self.n_train_batches)]
train_batch_sizes = [self.get_batch_size(i, self.n_train)
for i in x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gradient(self):\n # Fast path\n if self._gradient is not None:\n return self._gradient\n # Flatten (make if necessary)\n gradient = tools.flatten(tools.grads_of(self._model.parameters()))\n self._gradient = gradient\n return gradient",
"def optimizer(self):\n \n # tak... | [
"0.7405421",
"0.7381362",
"0.7146367",
"0.7146367",
"0.6987022",
"0.68998915",
"0.6878462",
"0.6854539",
"0.67637867",
"0.6739467",
"0.67282",
"0.67263603",
"0.67226493",
"0.6702495",
"0.6692243",
"0.6685572",
"0.6660238",
"0.66578424",
"0.66564786",
"0.6650672",
"0.6637952",... | 0.0 | -1 |
Return an alphanumeric string of size | def id_generator(cls, size):
return ''.join(random.choice(string.ascii_letters +
string.digits + '-_') for _ in range(size)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string_alphanumeric(size):\n\t# requirements = random, string\n\treturn ''.join(random.choice(string.ascii_letters + string.digits) for x in range(size))",
"def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))",
"def _random_... | [
"0.75828403",
"0.6994148",
"0.6916131",
"0.6910274",
"0.68924946",
"0.68841475",
"0.68585885",
"0.6802914",
"0.67789626",
"0.67113",
"0.66842073",
"0.66685",
"0.6652431",
"0.6648947",
"0.6615725",
"0.6574817",
"0.6569797",
"0.65653116",
"0.6555975",
"0.6555409",
"0.65460736",... | 0.0 | -1 |
Return the package configuration. | def config(self) -> Config:
if self._config is None:
self._config = Config(Path.cwd())
return self._config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_configuration(self) -> dict:\n return self.config",
"def config(self):\n return self.namespace['config']",
"def config():\n return _config",
"def get_config():\n return _config",
"def get_config(self):\n return self.config",
"def get_config():\n return CONFIG",
"def co... | [
"0.7558377",
"0.7558198",
"0.75417763",
"0.7503818",
"0.74983215",
"0.74817383",
"0.7476002",
"0.73667294",
"0.73342305",
"0.73252636",
"0.7290176",
"0.72715724",
"0.72715724",
"0.7261279",
"0.7261279",
"0.7261279",
"0.72519976",
"0.72519976",
"0.72519976",
"0.72519976",
"0.7... | 0.0 | -1 |
Return the current value of this HyperParameter. | def get(self, name):
# Fast path: check for a non-conditional param or for a conditional param
# that was defined in the current scope.
full_cond_name = self._get_name(name)
if full_cond_name in self.values:
if self._conditions_are_active():
return self.value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n return _libsbml.Parameter_getValue(self)",
"def value(self) -> any:\r\n\r\n return self.__value",
"def value(self):\n return self.__value",
"def value(self):\n return self.__value",
"def value(self):\n\n\t\treturn self.__value",
"def get_value(self):\n ... | [
"0.75921154",
"0.7110586",
"0.70929563",
"0.70929563",
"0.7060442",
"0.7024598",
"0.7024598",
"0.7024598",
"0.6980508",
"0.6946661",
"0.6930716",
"0.69265795",
"0.69265795",
"0.69158775",
"0.6914908",
"0.6914908",
"0.6914908",
"0.69118506",
"0.691128",
"0.6904845",
"0.6904845... | 0.0 | -1 |
Set the directory in which Spark is installed on the executors in Mesos. | def spark_home(self, sparkHome):
self.sparkProperties[SparkProperties.SPARK_MESOS_EXECUTOR_HOME] = sparkHome
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spark_config_set(is_spark_submit):\n if is_spark_submit:\n global sc, sqlContext\n sc = SparkContext()\n sqlContext = HiveContext(sc)",
"def _SetProgramDir(self):\n p = self.params\n # Program dirs are where the summaries are written to.\n if p.task_name:\n program_dir_n... | [
"0.5687636",
"0.550482",
"0.53286695",
"0.532663",
"0.5311964",
"0.5241732",
"0.52097964",
"0.5204703",
"0.5178969",
"0.51278526",
"0.51192296",
"0.50927633",
"0.50631905",
"0.50212556",
"0.4989",
"0.497186",
"0.49664629",
"0.49584767",
"0.49395975",
"0.4932763",
"0.49209318"... | 0.58402574 | 0 |
Give the position in PPM for a peak dimension | def aliasedPeakDimPosition(peakDim):
dataDimRef = peakDim.dataDimRef
position = peakDim.position
if dataDimRef:
position += peakDim.numAliasing * dataDimRef.dataDim.numPointsOrig
return position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPeakDimPpm(peakDim):\n\n dataDimRef = peakDim.dataDimRef\n if dataDimRef:\n return pnt2ppm( aliasedPeakDimPosition(peakDim), peakDim.dataDimRef )\n\n else:\n return peakDim.position",
"def peak_PSF(self):\n return self.compute_PSF(np.zeros(self.N_zern))",
"def getAliasedPeakDimPositions(... | [
"0.7710361",
"0.6560327",
"0.6419816",
"0.62910396",
"0.62728465",
"0.6176478",
"0.606386",
"0.6034404",
"0.6021505",
"0.601426",
"0.6014214",
"0.5995218",
"0.59804785",
"0.59800863",
"0.5979235",
"0.59677833",
"0.5943407",
"0.593342",
"0.5920231",
"0.58159405",
"0.5807891",
... | 0.6535363 | 2 |
Returns the directory path for the given package or module. | def path_for_import(name):
return os.path.dirname(os.path.abspath(import_module(name).__file__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPackageDirectory():\n return os.path.dirname(__file__)",
"def package_path(pkg):\n fname = pkgutil.get_loader(pkg).get_filename()\n dirname = op.dirname(fname)\n dirname = op.abspath(op.join(dirname, '..'))\n return dirname",
"def get_packages_path_from_package(package):\n root = fin... | [
"0.7849074",
"0.7761461",
"0.76768786",
"0.7623733",
"0.7619922",
"0.76142037",
"0.74755335",
"0.74605346",
"0.7371198",
"0.72105306",
"0.7194626",
"0.7164281",
"0.7147668",
"0.70908695",
"0.70873696",
"0.7031189",
"0.70070046",
"0.6982635",
"0.696865",
"0.6942843",
"0.694018... | 0.6859669 | 26 |
Separated from validate_test because urls are not required anywhere. We know a url is incorrect if it is empty or does not start with a "/" character. There is no validation done to ensure the url conforms to the suggested url specifications, although those suggestions are presented if a url fails validation here. | def validate_urls(test_name, test_keys):
example_urls = {
"json_url": "/json",
"db_url": "/mysql/db",
"query_url": "/mysql/queries?queries= or /mysql/queries/",
"fortune_url": "/mysql/fortunes",
"update_url": "/mysql/updates?queries= or /mysql/updates/",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_url(self):\n pass",
"def test_non_urls():\n assert normalize_url(\"\") is None\n assert normalize_url(\"abc xyz\") is None\n assert normalize_url(\"asb#abc\") is None\n assert normalize_url(\"Яндекс.рф\") is not None\n assert normalize_url(\"google.blog\") is not None\n asse... | [
"0.77858895",
"0.7421229",
"0.7240036",
"0.7166649",
"0.71234936",
"0.712027",
"0.71186316",
"0.7089189",
"0.70786023",
"0.70730996",
"0.70358413",
"0.6870198",
"0.68590987",
"0.68437743",
"0.67860436",
"0.6766074",
"0.67206806",
"0.6712979",
"0.66956604",
"0.6661353",
"0.664... | 0.7361694 | 2 |
Returns an `flattrclient.api.FlattrApi` object, initialized with a session object of `requests.session.Session`. | def get(auth_token):
session = requests.Session()
session.headers.update({'Accept': 'application/json',
'Authorization': 'Bearer %s' % auth_token})
return FlattrApi(session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, session):\n super(FlattrApi, self).__init__(session)\n self.things = ThingApi(session)\n self.users = UsersApi(session)\n self.authenticated = AuthenticatedApi(session)",
"def build_session():\n return requests.Session()",
"def session():\n s = requests.Sess... | [
"0.6981677",
"0.655661",
"0.6489899",
"0.6425714",
"0.642133",
"0.63802415",
"0.6366018",
"0.63562685",
"0.6330811",
"0.6273063",
"0.62316275",
"0.6165928",
"0.61319834",
"0.603433",
"0.5995882",
"0.5941252",
"0.5934109",
"0.5933255",
"0.5921951",
"0.5895072",
"0.5817055",
... | 0.65899205 | 1 |
For each unique first index in the category labels, scale the frequency matrix (to get rough probabilities) | def _get_normalized_adj_matrix(self):
# find all of the unique layers in the problem (first index of category tuples)
row_sums = self._frequency_matrix.sum(axis=1)
normed_matrix = self._frequency_matrix / row_sums[:, np.newaxis]
return normed_matrix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_data(X, meanzero=True, probability=False):\n\n\n \"\"\"CASES X1, X5, X12-X23: Scale large data values by indices. How these\n should be scaled is up for debate though the default is mean=0, std=1\"\"\"\n a = [0, 4, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]\n for i in a:\n if mean... | [
"0.6226115",
"0.6200018",
"0.58010566",
"0.5782561",
"0.5782561",
"0.56518835",
"0.56172836",
"0.56092787",
"0.55946463",
"0.55512685",
"0.55476946",
"0.55470145",
"0.55413216",
"0.5516437",
"0.5506422",
"0.55003345",
"0.5493902",
"0.5493894",
"0.54884267",
"0.54877716",
"0.5... | 0.0 | -1 |
Normalize a list of paths relative to a parent directory. | def normalize_paths(
paths: Sequence[str], parent: str = os.curdir
) -> list[str]:
assert isinstance(paths, list), paths
return [normalize_path(p, parent) for p in paths] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normPath(path, parentDir):\n if not os.path.isabs(path):\n path = os.path.join(parentDir, path)\n return os.path.normpath(os.path.abspath(path))",
"def _sanitize_relative_path(self, path):\n last = None\n path = os.path.normpath(path)\n while path != last:\n last ... | [
"0.65121686",
"0.62769693",
"0.6229018",
"0.59720194",
"0.59307325",
"0.59153193",
"0.59092635",
"0.5733712",
"0.5719236",
"0.56979245",
"0.5690638",
"0.54466045",
"0.543413",
"0.54007214",
"0.5367129",
"0.53292114",
"0.53259087",
"0.5317183",
"0.5304007",
"0.52978164",
"0.52... | 0.7942311 | 0 |
3 cases have 2 different prefixes returns cases from both prefixes. | def test_cases_different_prefix_return_both(self):
self.create_testdata()
res = self.filter([u"pre", u"moz"])
self.assertEqual(
Set([x.name for x in res.all()]),
Set(["CV 1", "CV 3", "CV 4"]),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prefix(uri1,uri2):\n if uri2[:len(uri1)]==uri1:\n return 1\n else:\n return None",
"def common_prefix(s1, s2):\n if not s1 or not s2:\n return None\n common = genericpath.commonprefix((s1, s2,))\n if common:\n return common\n else:\n return None",
"de... | [
"0.65687835",
"0.6411265",
"0.6146359",
"0.60651755",
"0.6054403",
"0.592349",
"0.58835757",
"0.58705837",
"0.58183616",
"0.5771966",
"0.5759704",
"0.57453704",
"0.5683855",
"0.56282353",
"0.56097084",
"0.55911493",
"0.5589562",
"0.55790496",
"0.55576724",
"0.5556584",
"0.555... | 0.635913 | 2 |
Get a user defined field adapted to a `zope.schema` field. | def schemaized_field(field):
return zope.schema.interfaces.IField(field) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createField(schemaName, field):\n# print(field.domain)\n# print(field.name, field.domain if isinstance(field.domain, str) else field.domain.type)\n# print(field.__dict__)\n return \"\\\"{name}\\\" {type_}\".format(\n name = field.name,\n type_ = '\"' + schemaName + '\".\"' + ... | [
"0.67718256",
"0.65424377",
"0.6503643",
"0.6446948",
"0.64030343",
"0.6358043",
"0.63319963",
"0.63187206",
"0.6299583",
"0.62577426",
"0.62561023",
"0.6247458",
"0.6244731",
"0.62442166",
"0.62132555",
"0.6205281",
"0.62051755",
"0.6202928",
"0.61870193",
"0.6164145",
"0.61... | 0.75402015 | 0 |
Get the root folder of the ZODB. | def root_folder(zodbS):
for connection in pyTestStackDemoStorage(zodbS, 'root_folder'):
yield connection.rootFolder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRootFolder():\n return CURRENT_CONNECTION.rootFolder",
"def root_dir(self):\n path = self.config_path()\n if path:\n root_dir = os.path.dirname(path)\n if not root_dir.endswith(\"/\"):\n root_dir += \"/\"\n return root_dir\n return No... | [
"0.79615635",
"0.7092427",
"0.70292354",
"0.6901644",
"0.68842787",
"0.6807161",
"0.67929024",
"0.6709074",
"0.6649462",
"0.66464394",
"0.65799767",
"0.65799767",
"0.65771",
"0.65689844",
"0.6566771",
"0.65598",
"0.65480137",
"0.652011",
"0.6507459",
"0.6492672",
"0.64850044"... | 0.7427007 | 1 |
`Field` fulfills the `IField` interface. | def test_entities__Field__1():
zope.interface.verify.verifyObject(IField, Field()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field(self):\n return self.__field",
"def schemaized_field(field):\n return zope.schema.interfaces.IField(field)",
"def field(self, field):\n return self.__getitem__(field)",
"def Field( # pylint: disable=invalid-name\n cls, name=None, description=None, deprecation_reason=None, requi... | [
"0.6774219",
"0.6745625",
"0.66470087",
"0.6585491",
"0.6512139",
"0.6462271",
"0.6462271",
"0.6462271",
"0.6462271",
"0.6404394",
"0.63897264",
"0.6355141",
"0.6322434",
"0.6220974",
"0.617906",
"0.6174519",
"0.6125568",
"0.61231345",
"0.60930866",
"0.6088446",
"0.60712117",... | 0.5959247 | 30 |
`(Persistent)Entities.getEntities()` returns entities sorted. The sort order is defined in the sort order storage. | def test_entities__getEntities__1(stubSortOrder, stubEntities):
e = stubEntities
assert [e.cat, e.kwack, e.duck] == e.entities.getEntities() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _order_entities(self):\n entity_deps = defaultdict(set)\n for e, features in self.top_level_features.items():\n # iterate over all dependency features of the top-level features on\n # this entity. If any of these are themselves top-level features, add\n # their en... | [
"0.68057364",
"0.60913485",
"0.60164005",
"0.5996694",
"0.58923537",
"0.5891691",
"0.5888653",
"0.5882377",
"0.5848912",
"0.5816706",
"0.5714627",
"0.57073295",
"0.56831414",
"0.56564736",
"0.5624643",
"0.558696",
"0.5583958",
"0.5569291",
"0.55691963",
"0.5565983",
"0.556552... | 0.5711995 | 11 |
`name` raises a ValueError if no class name is set. | def test_entities__Entity__name__2(address_book):
entity = Entity(None, IDummy, None)
with pytest.raises(ValueError):
entity.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_class(self, name):\n raise NotImplementedError",
"def set_name(self, name):\n self.class_name = name",
"def get_name(name, class_name):\n if name:\n return name\n if not class_name:\n raise MLRunInvalidArgumentError(\"name or class_name must be provided\")\n if isin... | [
"0.7340684",
"0.7292049",
"0.7229786",
"0.7223256",
"0.6931874",
"0.68843013",
"0.68202245",
"0.6599133",
"0.6556592",
"0.6530314",
"0.6467892",
"0.6467892",
"0.644715",
"0.6429616",
"0.6429308",
"0.63990724",
"0.63922334",
"0.6389287",
"0.6379979",
"0.63726336",
"0.6359888",... | 0.0 | -1 |
`getRawFields` sorts fields missing in sort order to the end. | def test_entities__Entity__getRawFields__1(entity_with_field, field):
entity = entity_with_field
entity.setFieldOrder([field.__name__, 'dummy'])
assert ([field.__name__, 'dummy', 'dummy2'] ==
[x[0] for x in entity.getRawFields()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_entities__Entity__getRawFields__3(entity_with_field, field):\n entity = entity_with_field\n entity.setFieldOrder(['dummy2', 'Field', 'dummy'])\n assert ([('dummy', IDummy['dummy']),\n ('dummy2', IDummy['dummy2']),\n (field.__name__, field)] ==\n list(entity.getR... | [
"0.6502745",
"0.63278985",
"0.62677133",
"0.62463695",
"0.6055766",
"0.5979338",
"0.59521765",
"0.59045285",
"0.5855424",
"0.58279073",
"0.58148974",
"0.5697809",
"0.56686926",
"0.56629145",
"0.5486784",
"0.54450834",
"0.5442381",
"0.53470707",
"0.53358936",
"0.5306128",
"0.5... | 0.6630689 | 0 |
`getRawFields` returns the fields sorted by the field order. | def test_entities__Entity__getRawFields__2(entity_with_field, field):
entity = entity_with_field
entity.setFieldOrder(['dummy2', field.__name__, 'dummy'])
assert ([('dummy2', IDummy['dummy2']),
(field.__name__, field),
('dummy', IDummy['dummy'])] == list(entity.getRawFields())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_entities__Entity__getRawFields__1(entity_with_field, field):\n entity = entity_with_field\n entity.setFieldOrder([field.__name__, 'dummy'])\n assert ([field.__name__, 'dummy', 'dummy2'] ==\n [x[0] for x in entity.getRawFields()])",
"def getFields(self):\n return sorted(self.sc... | [
"0.6848613",
"0.6814263",
"0.67888033",
"0.67626786",
"0.67161185",
"0.67050755",
"0.6540219",
"0.6519001",
"0.6437888",
"0.6421792",
"0.6182378",
"0.61282635",
"0.6100307",
"0.60257566",
"0.6010388",
"0.59650236",
"0.5948307",
"0.59001577",
"0.5890742",
"0.5883165",
"0.58831... | 0.6505599 | 8 |
`getFieldValues` returns all fields as `zope.schema` in order. | def test_entities__Entity__getFieldValues__1(
entity_with_field, schemaized_field):
entity = entity_with_field
entity.setFieldOrder(['dummy2', schemaized_field.__name__, 'dummy'])
assert ([IDummy['dummy2'], schemaized_field, IDummy['dummy']] ==
entity.getFieldValues()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFields(self):\n return sorted(self.schema.fields, key=lambda f: f.name)",
"def field_values(self):\n return self.proto.field_values",
"async def get_fields(self) -> List[Field]:\n schema = await self.get_schema()\n fields = []\n if schema:\n # The faust-avro... | [
"0.7208896",
"0.7144569",
"0.67633945",
"0.6686484",
"0.64398354",
"0.63567495",
"0.62770915",
"0.62325126",
"0.6227115",
"0.6197299",
"0.6178864",
"0.61726266",
"0.6171284",
"0.6145268",
"0.61445844",
"0.6137857",
"0.61373854",
"0.61225593",
"0.61043847",
"0.60963035",
"0.60... | 0.5780654 | 43 |
`getField` can return a `zope.schema` field. | def test_entities__Entity__getField__2(entity):
assert IDummy['dummy2'] == entity.getField('dummy2') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getdocfield(fieldname):\t\t\n\tl = [d for d in doctype_dl if d.doctype=='DocField' and d.fieldname==fieldname]\n\treturn l and l[0] or None",
"def test_entities__Entity__getField__3(entity_with_field, schemaized_field):\n assert (schemaized_field ==\n entity_with_field.getField(schemaized_field... | [
"0.68624765",
"0.67590296",
"0.67567647",
"0.66617405",
"0.6548466",
"0.6532272",
"0.6424736",
"0.6422297",
"0.6391313",
"0.637264",
"0.63143796",
"0.62470806",
"0.62470806",
"0.6232048",
"0.61930776",
"0.61913586",
"0.61454654",
"0.61317796",
"0.61297697",
"0.6100841",
"0.60... | 0.0 | -1 |
`getField` can return a user defined field as `zope.schema` field. | def test_entities__Entity__getField__3(entity_with_field, schemaized_field):
assert (schemaized_field ==
entity_with_field.getField(schemaized_field.__name__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schemaized_field(field):\n return zope.schema.interfaces.IField(field)",
"def getdocfield(fieldname):\t\t\n\tl = [d for d in doctype_dl if d.doctype=='DocField' and d.fieldname==fieldname]\n\treturn l and l[0] or None",
"def GetField(self,\n fully_qualified_fieldname: str,\n ... | [
"0.6978108",
"0.64445883",
"0.64408034",
"0.629065",
"0.6244611",
"0.6236785",
"0.61651355",
"0.61438185",
"0.60696095",
"0.6043545",
"0.6040789",
"0.6040789",
"0.60373497",
"0.6025747",
"0.59871656",
"0.596057",
"0.5957779",
"0.59564656",
"0.591051",
"0.5898512",
"0.58935016... | 0.6443976 | 2 |
`getRawField` can return a `zope.schema` field. | def test_entities__Entity__getRawField__2(entity):
assert IDummy['dummy2'] == entity.getRawField('dummy2') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_entities__Entity__getRawField__3(entity_with_field, field):\n assert field == entity_with_field.getRawField(field.__name__)",
"def schemaized_field(field):\n return zope.schema.interfaces.IField(field)",
"def field(self):\n return self.__field",
"def GetField(self,\n fully_qua... | [
"0.72386074",
"0.6283662",
"0.6181036",
"0.61084485",
"0.6086996",
"0.60611045",
"0.6011716",
"0.60065466",
"0.59443843",
"0.5911444",
"0.5898219",
"0.58873636",
"0.58452797",
"0.58452797",
"0.58452797",
"0.58452797",
"0.58309734",
"0.5801356",
"0.57850444",
"0.57621896",
"0.... | 0.6125109 | 3 |
`getRawField` can return a user defined field. | def test_entities__Entity__getRawField__3(entity_with_field, field):
assert field == entity_with_field.getRawField(field.__name__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getter(self):\n # if it's already defined, just return it\n if hasattr(self, inner_name):\n return getattr(self, inner_name)\n\n # if not, it will just return the default value of the field\n # accept raw value as default too\n return field.from_raw(field.default)"... | [
"0.6454515",
"0.62662596",
"0.6141444",
"0.6138856",
"0.60825974",
"0.60769933",
"0.6073568",
"0.60483915",
"0.6027442",
"0.6017592",
"0.5997831",
"0.5996397",
"0.59933925",
"0.59694356",
"0.59403336",
"0.58887535",
"0.5837791",
"0.57839626",
"0.5769151",
"0.57586586",
"0.574... | 0.7145104 | 0 |
`tagged_values` is actually a copy of the kwargs dict. Tagged values not modifiable by modifying the returned dict. | def test_entities__Entity__tagged_values__2():
e = Entity(u'Dummy', IDummy, 'Dummy', a=1, b='asdf')
e.tagged_values['a'] = 2
assert dict(a=1, b='asdf') == e.tagged_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kwargs(d):\n return {\"values\": d.get(\"values\", None)}",
"def aws_tags(self, values):\n if not getattr(self, \"tags\", None):\n self.tags = {}\n\n tags = defaultdict(list)\n\n for tag in values:\n tags[tag[\"Key\"]].append(tag[\"Value\"])\n\n se... | [
"0.6022419",
"0.59656966",
"0.588645",
"0.5618702",
"0.5536971",
"0.5514367",
"0.54506415",
"0.5388559",
"0.5371937",
"0.53519124",
"0.532181",
"0.52868825",
"0.52771527",
"0.52542967",
"0.5230774",
"0.5218715",
"0.5159425",
"0.5112058",
"0.51006275",
"0.50756925",
"0.5054362... | 0.5769426 | 3 |
Compute number of edges in a graph from its adjacency list | def edge_count(adjList):
edges = {}
for id, neigh in enumerate(adjList):
for n in neigh:
edges[max(n, id), min(n, id)] = id
return len(edges) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_num_edges(graph):\n # return the number of edges\n return sum([len(graph[source_node].keys()) for source_node in graph.keys()]) / 2",
"def return_num_edges(self):\n return sum(map(lambda x: len(x),self.__adj))",
"def num_edges(self):\n return sum(len(v.adj) for v in self... | [
"0.8279214",
"0.8122576",
"0.7761939",
"0.768518",
"0.74773186",
"0.74187654",
"0.7331205",
"0.7314173",
"0.7234503",
"0.7155408",
"0.71542233",
"0.7153205",
"0.71226156",
"0.712203",
"0.7114409",
"0.7097456",
"0.70652944",
"0.7015251",
"0.7003939",
"0.69998693",
"0.69857776"... | 0.7686066 | 3 |
Given a runlength encoded list, return whether this list is "1" at the specified time. | def exists_at_time(e, t):
t0 = 0
for l, x in e:
t1 = t0 + l
if t > t0 and t < t1:
return x
t0 = t1
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_time(self) -> bool:\n return self.times > 1",
"def are_consecutive(int_list):\n\n if set(np.diff(int_list)) == set([1]):\n return True\n else:\n return False",
"def is_next_run(self, local_time):\n return local_time <= self.stop_time",
"def list_check(... | [
"0.60582906",
"0.5825736",
"0.55792814",
"0.5486618",
"0.5436249",
"0.5396429",
"0.53646666",
"0.5351701",
"0.53062254",
"0.53047866",
"0.5258286",
"0.52397746",
"0.5222359",
"0.5189693",
"0.5172989",
"0.5147782",
"0.51347107",
"0.51101476",
"0.5108565",
"0.5106364",
"0.50971... | 0.5109081 | 18 |
Show an index page. | def index_page():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_index_page():\n\n return render_template('index.html')",
"def index():\n return render_template(\"index.html\",\n title='Index')",
"def index():\n return render_template('pages/index.html', isNav=True)",
"def index():\n return render_template('index.html')",... | [
"0.8531908",
"0.80338854",
"0.7943412",
"0.77842605",
"0.77842605",
"0.7766452",
"0.7744886",
"0.76850814",
"0.76816297",
"0.7678797",
"0.7672546",
"0.7672546",
"0.7657335",
"0.76573086",
"0.7628134",
"0.76141024",
"0.76105523",
"0.75957036",
"0.75957036",
"0.75957036",
"0.75... | 0.7667954 | 13 |
Set the value of the APIKey input for this Choreo. ((required, string) The API Key provided by Tumblr (AKA the OAuth Consumer Key).) | def set_APIKey(self, value):
super(RetrieveUserDashboardInputSet, self)._set_input('APIKey', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._analyzer.SetAPIKey(api_key)",
"def api_key(self, api_key):\n if api_key is None:\n raise ValueError(\"Invalid value for `api_k... | [
"0.78898466",
"0.78898466",
"0.77514654",
"0.7252826",
"0.7249392",
"0.72452533",
"0.70671475",
"0.7000636",
"0.67730814",
"0.672917",
"0.67123455",
"0.66907054",
"0.6634002",
"0.65785503",
"0.65154743",
"0.64451134",
"0.63818157",
"0.63348293",
"0.63276637",
"0.6326619",
"0.... | 0.6493754 | 15 |
Set the value of the SecretKey input for this Choreo. ((required, string) The Secret Key provided by Tumblr (AKA the OAuth Consumer Secret).) | def set_SecretKey(self, value):
super(RetrieveUserDashboardInputSet, self)._set_input('SecretKey', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret_key(self, val):\n self.__secret_key = val",
"def set_AccessTokenSecret(self, value):\n super(RetrieveUserDashboardInputSet, self)._set_input('AccessTokenSecret', value)",
"def get_oauthsecret_for_key(consumer_key):\n return Consumer.getsecretforkey(consumer_key)",
"def set_sec... | [
"0.5987977",
"0.5480287",
"0.54182595",
"0.5386243",
"0.53860015",
"0.5298941",
"0.52083564",
"0.5205812",
"0.5205812",
"0.51457125",
"0.50655764",
"0.50338715",
"0.50238633",
"0.5012662",
"0.5011126",
"0.49644002",
"0.4939996",
"0.49322814",
"0.49291348",
"0.4925039",
"0.488... | 0.57303417 | 1 |
Retrieve the value for the "Response" output from this Choreo execution. (The response from Tumblr. Default is JSON, can be set to XML by entering 'xml' in ResponseFormat.) | def get_Response(self):
return self._output.get('Response', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response(self):\n result = self.get_response_impl()\n if self.log_dest is not None:\n is_error, response = result\n if is_error:\n response = \"? \" + response\n else:\n response = \"= \" + response\n self._log(\"<< \",... | [
"0.68180877",
"0.6647456",
"0.65542877",
"0.65010643",
"0.63733447",
"0.63468",
"0.6287826",
"0.6217553",
"0.62120235",
"0.61746615",
"0.6165452",
"0.6071253",
"0.6045179",
"0.60425425",
"0.6020206",
"0.5977374",
"0.59503627",
"0.5888492",
"0.5875516",
"0.5864143",
"0.5859959... | 0.785358 | 8 |
Parse a font directory resource, return as font directory entries. Return an empty tuple if parsing failed. | def parse_os2_font_directory(data):
logging.debug('Parsing font directory')
try:
# If a font directory exists we use that to find the face's
# resource ID, as in this case it is not guaranteed to have
# a type of OS2RES_FONTFACE (7).
fontdir = OS2FONTDIRECTORY.from_bytes(data)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fonts(folder=None):\n fonts = {}\n if folder:\n cmd = ['fc-scan', '--format', '\"%{file}:%{family}:style=%{style}\\n\"', folder]\n else:\n cmd = ['fc-list', ':', 'file', 'family', 'style']\n for line in subprocess.check_output(cmd).decode('utf-8').split(\"\\n\"):\n logger.d... | [
"0.6200644",
"0.6149879",
"0.6149879",
"0.57939285",
"0.5236595",
"0.51685995",
"0.51301706",
"0.5113807",
"0.5071675",
"0.507126",
"0.5052928",
"0.5052928",
"0.50036967",
"0.4920582",
"0.48989677",
"0.48547408",
"0.4853345",
"0.4837448",
"0.4835108",
"0.48265684",
"0.4814672... | 0.7073485 | 0 |
Convert OS/2 font properties to monobit properties. | def convert_os2_properties(font_data):
# should we use the information in the fontdefheader?
metrics = font_data.pMetrics
# font encoding (850 indicates PMUGL)
# > usCodePage - This field is the registered code page for which the font was
# > designed. Often, this field is 0, which means the font ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_props(pcf_data):\n xlfd_name = pcf_data.xlfd_props.pop('FONT', '')\n pcf_data.xlfd_props = {_k: str(_v) for _k, _v in pcf_data.xlfd_props.items()}\n props = parse_xlfd_properties(pcf_data.xlfd_props, xlfd_name)\n props.update(dict(\n default_char=Codepoint(pcf_data.default_char),\n ... | [
"0.5851031",
"0.58017015",
"0.5733241",
"0.55621856",
"0.55519253",
"0.55476743",
"0.5529082",
"0.54757166",
"0.53243303",
"0.5309281",
"0.53073746",
"0.5260817",
"0.51661456",
"0.5154588",
"0.5152867",
"0.5146602",
"0.5120568",
"0.5120568",
"0.5120568",
"0.51168793",
"0.5104... | 0.80052733 | 0 |
Initialize agent with given index. | def __init__(self, index):
self.index = index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, index):\n self._index = index",
"def init_index(self):\n raise NotImplementedError",
"def agent_init(self):\n pass",
"def __init__(self, index=None):\n self.index = index or {}",
"def init_index(self, index_name):\n return Index(self, index_name)",
"d... | [
"0.6891143",
"0.67932534",
"0.67318374",
"0.67028016",
"0.64364475",
"0.6378175",
"0.63778377",
"0.6315742",
"0.6264946",
"0.6241573",
"0.621033",
"0.61126333",
"0.6095461",
"0.60742384",
"0.60587025",
"0.5988518",
"0.59874564",
"0.5960871",
"0.5935628",
"0.5935495",
"0.58887... | 0.66131073 | 5 |
Return the food you're meant to eat. This is in the form of a matrix where m[x][y]=true if there is food you can eat (based on your team) in that square. | def get_food(self, game_state):
if self.red:
return game_state.get_blue_food()
else:
return game_state.get_red_food() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_food_you_are_defending(self, game_state):\n if self.red:\n return game_state.get_red_food()\n else:\n return game_state.get_blue_food()",
"def getFood(self, gameState):\n\n if (self.red):\n return gameState.getBlueFood()\n else:\n re... | [
"0.595225",
"0.5865188",
"0.5804668",
"0.5803418",
"0.5654143",
"0.56472737",
"0.5628335",
"0.5477392",
"0.54658544",
"0.5416987",
"0.5415101",
"0.5414272",
"0.53787327",
"0.53677124",
"0.5307978",
"0.5262083",
"0.52482414",
"0.5223146",
"0.517632",
"0.51502633",
"0.5125814",... | 0.61166674 | 0 |
Return the food you're meant to protect. i.e., the food that your opponent is supposed to eat. This is in the form of a matrix where m[x][y]=true if there is food at (x,y) that your opponent can eat. | def get_food_you_are_defending(self, game_state):
if self.red:
return game_state.get_red_food()
else:
return game_state.get_blue_food() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDangerousFoodGoal(self, gameState):\n food = self.dangerousFood\n # print(food)\n myPos = self.getCurrentObservation().getAgentState(self.index).getPosition()\n if len(food) > 0:\n dis = 9999\n nearestFood = food[0]\n for a in food:\n ... | [
"0.63937265",
"0.6125176",
"0.5940247",
"0.58825344",
"0.5867708",
"0.582706",
"0.5778363",
"0.5597919",
"0.55908704",
"0.5546694",
"0.54811597",
"0.53577757",
"0.53576154",
"0.52819675",
"0.5254829",
"0.52048343",
"0.5194051",
"0.5187963",
"0.5165283",
"0.5134859",
"0.513281... | 0.59260803 | 3 |
Return agent indices of your opponents. This is the list of the numbers of the agents (e.g., red might be "1,3,5") | def get_opponents(self, game_state):
if self.red:
return game_state.get_blue_team_indices()
else:
return game_state.get_red_team_indices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def getOpponents(self, gameState):\n\n if self.red:\n return gameState.getBlueTeamIndices()\n else:\n return gameState.getRedTeamIndices()",
"def agentCounter(gameState, ind... | [
"0.67775023",
"0.67104214",
"0.66005355",
"0.64461",
"0.63500863",
"0.6142723",
"0.6096185",
"0.60506815",
"0.601233",
"0.57591033",
"0.57538366",
"0.568752",
"0.5636327",
"0.563423",
"0.5619768",
"0.55825144",
"0.5576896",
"0.5562943",
"0.5562462",
"0.5519714",
"0.55060816",... | 0.6859574 | 0 |
Return agent indices of your team. This is the list of the numbers of the agents (e.g., red might be the list of 1,3,5) | def get_team(self, game_state):
if self.red:
return game_state.get_red_team_indices()
else:
return game_state.get_blue_team_indices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def agentCounter(gameState, index, depth):\n if index == gameState.getNumAgents():\n return [depth-1, 0]\n else:\n return [depth, index]",
"def agent_locs_id... | [
"0.7201936",
"0.7010852",
"0.6865199",
"0.68359524",
"0.64972436",
"0.62874496",
"0.62658924",
"0.623388",
"0.612129",
"0.596773",
"0.59599155",
"0.5899746",
"0.5868237",
"0.58598524",
"0.58592105",
"0.5817717",
"0.5817605",
"0.5809372",
"0.57841516",
"0.5776882",
"0.57589805... | 0.6262408 | 7 |
Return how much you are beating the other team by. This is in the form of a number that is the difference between your score and the opponents score. This number is negative if you're losing. | def get_score(self, game_state):
if self.red:
return game_state.get_score()
else:
return game_state.get_score() * -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n #import pdb; pdb.set_trace()\n return ((self.team1.get_cur_hp() / self.team1.get_total_hp()) - \n (self.team2.get_cur_hp() / self.team2.get_total_hp()))",
"def _get_reward(self, player_score, opponent_score):\n return player_score - opponent_score",
"def c... | [
"0.7527441",
"0.72999656",
"0.70430803",
"0.6966716",
"0.69587827",
"0.69503456",
"0.69392496",
"0.69379425",
"0.6799346",
"0.6736964",
"0.66633713",
"0.6658763",
"0.6647026",
"0.66443455",
"0.66443455",
"0.66443455",
"0.66393805",
"0.6630664",
"0.6581241",
"0.6579812",
"0.65... | 0.60757625 | 84 |
Initialize agent with given index. | def __init__(self, index):
self.index = index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, index):\n self._index = index",
"def init_index(self):\n raise NotImplementedError",
"def agent_init(self):\n pass",
"def __init__(self, index=None):\n self.index = index or {}",
"def init_index(self, index_name):\n return Index(self, index_name)",
"d... | [
"0.6891143",
"0.67932534",
"0.67318374",
"0.67028016",
"0.64364475",
"0.6378175",
"0.63778377",
"0.6315742",
"0.6264946",
"0.6241573",
"0.621033",
"0.61126333",
"0.6095461",
"0.60742384",
"0.60587025",
"0.5988518",
"0.59874564",
"0.5960871",
"0.5935628",
"0.5935495",
"0.58887... | 0.66131073 | 4 |
The set of arguments for constructing a DropletSnapshot resource. | def __init__(__self__, *,
droplet_id: pulumi.Input[str],
name: Optional[pulumi.Input[str]] = None):
pulumi.set(__self__, "droplet_id", droplet_id)
if name is not None:
pulumi.set(__self__, "name", name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: DropletSnapshotArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def create_snapshot(self, **kwargs):\n post_body = json.dumps({'snapshot': kwargs})\n resp, body = self.post('s... | [
"0.7634257",
"0.5844861",
"0.5617854",
"0.54508436",
"0.5436717",
"0.54206216",
"0.5411752",
"0.5408402",
"0.5399191",
"0.53711754",
"0.5351368",
"0.5351029",
"0.5345687",
"0.53428435",
"0.53414357",
"0.53167534",
"0.52876705",
"0.5279676",
"0.522568",
"0.5218407",
"0.521562"... | 0.0 | -1 |
The ID of the Droplet from which the snapshot will be taken. | def droplet_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "droplet_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def droplet_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"droplet_id\")",
"de... | [
"0.76439667",
"0.74081326",
"0.7386014",
"0.73606974",
"0.73606974",
"0.69739026",
"0.69739026",
"0.69012725",
"0.66806585",
"0.66806585",
"0.66806585",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.667... | 0.7608756 | 1 |
The ID of the Droplet from which the snapshot will be taken. | def droplet_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "droplet_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def droplet_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_... | [
"0.76439667",
"0.7608756",
"0.7386014",
"0.73606974",
"0.73606974",
"0.69739026",
"0.69739026",
"0.69012725",
"0.66806585",
"0.66806585",
"0.66806585",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673733",
"0.6673... | 0.74081326 | 2 |
The ID of the Droplet from which the snapshot will be taken. | def droplet_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "droplet_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def droplet_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"droplet_id\")",
"def droplet_id(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"droplet_id\")",
"def... | [
"0.7609317",
"0.7408659",
"0.73866266",
"0.73613805",
"0.73613805",
"0.6973464",
"0.6973464",
"0.69012123",
"0.66803586",
"0.66803586",
"0.66803586",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
"0.66747636",
... | 0.7644475 | 0 |
Initializes a new trie node. | def __init__(self):
self.children = [None for i in range(ALPHABET_SIZE)]
self.is_end_of_word = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = self.TrieNode(None)",
"def __init__(self):\n self.root = self.TrieNode(0)",
"def __init__(self):\n self.root = TrieNode(None)",
"def __init__(self):\n self.root = TrieNode(None)",
"def __init__(self):\n self.trie = TrieNode()",
"def __i... | [
"0.8165057",
"0.8151141",
"0.81002945",
"0.81002945",
"0.80884635",
"0.80884635",
"0.80721563",
"0.7980621",
"0.7951292",
"0.7944938",
"0.79431003",
"0.79431003",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"... | 0.0 | -1 |
Initializes a new trie node. | def get_new_node(self):
return TrieNode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = self.TrieNode(None)",
"def __init__(self):\n self.root = self.TrieNode(0)",
"def __init__(self):\n self.root = TrieNode(None)",
"def __init__(self):\n self.root = TrieNode(None)",
"def __init__(self):\n self.trie = TrieNode()",
"def __i... | [
"0.8165057",
"0.8151141",
"0.81002945",
"0.81002945",
"0.80884635",
"0.80884635",
"0.80721563",
"0.7980621",
"0.7951292",
"0.7944938",
"0.79431003",
"0.79431003",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"0.79112715",
"... | 0.653305 | 69 |
Converts given character to array index of size 26 between 0 to 25. | def _char_to_array_index(self, ch):
return ord(ch) - ord('a') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def to_index(self, char):\n return ord(char) - ord(\"A\") - 32",
"def _get_index(self, character):\n OFFSET = 65 # ascii value of 'A' since the ... | [
"0.69545704",
"0.69545704",
"0.6758797",
"0.66760194",
"0.6570866",
"0.6522729",
"0.6491486",
"0.6491486",
"0.6380858",
"0.6336831",
"0.6290919",
"0.62019247",
"0.6161552",
"0.6154644",
"0.6147104",
"0.61442935",
"0.6130627",
"0.61083347",
"0.6025066",
"0.6008139",
"0.5977366... | 0.7433565 | 0 |
Return virtual name of the module. | def __virtual__():
if not ENABLED:
return (False, "The requests python module cannot be imported")
return "serverdensity_device" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_name(self):\n return self.name()",
"def module_name(self):\n return self.name",
"def virtual_name(self) -> Optional[str]:\n return pulumi.get(self, \"virtual_name\")",
"def virtual_name(self) -> Optional[str]:\n return pulumi.get(self, \"virtual_name\")",
"def module_... | [
"0.7317779",
"0.71667564",
"0.71403897",
"0.71403897",
"0.7074597",
"0.6958964",
"0.6764629",
"0.6720403",
"0.67155313",
"0.6652842",
"0.66398466",
"0.6598107",
"0.65599465",
"0.6549642",
"0.65483487",
"0.6541775",
"0.6535651",
"0.64378756",
"0.6422203",
"0.641961",
"0.641427... | 0.0 | -1 |
Fit the data to the model and then transform. This method is meant to be used for unsupervised learning models for clustering and dimensionality reduction. The models can be fit and tranformed through the load script or through chart expressions in Qlik. The load_script flag needs to be set accordingly for the correct ... | def fit_transform(self, load_script=False):
# Interpret the request data based on the expected row and column structure
row_template = ['strData', 'strData']
col_headers = ['model_name', 'n_features']
feature_col_num = 1
# An additional key field column is expected if t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_transform(self, data):\n self.fit(data)\n return self.transform(data)",
"def fit_transform(self, data):\n return self.transform(data)",
"def fit_transform(self, X, y=...):\n ...",
"def fit_transform(self, data):\n if not self._transformers:\n return self.... | [
"0.7373762",
"0.7175083",
"0.7094516",
"0.7025241",
"0.70091665",
"0.6980565",
"0.6940824",
"0.6895464",
"0.6880259",
"0.6765671",
"0.67572343",
"0.6704943",
"0.6677159",
"0.6655772",
"0.6622422",
"0.66209435",
"0.6617927",
"0.6617927",
"0.6617927",
"0.654767",
"0.6535734",
... | 0.7448178 | 0 |
Return history previously saved while fitting a Keras model. The history is avaialble as a DataFrame from the estimator. It provides metrics such as loss for each epoch during each run of the fit method. Columns will be ['iteration', 'epoch', 'loss'] and any other metrics calculated during training. | def get_keras_history(self):
# Get the model from cache or disk based on the model_name in request
self._get_model_by_name()
assert self.model.using_keras, "Loss history is only available for Keras models"
# Prepare the response using the histories data frame from the Keras mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_history(self) -> FitResultHelper:\n pass",
"def get_history(self):\n if self.validation:\n return self.iterations, (self.losses, self.valid_losses), \\\n (self.weights), (self.misclass_rate, self.valid_misclass_rate)\n return self.iterations, self.losses,... | [
"0.7052501",
"0.7024363",
"0.68790054",
"0.67894495",
"0.66416717",
"0.6634576",
"0.6626705",
"0.64849234",
"0.64661545",
"0.6421644",
"0.6334768",
"0.6317504",
"0.6294859",
"0.626471",
"0.6231158",
"0.61654013",
"0.61529607",
"0.6126438",
"0.61168253",
"0.6104604",
"0.608392... | 0.7479026 | 0 |
Get a previously saved model using the model_name | def _get_model_by_name(self):
# Interpret the request data based on the expected row and column structure
row_template = ['strData']
col_headers = ['model_name']
# Create a Pandas Data Frame for the request data
self.request_df = utils.request_df(self.request, r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model(model_name):\n module_name = 'strain.models.strain_' + model_name.lower()\n model_module = importlib.import_module(module_name)\n obj = getattr(model_module, model_name)\n return obj",
"def get_model_reference(self, model_name):\n\n print_debug(\"Geting model :\" + model_name)\n ... | [
"0.8108165",
"0.80199933",
"0.78389883",
"0.78304183",
"0.7805023",
"0.7591601",
"0.7434781",
"0.74062765",
"0.7391169",
"0.7380402",
"0.7357562",
"0.7356144",
"0.73012525",
"0.72587013",
"0.72187316",
"0.7194881",
"0.71618253",
"0.71618253",
"0.71618253",
"0.71618253",
"0.71... | 0.69779015 | 31 |
Get the model from the class model cache or disk. Update the cache if loading from disk. Return the model. | def _get_model(self, use_cache=True):
if use_cache and self.model.name in self.__class__.model_cache:
# Load the model from cache
self.model = self.__class__.model_cache[self.model.name]
# Refresh the keras model to avoid tensorflow errors
if self.model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_from_cache(modelfile, resolution):\n global __model_cache\n\n key = modelfile, int(resolution)\n\n if key not in __model_cache:\n return\n\n if not goodfile(modelfile):\n try:\n del __model_cache[key]\n except KeyError: # pragma: no cover\n # c... | [
"0.7514631",
"0.7319304",
"0.71419984",
"0.7105838",
"0.7055894",
"0.69622266",
"0.69525516",
"0.6899827",
"0.6894719",
"0.68889356",
"0.6858668",
"0.6824142",
"0.67444676",
"0.67267084",
"0.67156494",
"0.6692661",
"0.66700596",
"0.6645254",
"0.65619755",
"0.6560703",
"0.6507... | 0.7746074 | 0 |
Initialize restaurant name and cuisine type attributes | def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, restaurant_name, cuisine_type):\r\n\t\tself.restaurant_name = restaurant_name\r\n\t\tself.cuisine_type = cuisine_type",
"def __init__(self, restaurant_name, cuisine_type):\n\t\tself.name = restaurant_name\n\t\tself.type = cuisine_type",
"def __init__(self, restaurant_name, cuisine_type):\n\t... | [
"0.8867893",
"0.88307756",
"0.8777077",
"0.86650914",
"0.8590518",
"0.854975",
"0.854975",
"0.8524922",
"0.85144866",
"0.84030193",
"0.84030193",
"0.8368049",
"0.83221966",
"0.83221966",
"0.8252662",
"0.8079612",
"0.7813271",
"0.78129244",
"0.78112715",
"0.7777169",
"0.736069... | 0.87326837 | 4 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_yi = np.exp(x)
suma_e_yj = sum(e_yi)
soft = e_yi/suma_e_yj
return soft | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796294",
"0.7760558",
"0.7759004",
"0.77567077",
"0.76577055",
"0.76577055",
"0.76577055",
"0.76577055",
"0.7585655",
"0.743143",
"0.7407772",
"0.73941606",
"0.7358175",
"0.73174125",
"0.72689486",
"0.72623265",
"0.72614294",
"0.7256868",
"0.723019",
"0.7214918",
"0.72017... | 0.69533145 | 93 |
r""" Return basis of a dual lattice. | def compute_dual(lattice, row_wise: bool = True):
lat = to_row_wise(lattice, row_wise)
d = np.linalg.inv(lat @ lat.T) @ lat
if not row_wise:
d = d.T
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_basis(abc, lattice):\n return np.dot(abc.T, lattice.inv_matrix.T)",
"def getBasis(self):\n return self.__basis",
"def __getBasis(self) -> 'matrix':\n return array(list(BernBasis(self.domain, self.n, idx) for idx in range(self.n + 1)))",
"def get_basis(self, t):\n return np.vst... | [
"0.6748819",
"0.6397307",
"0.63326174",
"0.6097201",
"0.60450804",
"0.59411657",
"0.58349526",
"0.58246356",
"0.581243",
"0.581029",
"0.5800209",
"0.5782128",
"0.5759019",
"0.5695544",
"0.5691236",
"0.5668706",
"0.565275",
"0.56439495",
"0.56283873",
"0.5596489",
"0.5592591",... | 0.61514 | 3 |
Given a pandas series in row, scale it to have 0 mean and var 1 using feat_mean and feat_std Inputs | def scale_row(row, feat_mean, feat_std):
# If feat_std = 0 (this happens if adj_close doesn't change over N days),
# set it to a small number to avoid division by zero
feat_std = 0.001 if feat_std == 0 else feat_std
row_scaled = (row-feat_mean) / feat_std
return row_scaled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_feature(df):\n return df.apply(lambda column: (column - column.mean()) / column.std())",
"def normalize_series(series):\n return (series - series.mean()) / (series.max() - series.min())",
"def _normalize_feature(self, feature):\n\n for ic in range(self.data_shape[0]):\n fe... | [
"0.7132766",
"0.6608479",
"0.65137404",
"0.64793396",
"0.64694476",
"0.6302778",
"0.61978567",
"0.61772144",
"0.61592174",
"0.61483914",
"0.61185974",
"0.61144966",
"0.60863996",
"0.6074662",
"0.60632867",
"0.60632867",
"0.6023182",
"0.6020025",
"0.6007148",
"0.59990513",
"0.... | 0.7326219 | 0 |
Compute mean absolute percentage error (MAPE) | def get_mape(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
return np.mean(np.abs((y_true - y_pred) / y_true)) * 100 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mape(actual: np.ndarray, predicted: np.ndarray):\n return np.mean(np.abs(_percentage_error(actual, predicted)))",
"def mean_absolute_percentage_error(y_true, y_pred):\n if len(y_true.shape) > 1 or len(y_pred.shape) > 1:\n raise TypeError('Arrays need to be one-dimensional.')\n \n mape ... | [
"0.7936617",
"0.76534235",
"0.74976116",
"0.74901175",
"0.73194784",
"0.7313486",
"0.7270717",
"0.7173098",
"0.70893383",
"0.70797884",
"0.70488787",
"0.7028908",
"0.70101976",
"0.70088273",
"0.7007062",
"0.7006196",
"0.7004329",
"0.69965374",
"0.69923925",
"0.6976094",
"0.68... | 0.7017722 | 12 |
Create the dict of parameters for logging. | def define_logger(logs_path, log_level='INFO'):
try:
if not os.path.exists(logs_path):
os.mkdir(logs_path)
except OSError:
# Need this to log into stderr for tracking problems.
# On Apache, this will be redirect to the ErrorLog.
print >>sys.stderr, 'Cannot create {0} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _log_parameters(self):\n\n # Create file path\n path = self.output / (str(self.run_id) + '__' + self.name + '.json')\n path.parent.mkdir(parents=True, exist_ok=True)\n\n # Make sure parameters are JSON serializable\n parameters = vars(self).copy()\n for key, value in p... | [
"0.72127557",
"0.69871384",
"0.68431616",
"0.6807128",
"0.67623013",
"0.6729825",
"0.67139083",
"0.66924495",
"0.6653894",
"0.6628314",
"0.65715736",
"0.65579814",
"0.6510451",
"0.65023583",
"0.64967895",
"0.6490254",
"0.64677465",
"0.6424179",
"0.64182466",
"0.641284",
"0.64... | 0.0 | -1 |
Example view demonstrating rendering a simple HTML page. | def _copydoc():
with open(app_config.TRANSCRIPT_HTML_PATH) as f:
html = f.read()
doc = CopyDoc(html)
context = {
'doc': doc
}
return make_response(render_template('copydoc.html', **context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html_page():\n\n return render_template(\"moby.html\")",
"def get(self):\n self.render('view.html')",
"def hello():\n\n return render_template(\"index.html\")",
"def hello():\n return render_template(\"hello.html\")",
"def home_demo(request):\n\n return render(request, \"home_de... | [
"0.82181305",
"0.7517457",
"0.7275192",
"0.7262132",
"0.719313",
"0.7124594",
"0.7073872",
"0.70624375",
"0.7048777",
"0.70286745",
"0.7027904",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.7004205",
"0.6983125",
"0.69557106",
"0.69523466",
"0.6946... | 0.0 | -1 |
Example view demonstrating rendering a simple HTML page. | def child():
context = make_context()
return make_response(render_template('child.html', **context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html_page():\n\n return render_template(\"moby.html\")",
"def get(self):\n self.render('view.html')",
"def hello():\n\n return render_template(\"index.html\")",
"def hello():\n return render_template(\"hello.html\")",
"def home_demo(request):\n\n return render(request, \"home_de... | [
"0.821791",
"0.75176954",
"0.72749573",
"0.7261973",
"0.7192465",
"0.71233886",
"0.70735615",
"0.7061879",
"0.7048055",
"0.7027845",
"0.70275414",
"0.7005511",
"0.7005511",
"0.7005511",
"0.7005511",
"0.7005511",
"0.70037985",
"0.6982495",
"0.69556683",
"0.6951724",
"0.6945805... | 0.0 | -1 |
Example view demonstrating rendering a simple HTML page. | def index():
context = make_context()
return make_response(render_template('parent.html', **context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html_page():\n\n return render_template(\"moby.html\")",
"def get(self):\n self.render('view.html')",
"def hello():\n\n return render_template(\"index.html\")",
"def hello():\n return render_template(\"hello.html\")",
"def home_demo(request):\n\n return render(request, \"home_de... | [
"0.82181305",
"0.7517457",
"0.7275192",
"0.7262132",
"0.719313",
"0.7124594",
"0.7073872",
"0.70624375",
"0.7048777",
"0.70286745",
"0.7027904",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.7004205",
"0.6983125",
"0.69557106",
"0.69523466",
"0.6946... | 0.0 | -1 |
Example view demonstrating rendering a simple HTML page. | def preview():
context = make_context()
return make_response(render_template('parent.html', **context)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_html_page():\n\n return render_template(\"moby.html\")",
"def get(self):\n self.render('view.html')",
"def hello():\n\n return render_template(\"index.html\")",
"def hello():\n return render_template(\"hello.html\")",
"def home_demo(request):\n\n return render(request, \"home_de... | [
"0.82181305",
"0.7517457",
"0.7275192",
"0.7262132",
"0.719313",
"0.7124594",
"0.7073872",
"0.70624375",
"0.7048777",
"0.70286745",
"0.7027904",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.70059437",
"0.7004205",
"0.6983125",
"0.69557106",
"0.69523466",
"0.6946... | 0.0 | -1 |
Initialises a new 'Card' instance. | def __init__(self, cvNumber='', expiryDate='', pan='', accountHolderName='', Tender=None, *args, **kw_args):
#: The card verification number.
self.cvNumber = cvNumber
#: The date when this card expires.
self.expiryDate = expiryDate
#: The primary account number.
self.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card(self):\r\n return Card(self)",
"def card(self):\r\n return Card(self)",
"def card(self, card_id):\r\n return Card(self, card_id)",
"def __init__(self, cards):\n self.cards = cards",
"def __init__(self):\n self._cards = []\n #Add a single card for each suit... | [
"0.7595477",
"0.7595477",
"0.75220245",
"0.73043734",
"0.7297351",
"0.711586",
"0.70074624",
"0.6916885",
"0.69013155",
"0.689829",
"0.6874861",
"0.68229765",
"0.6746718",
"0.67043597",
"0.6690313",
"0.66680276",
"0.66432744",
"0.6631094",
"0.6617398",
"0.65881944",
"0.658157... | 0.6368037 | 33 |
Retrieve a dictionary of all the initial savers for the models. | def retrieve_init_savers(var_scopes_dict=None,
checkpoint_exclude_scopes_dict=None):
if var_scopes_dict is None:
return None
# Dictionary of init savers
init_savers = {}
for key, scope in var_scopes_dict.items():
trainable_vars = [
v for v in tf.trai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_saveables(self):\n\n saveables = dict()\n for i in range(self.bootstraps):\n saveables[f'forward_model_{i}'] = self.forward_models[i]\n saveables[f'forward_model_optim_{i}'] = self.forward_model_optims[i]\n return saveables",
"def get_saveables(self):\n\n ... | [
"0.7220556",
"0.68799424",
"0.6786313",
"0.66161346",
"0.6426652",
"0.6191279",
"0.59106165",
"0.59010965",
"0.5895657",
"0.5767955",
"0.57111275",
"0.5704965",
"0.5664016",
"0.55205977",
"0.5519148",
"0.550118",
"0.5498998",
"0.5492102",
"0.54644394",
"0.54613525",
"0.541442... | 0.58454967 | 9 |
Get a Config object for this API client. Broken out into a seperate method so that the test client can easily mock it up. | def _get_config(self, kwargs):
return Config(config_file=kwargs.pop('config_file', None),
env=kwargs.pop('env', None), overrides=kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config() -> Config:\n return get_or_set('config', build_configuration)",
"def get_config() -> Config:\n app_config = os.environ.get('APP_CONFIG', 'ProductionConfig')\n config_module = importlib.import_module(\n '.'.join(\n f\"magma.fluentd_client.config.{app_config}\".split('.'... | [
"0.76499104",
"0.7580057",
"0.75240105",
"0.74937093",
"0.7415436",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
"0.7369667",
... | 0.0 | -1 |
Return an annotation file name. | def SaveAsAnnotationFile(default_dir=None, default_file=None):
if default_dir is None:
default_dir = os.path.dirname(paths.sppas)
if default_file is None:
default_file = "newfile.xra"
save_file = None
wildcard = create_wildcard("All files", sppas.src.anndata.aio.extensions_out)
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ann_file(self):\n prefix = 'instances' if 'test' not in self.image_set else 'image_info'\n return os.path.join(self.data_path, 'annotations',\n prefix + '_' + self.image_set + '.json')",
"def _get_kps_ann_file(self):\n prefix = 'person_keypoints' if 'test'... | [
"0.7418841",
"0.68435615",
"0.682097",
"0.66299987",
"0.656887",
"0.6557899",
"0.6556182",
"0.65302604",
"0.64878166",
"0.647368",
"0.64341724",
"0.64009744",
"0.64009744",
"0.63951856",
"0.6353541",
"0.6316454",
"0.63093704",
"0.6307422",
"0.6298539",
"0.62940073",
"0.628640... | 0.0 | -1 |
Return an audio file name. | def SaveAsAudioFile(default_dir=None, default_file=None):
if default_dir is None:
default_dir = os.path.dirname(paths.sppas)
if default_file is None:
default_file = "newfile.wav"
save_file = None
wildcard = create_wildcard("All files", sppas.src.audiodata.aio.extensions)
wildcard... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wav_name(wav_path):\r\n filename = wav_path.rsplit(\"\\\\\")[-1]\r\n id_list = filename.split(\".\")[0]\r\n wav_speaker = id_list.split(\"_\")\r\n return wav_speaker[0], wav_speaker[1]",
"def audiofile(self, directory=None):\n\n return self.make_path(directory, '.wav')",
"async def f... | [
"0.7163907",
"0.7151597",
"0.7086605",
"0.7004378",
"0.69046944",
"0.68545365",
"0.68324274",
"0.682576",
"0.6728781",
"0.6726534",
"0.6720378",
"0.6610018",
"0.6576102",
"0.6570494",
"0.6541448",
"0.651236",
"0.65009606",
"0.64982784",
"0.64948183",
"0.64736646",
"0.6453473"... | 0.0 | -1 |
Compare prediction boxes and ground truths, convert ground truths to network output tensors | def build_targets(self, pred_boxes, conf, cls, ground_truth, nH, nW):
# Parameters
nB = len(ground_truth)
nA = self.num_anchors
nAnchors = nA * nH * nW
nPixels = nH * nW
device = pred_boxes.device
# Tensors
conf_pos_mask = torch.zeros(nB, nA, nH * nW, req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, net, data, prediction, truth):\n raw_output = prediction['output']\n # raw_output = tf.constant(np.load('out.npy'))\n batch = util.shape(raw_output)[0]\n prediction = tf.reshape(\n raw_output,\n (batch, self.num_cells, self.num_cells,\n ... | [
"0.67889076",
"0.6518005",
"0.6427023",
"0.6401813",
"0.638819",
"0.6374475",
"0.6349312",
"0.63418466",
"0.6236348",
"0.62105435",
"0.619718",
"0.61827886",
"0.61690557",
"0.6163719",
"0.6132844",
"0.61314994",
"0.60833293",
"0.60723686",
"0.60481024",
"0.60324675",
"0.60292... | 0.58071774 | 60 |
Compute 'Scaled Dot Product Attention' | def attention(query, key, mask=None, dropout_layer=None):
d_k = query.size(-1)
# query, key, value [batch size, head num, seq len, head dim]
# scores [batch size, head num, seq len, seq len]
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
scores = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scaled_dot_product_attention(q, k, v, mask):\n matmul_qk = tf.matmul(q, k, transpose_b=True) # [..., q_len, kv_len]\n # scale matmul_qk\n dk = tf.cast(tf.shape(k)[-1], tf.float32)\n scaled_attention_logits = matmul_qk / tf.sqrt(dk)\n # print(\"scaled_attention_logits\", tf.nn.top_k(scaled_atten... | [
"0.67412263",
"0.66336447",
"0.6571855",
"0.65150195",
"0.6505148",
"0.6504337",
"0.6503735",
"0.6503735",
"0.64900446",
"0.6464487",
"0.64103204",
"0.6387002",
"0.63768214",
"0.62903184",
"0.61006254",
"0.6056964",
"0.601408",
"0.5984356",
"0.595376",
"0.5942652",
"0.5925456... | 0.0 | -1 |
ROunds a tensor whose values are in [0,1] to a tensor with values in {0, 1}, using the straight through estimator for gradient. | def binaryRound(x):
g = tf.get_default_graph()
with ops.name_scope("BinaryRound") as name:
with g.gradient_override_map({"Round": "Identity"}):
return tf.round(x, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_gradient_to_tensor(x):\n return x",
"def relu_n1_to_1(x):\n return tf.math.maximum(-1.0, tf.math.minimum(x, 1.0))",
"def relu_grad(self, X):\n X[X<=0]=0\n X[X>0]=1\n return X",
"def grad_ReLU(self):\n y = self.x\n y[y<=0] = 0\n y[y>0] = 1\n r... | [
"0.69592494",
"0.66187894",
"0.6595226",
"0.6284046",
"0.62720966",
"0.6221529",
"0.6201836",
"0.6101813",
"0.6088306",
"0.6064112",
"0.60494924",
"0.6029087",
"0.59983575",
"0.59804493",
"0.5972279",
"0.5961465",
"0.5958991",
"0.59537625",
"0.58880985",
"0.58342624",
"0.5834... | 0.0 | -1 |
Sigmoid that uses identity function as its gradient | def passThroughSigmoid(x, slope=1):
g = tf.get_default_graph()
with ops.name_scope("PassThroughSigmoid") as name:
with g.gradient_override_map({"Sigmoid": "Identity"}):
return tf.sigmoid(x, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_grad(x):\n sig = sigmoid(x)\n return np.multiply(sig, 1 - sig)",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n... | [
"0.82425267",
"0.80847204",
"0.80847204",
"0.8064086",
"0.8041086",
"0.8041086",
"0.8041086",
"0.8041086",
"0.8041086",
"0.8041086",
"0.80310744",
"0.80277723",
"0.80227524",
"0.8010798",
"0.80015695",
"0.7965877",
"0.79616094",
"0.79616094",
"0.7958036",
"0.7945106",
"0.7944... | 0.0 | -1 |
Sigmoid followed by a random sample from a bernoulli distribution according to the result (binary stochastic neuron). Uses the REINFORCE estimator. | def binaryStochastic_REINFORCE(x, stochastic = True, loss_op_name="loss_by_example"):
g = tf.get_default_graph()
with ops.name_scope("BinaryStochasticREINFORCE"):
with g.gradient_override_map({"Sigmoid": "BinaryStochastic_REINFORCE",
"Ceil": "Identity"}):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_activation_sigmoid(self):\r\n senal = 1\r\n result = activation.soft_sigmoid(senal)\r\n self.assertEqual(result, 0.6963549298238342)",
"def sample_bernoulli(self, probabilities):\n return tf.nn.relu(tf.sign(probabilities - tf.random.uniform(probabilities.shape)))",
"def sigmoid... | [
"0.6788619",
"0.661523",
"0.65626025",
"0.65106994",
"0.6464587",
"0.645306",
"0.64352655",
"0.64330506",
"0.64265305",
"0.64265305",
"0.64251316",
"0.63954926",
"0.6392146",
"0.6391586",
"0.6384326",
"0.6384326",
"0.6384326",
"0.6384326",
"0.6384326",
"0.6384326",
"0.6370358... | 0.5914658 | 98 |
Create list with all positions of the bits represented by the bit field. | def bits(self):
return list(range(self.lsb, self.msb + 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_list(bits: int) -> list[Position]:\n positions = []\n for r in range(8):\n for c in range(8):\n mask = pos_mask(r, c)\n if bits & mask > 0:\n positions.append(Position(r, c))\n return positions",
"def bitlist(n):\n return [n >> i & 1 for i in range(7... | [
"0.8175614",
"0.72153026",
"0.70743394",
"0.6961602",
"0.68579984",
"0.6583331",
"0.6429662",
"0.64068633",
"0.6334687",
"0.62720686",
"0.62673223",
"0.6173341",
"0.615376",
"0.615376",
"0.6092991",
"0.6043566",
"0.59320277",
"0.5929743",
"0.59139615",
"0.5909586",
"0.5904987... | 0.7191359 | 2 |
Display a user friendly time from number of second. | def user_friendly_time(s):
s = int(s)
if s < 60:
return "{}s".format(s)
m = s // 60
s = s % 60
if m < 60:
return "{}m {}s".format(m, s)
h = m // 60
m = m % 60
if h < 24:
return "{}h {}m {}s".format(h, m, s)
d = h // 24
h = h % 24
return "{}d {}h {}m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_str(num):\n if num > 3600:\n return \"%0.2f hrs\" % (num / 3600)\n elif num > 60:\n return \"%0.2f mins\" % (num / 60)\n else:\n return \"%d seconds\" % num",
"def printTime(t):\n if t < 2 * MINUTE:\n return \"%d seconds\" % (t / SECOND)\n if t < 5 * HOUR:\n ... | [
"0.7702885",
"0.7260868",
"0.7231293",
"0.7144458",
"0.70752937",
"0.70528513",
"0.70471877",
"0.69600505",
"0.6946774",
"0.69319427",
"0.6925383",
"0.6920295",
"0.68728316",
"0.6869056",
"0.6839289",
"0.6837528",
"0.68244547",
"0.6815648",
"0.6775087",
"0.67601573",
"0.67386... | 0.6967122 | 7 |
Add a app to the database. | def add_app(self, app: AppDefinition) -> None:
self.db.insert_app(app=app) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_app(self, app, database):\n self.add_app_sig(AppSignature.from_app(app, database))",
"def add_app(self, app, database):\n self.add_app_sig(AppSignature.from_app(app, database))",
"def add_app(self, data):\n app_id = str(uuid.uuid4()).replace('-', '')\n try:\n self... | [
"0.81557506",
"0.81557506",
"0.79858816",
"0.77437276",
"0.7336584",
"0.7070419",
"0.68768734",
"0.6737575",
"0.64329773",
"0.6393965",
"0.63553363",
"0.6236789",
"0.62307894",
"0.62022716",
"0.616582",
"0.611664",
"0.6075109",
"0.603338",
"0.603338",
"0.6025594",
"0.6022432"... | 0.8988868 | 0 |
Compute stress and derivative of elasticity matrix. This assumes behavior is always viscoelastic. | def _calcStress(self, strainV, muV, lambdaV, shearRatioV, maxwellTimeV,
totalStrainV, viscousStrainV, initialStressV, initialStrainV,
stateVars):
import scipy.misc
# Define some numpy arrays
strainTpdt = numpy.array(totalStrainV, dtype=numpy.float64)
strainT = nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def effective_stress(self):\n tau = self.deviatoric_stress_tensor()\n tu_xx = tau[0,0]\n tu_yy = tau[1,1]\n tu_zz = tau[2,2]\n tu_xy = tau[0,1]\n tu_xz = tau[0,2]\n tu_yz = tau[1,2]\n \n # Second invariant of the strain rate tensor squared\n taudot = 0.5 * (+ tu_xx**2 + tu_yy... | [
"0.6218858",
"0.59964424",
"0.58846176",
"0.58669984",
"0.582145",
"0.58073324",
"0.5766871",
"0.5762073",
"0.5660937",
"0.56476516",
"0.56444407",
"0.561541",
"0.55837595",
"0.5561357",
"0.5549641",
"0.55379343",
"0.5504817",
"0.5443423",
"0.54414934",
"0.5437416",
"0.543544... | 0.59200615 | 2 |
Creates and returns the test dataset. | def get_datasets(self, test_ids):
use_rgb = "smp" in self.model_params["architecture"]
preprocess_t = get_preprocessing(use_rgb)
# creating the datasets
test_dataset = TestVoxelDataset(im_ids=test_ids,
transforms=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test(self) -> tf.contrib.data.Dataset:\n return self.__test_dataset",
"def _create_data():\n tf.logging.info(\"Create records..\")\n train, val, test = util.load_data(data_dir, FLAGS[\"is_aug\"])\n tf.logging.info(\"Dataset size: Train-{} Test-{} Val-{}\".format(len(train), len(test), len(val... | [
"0.742971",
"0.72319597",
"0.71850467",
"0.71055573",
"0.70824",
"0.70562875",
"0.704636",
"0.69980824",
"0.6994394",
"0.6985985",
"0.6985392",
"0.6981336",
"0.6949997",
"0.6947164",
"0.68814176",
"0.6865364",
"0.68530613",
"0.6838767",
"0.6835561",
"0.68294686",
"0.68141043"... | 0.69013166 | 14 |
Get the full path to a data file. Returns the path to a file underneath the data directory (as defined by `get_data_path`). Equivalent to os.path.join(get_data_path(), path_segments). | def get_data_file(*path_segments):
return os.path.join(get_data_path(), *path_segments) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(data_path):\n\treturn os.path.dirname(os.path.realpath(__file__)) + os.sep + data_path",
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def get_file_path(filename, path='Data/'):\n path= os.path.abspath(os.path.dirname(path))\n return os.path.join(path, filename)",
"d... | [
"0.72607946",
"0.7119141",
"0.7067157",
"0.70307446",
"0.6968667",
"0.69363314",
"0.6856017",
"0.6853482",
"0.6807814",
"0.67673206",
"0.67672586",
"0.6726451",
"0.6712626",
"0.6684106",
"0.6662318",
"0.6579254",
"0.6562185",
"0.652093",
"0.6484198",
"0.646809",
"0.6438099",
... | 0.8366851 | 0 |
Retrieve malstor data path This path is by default /../data/ in trunk and /usr/share/malstor in an installed version but this path is specified at installation time. | def get_data_path():
# Get pathname absolute or relative.
path = os.path.join(
os.path.dirname(__file__), __malstor_data_directory__)
abs_data_path = os.path.abspath(path)
if not os.path.exists(abs_data_path):
raise project_path_not_found
return abs_data_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep",
"def get_data_dir():\n return Path(current_app.config[\"USER_DIR\"]) / \"data\"",
"def get_data_path():\n\treturn _paths[_DATA_DIRECTORY_KEY]",
"def datadir():\n return '../... | [
"0.7547989",
"0.74351656",
"0.74136823",
"0.7373983",
"0.7277516",
"0.71793264",
"0.70989656",
"0.7083018",
"0.7026813",
"0.7022432",
"0.6990429",
"0.69896203",
"0.69415456",
"0.6915631",
"0.69149214",
"0.6911404",
"0.6906606",
"0.69063455",
"0.687315",
"0.68687177",
"0.68587... | 0.7571487 | 0 |
Get the full path of local module folder | def get_module_folder(configs, module_name):
repo_path = get_local_repository_path()
return os.path.join(repo_path, configs["groupId"].replace(".", "/"),
module_name, configs["releaseVersion"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_path():\n return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))",
"def module_path(self):\n return self.config['cwd']",
"def _get_module_path():\n\n return os.path.dirname(os.path.realpath(__file__))",
"def module_path():\n try:\n this_file_path = __file__\... | [
"0.817398",
"0.7930023",
"0.78983164",
"0.7768528",
"0.77180034",
"0.7680845",
"0.7658833",
"0.7601667",
"0.75917286",
"0.7568644",
"0.74617666",
"0.7368266",
"0.7356213",
"0.73433405",
"0.7276671",
"0.72656554",
"0.7257367",
"0.723635",
"0.7219493",
"0.72036743",
"0.7187815"... | 0.0 | -1 |
Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" | def date_to_milliseconds(date_str):
# get epoch value in UTC
epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
# parse our date string
d = dateparser.parse(date_str)
# if the date is not timezone aware apply UTC timezone
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())",
"def utctime(stamp):\n return stamp + utc_offset",
"def utc_offset_convert(utc_offset):\n offset=abs(utc_offset)\n hour=str(offset//3600)\n if len(hour)==1:\n hour=str(0)+hour\n\n minute=str(offset%3600//60... | [
"0.64477664",
"0.63468456",
"0.6254665",
"0.6040414",
"0.60042995",
"0.598265",
"0.5965658",
"0.5949968",
"0.5902936",
"0.58564705",
"0.5855957",
"0.5819514",
"0.5818276",
"0.58011425",
"0.5786838",
"0.577368",
"0.5727744",
"0.56951255",
"0.5691665",
"0.56866693",
"0.56724995... | 0.5823514 | 12 |
Converts String to all uppercases | def upper(value,n):
return value.upper()[0:n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uppercase(str):\n \n return str.upper()",
"def upper(string):\n new_string = '' # Empty string to append to\n for char in string: # Itterate over each character in user's string\n if char.isalpha() and not char.isupper(): # If the character is an alphabet and not already uppercase\n ... | [
"0.81259036",
"0.8069639",
"0.8029967",
"0.78622484",
"0.76900023",
"0.7559602",
"0.73790437",
"0.72199166",
"0.7084664",
"0.69768184",
"0.6973606",
"0.6916794",
"0.6864883",
"0.68216723",
"0.67940587",
"0.6714895",
"0.6669458",
"0.66394484",
"0.66189635",
"0.6598447",
"0.658... | 0.57867795 | 94 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.