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 |
|---|---|---|---|---|---|---|
Builds a kfactor circulant matrix (A matrix with the structure of circulant matrices, but with the entries above the diagonal multiplied by the same factor.) The matrix is store in memory. | def factor_circulant_matrix(x, k):
n=len(x)
return circulant(x) * (tri(n,n, 0) + k*np.transpose(tri(n,n, -1))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_k_matrix(self):\r\n K = self.uv_vol + self.Epsilon * self.guv_vol + \\\r\n (self.Epsilon / self.Beta) * self.uv_bound\r\n return K",
"def _K(m):\n M = m*(m - 1)/2\n K = np.zeros((M, m**2), dtype=np.int64)\n row = 0\n for j in range(1, m):\n col = (j - 1)*m + j... | [
"0.6495986",
"0.6089255",
"0.6045119",
"0.59890914",
"0.5949488",
"0.59035623",
"0.5859298",
"0.58462423",
"0.57634705",
"0.574443",
"0.5730508",
"0.5717386",
"0.56819576",
"0.566873",
"0.5568253",
"0.55545205",
"0.5523086",
"0.55172205",
"0.5492196",
"0.5491694",
"0.5478032"... | 0.78092545 | 0 |
Convert `data` to float64 or int(64|32|16|8); as fallback, return `data`. Assume `data` is of type `utf8` or a dictionary of utf8. | def _autocast_column(data: pyarrow.ChunkedArray) -> pyarrow.ChunkedArray:
# All-empty (and all-null) columns stay text
for chunk in data.iterchunks():
# https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-layout
_, offsets_buf, _ = chunk.buffers()
# If data has an off... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_float(data):\n try:\n return float(data)\n except (ValueError, TypeError ):\n return data",
"def float_from_string(data):\n return float(maybe_number(data))",
"def _float(data):\n try:\n return float(data)\n except ValueError as err:\n if data in ('None', 'NA'... | [
"0.748317",
"0.69878703",
"0.6950177",
"0.6709056",
"0.6397729",
"0.6396958",
"0.63965064",
"0.6293659",
"0.6279694",
"0.6161165",
"0.61318475",
"0.61182475",
"0.5992608",
"0.596135",
"0.5870688",
"0.5860507",
"0.58470494",
"0.58467394",
"0.5794232",
"0.5766028",
"0.5722432",... | 0.0 | -1 |
Parse CSV, TSV or other delimiterseparated text file. Raise LookupError for an `encoding` Python cannot handle. Raise UnicodeError when the file simply cannot be read as text. (e.g., a UTF16 file that does not start with a byteorder marker.) | def _parse_csv(
path: Path,
*,
settings: Settings = DEFAULT_SETTINGS,
encoding: Optional[str],
delimiter: Optional[str],
has_header: bool,
autoconvert_text_to_numbers: bool,
) -> ParseCsvResult:
warnings = []
with contextlib.ExitStack() as ctx:
n_bytes = path.stat().st_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read(filename, encodings=['ascii', 'utf-8', 'utf-16', 'latin-1']):\n text = None\n\n for encoding in encodings:\n try:\n f = open(filename, encoding=encoding)\n text = f.read()\n f.close()\n except UnicodeDecodeError:\n f.close()\n except ... | [
"0.6560378",
"0.62868285",
"0.61147213",
"0.6035779",
"0.6029811",
"0.5926391",
"0.5827321",
"0.5804859",
"0.58034223",
"0.5774665",
"0.5699063",
"0.56861764",
"0.56857336",
"0.56818",
"0.56673634",
"0.5613292",
"0.56082886",
"0.55889183",
"0.5518909",
"0.5518909",
"0.5518909... | 0.60616267 | 3 |
Update the config information with the number of attention heads. | def update_heads(info,
heads):
info["model_params"]["boltzmann_dict"]["num_heads"] = heads
# Concatenate the fingerprints produced by the different heads
info["model_params"]["boltzmann_dict"]["head_pool"] = "concatenate"
readoutdict = info["model_params"]["readoutdict"]
feat_dim ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_config(self):\n self.channel_count = self.config_global['channel_count']\n self.pixel_count = self.config_global['pixel_count']\n self.pixel_index_max = self.pixel_count - 1\n self.repeat_count = self.config_global['repeat_count']\n self.repeat_snake = self.config_glob... | [
"0.5661511",
"0.5599164",
"0.54210174",
"0.53882116",
"0.5338775",
"0.5247799",
"0.5247248",
"0.5225227",
"0.51431704",
"0.5058479",
"0.49841285",
"0.49445143",
"0.49379683",
"0.48532596",
"0.4848556",
"0.48481622",
"0.4835506",
"0.48258802",
"0.48030823",
"0.48024145",
"0.47... | 0.5935313 | 0 |
Distribution parameter for the location. | def loc(self):
return self._gev_bijector.loc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distribution(self) -> str:\n return pulumi.get(self, \"distribution\")",
"def loc(self):\n return self.distribution.loc",
"def get_distribution_parameters(self):\r\n return \"UNDEFINED\"",
"def distribution(self, env):\n pass",
"def _handleInput(self, paramInput):\n super()._... | [
"0.65867454",
"0.62829775",
"0.62012964",
"0.59412557",
"0.57245076",
"0.56689125",
"0.5637412",
"0.5567886",
"0.5564207",
"0.55510134",
"0.5550806",
"0.55264115",
"0.5516382",
"0.550923",
"0.5505646",
"0.5505646",
"0.5499564",
"0.5482442",
"0.5477142",
"0.54546994",
"0.54109... | 0.0 | -1 |
Initialise an allergy storage with the given allergy score. | def __init__(self, score):
self.score = score
self.list = [candidate[0] for candidate in self._allergens
if candidate[1] & self.score] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _krls_init(self, iALDth=1e-4, iMaxDict=1e3):\n \n dAldKRLS = {} # Initialize dictionary with data for aldkrls algorithm\n \n # Store all the parameters in the dictionary\n dAldKRLS['iALDth'] = iALDth; # ALD threshold\n dAldKRLS['iMaxDt'] = iMaxDict; # M... | [
"0.5347252",
"0.5322024",
"0.5263044",
"0.5225015",
"0.5212653",
"0.51022935",
"0.5069073",
"0.50057083",
"0.50024194",
"0.49871403",
"0.49801096",
"0.49767306",
"0.49670827",
"0.49553522",
"0.4951048",
"0.49419042",
"0.4933451",
"0.48849487",
"0.48819917",
"0.48739007",
"0.4... | 0.5045687 | 7 |
This returns a single entry corresponding to the Experiment Entity referred to by ExpEntityData. The returned string is given below (between Start and End) Start | def getExperimentEntry(ExpEntityData):
# Validate that ExpEntityData actually corresponds to an Experiment Entity
if ExpEntityData.Type != 'Experiment':
errprint("\nThe Entity Data does not represent the data of an experiment")
raise ValueError
OutputLines = []
OutputLines.append("")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_full_entity(entity: spacy.tokens.Token) -> str:\n entity_string = SpacyEventExtractor._get_chunk(entity)\n\n word = entity\n while True:\n prep, word = SpacyEventExtractor._get_prep_with_word(word)\n if word is None:\n break\n entity_str... | [
"0.6376407",
"0.5688458",
"0.56678385",
"0.5637462",
"0.5474638",
"0.5404834",
"0.5358794",
"0.53286546",
"0.5274664",
"0.5274664",
"0.52555805",
"0.5246036",
"0.51556396",
"0.51428646",
"0.51405764",
"0.51387566",
"0.51039517",
"0.5103533",
"0.5092884",
"0.5080785",
"0.50753... | 0.81062454 | 0 |
Initialize the sum to zero | def __init__(self, name):
super(Column, self).__init__(self, name)
self.sum = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_sum(self):\n self.sum_e = 0",
"def initial(self):\n return zero",
"def zero(self):\n raise NotImplementedError(\"Not implemented yet.\")",
"def reset_sum(self):\n self._error_sum = 0",
"def zero_sum(list):\n if not list:\n return 0\n else:\n return ... | [
"0.7703882",
"0.71630156",
"0.69994444",
"0.6945991",
"0.6897512",
"0.67463124",
"0.6605019",
"0.65537924",
"0.653141",
"0.65299124",
"0.6520557",
"0.65204495",
"0.6479404",
"0.6479189",
"0.6431233",
"0.64236397",
"0.6403008",
"0.63670397",
"0.63195443",
"0.62968844",
"0.6264... | 0.0 | -1 |
The `ComputeCluster` data source can be used to discover the ID of a cluster in vSphere. This is useful to fetch the ID of a cluster that you want to use for virtual machine placement via the `VirtualMachine` resource, allowing to specify the cluster's root resource pool directly versus using the alias available throug... | def get_compute_cluster(datacenter_id: Optional[str] = None,
name: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetComputeClusterResult:
__args__ = dict()
__args__['datacenterId'] = datacenter_id
__args__['name'] = name
op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_id(options):\n cluster = options.cluster\n datacenter = get_datacenter(options)\n for item in datacenter.hostFolder.childEntity:\n if (item.name == cluster):\n return item._GetMoId()",
"def get_compute_cluster_output(datacenter_id: Optional[pulumi.Input[Optional[str]]] = N... | [
"0.70518404",
"0.70052683",
"0.67735595",
"0.6768537",
"0.6736824",
"0.6736824",
"0.6736824",
"0.6736824",
"0.6736824",
"0.66624004",
"0.66624004",
"0.66624004",
"0.66624004",
"0.6613303",
"0.660601",
"0.660601",
"0.6474703",
"0.6474703",
"0.6474703",
"0.63924193",
"0.6386118... | 0.72311264 | 0 |
The `ComputeCluster` data source can be used to discover the ID of a cluster in vSphere. This is useful to fetch the ID of a cluster that you want to use for virtual machine placement via the `VirtualMachine` resource, allowing to specify the cluster's root resource pool directly versus using the alias available throug... | def get_compute_cluster_output(datacenter_id: Optional[pulumi.Input[Optional[str]]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetComputeClusterResult]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_compute_cluster(datacenter_id: Optional[str] = None,\n name: Optional[str] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetComputeClusterResult:\n __args__ = dict()\n __args__['datacenterId'] = datacenter_id\n __args__['name'] = n... | [
"0.72311264",
"0.70518404",
"0.67735595",
"0.6768537",
"0.6736824",
"0.6736824",
"0.6736824",
"0.6736824",
"0.6736824",
"0.66624004",
"0.66624004",
"0.66624004",
"0.66624004",
"0.6613303",
"0.660601",
"0.660601",
"0.6474703",
"0.6474703",
"0.6474703",
"0.63924193",
"0.6386118... | 0.70052683 | 2 |
Assert that the first (leftmost) protocol value is correctly fetched from the xforwardedheader. | def test_get_protocol_with_more_than_one_value():
request = Mock(
headers={"X-Forwarded-Proto": "https,http,http"},
protocol="http",
)
expected = "https"
protocol = get_browser_protocol(request)
assert expected == protocol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_h2_header_ok(self):\n self.set_frang_config(frang_config=\"http_strict_host_checking true;\")\n client = self.get_client(\"deproxy-1\")\n client.start()\n client.parsing = False\n\n first_headers = [(\":authority\", \"localhost\"), (\":path\", \"/\")]\n second_hea... | [
"0.6413071",
"0.6368929",
"0.63600814",
"0.6126467",
"0.6093351",
"0.6008764",
"0.597977",
"0.59638256",
"0.5935303",
"0.5915244",
"0.59103775",
"0.588814",
"0.58332074",
"0.5819531",
"0.58032525",
"0.57846427",
"0.5782095",
"0.57428664",
"0.5648308",
"0.5636194",
"0.5635823"... | 0.72213775 | 0 |
Randomly divide this image into training, validation and test split. The image is divided into three randomly ordered consecutive patches. The fractions of the image going into each patch are given by val_split, test_split, and 1 (val_split + test_split), respectively. Columns in which the patches overlap are removed. | def select_randomly(self, val_split: float, test_split: float) -> {str: int}:
def _select(start, n, label) -> int:
"""
Label all columns in [start, start+n) with label.
"""
n_selected = 0
for i in range(start, int(start + n)):
x = self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(self):\n\n ratio_c = 1 - self.ratio\n self.train, self.test = self.df.randomSplit([self.ratio, ratio_c], seed=12345)",
"def split_valid_sampling(inpath,\n patch_size, \n train_prop,\n val_prop,\n outpath,\n padding_mode='constant', \n padding_valu... | [
"0.6673594",
"0.6663889",
"0.6621361",
"0.65526426",
"0.6512163",
"0.6374599",
"0.63245976",
"0.6266016",
"0.62305325",
"0.62242997",
"0.6173855",
"0.61674833",
"0.61449915",
"0.612918",
"0.610995",
"0.6105582",
"0.6080789",
"0.6075082",
"0.6059651",
"0.6052234",
"0.6046871",... | 0.0 | -1 |
Return index of first unlabelled column after x. | def _next_unlabelled_col(x):
for i in range(self.n_cols):
idx = (x + i) % self.n_cols
x_current = self._x_positions[idx]
if self._cols[x_current].label is None:
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def XToCol(self, x):\r\n \r\n colLeft = 0\r\n numColumns = self.GetColumnCount()\r\n for col in xrange(numColumns):\r\n \r\n if not self.IsColumnShown(col):\r\n continue \r\n\r\n column = self.GetColumn(col)\r\n\r\n if x < (colLeft ... | [
"0.670367",
"0.66707695",
"0.65949285",
"0.63676727",
"0.6300657",
"0.62851495",
"0.6224062",
"0.62041897",
"0.61869335",
"0.6082615",
"0.6070392",
"0.6063719",
"0.60264426",
"0.6016226",
"0.59535724",
"0.59106576",
"0.58775485",
"0.5842333",
"0.5821943",
"0.5775763",
"0.5773... | 0.84793603 | 0 |
Return a mapping of column positions and labels. | def get_labels(self) -> {int: str}:
return {x: col.label for x, col in self._cols.items()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_columns(mapping):\n columns = []\n for name, column in mapping.items():\n columns.append(column.label(name))\n return columns",
"def get_label_ix_mapping(labels):\n return {label: i for i, label in enumerate(labels)}",
"def column_labels(self):\n return tuple(self._columns.k... | [
"0.73458505",
"0.72522795",
"0.68872035",
"0.68740356",
"0.6553106",
"0.650619",
"0.64447373",
"0.6226804",
"0.61503714",
"0.60560364",
"0.6047371",
"0.6043159",
"0.59742296",
"0.5932194",
"0.5919516",
"0.5908463",
"0.5892866",
"0.5887391",
"0.5864398",
"0.5817711",
"0.579350... | 0.7213927 | 2 |
Return value stored in config | def get(self, key, default_val=None):
if key not in self._config.keys(): # we don't want KeyError
return default_val # just return None if not found
return self._config[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]",
"def _get_config_value(self, section, key):\n return config.get(section, key)",
"def value(self) -> str:\n return self._config.get('value')",
"def get(self, key):\n ... | [
"0.8236148",
"0.78571916",
"0.78411025",
"0.77996963",
"0.7762611",
"0.7640735",
"0.7605088",
"0.7578148",
"0.7571694",
"0.7504212",
"0.7446086",
"0.7428434",
"0.7364911",
"0.7358118",
"0.7330266",
"0.73145777",
"0.7290636",
"0.72804093",
"0.7263993",
"0.7168558",
"0.7160482"... | 0.0 | -1 |
Update the config file | def update(self):
self.save_config_file() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conf_update(self):\n pass",
"def updateConfig(self):\n # Make sure to keep the default values in place.\n if self.newConfig['sensor'] == 0:\n self.newConfig['sensor'] = self.config['sensor']\n if self.newConfig['camera'] == 0:\n self.newConfig['camera'] = sel... | [
"0.8264877",
"0.7606795",
"0.74441475",
"0.726482",
"0.7236753",
"0.72217864",
"0.7091417",
"0.7060331",
"0.70171785",
"0.70084494",
"0.6937647",
"0.69036394",
"0.6887495",
"0.68652135",
"0.6852088",
"0.6795112",
"0.679408",
"0.67330885",
"0.6727831",
"0.6705917",
"0.66979545... | 0.88768095 | 0 |
Gets the current ml_task. If "auto" it is determined | def _get_ml_task(self):
self._validate_ml_task()
if self.ml_task == "auto":
classes_number = self.n_classes
if classes_number == 2:
self._estimator_type = "classifier" # for sk-learn api
return BINARY_CLASSIFICATION
elif classes_number... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_current_task():\r\n return current_task",
"def _get_current_task():\r\n return current_task",
"def get_current_task(self):\n return self.get_current_step().get_last_task()",
"def task(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"task\")",
"def task(self):\n... | [
"0.77952605",
"0.77952605",
"0.75856113",
"0.7273964",
"0.70522803",
"0.70522803",
"0.70522803",
"0.70522803",
"0.70522803",
"0.6897995",
"0.6803446",
"0.6802864",
"0.67456496",
"0.6690138",
"0.6611777",
"0.6603375",
"0.6532655",
"0.6522994",
"0.64612824",
"0.6443876",
"0.636... | 0.7787898 | 2 |
Gets the current results_path | def _get_results_path(self):
# if we already have the results path set, please return it
if self._results_path is not None:
return self._results_path
self._validate_results_path()
path = self.results_path
if path is None:
for i in range(1, 10001):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_results(self):\n\n return self._local_results_path",
"def get_result_path(self):\n return logPath",
"def index_path(self):\n\t\treturn os.path.normpath(self.output + \"/\" + self.resultset_index)",
"def remote_results(self):\n\n return self._remote_results_path",
"def set_res... | [
"0.7681095",
"0.7608964",
"0.72525233",
"0.71424973",
"0.65749073",
"0.65520835",
"0.6454215",
"0.6348574",
"0.63169134",
"0.6294443",
"0.6256191",
"0.6253854",
"0.62473315",
"0.6234381",
"0.61912316",
"0.61699665",
"0.6166557",
"0.6160031",
"0.61576474",
"0.6157143",
"0.6109... | 0.71246856 | 4 |
Gets the current stack_models | def _get_stack_models(self):
self._validate_stack_models()
if self.stack_models == "auto":
val = self._get_validation_strategy()
if val.get("validation_type", "") == "custom":
return False
return True if self.mode in ["Compete", "Optuna"] else False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models(self):\r\n return self.get_field('model')",
"def models(self):\r\n return self.get_field('model')",
"def get_models(self):\n self.load()\n return self._models",
"def get_models(self):\n return self.P, self.Q",
"def models(self):\n return self.config.mode... | [
"0.6803391",
"0.6803391",
"0.64394",
"0.6406779",
"0.6275852",
"0.6213419",
"0.6203647",
"0.6106908",
"0.60893244",
"0.6065379",
"0.5988689",
"0.5973042",
"0.5936472",
"0.5927681",
"0.5875577",
"0.5875577",
"0.5875577",
"0.5875577",
"0.5875577",
"0.5875577",
"0.5875577",
"0... | 0.72028995 | 0 |
Gets the current validation_strategy | def _get_validation_strategy(self):
strat = {}
self._validate_validation_strategy()
if self.validation_strategy == "auto":
if self._get_mode() == "Explain":
strat = {
"validation_type": "split",
"train_ratio": 0.75,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_validate(self):\n return self.validate",
"def validator(self):\n return self._validator",
"def paramValidationPref(self):\n # If the level of the object is below the Preference level,\n # recursively call base (super) classes to get preference at specified level\n ... | [
"0.6838031",
"0.6627097",
"0.6515644",
"0.6456136",
"0.6417892",
"0.63516897",
"0.634212",
"0.63212353",
"0.6285395",
"0.6255339",
"0.6221338",
"0.62149113",
"0.6194205",
"0.61286926",
"0.60330224",
"0.60326296",
"0.60178643",
"0.5966911",
"0.5960197",
"0.59587127",
"0.582506... | 0.67801 | 1 |
Gets the current start_random_models | def _get_start_random_models(self):
self._validate_start_random_models()
if self.start_random_models == "auto":
if self._get_mode() == "Explain":
return 1
if self._get_mode() == "Perform":
return 5
if self._get_mode() == "Compete":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exploring_starts(self):\n def random_choice(l): return l[np.random.randint(len(l))]\n return map(random_choice, (self.env.states, self.env.moves))",
"def get_random_start(self):\n arr = np.zeros(self.dimension)\n n_fit_p = len(self.fit_parameters)\n n_nui_p = len(self.nuisance_para... | [
"0.61098045",
"0.5519804",
"0.5495816",
"0.5439313",
"0.5439313",
"0.54216105",
"0.53990346",
"0.53893465",
"0.53497064",
"0.53497064",
"0.5334331",
"0.53277075",
"0.5320885",
"0.5319373",
"0.53144366",
"0.5306886",
"0.52948534",
"0.5272874",
"0.52695197",
"0.5261325",
"0.524... | 0.80309975 | 0 |
Gets the current random_state | def _get_random_state(self):
self._validate_random_state()
return deepcopy(self.random_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand(self):\n return self.State.rand()",
"def getstate(self):\n return (self.baseseed, self.counter, self.randbits_remaining)",
"def rand(self):\n self.state = (self.a * self.state + self.c)\n return self.state",
"def _get_state(self):\n return self.__state",
"def _get_st... | [
"0.8123552",
"0.7858806",
"0.7808915",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"... | 0.8489528 | 0 |
Ensure row data is valid This currently just checks that 2D arrays match the variable components. | def validate_row(row):
subkeys = [INDEP, DEP]
for subkey in subkeys:
for k, v in row[subkey].items():
if v is None:
continue
if np.ndim(v) > 1:
assert np.ndim(v) == 2
if 1 not in np.shape(v):
assert isinstance(k,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_data(self, row, col, value):\n\n return True",
"def check_row(row):\n \n if len(row) != _ncols:\n raise ValueError(\"Row contains {0} columns, expected {1}!\\n\\n{2}\\n\".format(len(row), _ncols, row))",
"def validate(self, row):\n raise NotImplementedError",
"def _val... | [
"0.69890326",
"0.6909129",
"0.6653121",
"0.6620799",
"0.6608853",
"0.6602894",
"0.65480334",
"0.6546582",
"0.65440375",
"0.6527276",
"0.649017",
"0.64542824",
"0.6438385",
"0.6417175",
"0.6406108",
"0.6311875",
"0.6278405",
"0.6260668",
"0.6255064",
"0.6238612",
"0.62377685",... | 0.7375959 | 0 |
Return a generator for entries that all contain keyvalue pairs | def iwhere(self, dct=None, lst=None, **kwargs):
dct = {} if dct is None else dct
m = dct.copy()
m.update(kwargs)
if lst is None:
lst = self
if DEP in lst[0] and INDEP in lst[0]:
filt_dep = True
else:
filt_dep = False
def filt_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterentries(self):\n for key in self.iterkeys():\n yield self.get(key)",
"def iteritems(self):\n return iter((kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all())",
"def exact_key_items(self):\n for key_node, value in self.get_tree_entries():\n for key in s... | [
"0.698165",
"0.693192",
"0.66643286",
"0.665048",
"0.6484602",
"0.6445664",
"0.641337",
"0.6401473",
"0.6376863",
"0.63687515",
"0.63678294",
"0.63492215",
"0.6311998",
"0.6230821",
"0.6206421",
"0.61832714",
"0.6166452",
"0.6166452",
"0.61628634",
"0.6138833",
"0.61117566",
... | 0.0 | -1 |
Return a list of dictionaries that only contain values for keys | def exclusively(self, keys, lst=None):
minimal = self.minimal() if lst is None else lst
def make_exclusive(d, keys):
dct = {}
for k in keys:
if k in d:
dct[k] = d[k]
else:
dct[k] = -999
return dc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_filter(indict, key_list):\n \n return dict((key, value) for key, value in list(indict.items()) if key in key_list)",
"def _filter_keys(item, keys):\n return dict((k, v) for k, v in item.iteritems() if k in keys)",
"def exclude(m, keys):\n return {k: v for k, v in m.items() if k not in keys... | [
"0.7157758",
"0.6764101",
"0.67270654",
"0.6699573",
"0.6676822",
"0.6673541",
"0.6655425",
"0.66365665",
"0.66270673",
"0.6611581",
"0.6571578",
"0.65568775",
"0.6545871",
"0.6436229",
"0.6432588",
"0.6381771",
"0.63771033",
"0.6347461",
"0.63027394",
"0.62880474",
"0.628692... | 0.72772044 | 0 |
Return lists of values grouped by other independent variables | def grouped(self, keys, labels="dict", as_dicts=False):
# TODO: This seems method unnecessarily complex
combined = self.combined()
filtered = self.filtered(keys, lst=combined)
out = {}
for dct in filtered:
d_labels = dct[INDEP].copy()
d = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variable_groups(all_inputs):\n row_length = len(all_inputs[0])\n for single_input in all_inputs[1:]:\n if len(single_input) != row_length:\n raise ValueError(\n \"Please make sure the length is the same if you want to input multiple values when the type of variables i... | [
"0.6295473",
"0.6200967",
"0.57439184",
"0.5688238",
"0.56285703",
"0.55854857",
"0.55849904",
"0.5516372",
"0.5502717",
"0.5489601",
"0.5482229",
"0.5476639",
"0.54517305",
"0.545083",
"0.54401696",
"0.54284453",
"0.5395837",
"0.539547",
"0.53786176",
"0.5318466",
"0.5317963... | 0.0 | -1 |
Construct a heap from a list of elements with priorities. Each element of the list must be in the form (Item, Priority). | def construct_heap(self, elems):
for e in elems:
self.n += 1
self.A.append(e)
self.pos[e[0]] = self.n
for i in range(self.n // 2, 0, -1):
self.combine(i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heap_sort(list):\n pass",
"def build_heap(self, items):\n for key in items:\n self.insert(key)",
"def __init__(self, list = []):\n # initialize empty heap\n self.heap = []\n\n # initialize heap with provided list\n for element in list:\n self.add(... | [
"0.6715845",
"0.6644555",
"0.66232336",
"0.6562983",
"0.6562983",
"0.6440951",
"0.64229244",
"0.64208883",
"0.64108974",
"0.63691944",
"0.6351629",
"0.63361603",
"0.632387",
"0.6306449",
"0.6306449",
"0.62739",
"0.62633675",
"0.62222654",
"0.6173713",
"0.6163355",
"0.61413926... | 0.6710219 | 1 |
Constructs a Octave ResNet26 model. | def pre_act_oct_resnet26(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [2, 2, 2, 2], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet10(shortcut_type, num_classes, in_channels):\n model = ResNet(BasicBlock, [1, 1, 1, 1], shortcut_type, num_classes, in_channels)\n return model",
"def resnet34(shortcut_type, num_classes, in_channels):\n model = ResNet(BasicBlock, [3, 4, 6, 3], shortcut_type, num_classes, in_channels)\n ret... | [
"0.65736985",
"0.6366523",
"0.6366468",
"0.6340577",
"0.6290355",
"0.62448686",
"0.6211965",
"0.62079406",
"0.6202202",
"0.61859906",
"0.617765",
"0.6167639",
"0.6150246",
"0.6131579",
"0.61293316",
"0.6126124",
"0.60872185",
"0.60808474",
"0.60243255",
"0.6022623",
"0.601866... | 0.64773536 | 1 |
Constructs a Octave ResNet50 model. | def pre_act_oct_resnet50(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [3, 4, 6, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def ResNet50_model(input_shape, pooling):\n f... | [
"0.6788361",
"0.67803186",
"0.674441",
"0.6740062",
"0.6740062",
"0.6740062",
"0.6740062",
"0.67154825",
"0.67154825",
"0.6712815",
"0.6572177",
"0.6566482",
"0.6549519",
"0.6523207",
"0.64100075",
"0.6408448",
"0.6368369",
"0.6368369",
"0.6367889",
"0.63454634",
"0.6303097",... | 0.66204983 | 10 |
Constructs a Octave ResNet101 model. | def pre_act_oct_resnet101(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [3, 4, 23, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet101(pretrained=False, **kwargs):\n model = ResNet('resnet101', Bottleneck, [3, 4, 23, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet101']))\n return model",
"def resnet101(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 2... | [
"0.6975478",
"0.6963279",
"0.6944051",
"0.6944051",
"0.6944051",
"0.6944051",
"0.69128805",
"0.68887615",
"0.6869963",
"0.6868124",
"0.68124294",
"0.6709491",
"0.6664259",
"0.6648746",
"0.66283625",
"0.66283625",
"0.65992206",
"0.65794027",
"0.6534455",
"0.6504741",
"0.646747... | 0.6689366 | 12 |
Constructs a Octave ResNet152 model. | def pre_act_oct_resnet152(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [3, 8, 36, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_model(self):\r\n\r\n self.model = ResNet152V2(weights='imagenet')",
"def resnet152(pretrained=False, **kwargs):\n model = ResNet('resnet152', Bottleneck, [3, 8, 36, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))\n return model"... | [
"0.71429336",
"0.71426964",
"0.70883363",
"0.7048324",
"0.70366234",
"0.70190185",
"0.6981999",
"0.6981999",
"0.6981999",
"0.6981999",
"0.6969816",
"0.6943194",
"0.6817958",
"0.67309207",
"0.6713831",
"0.6711944",
"0.6711944",
"0.6689598",
"0.6594432",
"0.65649575",
"0.624270... | 0.6930058 | 12 |
Remove the files written to disk by this class of tests. | def test_cleanup():
os.remove(test_file[:-4] + "_no_grave.h5m") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n for f in os.listdir('/tmp'):\n if not f.startswith(self.FILE_PREFIX):\n continue\n\n os.remove(os.path.join('/tmp', f))",
"def tearDown(self) -> None:\n filtered = [f for f in glob.glob('steps/tests/test_output/*') if not re.match(r'\\.keep... | [
"0.8038646",
"0.80053955",
"0.79976135",
"0.7974729",
"0.7966363",
"0.78566366",
"0.7773938",
"0.7761133",
"0.77407455",
"0.7704826",
"0.76752174",
"0.76329154",
"0.76329154",
"0.76329154",
"0.7632071",
"0.7624899",
"0.761122",
"0.76048136",
"0.7599777",
"0.7578465",
"0.75228... | 0.0 | -1 |
Given a distribution, given by the list p_list, returns the entropy of the distribution. | def entropy(p_list):
assert len(p_list) > 0
E = 0.0
for p in p_list:
if p == 0.0:
continue
E += p*math.log(p)
return E | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(l):\n\n probabilities = np.bincount(l) / len(l)\n with np.errstate(divide='ignore'): # ignore log(0) errors, we'll handle\n log_probabilities = np.log2(probabilities)\n log_probabilities[~np.isfinite(log_probabilities)] = 0\n return -np.sum(probabilities * log_probabilities)",
... | [
"0.75446194",
"0.73901826",
"0.7331276",
"0.7134225",
"0.70520824",
"0.7050444",
"0.69640076",
"0.6912087",
"0.68127155",
"0.68039405",
"0.6800982",
"0.6751854",
"0.6749378",
"0.6710503",
"0.6699265",
"0.6682273",
"0.6634976",
"0.6633226",
"0.6585759",
"0.6569177",
"0.6564183... | 0.83441865 | 0 |
Computes counts for ALL compatible predictions for the given entry, taking missing values into account. counts is assumed to be a defaultdict(int) instance | def predict_all(self,entry,counts):
if self.type == 'v':
counts[self.value] += 1
return
v = entry[self.feature]
if v is None:
for val,c in self.children.iteritems():
c.predict_all(entry,counts)
return
if self.type == 's':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def none_count(d):\n return six.moves.reduce(lambda x, y: x + 1 if y == None else x, d.values(), 0)",
"def _collect_counts(self, instance_list):\n \"\"\" Based on each instance, I augment empirical counts for every word and its BIO label in feature_count_table and for every transition from previous lab... | [
"0.627431",
"0.6079571",
"0.5920963",
"0.5891744",
"0.5813785",
"0.5808457",
"0.57633555",
"0.5717828",
"0.5693999",
"0.5685904",
"0.5680773",
"0.5613226",
"0.55953914",
"0.5592989",
"0.5554436",
"0.5554436",
"0.5554436",
"0.5552211",
"0.5529736",
"0.55194706",
"0.55182385",
... | 0.5712293 | 8 |
Return shape of data i.e. image size. | def _get_image_size(self):
return (3, 224, 224) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_shape(self):\n return self.data.shape[:2]",
"def image_shape(self):\n return self.data.shape[:2]",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n return self.data.shape",
"def shape(self):\n ... | [
"0.82124084",
"0.82124084",
"0.8147183",
"0.8147183",
"0.8147183",
"0.8147183",
"0.8147183",
"0.80937505",
"0.8010233",
"0.8006064",
"0.8006064",
"0.8006064",
"0.80019945",
"0.79247403",
"0.79092556",
"0.78679425",
"0.786282",
"0.7814866",
"0.7725889",
"0.76113486",
"0.75898"... | 0.0 | -1 |
Returns mean of the entire dataset. | def _get_mean(self):
return (0.485, 0.456, 0.406) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\r\n return np.mean(self.data_array)",
"def mean(self):\n return self.data.mean(axis=-1, keepdims=True)",
"def mean(self):\n return self.aggregate(np.mean)",
"def Mean(data):\n return data.mean()",
"def mean(self):\n mean = sum(self.data)/self.size\n ret... | [
"0.82411206",
"0.8131355",
"0.8031648",
"0.8015793",
"0.79474837",
"0.7917345",
"0.7879034",
"0.78769094",
"0.7875092",
"0.78153133",
"0.76866186",
"0.767841",
"0.7648848",
"0.7648848",
"0.75604665",
"0.7517856",
"0.74952906",
"0.7446794",
"0.7446794",
"0.7446794",
"0.7443946... | 0.0 | -1 |
Get the selected locale from user settings. | def get_locale():
setting = Setting.query.filter(Setting.name == 'default_language').first()
if setting is not None:
return setting.value
# Return default language when none found
return 'en' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_locale():\n localLang = request.args.get('locale')\n supportLang = app.config['LANGUAGES']\n if localLang in supportLang:\n return localLang\n userId = request.args.get('login_as')\n if userId:\n localLang = users[int(userId)]['locale']\n if localLang in supportLang:\n ... | [
"0.7412174",
"0.7108176",
"0.69538045",
"0.69421023",
"0.68359756",
"0.67491263",
"0.67384523",
"0.6731309",
"0.650032",
"0.63808835",
"0.6361166",
"0.63441944",
"0.63441944",
"0.6340159",
"0.62725174",
"0.61259097",
"0.6097418",
"0.6096102",
"0.60663605",
"0.60374147",
"0.60... | 0.73380387 | 1 |
Whether or not this is a hardened node. Hardened nodes are those with indices >= 0x80000000. | def hardened(self):
# A hardened key is a key with index >= 2 ** 31, so
# we check that the MSB of a uint32 is set.
return self.index & 0x80000000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_leaf(self):\r\n return self.zero_son is None and self.one_son is None",
"def is_internal(self):\n if self.is_leaf() or self.is_semileaf():\n return False\n return True",
"def node_inode(self):\n return False",
"def node_inode(self):\n return False",
"d... | [
"0.62713253",
"0.60492986",
"0.5942298",
"0.5942298",
"0.5901078",
"0.57642645",
"0.5762194",
"0.5736317",
"0.57134473",
"0.5682844",
"0.5674507",
"0.5665041",
"0.56444204",
"0.5642746",
"0.56300306",
"0.55741334",
"0.55603236",
"0.55570173",
"0.55541235",
"0.5552279",
"0.552... | 0.68602026 | 0 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
access_token = dictionary.get('accessToken')
token_type = dictionary.get('tokenType')
error = cohesity_app_sdk.models.error.Error.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.8317533",
"0.81689686",
"0.81689686",
"0.81188685",
"0.808892",
"0.7977596",
"0.7949056",
"0.79225504",
"0.78983366",
"0.7893884",
"0.7887517",
"0.7882494",
"0.7881197",
"0.7876339",
"0.78581846",
"0.78387725",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.780... | 0.7370376 | 100 |
returns the l2 penalty on (trainable) network parameters combined as tensor product. | def get_prod_penalty(nnet):
assert Cfg.ocsvm_loss is True
penalty = 0
layers = nnet.trainable_layers
num_layers = len(layers) - 1 # do not regularize parameters of oc-svm layer
assert num_layers > 0
W_norm_prod = 1.0
if layers[num_layers-1].b is not None:
penalty += T.sum(layers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_l2_reg(self) -> torch.Tensor:\n loss = 0\n for param in self.model.parameters():\n loss += (param ** 2).sum()\n return loss",
"def l2_regularization_penalty(self):\n return self.l2 * (np.linalg.norm(self.weights)**2)",
"def l2_training_penalty(batched_out: base.O... | [
"0.7459851",
"0.73080754",
"0.71070445",
"0.7071918",
"0.6722846",
"0.6637411",
"0.66100603",
"0.6606142",
"0.65346557",
"0.64298236",
"0.64298236",
"0.64298236",
"0.64195216",
"0.6411184",
"0.6407858",
"0.6394501",
"0.63773257",
"0.634488",
"0.63392335",
"0.6293014",
"0.6180... | 0.66554886 | 5 |
Return a 404 error when someone tries to call the URL. | def bad_callback(_request, _uri, headers):
return (404, headers, 'NOT AN ASSERTION') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def not_found():\n raise cherrypy.HTTPError(404, \"Not Found.\")",
"def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry... | [
"0.77854127",
"0.7611726",
"0.7589559",
"0.7564481",
"0.7564481",
"0.7564481",
"0.7564481",
"0.7564481",
"0.7564481",
"0.7564481",
"0.7528948",
"0.7528948",
"0.7528948",
"0.7528948",
"0.7528948",
"0.7528948",
"0.7528948",
"0.7528948",
"0.74066204",
"0.73611426",
"0.73296165",... | 0.0 | -1 |
Mock an error response when calling the OData API for user details. | def _mock_odata_api_for_error(self, odata_api_root_url, username):
def callback(request, uri, headers): # lint-amnesty, pylint: disable=unused-argument
"""
Return a 500 error when someone tries to call the URL.
"""
headers['CorrelationId'] = 'aefd38b7-c92c-445a-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_response_error(self):\n r = mock.Mock(spec=requests.Response)\n r.content = \"{'normal': 'resource'}\"\n\n f = Fitbit(**self.client_kwargs)\n f.client._request = lambda *args, **kwargs: r\n\n r.status_code = 404\n self.assertRaises(exceptions.HTTPNotFound, f.user_... | [
"0.68724155",
"0.6683057",
"0.6637301",
"0.6578398",
"0.6559852",
"0.6474468",
"0.6464813",
"0.6425861",
"0.638332",
"0.63573205",
"0.6336519",
"0.6328632",
"0.63244635",
"0.62987155",
"0.6267484",
"0.62195075",
"0.61980534",
"0.6191649",
"0.61694646",
"0.614538",
"0.61373806... | 0.73752326 | 0 |
Generate all possible pairs from the list of given elements. | def all_pairs(elements):
if len(elements) < 2:
return []
elif len(elements) == 2:
return [(elements[0], elements[1])]
else:
new_pairs = []
for elt in elements[1:]:
new_pairs.append((elements[0], elt))
return all_pairs(elements[1:]) + new_pairs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]",
"def all_pairs(items, sort=False):\n if sort:\n items = sorted(items)\n for i, ni in enumerate(items):\n for j, nj in enumerate(items):\n if j > i: yield ni, nj",
"def __unordered_pairs(l):\n\n ... | [
"0.7500274",
"0.6851043",
"0.6840614",
"0.68141717",
"0.6754132",
"0.669949",
"0.6683781",
"0.6671177",
"0.6668704",
"0.65523124",
"0.64457446",
"0.64399433",
"0.6394851",
"0.636628",
"0.6352524",
"0.6351291",
"0.6324047",
"0.6315178",
"0.6308765",
"0.63008136",
"0.62359875",... | 0.8119166 | 0 |
dataset_name should be 'train' or 'test' | def produce_and_cache_small_dataset_dict(dataset_name,
n=500000,
meter_types=const.METER_MAP.values()):
small_dataset_cache_file = pathlib.Path(dataset_name + '_small_store_joined.h5')
if small_dataset_cache_file.exists():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(dataset_name):\n dataset_as_lower = dataset_name.lower()\n if dataset_as_lower in _datasets_from_keras.keys():\n data_details = _datasets_from_keras[dataset_as_lower]\n (x_train, y_train), (x_test, y_test) = data_details['data'].load_data()\n else:\n raise IOError(\... | [
"0.7228631",
"0.70241654",
"0.70175004",
"0.70087993",
"0.6977617",
"0.6900802",
"0.68130064",
"0.6774054",
"0.67727417",
"0.67533123",
"0.673811",
"0.67380196",
"0.6732079",
"0.6708",
"0.6619651",
"0.6580174",
"0.65409255",
"0.6507022",
"0.6495979",
"0.6469288",
"0.64399636"... | 0.0 | -1 |
A cumulative metric is one that needs a prior value to calculate the next value. i.e. only the deltas for the current observed values are reported. A noncumulative metric is one where the absolute observed value is reported every time. | def is_cumulative(self):
return self.name in (
"app.cpu",
"app.uptime",
"app.disk.bytes",
"app.disk.requests",
"app.mem.majflt",
"app.io.wait",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_returns(self):\n return (1 + self.pct_change).cumprod()",
"def get_cumulative_model(self):\n cm = None\n for ac in self.ac:\n if ac[0] is None:\n continue\n m = self.get_model(last=False, a=ac[0], c=ac[1])\n cm = m if cm is None ... | [
"0.6869948",
"0.67523324",
"0.64255375",
"0.6341759",
"0.63019013",
"0.6291231",
"0.62111056",
"0.6121284",
"0.61202884",
"0.60518414",
"0.6049944",
"0.60443413",
"0.59521824",
"0.5944532",
"0.594417",
"0.5942714",
"0.5922843",
"0.5915984",
"0.58872694",
"0.58869976",
"0.5872... | 0.5677045 | 30 |
Closes any files held open by this reader. | def close(self):
try:
self._failed = True
if self._file is not None:
self._file.close()
self._failed = False
finally:
self._file = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close( self ):\n \n for file in self._files:\n ir.file_hub.close( file )",
"def close_all_files(self):\r\n while self.close_file():\r\n pass",
"def close(self):\n if self.current_file_number is not None:\n self.fh_raw.close()\n self.cu... | [
"0.7826722",
"0.77460366",
"0.7503366",
"0.72826236",
"0.72478783",
"0.7243321",
"0.7204818",
"0.7204593",
"0.7146203",
"0.7134031",
"0.7112463",
"0.71020526",
"0.70459485",
"0.7036263",
"0.70164305",
"0.7010969",
"0.6980717",
"0.6947164",
"0.6919161",
"0.68919945",
"0.688708... | 0.6589813 | 53 |
Returns true if the current process is still running. | def __is_running(pid):
try:
# signal flag 0 does not actually try to kill the process but does an error
# check that is useful to see if a process is still running.
os.kill(pid, 0)
return True
except OSError as e:
# Errno #3 corresponds to the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_running(self):\r\n if self._gone:\r\n return False\r\n try:\r\n # Checking if pid is alive is not enough as the pid might\r\n # have been reused by another process.\r\n # pid + creation time, on the other hand, is supposed to\r\n # identif... | [
"0.8082826",
"0.8080181",
"0.8026835",
"0.8013894",
"0.8012157",
"0.7952827",
"0.78069186",
"0.77576995",
"0.7746866",
"0.77379435",
"0.7681154",
"0.76794994",
"0.7676883",
"0.76404685",
"0.7629628",
"0.76252586",
"0.75991505",
"0.7584161",
"0.75792927",
"0.75562996",
"0.7544... | 0.7129584 | 59 |
YOLOV3 network hybrid forward. | def hybrid_forward(self, F, x, *args):
all_box_centers = []
all_box_scales = []
all_objectness = []
all_class_pred = []
all_anchors = []
all_offsets = []
all_feat_maps = []
all_detections = []
routes = []
for stage, block, output ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n for name, module in self.base._modules.items():\n if name == 'avgpool':\n break\n\n if name == 'layer3':\n l2 = Variable(x)\n\n x = Variable(module(x))\n l4 = Variable(x)\n\n \"\"\"for name, param in sel... | [
"0.65314513",
"0.6292418",
"0.6263829",
"0.6261159",
"0.62541807",
"0.6251553",
"0.6219152",
"0.62162906",
"0.61927277",
"0.6178997",
"0.6141839",
"0.6136382",
"0.6127676",
"0.6119838",
"0.6111306",
"0.61022437",
"0.6099669",
"0.60930973",
"0.60845137",
"0.60679704",
"0.60615... | 0.7524717 | 0 |
Reset class categories and class predictors. | def reset_class(self, classes):
self._clear_cached_op()
self._classes = classes
if self._pos_iou_thresh >= 1:
self._target_generator = YOLOV3TargetMerger(len(classes), self._ignore_iou_thresh)
for outputs in self.yolo_outputs:
outputs.reset_class(classes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.pred_classes.clear()\n self.gold_classes.clear()\n self.pred_probas.clear()\n self.gold_probas.clear()\n self.loss = 0\n self.nb_batches = 0\n self.prec_rec_f1 = None\n self.acc = None\n self.mcc = None",
"def reset(self):\n ... | [
"0.72172534",
"0.6899433",
"0.6748963",
"0.6726632",
"0.66773576",
"0.6629043",
"0.6529936",
"0.6484326",
"0.6478405",
"0.6478405",
"0.6471619",
"0.6466328",
"0.6457058",
"0.62709737",
"0.6202787",
"0.61770207",
"0.6149169",
"0.612528",
"0.60959744",
"0.6091237",
"0.6087531",... | 0.70744306 | 1 |
Generate a test environment using the given dataset. The settings are temporarily overwritten to use the test data. | def generate_test_environment(tmpdir, dataset):
# Overwrite settings with test settings
generate_test_settings(tmpdir, dataset)
# Generate the archive files
for usage in ['train', 'test']:
for dstype in ['images', 'labels']:
dataset_type = usage + '.' + dstype... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_environment(dataset, tmpdir):\n\n print(\">>> Test environment:\")\n print(\"dataset:\", dataset)\n print(\"tmpdir:\", tmpdir)\n\n generate_test_environment(tmpdir, dataset)\n\n return { 'dataset': dataset, 'tmpdir': tmpdir }",
"def test_generate_test_environment(dataset):\n\n prin... | [
"0.7599391",
"0.72667193",
"0.69813424",
"0.66441184",
"0.64025056",
"0.6268748",
"0.625678",
"0.6244715",
"0.61173195",
"0.60907793",
"0.60787404",
"0.60093623",
"0.5926749",
"0.5911557",
"0.5894079",
"0.58914727",
"0.58914727",
"0.58914727",
"0.58914727",
"0.58877015",
"0.5... | 0.7804764 | 0 |
Extracts (typically) overlapping regular patches from a grayscale image Changing the offset and stride parameters will result in images reconstructed by reconstruct_from_grayscale_patches having different dimensions! Callers should pad and unpad as necessary! | def extract_grayscale_patches( img, shape, offset=(0,0), stride=(1,1) ):
px, py = np.meshgrid( np.arange(shape[1]),np.arange(shape[0]))
l, t = np.meshgrid(
np.arange(offset[1],img.shape[1]-shape[1]+1,stride[1]),
np.arange(offset[0],img.shape[0]-shape[0]+1,stride[0]) )
l = l.ravel()
t = t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_patches_and_positions_from_image(\n image, patch_size, patch_stride, hse_grid_size,\n n_crops, h, w,\n c, scale_id, max_seq_len):\n p = tf.image.extract_patches(\n image, [1, patch_size, patch_size, 1], [1, patch_stride, patch_stride, 1],\n [1, 1, 1, 1],\n padding='SAME')\n\n ... | [
"0.69615763",
"0.6910621",
"0.6902872",
"0.6756077",
"0.6684931",
"0.6669656",
"0.66367173",
"0.66181797",
"0.6613878",
"0.6597331",
"0.65837264",
"0.65633184",
"0.65623057",
"0.652115",
"0.6456871",
"0.6398756",
"0.6369198",
"0.6359843",
"0.63577175",
"0.6351932",
"0.6345157... | 0.7973168 | 0 |
Get the surname of person | def surname(self):
return self._surname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surname(self):\n return self.__surname",
"def surname(self):\n if \"surname\" in self._prop_dict:\n return self._prop_dict[\"surname\"]\n else:\n return None",
"def surname(self):\n if \"surname\" in self._prop_dict:\n return self._prop_dict[\"su... | [
"0.84594584",
"0.8456766",
"0.8456766",
"0.7657546",
"0.75671947",
"0.7503995",
"0.71551466",
"0.7144786",
"0.6926863",
"0.68105274",
"0.67284966",
"0.66660845",
"0.6651198",
"0.6651198",
"0.6651198",
"0.6651198",
"0.6651198",
"0.66335547",
"0.6632711",
"0.65882415",
"0.65831... | 0.8435841 | 4 |
Returns the number of cluster a clustering has. | def analysis_function_num_clusters(self,clustering):
return len(clustering.clusters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())",
"def cluster_count(self) -> int:\n cluster_count = max(1, round(16**3 * (self.vein.purity / 100.0) / self.cluster_size))\n return self.distribution.scale_cluster_count(cluster_count)",
"def n_clusters(self):\n ... | [
"0.8762908",
"0.84918106",
"0.80784905",
"0.77352",
"0.71900326",
"0.7170602",
"0.7130262",
"0.70022637",
"0.6933635",
"0.68955094",
"0.6862841",
"0.6851633",
"0.68233424",
"0.68233424",
"0.6755365",
"0.6752718",
"0.66931707",
"0.66912186",
"0.6680638",
"0.66151196",
"0.66151... | 0.81173706 | 2 |
Returns the number of elements that are clusterized in this clustering (which may not be the total number of elements of the dataset if there were noisy elements) | def analysis_function_total_elements(self,clustering):
return clustering.total_number_of_elements | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_clusters(self):\n return len(self.clusters)",
"def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())",
"def count_elements_in_dataset(dataset):\n return dataset.count()",
"def cluster_count(self) -> int:\n cluster_count = max(1, round(16**3 * (self.vein.pu... | [
"0.7475261",
"0.73660713",
"0.7281601",
"0.7209829",
"0.7184535",
"0.71797055",
"0.71275187",
"0.7005667",
"0.6999668",
"0.69551873",
"0.68624055",
"0.68511283",
"0.67983764",
"0.6792057",
"0.6780994",
"0.6774845",
"0.6771099",
"0.66886616",
"0.66632557",
"0.66320395",
"0.661... | 0.74841356 | 0 |
Padding function for 1D sequences | def __pad__(sequence, max_l):
if max_l - len(sequence) < 0:
sequence = sequence[:max_l]
else:
sequence = np.pad(sequence, (0, max_l - (len(sequence))), 'constant', constant_values=(0))
return sequence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(seq, n):\n return",
"def pad_sequence(xs, length=None, padding=0):\n return PadSequence(length, padding).apply((xs))[0]",
"def pad_sequence(seq):\n seq_split = seq.strip().split(\"1\")\n last = seq_split[0]\n new_seq = last + \"1\"\n inc_added = 0\n out_added = 0\n for i in rang... | [
"0.77374345",
"0.76362944",
"0.737829",
"0.7223377",
"0.7206336",
"0.7144797",
"0.710272",
"0.70930755",
"0.70851046",
"0.705326",
"0.7034367",
"0.700346",
"0.6976378",
"0.6973453",
"0.69480914",
"0.6854283",
"0.68475085",
"0.6833989",
"0.6814044",
"0.6806954",
"0.67819375",
... | 0.6773792 | 22 |
Get BERT embeddings from a dataloader generator. | def _get_bert_embeddings(data_generator, embedding_model: torch.nn.Module, metadata: False):
use_cuda = torch.cuda.is_available()
device = torch.device("cuda:0" if use_cuda else "cpu")
with torch.set_grad_enabled(False):
embeddings = {'ids': [],
'embeddings': [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embeddings(model, loader, device=torch.device('cpu')):\n embeddings = []\n labels = []\n for item in loader:\n data, label = item\n data = data.view(-1, 1, data.shape[-1])\n data = data.to(device)\n label = label.to(device)\n output = model(data).squeeze(1)\n\n ... | [
"0.6092691",
"0.60436624",
"0.60151154",
"0.59234816",
"0.59059787",
"0.5782936",
"0.5690828",
"0.5666181",
"0.5597089",
"0.5583591",
"0.5570702",
"0.55484855",
"0.55165946",
"0.5495378",
"0.5463972",
"0.5451432",
"0.54469055",
"0.54453945",
"0.5405851",
"0.54010916",
"0.5367... | 0.73473763 | 0 |
Justified (name, value, units, doc) strings for active parameters. | def param_strs(self):
name_len = max(len(p.name) for p in self)
value_len = max(len(p.value_str) for p in self.params.values())
units_len = max(len(p.units) for p in self.params.values())
return [(p.name.ljust(name_len), p.value_str.ljust(value_len),
p.units.ljust(units_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n num_active = len([p for p in self if p])\n summary = \"%s has %d parameters with %d active (non-default)\" % \\\n (self.__class__.__name__, len(self), num_active)\n if num_active == 0:\n return summary\n return summary + ':\\n' + '\\n'.jo... | [
"0.7582478",
"0.6667753",
"0.65951604",
"0.6493384",
"0.64455795",
"0.64114326",
"0.63715106",
"0.62896985",
"0.6242153",
"0.62383384",
"0.62208116",
"0.62207097",
"0.61746264",
"0.6109571",
"0.61072844",
"0.6098375",
"0.60816747",
"0.6051815",
"0.6050969",
"0.60330296",
"0.6... | 0.7280672 | 1 |
Short humanfriendly string representation of model object. | def __repr__(self):
num_active = len([p for p in self if p])
return "<katpoint.%s active_params=%d/%d at 0x%x>" % \
(self.__class__.__name__, num_active, len(self), id(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n return super().__str__() + self.model.__str__()",... | [
"0.8028083",
"0.8028083",
"0.79938656",
"0.7976418",
"0.7948468",
"0.77171636",
"0.7662623",
"0.76042145",
"0.7593325",
"0.7579472",
"0.7536077",
"0.7449067",
"0.74469894",
"0.74191",
"0.7378081",
"0.7339475",
"0.73324215",
"0.7328719",
"0.7328719",
"0.730302",
"0.72758746",
... | 0.0 | -1 |
Inequality comparison operator (parameter values only). | def __ne__(self, other):
return not (self == other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, values):\n self = self.__eq__(values)\n return self.__invert__()",
"def __ne__(self, rhs):\n return not self.__eq__(rhs)",
"def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)",
"def __neq__(self, other): \n return not self == other",
"def test... | [
"0.72408104",
"0.71416056",
"0.69568586",
"0.6941666",
"0.68447745",
"0.6843122",
"0.6838853",
"0.68197155",
"0.6807232",
"0.679406",
"0.6777357",
"0.673857",
"0.673857",
"0.673857",
"0.673857",
"0.6725665",
"0.6725112",
"0.6718812",
"0.67053616",
"0.6701271",
"0.66915655",
... | 0.0 | -1 |
Extract input numbers from given string, | def get_input_from_string(str_input):
from string import split
res = []
list_input = split(str_input)
for i in xrange(len(list_input)):
res.append(float(list_input[i]))
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ExtractNumbers(s):\n\n t = s.strip('[]\\n')\n comma_space = r', '\n re_comma_space = re.compile(comma_space)\n z = re_comma_space.split(t)\n #print z\n return z",
"def extract_nums(string):\r\n num_list = []\r\n mods1 = string.replace('$', '')\r\n mods2 = mods1.replace('K', '')\r\n... | [
"0.7238783",
"0.7173874",
"0.7057713",
"0.68924135",
"0.68546575",
"0.67531013",
"0.67403173",
"0.6647867",
"0.657946",
"0.6577491",
"0.65233153",
"0.65192056",
"0.6391088",
"0.638495",
"0.6383692",
"0.6383132",
"0.6349406",
"0.6332319",
"0.6319145",
"0.6285752",
"0.6280346",... | 0.67156774 | 7 |
Create a centered Gaussian image having standard deviation "sigma". | def model_gauss(xsigma, nx, ny=1, nz=1, ysigma=None, zsigma=None, xcenter=None, ycenter=None, zcenter=None):
e = EMData()
e.set_size(nx, ny, nz)
if( ysigma == None ) : ysigma = xsigma
if( zsigma == None ) : zsigma = xsigma
if( xcenter == None ) : xcenter = nx//2
if( ycenter == None ) : ycenter = ny//2
if( zcen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_gaussian(size, sigma=10, center=None):\n\n x = np.arange(0, size[1], 1, float)\n y = np.arange(0, size[0], 1, float)\n y = y[:, np.newaxis]\n\n if center is None:\n x0 = y0 = size[0] // 2\n else:\n x0 = center[0]\n y0 = center[1]\n\n return np.exp(-4 * np.log(2) * ((... | [
"0.7622218",
"0.76156443",
"0.73544854",
"0.71752834",
"0.69022816",
"0.68148255",
"0.67936516",
"0.6789439",
"0.6705065",
"0.66758764",
"0.6667239",
"0.66651136",
"0.6639735",
"0.65926224",
"0.65801823",
"0.6565116",
"0.65491575",
"0.6542619",
"0.6531326",
"0.6530046",
"0.65... | 0.6426071 | 29 |
retrieve 3D alignment parameters from the header phi theta psi tx ty tz mirror scale | def get_params3D(ima, xform = "xform.align3d"):
t = ima.get_attr(xform)
d = t.get_params("spider")
return d["phi"],d["theta"],d["psi"],d["tx"],d["ty"],d["tz"],d["mirror"],d["scale"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params_3D_2D(phi, theta, psi, s2x, s2y):\n\tif theta > 90.0:\n\t\tmirror = 1\n\t\talpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 540.0-psi, 0, 0, 1.0)\n\telse:\n\t\tmirror = 0\n\t\talpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 360.0-psi, 0, 0, 1.0)\n\treturn alpha, sx, sy, mirror"... | [
"0.6369768",
"0.63076174",
"0.57975394",
"0.5729281",
"0.5533436",
"0.551851",
"0.5500369",
"0.5439547",
"0.5422399",
"0.54033196",
"0.5388639",
"0.5361121",
"0.53491545",
"0.53419423",
"0.531873",
"0.53108954",
"0.53095436",
"0.53085315",
"0.5303664",
"0.5303664",
"0.5302264... | 0.7157893 | 0 |
Write JSON in a consistent, humanreadable way. | def json_dumps(o: Any) -> bytes:
return json.dumps(
o, indent=4, sort_keys=True, ensure_ascii=True, separators=(",", ": "), cls=NumberEncoder
).encode("ascii") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self):\n self.json_o.write()",
"def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n encoding='utf-8', sort_keys=False)",
"def write(self, _filepath=None):\n if _filepath is None:... | [
"0.73995405",
"0.73701173",
"0.7319848",
"0.7299197",
"0.7268811",
"0.71151686",
"0.7094368",
"0.6901286",
"0.6872474",
"0.6859761",
"0.68393916",
"0.67960197",
"0.67669374",
"0.6747494",
"0.6735324",
"0.67135006",
"0.6681034",
"0.6619973",
"0.66117257",
"0.66088766",
"0.6588... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm,classes,normalize=False,title='Confusion Matrix', cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
cm=np.around(cm,decimals=2)
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81925154",
"0.8093376",
"0.8027219",
"0.80169857",
"0.7991475",
"0.7988959",
"0.79785",
"0.7973596",
"0.7959107",
"0.7956459",
"0.793519",
"0.79322356",
"0.79320693",
"0.79289055",
"0.79240024",
"0.79221827",
"0.792161",
"0.79209834",
"0.7920566",
"0.7919846",
"0.791543",
... | 0.0 | -1 |
Read and preprocess an image with data augmentation (random transform). | def read_for_training(p, augmentation=False):
img = imread(TRAIN + p, mode='RGB')
msk = img
if mode == 'background':
data = {'image': img}
elif mode == 'instance' or mode == 'code':
msk = imread(TRAIN_MASK + p.replace('.jpg', '.png'))
data = {'image': img, 'mask': msk}
if a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self, img):\n img_ = image.load_img(img, target_size=(299, 299))\n img_ = image.img_to_array(img_)\n img_ = np.expand_dims(img_, axis=0)\n img_ = preprocess_input(img_)\n return img_",
"def data_augmentation(image, aug):\n if (aug == \"random_crop\") and (rand... | [
"0.6944267",
"0.6885695",
"0.6801366",
"0.6746409",
"0.6730426",
"0.6700084",
"0.6674317",
"0.6642256",
"0.6604827",
"0.65799797",
"0.65796673",
"0.6575271",
"0.6572347",
"0.6542871",
"0.6535678",
"0.6521868",
"0.64719284",
"0.64391285",
"0.6430673",
"0.6425564",
"0.6418553",... | 0.70998 | 0 |
This function extract the squared l2 norm from the inner product matrix. | def l2_square_from_inner_product(matrix):
return np.diag(matrix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_product_to_normalized_L2_square(matrix):\n\n length = matrix.shape[0]\n norm = np.divide(1, np.sqrt(l2_square_from_inner_product(matrix)))\n\n normalized_inner_product = np.multiply(np.multiply(np.reshape(norm, [length, 1]), matrix),\n np.reshape(norm, [... | [
"0.8038655",
"0.79935986",
"0.7481027",
"0.7333756",
"0.71862626",
"0.7168722",
"0.71422154",
"0.71272767",
"0.7005889",
"0.6986283",
"0.6936558",
"0.689807",
"0.6859919",
"0.68299115",
"0.6818152",
"0.678622",
"0.67799747",
"0.6730021",
"0.67066455",
"0.6701476",
"0.6701306"... | 0.7382337 | 3 |
Function to modify the homepage | def modify_homepage():
this_dir = os.path.dirname(__file__)
home_file = app.config['HOME_PAGE_FOLDER'] + 'homepage.html'
value = ""
if request.form.get("newHome"):
value = request.form.get("newHome")
if not os.path.isdir(os.path.join(this_dir, app.config['HOME_PAGE_FOLDER'])):
os.mk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n\n return render_template('rosemead_homepage.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def a_homepage():\n\n\tret... | [
"0.7403166",
"0.7383433",
"0.7320676",
"0.730273",
"0.722838",
"0.722588",
"0.7190989",
"0.71861947",
"0.7157216",
"0.7157216",
"0.71296996",
"0.71152425",
"0.7102618",
"0.7062718",
"0.7043081",
"0.6962566",
"0.69548315",
"0.6911093",
"0.69107646",
"0.6907873",
"0.6875526",
... | 0.0 | -1 |
Test base.py GSObjects for notequals. | def test_ne():
# Define some universal gsps
gsp = galsim.GSParams(maxk_threshold=1.1e-3, folding_threshold=5.1e-3)
# Pixel. Params include scale, flux, gsparams.
# gsparams.
# The following should all test unequal:
gals = [galsim.Pixel(scale=1.0),
galsim.Pixel(scale=1.1),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n self.assertFalse(a != b)\n self.assertFalse(b != a)",
"def test_not_equal_on_not_equal_value(self):\n a =... | [
"0.74571276",
"0.73648274",
"0.73306084",
"0.72958326",
"0.7260039",
"0.72194594",
"0.7127766",
"0.70569617",
"0.7055979",
"0.7028425",
"0.70240885",
"0.7012719",
"0.6914279",
"0.68538886",
"0.68433744",
"0.6823976",
"0.6806015",
"0.6802378",
"0.6794009",
"0.675546",
"0.67511... | 0.0 | -1 |
Function that returns true if a string contains a number | def hasNumbers(inputString):
return any(char.isdigit() for char in inputString) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))",
"def has_number(any_string):\n return any(char.isdigit() for char in any_string)",
"def has_num(text):\n return any(str.isdigit(c) for c in text)",
"def is_number(s):\r\n try:\r\n int(s)\r\n ... | [
"0.86861813",
"0.83668447",
"0.82383734",
"0.7930955",
"0.79304606",
"0.7924505",
"0.78930366",
"0.78647584",
"0.77653086",
"0.7743263",
"0.7714202",
"0.7706238",
"0.77058214",
"0.77046204",
"0.77044505",
"0.7690902",
"0.766317",
"0.7639565",
"0.7527607",
"0.7527464",
"0.7508... | 0.8393111 | 1 |
Small function to change time format. Used for make_time func | def tedoius_time(time_string):
start = ['start', 'begin', 'beginning', 'head', 'first']
end = ['slut', 'end', 'tail', 'finish',
'finito', 'fin', 'done', 'finished']
if time_string.lower() in start:
time_string = "00:00:00"
# We need this exact string for later
elif time_string.lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def time_hack(self):\n now = datetime.datetime.now()\n monthnames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun',\n 'jul', 'aug', 'sep', 'oct', ... | [
"0.7315664",
"0.72966367",
"0.7183788",
"0.7177541",
"0.71764636",
"0.7169046",
"0.7167851",
"0.7160244",
"0.7139336",
"0.7091297",
"0.7036572",
"0.70216924",
"0.6875871",
"0.6864549",
"0.6824766",
"0.6812519",
"0.68091184",
"0.680905",
"0.68039894",
"0.67950267",
"0.6790418"... | 0.0 | -1 |
computes the sigmoid of z z z can be a matrix, vector or scalar sigmoid | def sigmoid(z):
g = np.zeros(z.shape)
# ====================== YOUR CODE HERE ======================
# Instructions: Compute the sigmoid of each value of z (z can be a matrix,
# vector or scalar).
return 1/(1+np.exp(-z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def sigmoid(z): \n return 1/(1 + np.e**(-z))",
"def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))",
"def sigmoid(z):\n\treturn 1.0/(1.0+np.exp(-z))",
"def sigmoid(z):\n return 1 / (1 + np.exp(-1 * z))",
"def sigmoid(z):\n\n s = 1... | [
"0.9156451",
"0.89855045",
"0.89530945",
"0.88890535",
"0.88774705",
"0.8873134",
"0.88591874",
"0.88549364",
"0.8827887",
"0.88264954",
"0.88236195",
"0.8823586",
"0.8804889",
"0.8797912",
"0.87720233",
"0.8767488",
"0.87623954",
"0.87474865",
"0.8720549",
"0.8660843",
"0.86... | 0.8674715 | 19 |
recourse through an attribute chain to get the ultimate value. | def safe_chain_getattr(obj, attr):
return reduce(getattr, attr.split('.'), obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self):\n nextattr = self.iterobj.next()\n return (nextattr.name, self.attrs[nextattr.name])",
"def _get_effective_attribute(self, attribute_name):\n result = []\n tmp = self[attribute_name]\n if tmp != None:\n result.append( tmp )\n if tmp == None or ... | [
"0.594284",
"0.59209895",
"0.5796574",
"0.54958975",
"0.54589653",
"0.54450005",
"0.5416079",
"0.53792626",
"0.5287629",
"0.52547",
"0.5249592",
"0.5235394",
"0.5232",
"0.522848",
"0.52224046",
"0.520934",
"0.52058285",
"0.51851255",
"0.51851255",
"0.51851255",
"0.51851255",
... | 0.5363558 | 8 |
Find all prime numbers between 0 and n | def get_primes(n):
primes = [True] * (n / 2)
for i in range(int((n / 2 - 1) / 2) >> 1):
for j in range((i * (i + 3) << 1) + 3, n / 2, (i << 1) + 3):
primes[j] = False
return [2] + [((i << 1) + 3) for i in range(n / 2) if (primes[i])] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]",
"def find_n_primes(n):\n primes = [ ]\n\n if n < 2:\n return None;\n\n primes.append(2)\n\n for i in range(3, n + 1, 2):\n is_prime = True\n for p in primes:\n if i % p is 0:\n is_prime = False\n continue\n ... | [
"0.8414769",
"0.8174812",
"0.8154782",
"0.8066897",
"0.79940116",
"0.7972602",
"0.7941718",
"0.79004717",
"0.78921247",
"0.7884613",
"0.786188",
"0.786017",
"0.7860028",
"0.78575575",
"0.78575575",
"0.7856777",
"0.78546125",
"0.78280634",
"0.78155655",
"0.7812109",
"0.7803009... | 0.77787405 | 21 |
Rotate points by quaternions. | def quat_rotate(X, q):
# repeat q along 2nd dim
ones_x = X[[0], :, :][:, :, [0]] * 0 + 1
q = torch.unsqueeze(q, 1) * ones_x
q_conj = torch.cat([q[:, :, [0]], -1 * q[:, :, 1:4]], dim=-1)
X = torch.cat([X[:, :, [0]] * 0, X], dim=-1)
X_rot = hamilton_product(q, hamilton_product(X, q_conj))
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qrotate(points, axis, theta):\n q = Quaternion.rotator(axis, theta)\n return q.rotate(points)",
"def rotate_points(points,quaternions):\n \n res = np.zeros((quaternions.shape[0],points.shape[0],4)) \n res[:,:,1:] = points \n conjugates = conjugate(quaternions) \n \n f... | [
"0.7982522",
"0.7720816",
"0.76980317",
"0.7503948",
"0.71261555",
"0.67684865",
"0.66305953",
"0.66130453",
"0.65267867",
"0.6443186",
"0.64176416",
"0.64084005",
"0.63606745",
"0.633426",
"0.6299331",
"0.62791884",
"0.6247232",
"0.6116867",
"0.61149526",
"0.608029",
"0.6071... | 0.6787191 | 6 |
Returns a list of action and state this object can perform... These are in a form that Peregrin can handle, and are use by the class to limit what it allows Peregrin to call. | def actions(self):
self._actions = {}
self._actions['getItems'] = ('FileCrawler', None)
#self._actions['getContents'] = ('ParseContents', ('path'))
return self._actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getActions(self, state): \n util.raiseNotDefined()",
"def get_available_actions(self, state):\n pass",
"def actions(self, state):\n myActionList= (1,2);\n return myActionList",
"def actions(self, state):\n\t\traise NotImplementedError",
"def actions(self) -> list:\n ... | [
"0.79093474",
"0.7743691",
"0.7566298",
"0.7564206",
"0.75434977",
"0.73026574",
"0.72860223",
"0.72488976",
"0.7185109",
"0.71836317",
"0.7171607",
"0.71485937",
"0.71485937",
"0.71485937",
"0.7132329",
"0.71137536",
"0.70944935",
"0.7048736",
"0.7040828",
"0.69925964",
"0.6... | 0.6020623 | 97 |
Test that the 'get' fails because the root is not recognized. | def test_no_recognized_root(self):
result = self.runner.invoke(
cli,
[*CLI_LOG_OPTION, "config", "get", "wrong_root.agent_name"],
standalone_mode=False,
)
assert result.exit_code == 1
assert (
result.exception.message
== "The ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_root_get(self):\n pass",
"def test_root_get(self):\n pass",
"def test_root(self):\n self.skipTest(\"\")\n response = self.fetch('/')\n self.assertEqual(response.code, 404)",
"def test_get_fail(self):\n with self.assertRaises(AssertionError):\n sel... | [
"0.81144464",
"0.81144464",
"0.70011485",
"0.68381655",
"0.68031454",
"0.667773",
"0.6674683",
"0.6666335",
"0.6611255",
"0.65303046",
"0.6396875",
"0.6372637",
"0.6341329",
"0.634079",
"0.63209414",
"0.6298034",
"0.6295935",
"0.6282365",
"0.62819725",
"0.6272043",
"0.6221722... | 0.65112627 | 10 |
Test that the 'get' fails because the resource does not exist. | def test_resource_not_existing(self):
result = self.runner.invoke(
cli,
[
*CLI_LOG_OPTION,
"config",
"get",
"connections.non_existing_connection.name",
],
standalone_mode=False,
)
asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_not_exist(self):\n attempt_id = 9999\n _, err = self.resource.get(attempt_id)\n self.assertEqual(404, err)",
"def test_get_non_existing(self):\n\n response = self.client.get('/auth/non-existing-resource')\n\n self.assert404(response)\n self.assertEqual('not ... | [
"0.8803426",
"0.87292",
"0.8429405",
"0.797745",
"0.797067",
"0.7951216",
"0.77274334",
"0.76254976",
"0.75959903",
"0.7590098",
"0.7587531",
"0.75486064",
"0.75073713",
"0.75045615",
"0.7498573",
"0.7495179",
"0.74433476",
"0.74420184",
"0.741603",
"0.74085885",
"0.7400039",... | 0.6998007 | 81 |
Test that getting a vendor component with wrong component type raises error. | def test_get_fails_when_getting_vendor_dependency_with_wrong_component_type(self):
result = self.runner.invoke(
cli,
[
*CLI_LOG_OPTION,
"config",
"get",
"vendor.fetchai.component_type_not_correct.error.non_existing_attribute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_component_with_invalid_name():\n\n with pytest.raises(ComponentAttributeError):\n application_services.get_component('missing_component')",
"def test_register_component_with_invalid_type():\n\n with pytest.raises(InvalidComponentTypeError):\n component = CoreObject()\n app... | [
"0.7484369",
"0.70648474",
"0.6751108",
"0.6693934",
"0.65564436",
"0.6499122",
"0.6351091",
"0.6348619",
"0.62459064",
"0.61908615",
"0.61505693",
"0.6141869",
"0.6136945",
"0.6136352",
"0.61140954",
"0.608789",
"0.60551083",
"0.60050845",
"0.59680504",
"0.59571373",
"0.5918... | 0.7972388 | 0 |
Test setting the default routing. | def test_set_type_dict(self):
result = self.runner.invoke(
cli,
[
*CLI_LOG_OPTION,
"config",
"set",
"agent.default_routing",
'{"fetchai/contract_api:any": "fetchai/ledger:any"}',
"--type=dict"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_router(self):\n assert self.rc_conf.has_key('defaultrouter')\n assert self.rc_conf['defaultrouter'] == '\"10.137.1.7\"'",
"def test_default_routing_updated(self):\n assert self.agent_config.default_routing == {\n self.new_protocol_id: self.new_connection_id\n ... | [
"0.7380499",
"0.71554756",
"0.706406",
"0.6946817",
"0.6943349",
"0.67906195",
"0.66364366",
"0.6569018",
"0.6359504",
"0.6266595",
"0.619172",
"0.6175089",
"0.61632776",
"0.60943156",
"0.6091761",
"0.60507745",
"0.60375005",
"0.6034048",
"0.59746397",
"0.59736043",
"0.597312... | 0.0 | -1 |
Test setting the default routing. | def test_set_type_list(self):
result = self.runner.invoke(
cli,
[
*CLI_LOG_OPTION,
"config",
"set",
"vendor.fetchai.connections.p2p_libp2p.config.entry_peers",
'["peer1", "peer2"]',
"--type=li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_router(self):\n assert self.rc_conf.has_key('defaultrouter')\n assert self.rc_conf['defaultrouter'] == '\"10.137.1.7\"'",
"def test_default_routing_updated(self):\n assert self.agent_config.default_routing == {\n self.new_protocol_id: self.new_connection_id\n ... | [
"0.7380499",
"0.71554756",
"0.706406",
"0.6946817",
"0.6943349",
"0.67906195",
"0.66364366",
"0.6569018",
"0.6359504",
"0.6266595",
"0.619172",
"0.6175089",
"0.61632776",
"0.60943156",
"0.6091761",
"0.60507745",
"0.60375005",
"0.6034048",
"0.59746397",
"0.59736043",
"0.597312... | 0.0 | -1 |
Test that the 'get' fails because the root is not recognized. | def test_no_recognized_root(self):
result = self.runner.invoke(
cli,
[*CLI_LOG_OPTION, "config", "set", "wrong_root.agent_name", "value"],
standalone_mode=False,
)
assert result.exit_code == 1
assert (
result.exception.message
=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_root_get(self):\n pass",
"def test_root_get(self):\n pass",
"def test_root(self):\n self.skipTest(\"\")\n response = self.fetch('/')\n self.assertEqual(response.code, 404)",
"def test_get_fail(self):\n with self.assertRaises(AssertionError):\n sel... | [
"0.81131697",
"0.81131697",
"0.6998153",
"0.68379533",
"0.680399",
"0.6676301",
"0.6673244",
"0.66658753",
"0.66128844",
"0.65304714",
"0.6508784",
"0.6396497",
"0.6373404",
"0.63408643",
"0.6340362",
"0.6320993",
"0.6299329",
"0.62931",
"0.62797034",
"0.6279614",
"0.62703735... | 0.618814 | 23 |
Test that the 'get' fails because the resource does not exist. | def test_resource_not_existing(self):
result = self.runner.invoke(
cli,
[
*CLI_LOG_OPTION,
"config",
"set",
"connections.non_existing_connection.name",
"value",
],
standalone_mode=Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_not_exist(self):\n attempt_id = 9999\n _, err = self.resource.get(attempt_id)\n self.assertEqual(404, err)",
"def test_get_non_existing(self):\n\n response = self.client.get('/auth/non-existing-resource')\n\n self.assert404(response)\n self.assertEqual('not ... | [
"0.88033277",
"0.8728782",
"0.8429543",
"0.79759574",
"0.7970379",
"0.7949762",
"0.7726153",
"0.76256686",
"0.7595202",
"0.7590344",
"0.7586807",
"0.7548084",
"0.75071794",
"0.75046843",
"0.7499026",
"0.74956346",
"0.7443056",
"0.7441133",
"0.7414929",
"0.74075717",
"0.739820... | 0.0 | -1 |
Return the type of an object. | def _get_type(self, obj):
typever = obj['Type']
typesplit = typever.split('.')
return typesplit[0] + '.' + typesplit[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type ( self, object ):\n return self.type",
"def get_type ( self, object ):\n return self.type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def o... | [
"0.8628719",
"0.8628719",
"0.8257007",
"0.8257007",
"0.8257007",
"0.8257007",
"0.8257007",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.82011956",
"0.... | 0.69202507 | 88 |
Check if the PATCH Operation is allowed on the resource. | def _validate_if_patch_supported(self, headers, uri):
if not self._operation_allowed(headers, 'PATCH'):
msg = ('PATCH Operation not supported on the resource '
'"%s"' % uri)
raise exception.IloError(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_PATCH(self):\n if not self.url:\n return\n response = self.client.patch(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])",
"def test_partial... | [
"0.69640553",
"0.6944961",
"0.6830189",
"0.6657633",
"0.65127224",
"0.63872164",
"0.6329733",
"0.62977004",
"0.61410993",
"0.6072097",
"0.5949872",
"0.5900068",
"0.58420664",
"0.58221006",
"0.5762764",
"0.57505614",
"0.5717169",
"0.571581",
"0.56980234",
"0.5684516",
"0.56841... | 0.803524 | 0 |
Get the iscsi settings resoure. | def _get_iscsi_settings_resource(self, data):
try:
iscsi_settings_uri = data['links']['Settings']['href']
except KeyError:
msg = ('iscsi settings resource not found.')
raise exception.IloCommandNotSupportedError(msg)
status, headers, iscsi_settings = self._re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_settings(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/setting\"\n })",
"def get_settings(self):\n return self.settings",
"def get_settings(self):\n url = \"https://api.imgur.com/3/account/{0}/settings\".format(self.name)\n return self._imgur... | [
"0.6224379",
"0.5955814",
"0.59340453",
"0.5871603",
"0.5869005",
"0.5833151",
"0.57728857",
"0.57651824",
"0.57078904",
"0.57052916",
"0.5703846",
"0.5703846",
"0.5703846",
"0.5703846",
"0.56948245",
"0.5670498",
"0.5628336",
"0.56175953",
"0.56175953",
"0.5589727",
"0.55740... | 0.7113912 | 0 |
Gets the product name of the server. | def get_product_name(self):
system = self._get_host_details()
return system['Model'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_name(self):\n return self._stub.List(self._message).product_name",
"def product_name(self):\n return self._product_name",
"def product_name(self) -> Optional[str]:\n return pulumi.get(self, \"product_name\")",
"def server_name(self) -> str:\n return pulumi.get(self, \"... | [
"0.8168809",
"0.7893617",
"0.7663046",
"0.7437491",
"0.7431132",
"0.7421063",
"0.73451436",
"0.73016155",
"0.73016155",
"0.71450585",
"0.6981237",
"0.6889687",
"0.6856621",
"0.67716855",
"0.6767265",
"0.6752493",
"0.66959023",
"0.66839856",
"0.6644297",
"0.6551729",
"0.654257... | 0.7758751 | 2 |
Perform requested power operation. | def _perform_power_op(self, oper):
power_settings = {"Action": "Reset",
"ResetType": oper}
systems_uri = "/rest/v1/Systems/1"
status, headers, response = self._rest_post(systems_uri, None,
power_settings)
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power():\n request_command(tv_command=TVCommand.power)",
"def power_on(self):\n raise NotImplementedError",
"def pow(self, power):\n daskD.wait(self.client.map(_call_pow, self.vecDask, power=power, pure=False))\n return self",
"def power_on(self):\n pass",
"def power(self... | [
"0.71487105",
"0.7076449",
"0.70716",
"0.6828888",
"0.6828583",
"0.670036",
"0.6691989",
"0.66501945",
"0.6643156",
"0.6614282",
"0.6602157",
"0.6598427",
"0.6593769",
"0.6579953",
"0.6551106",
"0.6543305",
"0.6498859",
"0.6488113",
"0.6479012",
"0.646967",
"0.6468145",
"0.... | 0.7263758 | 0 |
Retrieves the pending boot mode of the server. Gets the boot mode to be set on next reset. | def get_pending_boot_mode(self):
headers, uri, bios_settings = self._check_bios_resource(['BootMode'])
_, _, settings = self._get_bios_settings_resource(bios_settings)
boot_mode = settings.get('BootMode')
if boot_mode == 'LegacyBios':
boot_mode = 'legacy'
return boot_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_boot_mode():\n boot_mode = 'Legacy'\n try:\n reg_key = winreg.OpenKey(\n winreg.HKEY_LOCAL_MACHINE, r'System\\CurrentControlSet\\Control')\n reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0]\n if reg_value == 2:\n boot_mode = 'UEFI'\n except:\n boot_mode = 'Unknown'\n\n... | [
"0.70903546",
"0.69976276",
"0.6860447",
"0.6815118",
"0.66070074",
"0.62555677",
"0.6129522",
"0.6030498",
"0.6028887",
"0.6026956",
"0.6023533",
"0.5965988",
"0.58770573",
"0.5847371",
"0.5799201",
"0.5777145",
"0.5753953",
"0.57251155",
"0.5688327",
"0.56876516",
"0.564913... | 0.8131488 | 0 |
Gets the ilo firmware version for server capabilities | def _get_ilo_firmware_version(self):
manager, reset_uri = self._get_ilo_details()
ilo_firmware_version = manager['Firmware']['Current']['VersionString']
return {'ilo_firmware_version': ilo_firmware_version} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firmware_version(self):\n return self._get_system_status()[\"firmware\"]",
"def get_ilo_firmware_version_as_major_minor(self):\n try:\n manager, reset_uri = self._get_ilo_details()\n ilo_fw_ver_str = (\n manager['Oem']['Hp']['Firmware']['Current']['VersionString... | [
"0.76318765",
"0.74084985",
"0.73684555",
"0.7351483",
"0.7309879",
"0.71681994",
"0.7141852",
"0.696607",
"0.6915562",
"0.690672",
"0.68797165",
"0.6854152",
"0.67555326",
"0.6753871",
"0.67471206",
"0.67280734",
"0.6711157",
"0.6674547",
"0.66333795",
"0.6591106",
"0.655982... | 0.7568138 | 1 |
Gets the ilo firmware version for server capabilities | def get_ilo_firmware_version_as_major_minor(self):
try:
manager, reset_uri = self._get_ilo_details()
ilo_fw_ver_str = (
manager['Oem']['Hp']['Firmware']['Current']['VersionString']
)
return common.get_major_minor(ilo_fw_ver_str)
except Exce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firmware_version(self):\n return self._get_system_status()[\"firmware\"]",
"def _get_ilo_firmware_version(self):\n\n manager, reset_uri = self._get_ilo_details()\n ilo_firmware_version = manager['Firmware']['Current']['VersionString']\n return {'ilo_firmware_version': ilo_firmware_ver... | [
"0.76303834",
"0.7566883",
"0.7366854",
"0.73500246",
"0.73084676",
"0.71665615",
"0.7140502",
"0.6964108",
"0.69159454",
"0.6905643",
"0.6877727",
"0.6852079",
"0.6753259",
"0.6751832",
"0.67452294",
"0.6726138",
"0.6709597",
"0.66727823",
"0.6632324",
"0.65892386",
"0.65594... | 0.7407143 | 2 |
Returns the vertex symbol of a topology as a list of strings | def get_vs(self,name):
return self.mfp.get_vs(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertices(self):\n return str(self.vert_dict.keys())",
"def graph(g):\n return str(g.adjacencyList())",
"def list_vertices(self):\n return list(self.graph_dict.keys())",
"def __str__(self):\n vList = []\n for vertex in self:\n vList.append(vertex.name)\n ... | [
"0.6693307",
"0.64824003",
"0.6428527",
"0.6385017",
"0.61859804",
"0.6184684",
"0.6171001",
"0.61704546",
"0.6142896",
"0.6142896",
"0.6142896",
"0.60300994",
"0.60281855",
"0.6027096",
"0.59981346",
"0.5959071",
"0.5957562",
"0.5946406",
"0.5943226",
"0.5909223",
"0.59061",... | 0.0 | -1 |
set requires_grad to 'true' for all paramters, but save original values to resotre them later | def _get_gradients(self, batch):
embedding_gradients = []
original_param_name_to_requires_grad_dict = {}
for param_name, param in self.model.named_parameters():
original_param_name_to_requires_grad_dict[param_name] = param.requires_grad
param.requires_grad = True... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad",
"def set_requires_grad(self, requires_grad):\n for parameter in self.parameters():\n parameter.requires_grad = requires_grad",
"def freeze_params(m):... | [
"0.76790285",
"0.76790285",
"0.75791013",
"0.75430167",
"0.74836636",
"0.7409139",
"0.7380558",
"0.73643893",
"0.72944826",
"0.72131354",
"0.719416",
"0.71648544",
"0.71418315",
"0.71305335",
"0.70704716",
"0.7017141",
"0.69882965",
"0.69882965",
"0.69626516",
"0.6960601",
"0... | 0.0 | -1 |
Registers a backward hook on the used to save the gradients of the embeddings for use in get_gradients() when there are multiple inputs (e.g., a passage and question), the hook will be called multiple times. We append all the embeddings gradients to a list. | def _register_embedding_gradient_hooks(self, embedding_gradients):
def hook_layers(module, grad_in, grad_out):
embedding_gradients.append(grad_out[0])
backward_hooks = []
embedding_layer = self.get_embeddings_layer()
backward_hooks.append(embedding_layer.register_backward_h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _register_post_backward_hooks(self) -> None:\n if not torch.is_grad_enabled():\n return # don't register grad hooks if grad isn't enabled\n for p in self.full_params:\n if p.requires_grad:\n if hasattr(p, \"_shard_bwd_hook\"):\n continue\n # Register a hook on the first ... | [
"0.744036",
"0.7207515",
"0.68466437",
"0.6619593",
"0.6545222",
"0.65270805",
"0.6505459",
"0.64318466",
"0.6385007",
"0.63628876",
"0.63604456",
"0.63604456",
"0.62412906",
"0.6231469",
"0.62253386",
"0.61755383",
"0.609307",
"0.60908824",
"0.60908824",
"0.60785884",
"0.603... | 0.8470942 | 0 |
Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. | def which(cmd, mode=os.F_OK | os.X_OK, path=None):
# Check that a given file can be accessed with the correct mode.
# Additionally check that `file` is not a directory, as on Windows
# directories pass the os.access check.
def _access_check(fn, mode):
return (os.path.exists(f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def which(cmd, mode=os.F_OK | os.X_OK, path=None):\n # Check that a given file can be accessed with the correct mode.\n # Additionally check that `file` is not a directory, as on Windows\n # directories pass the os.access check.\n def _access_check(fn, mode):\n ... | [
"0.77106726",
"0.7453694",
"0.727641",
"0.6943331",
"0.6540709",
"0.639578",
"0.60801244",
"0.59047854",
"0.5880955",
"0.5878199",
"0.57527226",
"0.5732597",
"0.5709009",
"0.5672643",
"0.5576627",
"0.5575957",
"0.55535084",
"0.5497285",
"0.5452454",
"0.5445605",
"0.5425212",
... | 0.7460819 | 1 |
A view to show all products, including ability to search | def portfolio(request):
projects = Project.objects.all()
categories = None
if request.GET:
if 'category' in request.GET:
categories = request.GET['category'].split(',')
projects = projects.filter(category__name__in=categories)
categories = ProjectCategory.objects... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_products(request):\n products = Product.objects.all()\n return render(request, \"products.html\", {\"products\": products})",
"def all_products(request):\n\n products = Product.objects.all()\n return render(request, 'products.html', {'products': products})",
"def products(request):\n\n r... | [
"0.82876235",
"0.8283801",
"0.78482085",
"0.76325524",
"0.7614649",
"0.7584741",
"0.74856204",
"0.74783254",
"0.74655133",
"0.7386778",
"0.7367176",
"0.7330932",
"0.72938323",
"0.7253225",
"0.72413594",
"0.7230313",
"0.72217464",
"0.720815",
"0.711731",
"0.7079289",
"0.704237... | 0.0 | -1 |
Return True if the campaign authorizes the user to provide data to the campaign. This is the case if the user owns or works for the campaign. Otherwise, return False. | def authorizes(self, user):
return self.owner == user or self.workers.filter(pk=user.id).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized(self):\n return self.authorization is not None",
"def user_allow_credit(self):\n try:\n return self.user.creditAllowed()\n except AttributeError:\n return False",
"def has_permission(self, request, view):\n user = request.user\n try:\n ... | [
"0.71512544",
"0.6903803",
"0.6882612",
"0.6824171",
"0.6759655",
"0.671842",
"0.67081565",
"0.6686441",
"0.66475916",
"0.6640897",
"0.6619891",
"0.66168815",
"0.6604757",
"0.6577445",
"0.65759784",
"0.65525156",
"0.65457594",
"0.65178764",
"0.6516392",
"0.65048504",
"0.64949... | 0.68715215 | 3 |
Create a new FrozenDict where one entry is removed. | def pop(self, key: K) -> Tuple['FrozenDict[K, V]', V]:
value = self[key]
new_dict = dict(self._dict)
new_dict.pop(key)
new_self = type(self)(new_dict)
return new_self, value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze(xs: Mapping[Any, Any]) -> FrozenDict[Any, Any]:\n return FrozenDict(xs)",
"def unfreeze(x: Union[FrozenDict, Dict[str, Any]]) -> Dict[Any, Any]:\n if isinstance(x, FrozenDict):\n # deep copy internal state of a FrozenDict\n # the dict branch would also work here but\n # it is much less perf... | [
"0.6839586",
"0.6433712",
"0.63349175",
"0.630568",
"0.60893214",
"0.59897816",
"0.5919276",
"0.5696106",
"0.56297266",
"0.5533009",
"0.5489603",
"0.54769456",
"0.54426163",
"0.53937614",
"0.5389322",
"0.5372033",
"0.5324981",
"0.53037596",
"0.53020614",
"0.52977496",
"0.5270... | 0.57714397 | 7 |
Deep copy unfrozen dicts to make the dictionary FrozenDict safe. | def _prepare_freeze(xs: Any) -> Any:
if isinstance(xs, FrozenDict):
# we can safely ref share the internal state of a FrozenDict
# because it is immutable.
return xs._dict # pylint: disable=protected-access
if not isinstance(xs, dict):
# return a leaf as is.
return xs
# recursively copy dicti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfreeze(x: Union[FrozenDict, Dict[str, Any]]) -> Dict[Any, Any]:\n if isinstance(x, FrozenDict):\n # deep copy internal state of a FrozenDict\n # the dict branch would also work here but\n # it is much less performant because jax.tree_util.tree_map\n # uses an optimized C implementation.\n ret... | [
"0.71733785",
"0.7037678",
"0.65864396",
"0.6474158",
"0.62573695",
"0.6152454",
"0.61428803",
"0.6087053",
"0.6052837",
"0.60174745",
"0.5997487",
"0.59899086",
"0.5918377",
"0.5899443",
"0.5898595",
"0.5892593",
"0.5735094",
"0.572419",
"0.5684948",
"0.56120795",
"0.5609732... | 0.7742294 | 0 |
Unfreeze a FrozenDict. Makes a mutable copy of a `FrozenDict` mutable by transforming it into (nested) dict. | def unfreeze(x: Union[FrozenDict, Dict[str, Any]]) -> Dict[Any, Any]:
if isinstance(x, FrozenDict):
# deep copy internal state of a FrozenDict
# the dict branch would also work here but
# it is much less performant because jax.tree_util.tree_map
# uses an optimized C implementation.
return jax.tre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_freeze(xs: Any) -> Any:\n if isinstance(xs, FrozenDict):\n # we can safely ref share the internal state of a FrozenDict\n # because it is immutable.\n return xs._dict # pylint: disable=protected-access\n if not isinstance(xs, dict):\n # return a leaf as is.\n return xs\n # recursive... | [
"0.678866",
"0.63871247",
"0.63075334",
"0.6243246",
"0.61387753",
"0.61324066",
"0.5833921",
"0.56678116",
"0.5610028",
"0.5581237",
"0.547987",
"0.528664",
"0.5166779",
"0.51488274",
"0.5131935",
"0.513004",
"0.5127286",
"0.51143354",
"0.5108335",
"0.5104038",
"0.50658894",... | 0.80311483 | 0 |
Create a new dict where one entry is removed. This is a utility function that can act on either a FrozenDict or regular dict and mimics the behavior of `FrozenDict.pop`. | def pop(
x: Union[FrozenDict, Dict[str, Any]], key: str
) -> Tuple[Union[FrozenDict, Dict[str, Any]], Any]:
if isinstance(x, FrozenDict):
return x.pop(key)
elif isinstance(x, dict):
new_dict = jax.tree_map(lambda x: x, x) # make a deep copy of dict x
value = new_dict.pop(key)
return new_dict, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, key: K) -> Tuple['FrozenDict[K, V]', V]:\n value = self[key]\n new_dict = dict(self._dict)\n new_dict.pop(key)\n new_self = type(self)(new_dict)\n return new_self, value",
"def dict_pop(d, key):\n return d.pop(key)",
"def remove_element( self, dictionary, key):\n\n _dict ... | [
"0.70482343",
"0.67293966",
"0.6490357",
"0.6465873",
"0.61706996",
"0.6144822",
"0.6001672",
"0.59998095",
"0.5967065",
"0.59639794",
"0.5955744",
"0.59308225",
"0.588004",
"0.58719283",
"0.58055025",
"0.57446265",
"0.57119524",
"0.56699175",
"0.5650597",
"0.56066054",
"0.55... | 0.7112404 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.