query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2 values |
|---|---|---|---|---|---|---|
Write the concordance entries to the output file(filename) See sample output files for format. | def write_concordance(self, filename):
all_keys = self.concordance_table.get_all_keys()
lines = []
for i in all_keys:
a = ""
a += i + ":"
f = self.concordance_table.get_value(i)
if f != None:
for s in f:
a += " " + str(s)
a += "\n"
lines.append(a)
a = open(filename, "w+")
for i in lines:
a.write(i)
a.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_concordance(self, filename):\n out = ''\n values = [x for x in self.concordance_table.hash_table if x is not None]\n values.sort(key=lambda x: x[0])\n for v in values:\n out += f'{v[0]}: {\" \".join(str(x) for x in sorted(set(v[1])))}\\n' \n with open(filenam... | [
"0.7794726",
"0.66742295",
"0.64932483",
"0.64526165",
"0.6379942",
"0.63655496",
"0.63634735",
"0.62910575",
"0.6240714",
"0.6233921",
"0.6233921",
"0.6233921",
"0.61785156",
"0.61412483",
"0.61257005",
"0.610843",
"0.6082861",
"0.60720426",
"0.6064205",
"0.60603034",
"0.598... | 0.7876976 | 0 |
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 |
Compute the matrixvector product y = Cu where C is a kfactor circulant matrix All matrices are real | def factor_circulant_multiplication(u, x, k=1):
n = len(u)
D_k = (k**(1/n))**np.arange(0,n)
Lambda = fft(D_k*x)
return (1/D_k)*real(ifft(Lambda*fft(D_k*u))) # y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateC(A, U, B):\n \n m_dim = A.shape[1] \n q_dim = B.shape[0]\n \n C_tensor = np.zeros((m_dim, m_dim, q_dim), dtype=np.complex)\n \n for k in range(q_dim):\n A_k = A[:, :, k]\n b_k = B[k]\n \n x_hat = U @ b_k\n y_hat = A_k.conj().T @ x_hat\n \... | [
"0.6325033",
"0.6273725",
"0.6251581",
"0.62479377",
"0.6177961",
"0.6087597",
"0.6022537",
"0.60215706",
"0.6020421",
"0.60090333",
"0.6000697",
"0.5998053",
"0.59429264",
"0.59204763",
"0.58713275",
"0.5850264",
"0.5813686",
"0.57964927",
"0.57901424",
"0.57262236",
"0.5726... | 0.693636 | 0 |
Solves Tx=b using the Levinson algorithm where T is apositivedefinite symmetric Toeplitz matrix b is a real vector | def levinson(r, b):
n = len(b)
y = zeros((n,))
x = zeros((n,))
# normalize the system so that the T matrix has diagonal of ones
r_0 = r/r[0]
b_0 = b/r[0]
if n == 1:
return b_0
y[0] = -r_0[1]
x[0] = b_0[0]
beta = 1
alpha = -r_0[1]
for k in range(0,n-1):
beta = (1 - alpha*alpha)*beta
mu = (b_0[k+1] - dot(r_0[1:k+2], x[k::-1])) /beta
x[0:k+1] = x[0:k+1] + mu*y[k::-1]
x[k+1] = mu
if k < n-2:
alpha = -(r_0[k+2] + dot(r_0[1:k+2], y[k::-1]))/beta
y[0:k+1] = y[0:k+1] + alpha * y[k::-1]
y[k+1] = alpha
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tridisolve(d, e, b, overwrite_b=True):\n\t\tN = len(b)\n\t\t# work vectors\n\t\tdw = d.copy()\n\t\tew = e.copy()\n\t\tif overwrite_b:\n\t\t\tx = b\n\t\telse:\n\t\t\tx = b.copy()\n\t\tfor k in range(1, N):\n\t\t\t# e^(k-1) = e(k-1) / d(k-1)\n\t\t\t# d(k) = d(k) - e^(k-1)e(k-1) / d(k-1)\n\t\t\tt = ew[ k - 1 ]\n... | [
"0.63466734",
"0.61827254",
"0.61033237",
"0.6093494",
"0.60769826",
"0.5885008",
"0.58844715",
"0.5877297",
"0.58737326",
"0.58588946",
"0.5838278",
"0.5794063",
"0.57753825",
"0.5773156",
"0.5763559",
"0.57562786",
"0.574674",
"0.57452273",
"0.57390094",
"0.57179475",
"0.56... | 0.7257071 | 0 |
Compute the log determinant of a positivedefinite symmetric toeplitz matrix. The determinant is computed recursively. The intermediate solutions of the Levinson recursion are expolited. | def toeplitz_slogdet(r):
n = len(r)
r_0 = r[0]
r = np.concatenate((r, np.array([r_0])))
r /= r_0 # normalize the system so that the T matrix has diagonal of ones
logdet = n*np.log(np.abs(r_0))
sign = np.sign(r_0)**n
if n == 1:
return (sign, logdet)
# now on is a modification of Levinson algorithm
y = zeros((n,))
x = zeros((n,))
b = -r[1:n+1]
r = r[:n]
y[0] = -r[1]
x[0] = b[0]
beta = 1
alpha = -r[1]
d = 1 + dot(-b[0], x[0])
sign *= np.sign(d)
logdet += np.log(np.abs(d))
for k in range(0,n-2):
beta = (1 - alpha*alpha)*beta
mu = (b[k+1] - dot(r[1:k+2], x[k::-1])) /beta
x[0:k+1] = x[0:k+1] + mu*y[k::-1]
x[k+1] = mu
d = 1 + dot(-b[0:k+2], x[0:k+2])
sign *= np.sign(d)
logdet += np.log(np.abs(d))
if k < n-2:
alpha = -(r[k+2] + dot(r[1:k+2], y[k::-1]))/beta
y[0:k+1] = y[0:k+1] + alpha * y[k::-1]
y[k+1] = alpha
return(sign, logdet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fast_logdet(matrix):\n sign, ld = np.linalg.slogdet(matrix)\n if not sign > 0:\n return -np.inf\n return ld",
"def pddet(A):\r\n L = jitchol(A)\r\n logdetA = 2*sum(np.log(np.diag(L)))\r\n return logdetA",
"def log_abs_det_jacobian(self, z):\n pre_u = self.u_ + self.u\n ... | [
"0.7205463",
"0.69225436",
"0.6803772",
"0.6577487",
"0.65662503",
"0.6258033",
"0.6235449",
"0.6192166",
"0.61640286",
"0.60718197",
"0.602648",
"0.5906651",
"0.5904567",
"0.58784807",
"0.58522433",
"0.5850299",
"0.58452636",
"0.5838441",
"0.5796368",
"0.57808894",
"0.577887... | 0.6977162 | 1 |
Preprocessing needed for toeplitz_inverse_multiplication() | def toeplitz_inverse_multiplication_prep(T_column):
phi=1
psi=2
assert phi != 0
assert psi != 0
assert phi != psi
n = len(T_column)
x = levinson(T_column, np.concatenate( (np.array([1]), np.zeros((n-1,))) ) )
y = levinson(T_column, np.concatenate( (np.zeros((n-1,)), np.array([1])) ) )
x_0 = x[0]
D_phi = (phi**(1/n))**np.arange(0,n)
D_psi = (psi**(1/n))**np.arange(0,n)
Lambda_1 = fft(D_psi*x)
Lambda_2 = fft(D_phi*np.concatenate(([phi*y[-1]], y[0:-1])))
Lambda_3 = fft(D_psi*np.concatenate(([psi*y[-1]], y[0:-1])))
Lambda_4 = fft(D_phi*x)
return (x_0, phi, psi, D_phi, D_psi, Lambda_1, Lambda_2, Lambda_3, Lambda_4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bd_toeplitz_inverse_multiplication_prep(*arrs):\n \n t = []\n for c in arrs: # loop over each block\n t.append(toeplitz_inverse_multiplication_prep(c))\n return tuple(t)",
"def toeplitz_inverse_multiplication(u, x_0, phi, psi, D_phi, D_psi, Lambda_1, Lambda_2, Lambda_3, Lambda_4):\n\n y... | [
"0.65743506",
"0.63173485",
"0.60780877",
"0.60345995",
"0.5920918",
"0.5710167",
"0.5684219",
"0.56176597",
"0.56087387",
"0.5590726",
"0.5568226",
"0.556281",
"0.5558012",
"0.5548983",
"0.5540906",
"0.5426001",
"0.5426001",
"0.5406237",
"0.53970987",
"0.5395093",
"0.5389461... | 0.65871215 | 0 |
matrix multiplication with the inverse of a blockdiagonal matrix having Toeplitz blocks. y = T u Analogous to toeplitz_inverse_multiplication() | def bd_toeplitz_inverse_multiplication(u, *arrs):
y = zeros(shape(u))
n_start = 0
n_end = 0
for t in arrs:
n_start = n_end
n_end += len(t[3]) # len(t[3]) is the length of the block
y[n_start:n_end] = toeplitz_inverse_multiplication(u[n_start:n_end], *t)
assert len(y) == n_end
return y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toeplitz_inverse_multiplication_prep(T_column):\n \n phi=1\n psi=2\n assert phi != 0\n assert psi != 0\n assert phi != psi\n \n n = len(T_column)\n \n x = levinson(T_column, np.concatenate( (np.array([1]), np.zeros((n-1,))) ) )\n y = levinson(T_column, np.concatenate( (np.zeros... | [
"0.65371925",
"0.6473114",
"0.639856",
"0.6361315",
"0.6302969",
"0.6292023",
"0.6192051",
"0.61344135",
"0.61059606",
"0.60929507",
"0.6069136",
"0.6021487",
"0.60205114",
"0.6011188",
"0.5997013",
"0.5966648",
"0.5926399",
"0.5926365",
"0.5916658",
"0.5888663",
"0.5883227",... | 0.7164876 | 0 |
Parse a single line of csvtoarrow output. Raise RuntimeError if a line cannot be parsed. (We can't recover from that because we don't know what's happening.) | def _parse_csv_to_arrow_warning(line: str) -> I18nMessage:
for pattern, builder in _ERROR_PATTERNS:
match = pattern.match(line)
if match:
return builder(**match.groupdict())
raise RuntimeError("Could not parse csv-to-arrow output line: %r" % line) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_line(self, line):\n raise NotImplementedError",
"def test_parseLine2(mocker):\n \n # given: setup test framework\n worker = Worker()\n testString = \"11/11/19,Brighter Futures,12000\"\n \n # when:\n result = worker.parseLineCSV(testString)\n \n # then: (Using PyTruth a... | [
"0.6595832",
"0.6529445",
"0.62704617",
"0.61401874",
"0.61335003",
"0.61316746",
"0.61252147",
"0.61061907",
"0.5982218",
"0.5961737",
"0.5809438",
"0.5809438",
"0.5809438",
"0.5809438",
"0.5806658",
"0.5806658",
"0.5729117",
"0.5704075",
"0.5667828",
"0.56519485",
"0.562726... | 0.7278119 | 0 |
Return true if we should fastskip converting a pa.Array. The _true_ reason for this function is to test whether an Array contains "Inf" or "NaN". A numberconversion library will parse those. But _this_ library is for Workbench, and Workbench doesn't support NaN/Inf. So this function helps us decide _not_ to autoconvert a column when the intent isn't perfectly clear. Assume `arr` is of type `utf8` or a dictionary of `utf8`. Assume there are no gaps hidden in null values in the buffer. (It's up to the caller to prove this.) | def _utf8_chunk_may_contain_inf_or_nan(chunk: pyarrow.Array) -> bool:
_, offsets_buf, data_buf = chunk.buffers()
offsets = array.array("i")
assert offsets.itemsize == 4
offsets.frombytes(offsets_buf)
if sys.byteorder != "little":
offsets.byteswap() # pyarrow is little-endian
offset0 = offsets[chunk.offset]
offsetN = offsets[chunk.offset + len(chunk)] # len(offsets) == 1 + len(chunk)
b = data_buf[offset0:offsetN].to_pybytes()
return SCARY_BYTE_REGEX.search(b) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asarray_chkfinite(a):\n a = asarray(a)\n if (a.dtype.char in typecodes['AllFloat']) \\\n and (_nx.isnan(a).any() or _nx.isinf(a).any()):\n raise ValueError, \"array must not contain infs or NaNs\"\n return a",
"def is_array(self, arr):\n return isinstance(arr, np.ndarray)",
... | [
"0.63142204",
"0.59511065",
"0.59251046",
"0.5863669",
"0.5700599",
"0.5661153",
"0.5581066",
"0.54970616",
"0.54685277",
"0.54147017",
"0.53897524",
"0.5384138",
"0.53668594",
"0.5293467",
"0.52856606",
"0.527953",
"0.5257239",
"0.5248469",
"0.5248469",
"0.5215622",
"0.52145... | 0.60420185 | 1 |
Update the config information with new dropout values. | def update_dropout(info,
dropout,
dropout_type,
prop_name):
if dropout_type == "schnet_dropout":
info["model_params"]["schnet_dropout"] = dropout
elif dropout_type == "chemprop_dropout":
info["model_params"]["cp_dropout"] = dropout
elif dropout_type == "readout_dropout":
# if it's in the readout layers, find the dropout
# layers in the readout dictionary and update them
readout = info["model_params"]["readoutdict"]
layer_dics = readout[prop_name]
for layer_dic in layer_dics:
if layer_dic["name"] == "Dropout":
layer_dic["param"]["p"] = dropout
info["model_params"]["readoutdict"] = {prop_name: layer_dics}
elif dropout_type == "attention_dropout":
info["model_params"]["boltzmann_dict"]["dropout_rate"] = dropout
else:
info["model_params"][dropout_type] = dropout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conf_update(self):\n pass",
"def update(self):\n self.save_config_file()",
"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['ca... | [
"0.6544299",
"0.63342535",
"0.60116196",
"0.59151256",
"0.5909534",
"0.57759255",
"0.57704425",
"0.5765275",
"0.5730661",
"0.56408286",
"0.5635697",
"0.558882",
"0.55770063",
"0.5571904",
"0.5553866",
"0.5534613",
"0.5478377",
"0.546527",
"0.5463798",
"0.5436312",
"0.5427711"... | 0.63966775 | 1 |
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 = info["model_params"]["mol_basis"]
for key, lst in readoutdict.items():
for i, dic in enumerate(lst):
if "param" in dic and "in_features" in dic.get("param", {}):
# make sure that the input dimension to the readout is equal to
# `heads * feat_dim`, where `feat_dim` is the feature dimension
# produced by each head
readoutdict[key][i]["param"]["in_features"] = feat_dim * heads
break
info["model_params"]["readoutdict"] = readoutdict | {
"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 |
Update a general parameter that's in the main info dictionary. | def update_general(info, key, val):
info["model_params"][key] = val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_general_param(self, param, val):\n assert param in self.params, '%s is not recognized as a valid parameter' % param\n self.params[param].change_value(val)",
"def _paramUpdate(self):\n\n # Update the database attributes accordingly.\n dt.utilities.DB_attrs_save(self.Database... | [
"0.7279819",
"0.71316004",
"0.70896465",
"0.68731415",
"0.6845889",
"0.68180555",
"0.6810109",
"0.67108864",
"0.6680052",
"0.6631445",
"0.6597182",
"0.6568276",
"0.65336627",
"0.65146816",
"0.64628476",
"0.64187586",
"0.64153326",
"0.63640064",
"0.63570213",
"0.63570213",
"0.... | 0.7829526 | 0 |
Construct generalized extreme value distribution. The parameters `loc`, `scale`, and `concentration` must be shaped in a way that supports broadcasting (e.g. `loc + scale` + `concentration` is valid). | def __init__(self,
loc,
scale,
concentration,
validate_args=False,
allow_nan_stats=True,
name='GeneralizedExtremeValue'):
parameters = dict(locals())
with tf.name_scope(name) as name:
dtype = dtype_util.common_dtype([loc, scale, concentration],
dtype_hint=tf.float32)
loc = tensor_util.convert_nonref_to_tensor(
loc, name='loc', dtype=dtype)
scale = tensor_util.convert_nonref_to_tensor(
scale, name='scale', dtype=dtype)
concentration = tensor_util.convert_nonref_to_tensor(
concentration, name='concentration', dtype=dtype)
dtype_util.assert_same_float_dtype([loc, scale, concentration])
# Positive scale is asserted by the incorporated GEV bijector.
self._gev_bijector = gev_cdf_bijector.GeneralizedExtremeValueCDF(
loc=loc, scale=scale, concentration=concentration,
validate_args=validate_args)
# Because the uniform sampler generates samples in `[0, 1)` this would
# cause samples to lie in `(inf, -inf]` instead of `(inf, -inf)`. To fix
# this, we use `np.finfo(dtype_util.as_numpy_dtype(self.dtype).tiny`
# because it is the smallest, positive, 'normal' number.
super(GeneralizedExtremeValue, self).__init__(
distribution=uniform.Uniform(
low=np.finfo(dtype_util.as_numpy_dtype(dtype)).tiny,
high=tf.ones([], dtype=dtype),
allow_nan_stats=allow_nan_stats),
# The GEV bijector encodes the CDF function as the forward,
# and hence needs to be inverted.
bijector=invert_bijector.Invert(
self._gev_bijector, validate_args=validate_args),
parameters=parameters,
name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, loc=0, scale=1, size=None, **kwargs):\n return super().__call__(loc, scale, size=size, **kwargs)",
"def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):\n return super().__call__(loc, scale, size=size, **kwargs)",
"def __call__(self, loc=0.0, scale=1.0, size=None, **kwa... | [
"0.5140067",
"0.51391375",
"0.51391375",
"0.51391375",
"0.51391375",
"0.51391375",
"0.51385653",
"0.512212",
"0.51002985",
"0.5092538",
"0.5085862",
"0.5006036",
"0.49219593",
"0.49213806",
"0.4891641",
"0.48677793",
"0.48438725",
"0.4842382",
"0.48329198",
"0.48204932",
"0.4... | 0.6448586 | 0 |
Construct Artillery YAML configuration | def set_yaml_config(self) -> None:
# LT-248: We can pick Artillery Phase configuration from conf file
self.yaml_config = {
"config": {
"target": self.get_swagger_url(),
"processor": f"./{self.OUT_FILE}",
"phases": [
{
"duration": settings.DURATION or 1,
"arrivalRate": settings.SPAWN_RATE or 1
}
]
},
"scenarios": self.task_set.yaml_flow
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yamlConfigForParsingPlugins():\n parameters = \"\"\"\njoinPaths: !joinPaths\n - a\n - b\n - \"c\"\nrunPageTemplates: !findRunPageTemplates\n - \"templates\"\nbcrypt: !bcrypt\n bcryptLogRounds: 12\n user: \"pass\"\nbcryptNoUser: !bcrypt\n bcryptLogRounds: 12\n null: null\nsecretKey: !... | [
"0.6141873",
"0.6054223",
"0.6019494",
"0.5994903",
"0.59923637",
"0.5968164",
"0.59273314",
"0.57849234",
"0.5761136",
"0.57510424",
"0.57198846",
"0.5717234",
"0.57150394",
"0.5667676",
"0.5636936",
"0.56257606",
"0.55977577",
"0.55945677",
"0.55880404",
"0.55880404",
"0.55... | 0.69550043 | 0 |
Tell if a person if allergic to the given allergen. | def is_allergic_to(self, allergen):
return allergen in self.list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_allergen(self, is_allergen):\n\n self._is_allergen = is_allergen",
"def in_garden(obj):\n print(\"Searching the garden's random objects\")\n return obj in _random_objects",
"def allergies(self, allergies):\n\n self.logger.debug(\"In 'allergies' setter.\")\n\n self._allergies =... | [
"0.6099033",
"0.5558612",
"0.5521234",
"0.5301362",
"0.5294011",
"0.5216652",
"0.5088434",
"0.507583",
"0.5070816",
"0.50542706",
"0.5041537",
"0.50312674",
"0.49993923",
"0.49899283",
"0.49749395",
"0.49660623",
"0.49616873",
"0.49227342",
"0.49170405",
"0.49064264",
"0.4897... | 0.77161974 | 0 |
This returns a single entry corresponding to the Directory Entity referred to by FolderEntityData. The returned string is given below (between Start and End) Start | def getFolderEntry(FolderEntityData):
if FolderEntityData.Type not in ['IntermediateDir', 'ExperimentDir']:
errprint('\nThe given EntityData does not represent the data of a directory')
raise ValueError
OutputLines = []
OutputLines.append("FolderID : {UID}".format(UID=FolderEntityData.ID))
OutputLines.append("ParentFolderID : {UID}".format(UID=FolderEntityData.ParentID))
OutputLines.append("FolderType : {Type}".format(Type=FolderEntityData.Type))
OutputLines.append("FolderTitle : {Title}".format(Title=FolderEntityData.Title))
OutputLines.append("FolderDescription: |-2")
OutputLines += [" "+Line for Line in FolderEntityData.Description.splitlines()]
OutputLines.append("")
return "\n".join(OutputLines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFolderItemName(self) -> unicode:\n ...",
"def getFolderPath(self) -> unicode:\n ...",
"def directory_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"directory_id\")",
"def get(self):\n return self.directory_name",
"def metadataDirectory(self):\n guid_ha... | [
"0.5994919",
"0.56029546",
"0.5287925",
"0.52766377",
"0.5237696",
"0.52345103",
"0.5213454",
"0.5185664",
"0.517336",
"0.51614946",
"0.51094973",
"0.51090777",
"0.50988936",
"0.50865364",
"0.50664777",
"0.5054286",
"0.50433457",
"0.5036197",
"0.50105923",
"0.4974974",
"0.497... | 0.7627963 | 0 |
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("")
OutputLines.append("- ID : {ID}".format(ID=ExpEntityData.ID))
OutputLines.append(" Title : {Title}".format(Title=ExpEntityData.Title))
OutputLines.append(" Description: |-2")
OutputLines += [" "+Line for Line in ExpEntityData.Description.splitlines()]
OutputLines.append("")
OutputLines.append(
"{0:#<100}".format("## End of Experiment {UID} ".format(UID=ExpEntityData.ID)))
return "\n".join(OutputLines) | {
"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 |
get all the employees out of the database | def get_employees(self):
from Employee import Employee
cursor = self.dbconnect.get_cursor()
cursor.execute('select * from employee')
employees = list()
for row in cursor:
employee = Employee(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8])
employees.append(employee)
return employees | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n resultado = EmployeeModel.query.all()\n return resultado",
"def get_employees(self, active_only):\n cursor = self.dbconnect.get_cursor()\n\n if active_only:\n cursor.execute(\n 'SELECT id, name, email, office, extra_info, picture_location, re... | [
"0.7986589",
"0.78798616",
"0.7810305",
"0.7761145",
"0.771737",
"0.7529015",
"0.7422921",
"0.722801",
"0.7137951",
"0.71137774",
"0.7091648",
"0.7014968",
"0.6984071",
"0.6906787",
"0.6850874",
"0.67577934",
"0.6755647",
"0.67153805",
"0.66789347",
"0.6564769",
"0.65336215",... | 0.8586788 | 0 |
this function gets all the admins from the database | def get_admins(self):
from Employee import Employee
admins = list()
cursorRoles = self.dbconnect.get_cursor()
cursorRoles.execute('select * from employeeRoles where role=\'admin\'')
for row in cursorRoles:
admins.append(self.get_employee(row[0]))
return admins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_admins():\n users = get_users()\n admins = []\n for user in users:\n if user[\"approval_level\"] == \"admin\":\n admins.append(user)\n\n return admins",
"def get_admins(name):\n obj = DataService.objects(name=name).first()\n if obj is None:\n return []\n retu... | [
"0.77166426",
"0.76271695",
"0.76095897",
"0.7580871",
"0.75705355",
"0.7568923",
"0.74572515",
"0.7428086",
"0.7204757",
"0.7203195",
"0.7175435",
"0.70761865",
"0.70348865",
"0.70129657",
"0.69840354",
"0.6977274",
"0.69340014",
"0.6931243",
"0.6885563",
"0.6853746",
"0.684... | 0.81468296 | 0 |
gets a single employee out the database on an id | def get_employee(self, id):
from Employee import Employee
cursor = self.dbconnect.get_cursor()
cursor.execute('SELECT * FROM employee WHERE employeeID=%s ', (id,))
row = cursor.fetchone()
return Employee(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, id):\n resultado = EmployeeModel.query.filter_by(employee_id=id).first()\n if resultado:\n return resultado\n api.abort(404)",
"def get(id_: int):\n logger.debug('Retrieving employee by id %i.', id_)\n try:\n query = db.session.query(Employee)\n e... | [
"0.8462909",
"0.8436909",
"0.8286135",
"0.8277989",
"0.795276",
"0.7786417",
"0.75786275",
"0.7489491",
"0.7484681",
"0.73151207",
"0.7233033",
"0.6973724",
"0.6964095",
"0.6891466",
"0.68717116",
"0.6806852",
"0.66826135",
"0.6661457",
"0.6648924",
"0.6645056",
"0.66137886",... | 0.8603124 | 0 |
gets a single employee out the database on a name | def get_employeeOnName(self, name):
from Employee import Employee
cursor = self.dbconnect.get_cursor()
cursor.execute('SELECT * FROM employee WHERE name=%s ', (name,))
if (cursor.rowcount != 0):
row = cursor.fetchone()
return Employee(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8])
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_employee_by_name(self, name):\n cursor = self.dbconnect.get_cursor()\n cursor.execute('SELECT id, name, email, office, extra_info, picture_location, research_group, title, is_external,'\n ' is_admin, is_active FROM employee WHERE name=%s', (name,))\n row = cursor.... | [
"0.75500387",
"0.7348031",
"0.7300037",
"0.72360134",
"0.7058836",
"0.7009213",
"0.6654517",
"0.66495013",
"0.66377455",
"0.65564954",
"0.6541405",
"0.6435797",
"0.6376785",
"0.6338932",
"0.61743134",
"0.61031044",
"0.60764945",
"0.60599095",
"0.59950364",
"0.5983809",
"0.597... | 0.8025803 | 0 |
adds an employee to the database | def add_employee(self, empl):
cursor = self.dbconnect.get_cursor()
try:
cursor.execute('INSERT INTO employee values(default,%s,%s,%s,%s,%s,%s,%s,%s)',
(empl.name, empl.email, empl.office, empl.research_group, empl.title, empl.internOrExtern,
empl.active, empl.promotor))
cursor.execute('SELECT LASTVAL()')
eid = cursor.fetchone()[0]
empl.id = eid
# get id and return updated object
self.dbconnect.commit()
except(Exception, self.dbconnect.get_error()) as error:
self.dbconnect.rollback()
raise Exception('\nUnable to save Employee!\n(%s)' % (error)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_employee(self, obj):\n cursor = self.dbconnect.get_cursor()\n try:\n cursor.execute('INSERT INTO employee(id, name, email, office, extra_info, picture_location, research_group, '\n 'title, is_external, is_admin, is_active) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s... | [
"0.8205563",
"0.7556254",
"0.74963003",
"0.74677837",
"0.74195415",
"0.71267223",
"0.7027136",
"0.68783706",
"0.6761403",
"0.6604914",
"0.6410982",
"0.63886535",
"0.6380282",
"0.6344615",
"0.6239359",
"0.6239359",
"0.6229492",
"0.6211725",
"0.618129",
"0.61335653",
"0.6131431... | 0.7959675 | 1 |
adds a role to an employee | def add_employeeRole(self, id, role):
cursor = self.dbconnect.get_cursor()
try:
cursor.execute('INSERT INTO employeeRoles values(%s,%s)',
(id, role))
# get id and return updated object
self.dbconnect.commit()
except(Exception, self.dbconnect.get_error()) as error:
self.dbconnect.rollback()
raise Exception('\nUnable to save EmployeeRole!\n(%s)' % (error)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_role():\n role = roles.find_or_create_role(request.values.get('role_name', ''))\n user = users.get_or_404(int(request.values.get('user_id', '')))\n if not users.add_role_to_user(user, role):\n return {}, 500\n return {}",
"def test_add_role(self):\n pass",
"def add_role(role):... | [
"0.7416667",
"0.73289865",
"0.72949153",
"0.72568375",
"0.7244213",
"0.71598387",
"0.7032163",
"0.699969",
"0.6978381",
"0.69690233",
"0.6907972",
"0.68849903",
"0.687573",
"0.6826044",
"0.6823985",
"0.6823678",
"0.67929417",
"0.67829245",
"0.6731767",
"0.6684479",
"0.6680996... | 0.80732065 | 0 |
gets al the roles of an employee | def get_employeeRoles(self, id):
cursor = self.dbconnect.get_cursor()
cursor.execute('select * from employeeRoles where employee=%s', (id,))
roles = list()
for row in cursor:
roles.append(row[1])
return roles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_roles(role):",
"def getRoles(self):",
"def getRoles(self):\n return [self.getRole(), {\"roleName\":\"policajti\", \"roleTitle\":\"Svestky\"}]",
"def roles(self):\n params = {\n \"f\" : \"json\"\n }\n uURL = self._url + \"/roles\"\n return self._con.get(path=u... | [
"0.7949602",
"0.77490324",
"0.7219508",
"0.7100693",
"0.70895886",
"0.70715743",
"0.6987245",
"0.6968574",
"0.6919542",
"0.6890405",
"0.6882044",
"0.6865154",
"0.6842712",
"0.67842984",
"0.67706275",
"0.67660475",
"0.6756659",
"0.673916",
"0.6718372",
"0.6637145",
"0.66315967... | 0.81541693 | 0 |
changes the data of an employee | def change_employee(self, employee):
cursor = self.dbconnect.get_cursor()
try:
if employee.id == None:
raise Exception('no id given')
cursor.execute('select * from employee where employeeID=%s', (str(employee.id),))
if cursor.rowcount == 0:
raise Exception('no employee found with that id')
cursor.execute(
'update employee set name= %s,email= %s,office= %s,title= %s,INTernORextern= %s,active= %s,promotor= %s where employeeID=%s',
(employee.name, employee.email, employee.office, employee.title,
employee.internOrExtern, employee.active, employee.promotor, employee.id))
self.dbconnect.commit()
except:
self.dbconnect.rollback()
raise Exception('unable to change employee') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_employee(self, obj):\n cursor = self.dbconnect.get_cursor()\n try:\n cursor.execute('UPDATE employee '\n 'SET name = %s, email = %s, office = %s, extra_info = %s, picture_location = %s, '\n 'research_group = %s, title = %s, is_... | [
"0.7302678",
"0.718177",
"0.7112663",
"0.7027216",
"0.7005247",
"0.68823713",
"0.6850561",
"0.67905223",
"0.6775437",
"0.6432232",
"0.6327525",
"0.6219686",
"0.61889017",
"0.6159903",
"0.61581737",
"0.6071851",
"0.60707927",
"0.597288",
"0.5945182",
"0.58981615",
"0.5867029",... | 0.7703579 | 0 |
get all the projects of an employee IMPORTANT not all fields will be completed only the fields in the project table and that of the activeYears | def get_employeeProjects(self, id):
from Project import Project
cursor = self.dbconnect.get_cursor()
cursor.execute('select project from projectpromotor where employee=%s', (id,))
projectsId = list()
for row in cursor:
projectsId.append(row[0])
projects = list()
for projId in projectsId:
cursor.execute('select * from project where projectID=%s',
(projId,)) # returns exactly one row from the table
row = cursor.fetchone()
project = Project(row[0], row[1], row[2], row[3])
cursor.execute('select year from projectYearConnection where projectID=%s', (projId,))
years = list()
for row in cursor:
years.append(row[0])
project.activeYear = years
projects.append(project)
return projects | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects():\n if current_user.get_id() is None:\n return\n with database.engine.begin() as connection:\n result = connection.execute(select(\n [models.projects.c.project_id, models.projects.c.name, models.projects.c.path, models.projects.c.creation_date, models.projects.c.use... | [
"0.6504841",
"0.6427155",
"0.6327203",
"0.6314313",
"0.6288553",
"0.62257266",
"0.62068164",
"0.6192607",
"0.6165686",
"0.6157085",
"0.6130755",
"0.61147606",
"0.61008775",
"0.60764706",
"0.60260594",
"0.60055494",
"0.5962676",
"0.5942284",
"0.5927183",
"0.58933854",
"0.58909... | 0.72116566 | 0 |
The Simple Moving Average (SMA) is calculated by adding the price of an instrument over a number of time periods and then dividing the sum by the number of time periods. The SMA is basically the average price of the given time period, with equal weighting given to the price of each period. Simple Moving Average SMA = ( Sum ( Price, n ) ) / n | def SimpleMovingAverage(self, timeperiod = 14):
return ta.SMA(self.data.close,timeperiod) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SMA(serie, n):\r\n\r\n return serie.rolling(window=n).mean()",
"def get_SMA(values, window=20):\n\treturn values.rolling(window, center=False).mean()",
"def sma(matrix, interval):\n\n # declare empty SMA numpy array\n s = np.zeros((matrix.shape[0] - interval))\n\n # calculate the value of each ... | [
"0.7370013",
"0.73070514",
"0.72123134",
"0.72123134",
"0.71889323",
"0.71044785",
"0.69947493",
"0.6878451",
"0.6826726",
"0.67439926",
"0.6694565",
"0.6685296",
"0.6657218",
"0.6633062",
"0.6631047",
"0.6587248",
"0.6556056",
"0.6541206",
"0.6492296",
"0.64602447",
"0.64139... | 0.8110601 | 0 |
Average True Range Is a lagging indicator, used to provide insights into volatility. | def AverageTrueRange(self, timeperiod = 14):
return ta.ATR(self.data.high, self.data.low, self.data.close, timeperiod) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_true_range(self, period=14):\n tr = self._true_range_computation(period=period * 2)\n return pd.Series(tr.rolling(center=False, window=period,\n min_periods=period - 1).mean(),\n name='{} day ATR Ticker: {}'.format(period,\n ... | [
"0.6600089",
"0.6148675",
"0.6051582",
"0.59976155",
"0.57290894",
"0.5724756",
"0.5678576",
"0.56369007",
"0.55565417",
"0.5463608",
"0.5455246",
"0.5452944",
"0.54398197",
"0.5430366",
"0.5412434",
"0.53751826",
"0.5327749",
"0.5327182",
"0.5326094",
"0.52998155",
"0.527575... | 0.6382062 | 1 |
Starting at the current column header, shift to the right col_shift times | def get_header(col_current, col_shift):
header = col_current
for i in range(col_shift):
header = header.right
return header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_column(self, coords, direction):\n self.shift_cells(self.get_column(coords, direction), direction)",
"def rollback(self) -> None:\n for k in self._moved_cols:\n self._cols[k].move_back()",
"def shift_right(self):\n self.pointer = (self.pointer + 1) % len(self.data)",
... | [
"0.6121716",
"0.59776706",
"0.5851196",
"0.5847812",
"0.57968843",
"0.5760453",
"0.566838",
"0.5658573",
"0.558538",
"0.5567467",
"0.5556038",
"0.5546835",
"0.55436087",
"0.5541556",
"0.5532854",
"0.5511011",
"0.5500459",
"0.5493521",
"0.5485904",
"0.54635084",
"0.5462295",
... | 0.69813544 | 0 |
Remove the specified column header from the header chain All rows that appear in this column are also removed | def remove_col(self, col_header):
# Remove the column header from the header chain
col_header.right.left = col_header.left
col_header.left.right = col_header.right
# Loop down through the column and remove the rows
cell = col_header.down
while cell != col_header:
row_cell = cell.right
# Move through all cells in this row and update their up/down links
while row_cell != cell:
row_cell.down.up = row_cell.up
row_cell.up.down = row_cell.down
row_cell.header.sum -= 1
# Move on to the next cell in the row
row_cell = row_cell.right
# Move on to the next row
cell = cell.down | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unremove_col(self, col_header):\n # Add the column head back into the chain\n col_header.right.left = col_header\n col_header.left.right = col_header\n # Loop up through the column and add the rows back in\n # Doing this in exactly the reverse order of the removing ensures th... | [
"0.7807759",
"0.7441563",
"0.71072763",
"0.67735565",
"0.6634205",
"0.6594297",
"0.6533182",
"0.6480123",
"0.6172724",
"0.6143548",
"0.6119587",
"0.6100099",
"0.60919523",
"0.6055784",
"0.60248214",
"0.60123044",
"0.60102904",
"0.5948839",
"0.5927248",
"0.5872746",
"0.5860796... | 0.80928975 | 0 |
Adds the specified column header back into the header chain Also adds all rows that this column removed back in | def unremove_col(self, col_header):
# Add the column head back into the chain
col_header.right.left = col_header
col_header.left.right = col_header
# Loop up through the column and add the rows back in
# Doing this in exactly the reverse order of the removing ensures that we return
# to the state we were in before the removal
cell = col_header.up
while cell != col_header:
row_cell = cell.left
# Move through all cells in this row and update their up/down links
while row_cell != cell:
row_cell.down.up = row_cell
row_cell.up.down = row_cell
row_cell.header.sum += 1
# Move on to the next cell in the row
row_cell = row_cell.left
# Move on to the next row
cell = cell.up | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_col(self, col_header):\n # Remove the column header from the header chain\n col_header.right.left = col_header.left\n col_header.left.right = col_header.right\n # Loop down through the column and remove the rows\n cell = col_header.down\n while cell != col_heade... | [
"0.71142775",
"0.6889686",
"0.65644413",
"0.6336859",
"0.608312",
"0.60671866",
"0.6046899",
"0.6015363",
"0.5942229",
"0.58050436",
"0.5728618",
"0.57080615",
"0.5686853",
"0.5644749",
"0.55979675",
"0.5594624",
"0.5594624",
"0.5585846",
"0.5558042",
"0.5540971",
"0.55384934... | 0.73550874 | 0 |
Find the column that has the minimum number of cells in it to minimize branching Returning a column with 0 cells in it is ok this gets dealt with in the solving loop | def get_minimum_column(self):
min_col = self.root.right
current_col = min_col.right
while current_col != self.root:
if current_col.sum < min_col.sum:
min_col = current_col
# Move on to the next column
current_col = current_col.right
return min_col | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_reduce_nb(col, a, *args):\n return np.nanmin(a)",
"def find_smallest(self):\n # add max value to covered rows and columns to ignore the covered cells\n maxval = self.C.max()\n C = self.C + self.row_cover[:, np.newaxis]*maxval\n C += self.col_cover*maxval\n # return t... | [
"0.6645709",
"0.6558186",
"0.64990723",
"0.6368767",
"0.63344336",
"0.6301566",
"0.6237791",
"0.6110719",
"0.60172206",
"0.60031587",
"0.59943664",
"0.59906703",
"0.5983194",
"0.59770536",
"0.5949309",
"0.5948226",
"0.59324056",
"0.592747",
"0.5884803",
"0.58845806",
"0.58685... | 0.69948006 | 0 |
This method swaps out the numpy instance in the module, should it have one, to the one in the fake instance we have here. | def _swap_numpy(self, module):
# Check to make sure this is not one of the string options from the YAML
if not isinstance(module, str):
if hasattr(module, 'numpy'): # Check if it has a self.numpy object
# TODO: Replace this with the correct variable
module.numpy = self.fake.numpy # Swap out with the class's instance of numpy
return module # Return out the mutated module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reference_to_array(self):\n arr = numpy.arange(0.0, 10.0, 0.1)\n arr = numpy.reshape(arr, (25, 4))\n vtk_arr = array_handler.array2vtk(arr)\n arr1 = array_handler.vtk2array(vtk_arr)\n # Now make sure these are using the same memory.\n arr[0][0] = 100.0\n s... | [
"0.60902596",
"0.58744705",
"0.5683738",
"0.5663783",
"0.5609355",
"0.5535437",
"0.5494269",
"0.54620075",
"0.54172635",
"0.5362005",
"0.5362005",
"0.5336442",
"0.5305379",
"0.530221",
"0.5182793",
"0.51734614",
"0.5172819",
"0.51510024",
"0.51288235",
"0.5113124",
"0.5095370... | 0.765654 | 0 |
This method injects in the providers to the faker instance. | def add_providers(self):
str_providers = PROVIDERS[0] # Providers, called by name
live_providers = PROVIDERS[1] # Providers, provided as a live module
for providers in PROVIDERS: # Iterate over the types of providers
for provider in providers: # Iterate over all the methods
# Inject those into faker, and swap the numpy instance
self.fake.add_faker(self._swap_numpy(provider[0]), provider[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, config: Config) -> None:\n self.config = config\n\n faker_config = self.config.faker\n self.faker = Faker(locale=faker_config.locale)\n\n self.fakes = {}",
"def setup_provider(self):\n pass",
"def add_providers_deped(self):\n # This gives direct acce... | [
"0.63692963",
"0.6351762",
"0.61550707",
"0.6035626",
"0.5997692",
"0.5795709",
"0.57771325",
"0.57227266",
"0.55226743",
"0.54858613",
"0.5434935",
"0.54322845",
"0.53593737",
"0.5339375",
"0.5336239",
"0.53179175",
"0.529026",
"0.5267008",
"0.52436227",
"0.52424914",
"0.520... | 0.77991426 | 0 |
Create a map of duplicates and probabilities according to a pdf, i.e. uniform and store for reuse on each original event current version taken directly from FEBRL needs review b/c number of duplicates stored starts at 2? | def generate_duplicate_pdf(self):
num_dup = 1
prob_sum = 0.0
prob_list = [(num_dup, prob_sum)]
max_dups = self.duplicate_cfg["Max_duplicate"]
uniform_val = 1.0 / float(max_dups)
for i in range(max_dups - 1):
num_dup += 1
prob_list.append((num_dup, uniform_val + prob_list[-1][1]))
return prob_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multinomial_pmf(sample, probabilities):\r\n # TODO\r\n a=[]\r\n b=[]\r\n i=0\r\n key_list=[]\r\n value_list=[]\r\n for key,value in sample.items():\r\n key_list.append(key)\r\n value_list.append(value)\r\n b=list(sample)\r\n while i< len(b):\r\n a.append(probabil... | [
"0.6266391",
"0.6231039",
"0.6222904",
"0.6209188",
"0.62075746",
"0.60514987",
"0.60154533",
"0.59842813",
"0.59767723",
"0.5969421",
"0.5939433",
"0.58987904",
"0.58945656",
"0.58854735",
"0.58664787",
"0.5817961",
"0.57828134",
"0.5771365",
"0.5759954",
"0.5755793",
"0.573... | 0.74976236 | 0 |
Determines whether original record will be duplicated Gets the maximum number of duplicated records to generate | def expect_duplicate(self):
# Reset everything for this record
self._expect_duplicate = False
self.__dupcntr = 0
self.__maxdup = 0
# Get the probability to generate duplicate for next record
if self.fake.random.random() < self.duplicate_cfg["Prob_duplicate"]:
self._expect_duplicate = True
self.__maxdup = self.random_select_ndups()
else:
self._expect_duplicate = False
self.__maxdup = 0
self.__logger.debug("expect_duplicate ndups: %d", self.__maxdup) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_duplicate(self):\n return bool(self.duplicated)",
"def isRepeated(self):\n return self._field.label == FieldDescriptor.LABEL_REPEATED",
"def is_duplicate(self, **kwargs):\n return len(list(self.c.select(**kwargs))) > 0",
"def process_duplicate_rows(self):\n pass",
"def is... | [
"0.675923",
"0.63455653",
"0.6291391",
"0.5996474",
"0.59781253",
"0.5973371",
"0.59171003",
"0.5903125",
"0.5873092",
"0.58724254",
"0.5841418",
"0.58190286",
"0.5798888",
"0.5789265",
"0.5784065",
"0.57638514",
"0.5761442",
"0.57307065",
"0.5723805",
"0.5719764",
"0.5711496... | 0.7407912 | 0 |
Generate the predictions of the original model on training and validation datasets. The original model is also trained if train = True. | def generate_original_preds(train = True):
x_train, y_train, x_val, y_val, id_to_word = load_data()
model = create_original_model()
if train:
filepath="models/original.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc',
verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]
model.fit(x_train, y_train, validation_data=(x_val, y_val),callbacks = callbacks_list, epochs=epochs, batch_size=batch_size)
model.load_weights('./models/original.hdf5',
by_name=True)
pred_train = model.predict(x_train,verbose = 1, batch_size = 1000)
pred_val = model.predict(x_val,verbose = 1, batch_size = 1000)
if not train:
print('The val accuracy is {}'.format(calculate_acc(pred_val,y_val)))
print('The train accuracy is {}'.format(calculate_acc(pred_train,y_train)))
np.save('data/pred_train.npy', pred_train)
np.save('data/pred_val.npy', pred_val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_predict(self):\n self.classifier = self.model\n self.classifier.fit(self.X_sample, self.y_sample)\n self.y_pred = self.classifier.predict(self.X_test)",
"def get_predictions(fitted_model_filename):\n click.echo(\"Mode: predicting probabilities.\\n\")\n defaults = get_defaults()... | [
"0.6959041",
"0.6904541",
"0.6858206",
"0.674883",
"0.6679141",
"0.65974444",
"0.654767",
"0.65204763",
"0.64544606",
"0.6438485",
"0.6437152",
"0.64298964",
"0.6410104",
"0.640449",
"0.640449",
"0.6369408",
"0.63413376",
"0.63313776",
"0.62701774",
"0.6262735",
"0.6240748",
... | 0.7165115 | 0 |
The managed object reference ID of the root resource pool for the cluster. | def resource_pool_id(self) -> str:
return pulumi.get(self, "resource_pool_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool_id ( self ):\n return self._pool_id",
"def managed_object_id(self):\n o = self._data[\"managed_object\"]\n if type(o) in (int, long):\n return o\n return o.id",
"def identity_pool_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"identity_pool_id\"... | [
"0.71896243",
"0.66001445",
"0.65141094",
"0.6471181",
"0.6368429",
"0.6354283",
"0.634698",
"0.6305942",
"0.62388986",
"0.62217504",
"0.6184611",
"0.61742735",
"0.61742735",
"0.61742735",
"0.61742735",
"0.61742735",
"0.61529875",
"0.6127469",
"0.6123672",
"0.61147434",
"0.61... | 0.74713767 | 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 through the `ResourcePool` data source. > You may also wish to see the `ComputeCluster` resource for more information about clusters and how to managed the resource in this provider. Example Usage ```python import pulumi import pulumi_vsphere as vsphere datacenter = vsphere.get_datacenter(name="dc01") compute_cluster = vsphere.get_compute_cluster(name="cluster01", datacenter_id=datacenter.id) ``` | 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
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
__ret__ = pulumi.runtime.invoke('vsphere:index/getComputeCluster:getComputeCluster', __args__, opts=opts, typ=GetComputeClusterResult).value
return AwaitableGetComputeClusterResult(
datacenter_id=pulumi.get(__ret__, 'datacenter_id'),
id=pulumi.get(__ret__, 'id'),
name=pulumi.get(__ret__, 'name'),
resource_pool_id=pulumi.get(__ret__, 'resource_pool_id')) | {
"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 |
Test addition for Complex with Complex, complex, int and float | def test_add():
z = Complex(1, -2)
w = Complex(1, 1)
assert (z + w) == Complex(2, -1)
assert (z + (1+1j)) == Complex(2, -1)
assert (z + 2) == Complex(3, -2)
assert (z + 2.0) == Complex(3, -2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complex_sum(c_1,c_2):\n return c_1 + c_2",
"def _cmplx_add_ ( s , o ) :\n return o + complex ( s )",
"def __add__(self, other):\n if isinstance(other, float) or isinstance(other, int):\n return Complex(self._reNum + other, self._imNum)\n if isinstance(other, complex):\... | [
"0.76475245",
"0.7613455",
"0.73216003",
"0.7232131",
"0.7204029",
"0.7114866",
"0.6915121",
"0.69098693",
"0.6900085",
"0.6607692",
"0.6509762",
"0.6498399",
"0.6357027",
"0.6335295",
"0.63045627",
"0.6205945",
"0.61870325",
"0.6182034",
"0.6174292",
"0.6170315",
"0.61585486... | 0.81614006 | 0 |
Test subtraction for Complex with Complex, complex, int and float | def test_sub():
z = Complex(1, -2)
w = Complex(1, 1)
assert (z - w) == Complex(0, -3)
assert (z - (1+1j)) == Complex(0, -3)
assert (z - 2) == Complex(-1, -2)
assert (z - 2.0) == Complex(-1, -2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complex_difference(c_1,c_2):\n return c_1 - c_2",
"def _cmplx_sub_ ( s , o ) :\n return (-o ) + complex ( s )",
"def complex(real, imag):",
"def __sub__(self,other):\n\t\treal = self.realPart - other.realPart\n\t\timaginary = self.imaginaryPart - other.imaginaryPart\n\n\t\t#create and retu... | [
"0.73002094",
"0.69852185",
"0.6779295",
"0.6768346",
"0.6679916",
"0.6596779",
"0.6549099",
"0.64673406",
"0.6422183",
"0.6415886",
"0.63986313",
"0.628705",
"0.6265425",
"0.62318534",
"0.61975026",
"0.6182748",
"0.6176905",
"0.6081503",
"0.60485506",
"0.6047534",
"0.6038145... | 0.75719965 | 0 |
Compute LDA model & find perplexity, save topics list for coherence calc | def lda_models(doc_term_matrix, n_topics, vectorizer, rand_start):
perplexity_values = []
lda_time = []
topics_list = []
i = rand_start
for num_topics in n_topics:
# create model
t1 = time.time()
lda_model = LatentDirichletAllocation(n_components=num_topics, doc_topic_prior = 1/num_topics,
topic_word_prior=0.1, n_jobs=39, random_state = i)
lda_model.fit_transform(doc_term_matrix)
t2 = time.time()
lda_time.append(t2-t1)
print(f" Model time: {t2-t1}", flush = True)
# compute perplexity
perplexity_values.append(lda_model.bound_)
# create list of topics
topics = list_topics(lda_model.components_, vectorizer, top_n=10)
topics_list.append(topics)
# output completion message
i = i+1
print('Number of topics =', num_topics, "complete.", flush = True)
return perplexity_values, lda_time, topics_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_lda_model(self):\n self.id2word = corpora.Dictionary(self.documents)\n self.id2word.filter_extremes(no_below=20, no_above=0.5)\n corpus = [self.id2word.doc2bow(text) for text in self.documents]\n coherence_c_v = []\n coherence_u_mass = []\n print(\"Fitting models\"... | [
"0.7421184",
"0.73544043",
"0.72307",
"0.7002529",
"0.6943727",
"0.673741",
"0.6723259",
"0.6671794",
"0.6657565",
"0.6648194",
"0.6644296",
"0.66000706",
"0.6559571",
"0.6551705",
"0.65513426",
"0.65454745",
"0.6489818",
"0.64809227",
"0.6480784",
"0.6443412",
"0.63931346",
... | 0.744949 | 0 |
Workaround manage.py migrate complications run syncdb in case it's our first run, so we make sure south_migrationhistory table is created run migrate to apply latest migrations run syncdb again to populate contrib.auth.models | def smart_syncdb_migrate(self):
local('python manage.py syncdb')
local('python manage.py migrate')
local('python manage.py syncdb --all') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate():\n puts(yellow(\"Run South migrations\"))\n django_manage('migrate')",
"def post_migrations(self):",
"def migrate(self):\n\tpass",
"def syncdb():\n with virtualenv():\n run('python manage.py syncdb --noinput')\n run('python manage.py migrate')",
"def update_db():\r\n ... | [
"0.7362598",
"0.7175394",
"0.6962745",
"0.67925906",
"0.66853064",
"0.665665",
"0.66325575",
"0.65849835",
"0.6555793",
"0.65435",
"0.6471299",
"0.6459678",
"0.6422288",
"0.6384289",
"0.63629246",
"0.6273245",
"0.615992",
"0.61169046",
"0.6091286",
"0.60912824",
"0.60731256",... | 0.7330435 | 1 |
ssum([1,2,3]) 6 ssum([2,3]) 5 ssum([3]) 3 ssum([]) 0 | def ssum(L: list) -> int:
return 0 if not L else L[0]+ssum(L[1:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_sum(list):\n if not list:\n return 0\n else:\n return sum(list)",
"def sum_unique(l):\n pass",
"def sum_of_squares(seq):\n if len(seq) == 0:\n return 0\n else:\n result = 0\n for num in seq:\n result += num ** 2\n return result",
"d... | [
"0.6345257",
"0.62525344",
"0.6204409",
"0.61191237",
"0.6101727",
"0.6077421",
"0.60648704",
"0.60515577",
"0.60255706",
"0.5993455",
"0.5983791",
"0.5964002",
"0.5958428",
"0.594942",
"0.5904664",
"0.5882846",
"0.5862508",
"0.5862386",
"0.5833747",
"0.582293",
"0.58177805",... | 0.7876537 | 0 |
print_stars(5) \n\n\n\n\n print_stars(4) \n\n\n\n print_stars(3) \n\n\n print_stars(2) \n\n print_stars(1) \n print_stars(0) '' | def print_stars(N: int) -> str:
# if N:
# return f'*\n{print_stars(N-1)}'
# return ''
return '' if not N else f'*\n{print_stars(N-1)}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_stars():\n for i in range(2):\n for j in range(35):\n print(\"*\", end = '')\n print('')",
"def star():\n print('*', end='')",
"def starry_box(phrase):\n numStars = len(phrase) + 4\n print '*' * numStars\n print '*', phrase, '*'\n print '*' * num... | [
"0.78595215",
"0.7326586",
"0.6608579",
"0.66084236",
"0.64868563",
"0.6461798",
"0.62855875",
"0.6244473",
"0.6224193",
"0.621459",
"0.61932653",
"0.61023444",
"0.6071811",
"0.59977406",
"0.5921401",
"0.5901315",
"0.58597124",
"0.5856981",
"0.58483934",
"0.5816308",
"0.57875... | 0.8280417 | 0 |
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 |
Extract metadata like original image name and crop position from the given file name. Change this function to use a different file name pattern. | def get_metadata_from_filename(file_name: str) -> namedtuple:
if os.path.isabs(f):
file_name = os.path.basename(file_name)
original_image_name = file_name.split('-')[0]
x_pos = int(file_name.split('.')[-2].split('+')[-2:][0])
Metadata = namedtuple('Metadata', ['original_image_name', 'x_pos'])
return Metadata(original_image_name, x_pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseFilename(fileName):\n # regex to match names like Axis-BaldCA_2018-05-29T16_02_30_129496.jpg\n # and bm-n-mobo-c__2017-06-25z11;53;33.jpg\n regexExpanded = '([A-Za-z0-9-_]+[^_])_+(\\d{4}-\\d\\d-\\d\\d)T(\\d\\d)[_;](\\d\\d)[_;](\\d\\d)'\n # regex to match diff minutes spec for subtracted images... | [
"0.7071573",
"0.66357124",
"0.64707863",
"0.6266383",
"0.61719465",
"0.6033898",
"0.600292",
"0.59774214",
"0.59133536",
"0.5879702",
"0.5877382",
"0.5843988",
"0.5837125",
"0.5832479",
"0.58029586",
"0.57413375",
"0.5720259",
"0.57090443",
"0.5669945",
"0.5668011",
"0.564875... | 0.6781023 | 1 |
Insert the crop represented by file_name into this image. | def insert(self, file_path: str, annot_type: str) -> None:
if self._valid_file_name_regex.match(os.path.basename(file_path)) is None:
raise ValueError(f'Illegal file name: {os.path.basename(file_path)}')
x_pos = get_metadata_from_filename(file_path).x_pos
if x_pos in self._x_positions:
col = self._cols[x_pos]
else:
col = Column()
self._x_positions.append(x_pos)
self._x_positions.sort()
col.insert(Crop(file_path, annot_type))
self._cols[x_pos] = col
self.n_cols = len(self._cols) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_current(self, image_name):\n # Sets the position of the crop\n self.j ,self.i = 0, 0\n\n # loads the image\n self.image = convert2int(tifffile.imread(image_name)).astype(numpy.float32)\n\n # Computes the number of crops in x and y\n self.ny = numpy.ceil(self.image.... | [
"0.60004956",
"0.5452988",
"0.53952855",
"0.53464556",
"0.53207326",
"0.52505255",
"0.5239172",
"0.518678",
"0.5163597",
"0.5147501",
"0.5141308",
"0.513236",
"0.5121384",
"0.5045127",
"0.5008329",
"0.50027025",
"0.49967998",
"0.4968934",
"0.49625248",
"0.4922145",
"0.4885444... | 0.56664383 | 1 |
Remove unlabelled columns in [startcol_width, end+col_width]. | def _remove_overlaps(start, end) -> int:
start = self._x_positions[start % self.n_cols]
end = self._x_positions[int(end) % self.n_cols]
n_removed = 0
for x, col in self._cols.items():
if start - self.col_width <= x <= start or end <= x <= end + self.col_width:
if col.label is None:
n_removed += col.mark_as('ignore')
return n_removed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cols_drop():",
"def CleanUp(self):\n blankColumnPattern = re.compile('^-*$')\n blankColumns = []\n for columnIndex in range(self.alignment.get_alignment_length() - 1):\n columnValues = self.alignment[:,columnIndex]\n match = blankColumnPattern.search(columnValue... | [
"0.6347648",
"0.60383844",
"0.5991607",
"0.5967662",
"0.57150346",
"0.56798846",
"0.5672258",
"0.5656547",
"0.56305486",
"0.5617258",
"0.55419534",
"0.5483048",
"0.54566985",
"0.54525024",
"0.5401275",
"0.5390643",
"0.5390326",
"0.5388381",
"0.53292286",
"0.53068745",
"0.5285... | 0.67192227 | 0 |
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 |
Move the file associated with this crop to the directory path/annot_type, where annot_type is this crop's annotation type. | def move_to(self, path: str) -> None:
self._new_path = os.path.join(path, self.annot_type, os.path.basename(self._file_path))
os.rename(self._file_path, self._new_path)
self._file_was_moved = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveFile(self, srcPath):\n # Gets the classification for the file type of the path moved\n classification = self.classifyFile(srcPath)\n\n if classification:\n # Gets the output path given the file type\n newPath = self.outPaths[classification][\"outPath\"] + srcPath.... | [
"0.6297892",
"0.5993658",
"0.58924556",
"0.58497065",
"0.574657",
"0.5685253",
"0.5554716",
"0.544296",
"0.5296529",
"0.5167809",
"0.5167291",
"0.51232123",
"0.5116003",
"0.51118386",
"0.5106717",
"0.50523245",
"0.5047933",
"0.50246215",
"0.50095254",
"0.5005804",
"0.49968418... | 0.7432932 | 0 |
Undo a former file movement by moving the file back to its origin. | def move_back(self) -> None:
if self._file_was_moved:
os.rename(self._new_path, self._file_path)
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undo(backup):\r\n backup.load_backup()\r\n backup.undo_moves()",
"def undo():\n\n try:\n my_file.undo()\n except FileNotFoundError:\n print('No file has been read yet')\n except Exception:\n print('You must make an edit to undo')",
"def undo():",
"def undo_moves(self):... | [
"0.6898709",
"0.6796202",
"0.67440903",
"0.66569364",
"0.6606794",
"0.6522146",
"0.6483597",
"0.6466735",
"0.6456174",
"0.6436866",
"0.64312315",
"0.6424864",
"0.63239264",
"0.62896913",
"0.62687606",
"0.61865735",
"0.6161903",
"0.614128",
"0.6138943",
"0.6126032",
"0.6055876... | 0.7445615 | 0 |
Mark this column with the provided label. Returns number of labelled crops. | def mark_as(self, label: str) -> int:
self.label = label
return len(self._content) // len(ANNOTATIONS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit(self, label=None):\n self.labels[label] += 1",
"def label_index(self, label: Text) -> int:\n count = 0\n for l in self.le.classes_:\n if(l == label):\n return count\n count += 1",
"def get_count_by_label(self, label=None):\n if label is N... | [
"0.6160278",
"0.6008114",
"0.5806169",
"0.54976237",
"0.5418939",
"0.5353223",
"0.5351463",
"0.5350682",
"0.52923065",
"0.5270436",
"0.52658045",
"0.52610487",
"0.52374464",
"0.5227169",
"0.5211575",
"0.5198103",
"0.51884943",
"0.5185271",
"0.51499337",
"0.5137268",
"0.510938... | 0.6514316 | 0 |
Move all files of this column to the corresponding directory, if this column is not labeled to be ignored. Returns number of files moved. | def move(self, dry_run: bool) -> int:
if self.label == 'ignore':
return 0
file_counter = 0
for crop in self._content:
if not dry_run:
crop.move_to(self.label)
file_counter += 1
return file_counter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_disk(self, dry_run: bool) -> int:\n file_counter = 0\n for k, col in self._cols.items():\n self._moved_cols.append(k)\n file_counter += col.move(dry_run=dry_run)\n return file_counter",
"def organizeDir(self):\n # Classify every file in dir\n for fi... | [
"0.6540349",
"0.6040318",
"0.59826165",
"0.5923412",
"0.5619923",
"0.55904424",
"0.5581633",
"0.54979753",
"0.54583585",
"0.5416308",
"0.53824425",
"0.53258795",
"0.5291548",
"0.52602667",
"0.52368546",
"0.5232204",
"0.52239007",
"0.52128977",
"0.52018017",
"0.5200375",
"0.51... | 0.6531521 | 1 |
Create metrics of gauge type for filesystem replica link lag, with the local filesystem name, replication direction, remote array name, remote filesystem name and replication status as labels. | def _replica_links_lag(self):
for f in self.fb.get_filesystem_replica_links():
self.replica_links_lag.add_metric([f.local_file_system.name,
f.direction,
f.remote.name,
f.remote_file_system.name,
f.status], -1 if f.lag is None else f.lag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_metrics():\n p = os.path.join(os.sep, \"mnt\", \"glusterfs\")\n mount_stats = os.statvfs(p)\n # block size * total blocks\n total_space = mount_stats.f_blocks * mount_stats.f_bsize\n free_space = mount_stats.f_bfree * mount_stats.f_bsize\n # capsize only operates on i64 values\n us... | [
"0.5539488",
"0.5088195",
"0.507494",
"0.5027533",
"0.49304163",
"0.4900687",
"0.4889911",
"0.47771588",
"0.47663313",
"0.47630692",
"0.47085527",
"0.46948",
"0.46515706",
"0.45758998",
"0.45718196",
"0.4553225",
"0.45504344",
"0.45424002",
"0.453815",
"0.45122313",
"0.451044... | 0.5900812 | 0 |
Builds and sends an embed message with new commits information. | async def process_push_hook(push: models.PushHook):
repository = push.repository
project = push.project
commit_str = "commit" if push.total_commits_count == 1 else "commits"
# Show link to commit compare if there's more than one commit
if push.total_commits_count > 1:
embed_url = f"{repository.homepage}/compare/{push.before[:7]}...{push.after[:7]}"
else:
embed_url = f"{repository.homepage}/commit/{push.after[:7]}"
if push.before == EMPTY_COMMIT:
embed = discord.Embed(title=f"[{project.namespace}/{project.name}] New branch created {push.branch}",
url=embed_url, colour=discord.Colour.light_grey())
embed.set_author(name=push.user_name, icon_url=push.user_avatar)
await send_message(None, embed=embed, avatar_url=push.project.avatar_url)
elif push.after == EMPTY_COMMIT:
embed = discord.Embed(title=f"[{project.namespace}/{project.name}] Branch deleted {push.branch}",
url=embed_url, colour=discord.Colour.light_grey())
embed.set_author(name=push.user_name, icon_url=push.user_avatar)
await send_message(None, embed=embed, avatar_url=push.project.avatar_url)
# If there are no commits, do not show a message
if not push.total_commits_count:
return
embed = discord.Embed(title=f"[{project.namespace}/{project.name}:{push.branch}] "
f"{push.total_commits_count} new {commit_str}",
url=embed_url, colour=discord.Colour.blurple())
embed.set_author(name=push.user_name, icon_url=push.user_avatar)
embed.description = ""
for commit in push.commits:
message = commit.message.splitlines()[0]
embed.description += f"[`{commit.id[:7]}`]({commit.url}) {message} - {commit.author.name}\n"
print("Sending push message")
await send_message(None, embed=embed, avatar_url=push.project.avatar_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command(self, bot, comm, groups):\n commit_message = self.plugin.get_commit_message()\n bot.reply(comm, u'{user}: {msg}', kwvars={'msg': commit_message})",
"def _generate_commit(\n self, msg: Optional[str] = None, author: Optional[str] = None\n ) -> dict:\n if author:\n... | [
"0.5981543",
"0.5900061",
"0.58865404",
"0.5829465",
"0.5829347",
"0.58225244",
"0.5794675",
"0.5761677",
"0.5699984",
"0.56958634",
"0.5648896",
"0.5571014",
"0.5564511",
"0.5560195",
"0.5509813",
"0.550364",
"0.54569304",
"0.54245734",
"0.5418751",
"0.5418156",
"0.53992987"... | 0.6393245 | 0 |
Builds and sends an embed message with notes information. | async def process_note_hook(data: models.NoteHook):
note = data.note
user = data.user
project = data.project
colour = discord.Colour.greyple()
embed = discord.Embed(url=note.url, description=note.description, colour=colour)
embed.set_author(name=user.username, icon_url=user.avatar_url)
if data.issue:
issue = data.issue
embed.title = f"[{project.namespace}/{project.name}] New comment on issue #{issue.iid}: {issue.title}"
if data.commit:
commit = data.commit
embed.title = f"[{project.namespace}/{project.name}] New comment on commit `{commit.id[:7]}`"
if data.merge_request:
merge = data.merge_request
embed.title = f"[{project.namespace}/{project.name}] New comment on merge request !{merge.iid}: {merge.title}"
await send_message(None, embed=embed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed():",
"async def note(self, ctx):\n note_embed = discord.Embed(color=discord.Color.blurple())\n note_embed.add_field(name=\"__**Please Note**__\", value=RULES_NOTE)\n await ctx.send(embed=note_embed)",
"async def _create_embed(self, event, info):\n\n e = discord.Embed(url=i... | [
"0.653712",
"0.6195667",
"0.5904277",
"0.59017",
"0.58894485",
"0.58441114",
"0.5828449",
"0.5747832",
"0.5732143",
"0.57031065",
"0.5664874",
"0.56358755",
"0.55843145",
"0.5578333",
"0.55621606",
"0.5557521",
"0.55531627",
"0.5505942",
"0.54942673",
"0.54742163",
"0.5460713... | 0.63638 | 1 |
Builds and sends an embed message with merge request information. | async def process_merge_request_hook(data: models.MergeRequestHook):
project = data.project
merge = data.merge_request
user = data.user
description = ""
action = "Issue updated"
colour = discord.Colour.light_grey()
if merge.action == "open":
action = "Merge request opened"
description = merge.description
colour = discord.Colour.dark_green()
elif merge.action == "close":
action = "Merge request closed"
colour = discord.Colour.dark_grey()
embed = discord.Embed(title=f"[{project.namespace}/{project.name}] {action}: !{merge.iid} {merge.title}",
url=merge.url, description=description, colour=colour)
embed.set_author(name=user.username, icon_url=user.avatar_url)
embed.set_footer(text=f"{merge.source_branch} → {merge.target_branch}")
await send_message(None, embed=embed) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_commit_msg(author, reviewers, source_branch, target_branch,\n commit_message, mp_web_link):\n return \"Merge {} into {} [a={}] [r={}]\\n\\n{}\\n\\nMP: {}\".format(\n source_branch, target_branch, author,\n reviewers, commit_message, mp_web_link)",
"def build_embed(s... | [
"0.5688839",
"0.51731527",
"0.514443",
"0.5102154",
"0.50153357",
"0.5012565",
"0.4874328",
"0.48101324",
"0.47793704",
"0.46545884",
"0.46417007",
"0.46417007",
"0.46417007",
"0.4641089",
"0.46038324",
"0.45967078",
"0.45881125",
"0.4585066",
"0.45759517",
"0.4558107",
"0.45... | 0.6398354 | 0 |
Function that represents the window which Character Mods can be applied. | def chars_window():
path_dir = r'Sor_Mods_Storage\chars'
char_mods_dict = sor_module.list_char_mods(path_dir=path_dir)
# Loading Images to screen
chars = tk.Toplevel()
mainTitleImg = ImageTk.PhotoImage(Image.open(r'img/axel_daniel2221.png'))
imgRandom_label = tk.Label(chars, image=mainTitleImg)
title = tk.Label(chars, text="Characters Mods")
comboBox_chars = ttk.Combobox(chars, values=list(char_mods_dict.keys()))
def apply_char_mod():
char_selected = comboBox_chars.get()
result_window = tk.Toplevel()
value = ''
if char_selected == '':
value = f'{value} Please Select an Mod to Apply!'
else:
sor_module.apply_mod(mod_dir=path_dir, mod=char_selected, type='chars')
value = f'Character Mod {char_selected} applied!'
result_label = tk.Label(result_window, text=value)
result_label.pack()
btn_apply = tk.Button(chars, text='Apply', command=apply_char_mod)
title.grid(row=0, column=0)
comboBox_chars.grid(row=1, column=0)
imgRandom_label.grid(row=1, column=1)
btn_apply.grid(row=2, column=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window_function(self):\n return self._wndfnc, self._wndfnc_norm",
"def get_window(self): # real signature unknown; restored from __doc__\n pass",
"def _get_window_width(self):",
"def modifiers_coding_map_creator(self):\n self.mapCreatorWindow = map_creator.ModifiersMapCreatorWindow()... | [
"0.60196453",
"0.5610308",
"0.5482973",
"0.5434321",
"0.5421594",
"0.5412486",
"0.5364167",
"0.5364138",
"0.5340363",
"0.5302406",
"0.530197",
"0.5284308",
"0.5282597",
"0.5280957",
"0.52492845",
"0.52104515",
"0.517051",
"0.5156331",
"0.5152639",
"0.51405567",
"0.51250046",
... | 0.65728295 | 0 |
Function that represents the window which Enemy Mods can be applied. | def enemy_window():
path_dir = r'Sor_Mods_Storage\enemies'
enemy_mods_dict = sor_module.list_char_mods(path_dir=path_dir)
# Loading Images to screen
enemies = tk.Toplevel()
mainTitleImg = ImageTk.PhotoImage(Image.open(r'img/axel_daniel2221.png'))
imgRandom_label = tk.Label(enemies, image=mainTitleImg)
title = tk.Label(enemies, text="Enemies Mods")
comboBox_enemies = ttk.Combobox(enemies, values=list(enemy_mods_dict.keys()))
def apply_enemy_mod():
char_selected = comboBox_enemies.get()
result_window = tk.Toplevel()
value = ''
if char_selected == '':
value = f'{value} Please Select an Mod to Apply!'
else:
sor_module.apply_mod(mod_dir=path_dir, mod=char_selected, type='enemies')
value = f'Enemy Mod {char_selected} applied!'
result_label = tk.Label(result_window, text=value)
result_label.pack()
btn_apply = tk.Button(enemies, text='Apply', command=apply_enemy_mod)
title.grid(row=0, column=0)
comboBox_enemies.grid(row=1, column=0)
imgRandom_label.grid(row=1, column=1)
btn_apply.grid(row=2, column=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window(self): # real signature unknown; restored from __doc__\n pass",
"def get_main_window():\n\n pass",
"def createGameWindow():\n gameWindow = g.GraphWin(\"game\", 450, 800) #Window to show game\n\n return gameWindow",
"def maya_window():\n return to_qwidget(\"MayaWindow\")",
... | [
"0.64761674",
"0.63803315",
"0.6314744",
"0.6216543",
"0.62010247",
"0.6149478",
"0.60766095",
"0.60618967",
"0.6037659",
"0.60210836",
"0.60210836",
"0.600711",
"0.6003741",
"0.5992173",
"0.59492654",
"0.58889663",
"0.58503634",
"0.57341456",
"0.56976503",
"0.56692207",
"0.5... | 0.678502 | 0 |
Function that represents the window which Stage Mods can be applied. | def stage_window():
path_dir = r'Sor_Mods_Storage\stages'
stage_mods_dict = sor_module.list_char_mods(path_dir=path_dir)
# Loading Images to screen
stages = tk.Toplevel()
mainTitleImg = ImageTk.PhotoImage(Image.open(r'img/axel_daniel2221.png'))
imgRandom_label = tk.Label(stages, image=mainTitleImg)
title = tk.Label(stages, text="Stage Mods")
comboBox_chars = ttk.Combobox(stages, values=list(stage_mods_dict.keys()))
def apply_stage_mod():
stage_selected = comboBox_chars.get()
result_window = tk.Toplevel()
value = ''
if stage_selected == '':
value = f'{value} Please Select an Stage Mod to Apply!'
else:
sor_module.apply_mod(mod_dir=path_dir, mod=stage_selected, type='stages')
value = f'Enemy Mod {stage_selected} applied!'
result_label = tk.Label(result_window, text=value)
result_label.pack()
btn_apply = tk.Button(stages, text='Apply', command=apply_stage_mod)
title.grid(row=0, column=0)
comboBox_chars.grid(row=1, column=0)
imgRandom_label.grid(row=1, column=1)
btn_apply.grid(row=2, column=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window(self): # real signature unknown; restored from __doc__\n pass",
"def get_main_window():\n\n pass",
"def GetWindow(self):\r\n\r\n return self.window",
"def window(self):\n return self._window",
"def window(self):\n return self._window",
"def showWindow(*args, ... | [
"0.6928395",
"0.684634",
"0.6601684",
"0.6564466",
"0.6564466",
"0.64463425",
"0.6378235",
"0.6353312",
"0.6351047",
"0.629362",
"0.62887776",
"0.6145612",
"0.6136457",
"0.6110733",
"0.60973674",
"0.6074384",
"0.6053072",
"0.6018539",
"0.59742665",
"0.5963318",
"0.59591293",
... | 0.6935589 | 0 |
delete the specified intentfrom your account. | def delete_intent(intent_name):
try:
client.get_intent(
name=intent_name,
versionOrAlias='$LATEST'
)
answer=raw_input("Do you want to delete %s from your account(Y/y for YES, other NO):" %(intent_name))
if answer in ['Y', 'y']:
client.delete_intent(
name=intent_name
)
print "You chose to delete the intent %s, deleted..." %(intent_name)
else:
print "You chose not to delete the inten t%s, exiting..." %(intent_name)
except:
print "There is no intent called %s, exiting..." %(intent_name)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_account(self, account):\n \n pass",
"def delete(self, args):\n try:\n db = get_db('intents')\n intents = db.delete_intent(args['intent'])\n resp = jsonify(intents=intents)\n resp.status_code = 200\n return resp\n except... | [
"0.7136622",
"0.7109074",
"0.6793135",
"0.6618114",
"0.6454273",
"0.6342631",
"0.63189256",
"0.62924826",
"0.6259348",
"0.6142261",
"0.6112738",
"0.60232806",
"0.5955118",
"0.59354204",
"0.5897123",
"0.58737737",
"0.5854009",
"0.5853782",
"0.5827274",
"0.5824352",
"0.57835615... | 0.7211831 | 0 |
demo function to get the intent's latest configuration | def get_intent_configuration(intent_name, version ="$LATEST"):
response=client.get_intent(
name=intent_name,
version=version
)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config():\n return CONFIG",
"def getConfig(self):\n pass",
"def config(self) -> \"AutomationConfig\":",
"def config(self) -> \"AutomationConfig\":",
"def get_config(self,config):\n return self.parser.get(\"main\", config)",
"def get_details(self):\n return self.__config_da... | [
"0.6338923",
"0.6251342",
"0.61532223",
"0.61532223",
"0.6144978",
"0.60848004",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
"0.6024894",
... | 0.73107255 | 0 |
a help function to print the intentinformation in format | def format_print_jobs(intent):
print "\nintentName: %s" %(intent['name'])
for k,v in intent.iteritems():
if k <> 'name':
print "\t" + str(k) + ": " + str(v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printhelp():",
"def info(self):",
"def info(self):",
"def details(self) -> str:\n return f\"- **language**: [{self.language}]\\n\" \\\n f\"- **opengame**: [{self.opengame}]\\n\" \\\n f\"- **system**: [{self.system}]\\n\" \\\n f\"- **mode**: [{self.mode}]\\... | [
"0.64891857",
"0.64813703",
"0.64813703",
"0.6405768",
"0.6331518",
"0.6306247",
"0.62967855",
"0.6288361",
"0.6245361",
"0.6203289",
"0.61881757",
"0.617994",
"0.6178175",
"0.6174316",
"0.6146131",
"0.614331",
"0.6139111",
"0.61244285",
"0.6111058",
"0.60988563",
"0.60816693... | 0.6709204 | 0 |
Crawls all requested bug data and bug ids. Saves them in files (bugIDListP.pickle, bugIDList.csv, bugsData.txt ) and/or Mongo DB collections (BugIDs, BugsData) depending if they are given at initialization. | def get_all_bugs(self) -> List:
#starting point
offset = 0
#list for all bugs
resultBugList = []
#list for bug IDs
bugIDList = []
#checks if there are still results returned
notEmpty = True
#queries in 500 bug steps until the result list is empty
while notEmpty:
print("entered")
#interpretation of result as list plus formatting for eval errors
result = ast.literal_eval(self.session.get(self.bugURL + "&offset=" + str(offset)).text.
replace('true', 'True').replace('false', 'False').replace('null', 'None'))["bugs"]
#checks if the query needs to be set again with a new offset
if result:
resultBugList += result
else:
notEmpty = False
#gets the ID out of all comments
partList = [bug["id"] for bug in result]
bugIDList += partList
#sets new starting point
offset += 500
#inserts bug ids and bugs into db if given one
if self.mongoDB:
for id in bugIDList:
self.mongoDB["BugIDs"].insert_one({"ID": id})
self.mongoDB["BugsData"].insert_many(resultBugList)
#creates files for bug ids and bugs if given a folder
if self.folder:
#saves bug list as python object
with open(self.folderpath + "bugIDListP.pickle", "wb") as a:
pickle.dump(bugIDList, a)
#saves bug list as csv
with open(self.folderpath + "bugIDList.csv", "w") as b:
for id in bugIDList:
b.write(str(id) + "\n")
with open(self.folderpath + "bugsData.txt", "w") as c:
for bug in resultBugList:
c.write(str(bug) + "\n")
#returns List Object for further processing
return(bugIDList) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_comments(self, idList: Union[List, str]) -> None:\n\n #loads pickle list if it is one\n if type(idList) == str and \".pickle\" in idList:\n print(\"pickle load\")\n with open(idList, \"rb\") as f:\n idList = pickle.load(f)\n elif type(idList) ==... | [
"0.6098931",
"0.581118",
"0.58095926",
"0.5599205",
"0.55810404",
"0.55514055",
"0.5436911",
"0.5393213",
"0.5392565",
"0.52618045",
"0.5231558",
"0.52075624",
"0.519109",
"0.514051",
"0.5135371",
"0.5125481",
"0.5122285",
"0.50928766",
"0.50890225",
"0.50798535",
"0.50633335... | 0.7346313 | 0 |
Crawls for all comments belonging to the bugs in the BugIDList. | def get_all_comments(self, idList: Union[List, str]) -> None:
#loads pickle list if it is one
if type(idList) == str and ".pickle" in idList:
print("pickle load")
with open(idList, "rb") as f:
idList = pickle.load(f)
elif type(idList) == str:
print("Error: Buglist parameter seems to be neither a List object or the name of a pickle file "
"(needs to contain .pickle).")
#goes through idList
for id in tqdm(idList):
#performs request and replaces trouble some parts
commentsString = self.session.get(self.commentURL.format(id)).text.\
replace('true', 'True').replace('false', 'False').replace('null', 'None')
#gets only the comments
commentsDict = ast.literal_eval(commentsString)["bugs"][str(id)]["comments"]
#enters comments into db or file if there are any comments for the id
if commentsDict:
if self.mongoDB:
self.mongoDB["Comments"].insert_many(commentsDict)
if self.folder:
with open(self.folderpath + "Bugzilla_Comments.txt", 'a') as f:
f.write(str(commentsDict) + "\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_bugs(self) -> List:\n #starting point\n offset = 0\n #list for all bugs\n resultBugList = []\n #list for bug IDs\n bugIDList = []\n #checks if there are still results returned\n notEmpty = True\n\n #queries in 500 bug steps until the result... | [
"0.64830816",
"0.6414829",
"0.64109683",
"0.6044062",
"0.5997073",
"0.5927429",
"0.5870754",
"0.58518946",
"0.57999045",
"0.5750483",
"0.5748707",
"0.5685098",
"0.5681446",
"0.5678411",
"0.5673924",
"0.56592536",
"0.5652936",
"0.5610223",
"0.5589951",
"0.55766493",
"0.5568257... | 0.7094204 | 0 |
Crawls for all comments belonging to the bugs in the BugIDList utilizing parallelization. | def get_all_comments_mp(self, list: Union[List, str], workers: int = 10) -> None:
# loads pickle list if it is one
if type(list) == str and ".pickle" in list:
print("wat")
with open(list, "rb") as f:
list = pickle.load(f)
elif type(list) == str:
print("Error: Buglist parameter seems to be neither a List object or the name of a pickle file "
"(needs to contain .pickle).")
#gets workers and splits list into chunks fitting the worker amount
pool = Pool(workers)
list = np.array(list)
lists = np.array_split(list, workers)
#each worker crawls for comments
for sub_list in lists:
print(sub_list)
pool.apply_async(self.get_all_comments, (sub_list,))
pool.close()
pool.join() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_comments(self, idList: Union[List, str]) -> None:\n\n #loads pickle list if it is one\n if type(idList) == str and \".pickle\" in idList:\n print(\"pickle load\")\n with open(idList, \"rb\") as f:\n idList = pickle.load(f)\n elif type(idList) ==... | [
"0.6642331",
"0.6419399",
"0.6326556",
"0.590753",
"0.58366686",
"0.5725965",
"0.56005704",
"0.55982554",
"0.55817443",
"0.5574108",
"0.5573544",
"0.55464286",
"0.5534647",
"0.55332947",
"0.55286044",
"0.5525885",
"0.55153495",
"0.54998296",
"0.549831",
"0.5463732",
"0.544268... | 0.64263386 | 1 |
download sequencing file from SRA archive requires local install of SRA tools in path requires verification of filenames and paths | def download_SRA(SRA):
print("Downloading SRA archive")
output = subprocess.run(['prefetch', '-f', 'yes', SRA], stderr=subprocess.STDOUT)
print("Extracting FASTQ data")
output = subprocess.run(['fastq-dump', '--gzip', NCBI_DIR+SRA+'.sra'], stderr=subprocess.STDOUT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_sra_files(remote_location, local_location = '', max_recursion = 3, verbose = False):\n\n downloaded_files = list();\n\n def printv(*args):\n if(verbose):\n print(*args);\n sys.stdout.flush();\n\n printv(\"Reading folder: \", remote_location);\n\n req = urllib2.... | [
"0.6527539",
"0.63202286",
"0.6183208",
"0.61473656",
"0.6141469",
"0.5976712",
"0.5897661",
"0.58915883",
"0.58283",
"0.5815497",
"0.5812849",
"0.58102864",
"0.58102864",
"0.5790022",
"0.57642645",
"0.5758532",
"0.57328504",
"0.57257515",
"0.57255936",
"0.5705985",
"0.570499... | 0.77889556 | 0 |
maps reads (bowtie to rRNA for legacy?) to extract ambiguous and uniquely mapped reads | def map_reads(SRA):
#1. bowtie to rRNA
print("Bowtie alignement on contaminant RNA...")
cmd_bowtie = 'bowtie'+ ' ' + '-a' + ' ' + '-p6' + ' ' + '-S' + ' ' + '--un' + ' ' + TMP_DIR+SRA+'_rrnaUnmapped.fastq' + ' ' + BOWTIE_DIR+'/rRNA' + ' ' + TMP_DIR+SRA+'_trimmed.fastq' + ' ' + '|' + ' ' + 'samtools view -@ 6 -bS' + ' ' + '>' + TMP_DIR+SRA+'_trimmed_rrna.bam'
output = subprocess.run(cmd_bowtie, shell=True)
# 2. STAR to ref genome
print("STAR alignement to yeast genome...")
cmd_STAR = 'STAR --outSAMtype BAM Unsorted --runThreadN 6 --winAnchorMultimapNmax 200 --seedSearchStartLmax 15 --genomeDir' + ' ' + STAR_DIR + ' ' + '--readFilesIn' + ' ' + TMP_DIR+SRA+'_rrnaUnmapped.fastq' + ' ' + '--outFileNamePrefix' + ' ' + TMP_DIR+SRA+'_STAR_'
output = subprocess.run(cmd_STAR, shell=True)
# 3. Samtools keep uniquely mapped reads and sort
print("Samtools to keep uniquely mapped reads and sort...")
cmd_samtools1 = 'samtools view -@ 6 -b -q 255 -o' + ' ' + TMP_DIR+SRA+'_yeast_uniqueMapped_reads.bam' + ' ' + TMP_DIR+SRA+'_STAR_Aligned.out.bam'
output = subprocess.run(cmd_samtools1, shell=True)
cmd_samtools2 = 'samtools sort -@ 6 -o' + ' ' + TMP_DIR+SRA+'_yeast_uniqueMapped_reads_sorted.bam' + ' ' + TMP_DIR+SRA+'_yeast_uniqueMapped_reads.bam'
output = subprocess.run(cmd_samtools2, shell=True)
cmd_samtools3 = 'samtools index' + ' ' + TMP_DIR+SRA+'_yeast_uniqueMapped_reads_sorted.bam'
output = subprocess.run(cmd_samtools3, shell=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_read_candidates(self, read):\n self.read_allele_dictionary = {}\n ref_alignment_start = read.reference_start\n ref_alignment_stop = self.get_read_stop_position(read)\n # if the region has reached a very high coverage, we are not going to parse through all the reads\n if ... | [
"0.6826506",
"0.66215014",
"0.6525083",
"0.6418822",
"0.6416063",
"0.631023",
"0.6223504",
"0.6182403",
"0.60843307",
"0.6026228",
"0.6004919",
"0.5979466",
"0.5960708",
"0.59569067",
"0.59227425",
"0.59207463",
"0.5912195",
"0.58296555",
"0.5819795",
"0.5811446",
"0.5797608"... | 0.6700885 | 1 |
wrapper to run scikitribo from the same pipeline requires local install of modified scikitribo toolbox requires local install of all dependencies of scikitribo environment (see conda environment file) | def run_scikit_ribo(SRA, genome_fasta, genome_gtf):
# 3. Scikit-ribo index
print("Building scikit-ribo index")
if not os.path.exists(SCIKIT_DIR):
os.mkdir(SCIKIT_DIR)
cmd_scikit = 'python' + ' ' + SCIKIT_PATH + 'scikit-ribo-build.py' + ' ' + '-g' + ' ' + genome_gtf + ' ' + '-f' + ' ' + genome_fasta + ' ' + '-p' + ' ' + SRA + ' ' + '-o' + SCIKIT_DIR
output = subprocess.run(cmd_scikit, shell=True)
print("scikit-ribo-run.py...")
cmd_scikit = 'python' + ' ' + SCIKIT_PATH + 'scikit-ribo-run.py' + ' ' + '-i' + ' ' + TMP_DIR+SRA+'_yeast_uniqueMapped_reads_sorted.bam' + ' ' + '-f' + ' ' + SCIKIT_DIR + ' ' + '-p' + ' ' + SRA + ' ' + '-o' + ' ' + 'TMP/scikit_'+SRA
output = subprocess.run(cmd_scikit, shell=True)
print("plot_ribo_density_dict.py...")
cmd_scikit = 'python' + ' ' + SCIKIT_PATH + 'plot_ribo_density_dict_noCDT.py' + ' ' + '-i' + ' ' + TMP_DIR+'scikit_'+SRA+'/riboseq_input.txt' + ' ' + '-g' + ' ' + 'all' + ' ' + '-o' + ' ' + TMP_DIR+'scikit_'+SRA #+'_profiles'
output = subprocess.run(cmd_scikit, shell=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformation_catalog():\n tc = TransformationCatalog()\n\n # Add docker container\n #crisis_container = Container(\n # 'crisis_container',\n # Container.DOCKER,\n # image = \"docker://slnagark/crisis_wf:latest\",\n # arguments=\"--runtime=nvidi... | [
"0.57629657",
"0.56087464",
"0.54360694",
"0.54355013",
"0.5393979",
"0.53826815",
"0.5367081",
"0.5317132",
"0.52905655",
"0.5287661",
"0.52496874",
"0.5199404",
"0.51819116",
"0.51798064",
"0.51774645",
"0.5171329",
"0.50645137",
"0.50610745",
"0.50353134",
"0.5028036",
"0.... | 0.6405816 | 0 |
Returns dictionary with strand orientation as values and geneIDs as Keys/ | def gather_strand_by_geneID_dict(genome_gtf):
strand_by_geneID_dict = {}
with open(genome_gtf) as f:
for line in f:
current_line = line.split('\t')
if current_line[2] == "CDS":
current_orf = current_line[8].split(';')[2].split()[1].strip('\"')
current_strand = current_line[6]
strand_by_geneID_dict[current_orf] = current_strand
return strand_by_geneID_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_gene_map(self) -> OrderedDict:\n if \"gene\" not in self.data:\n return OrderedDict()\n\n genes: OrderedDict = OrderedDict()\n for idx, genestr in self.data[\"gene\"].items():\n if pd.isnull(genestr):\n continue\n for gene in genestr.spl... | [
"0.6775984",
"0.63313013",
"0.6185268",
"0.6166058",
"0.61002773",
"0.5993038",
"0.5952857",
"0.5945249",
"0.5915649",
"0.59024686",
"0.5877856",
"0.5875492",
"0.5870065",
"0.5817717",
"0.57851946",
"0.57501155",
"0.57454574",
"0.5728968",
"0.57258415",
"0.56919414",
"0.56362... | 0.6580928 | 1 |
Determine relevant entries in crkeng.xml and build a smaller xml file for testing. | def build_test_xml():
crkeng_file_path = find_latest_xml_file(shared_res_dir / "dictionaries")
print(f"Building test dictionary files using {crkeng_file_path.name}")
crkeng_root = ET.parse(str(crkeng_file_path)).getroot()
# relevant entries in crkeng.xml file we want to determine
relevant_xml_ls: Set[str] = set()
xml_ls: Set[str] = set()
crkeng_entries = crkeng_root.findall(".//e")
for element in crkeng_entries:
xml_l = extract_l_str(element)
xml_ls.add(xml_l)
test_words = get_test_words()
print(f"Analyzing xml l elements and test words")
word_to_analyses = morphodict.analysis.relaxed_analyzer().bulk_lookup(
xml_ls | test_words
)
print("Analysis done")
test_word_lemmas: Set[str] = set()
for test_word in test_words:
for analysis in word_to_analyses[test_word]:
lemma = fst_analysis_parser.extract_lemma(analysis)
if lemma is None:
logger.warn(
"Skipping test word: %s. "
"Could not extract lemma from its analysis: %s",
test_word,
analysis,
)
continue
test_word_lemmas.add(lemma)
for xml_l in tqdm(xml_ls, desc="screening relevant entries in crkeng.xml"):
if xml_l in test_words:
relevant_xml_ls.add(xml_l)
continue
for xml_l_analysis in word_to_analyses[xml_l]:
xml_lemma = partition_analysis(xml_l_analysis)[1]
for test_word_lemma in test_word_lemmas:
if test_word_lemma == xml_lemma:
relevant_xml_ls.add(xml_l)
break
relevant_crkeng_entries = []
for element in crkeng_entries:
xml_l = extract_l_str(element)
if xml_l in relevant_xml_ls:
relevant_crkeng_entries.append(element)
crkeng_xml_utils.write_xml_from_elements(
list(crkeng_root.findall(".//source")) + relevant_crkeng_entries,
shared_res_dir / "test_dictionaries" / "crkeng.xml",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def XML_EC_PL(Name, InputsFile, OutputFile, emin,emax):\n\n\t#On commence par afficher ce qu'on fait\r\n\tprint \" Build xml file \"\r\n\r\tprint InputsFile\n\t#ouverture du fichier dans lequel on place le source model\n\ttry:\n\t\tfresult = open(OutputFile, 'w')\n\texcept:\n\t\tprint \"Coucou\"\r\n \t#ecriture... | [
"0.61072654",
"0.5717132",
"0.5615994",
"0.5543528",
"0.55028045",
"0.53621995",
"0.5347263",
"0.5297309",
"0.5269815",
"0.5254691",
"0.52032775",
"0.5177183",
"0.5130147",
"0.5118681",
"0.51131713",
"0.51111734",
"0.5094071",
"0.50852966",
"0.5085046",
"0.50843346",
"0.50589... | 0.72865844 | 0 |
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 |
FILL COLUMN2 WITH MOST LIKELY VALUES BASED ON COLUMN1 | def fillgaps(column1,column2,train,test):
ddict={}
d1=test[[column1,column2]].dropna().values
d2=train[[column1,column2]].dropna().values
c1=np.array(d1[:,0].tolist()+d2[:,0].tolist())
c2=np.array(d1[:,1].tolist()+d2[:,1].tolist())
for ic1 in np.unique(c1):
ddict[ic1]=(c2[c1==ic1].mean(),c2[c1==ic1].std())
full_data = [train, test]
for dataset in full_data:
for missing in np.where(np.isnan(dataset[column2]))[0]:
m,s=ddict[dataset[column1][missing]]
if s<=0:
dataset[column2][missing]=m
else:
dataset[column2][missing]=np.random.normal(loc=m,scale=s,size=1)
return (train,test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fill_col1_val_where_col2_notna(col1, col2, val):\n fill_ser = col1.copy()\n fill_ser[col2.notna()] = val\n return col1.fillna(fill_ser)",
"def fill_col(col, x):\n col.append(x)\n return col",
"def merge(line):\n #Step1. Putting 0 to the end of the list.\n result = []\n for cell in ... | [
"0.6066896",
"0.5588243",
"0.5520393",
"0.5153865",
"0.5142474",
"0.5100762",
"0.50284475",
"0.50032073",
"0.4990765",
"0.4952544",
"0.49398243",
"0.49170038",
"0.4903504",
"0.4887256",
"0.48762384",
"0.48469424",
"0.48462567",
"0.48410118",
"0.47721502",
"0.47698507",
"0.475... | 0.57042193 | 1 |
Returns true if player has 3 of spades in their hand. | def has_3_spades(self):
if Card('3', 'spades') in self.hand:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_three_of_a_kind(self):\n self.suit_hist()\n for val in self.ranks.values():\n if val >= 3:\n self.rank_per_hand['2'] = \"three of a kind\"\n return True\n return False",
"def is_three_of_a_kind(hand):\n count = {c:0 for c in cards.keys()}\n... | [
"0.72666436",
"0.7080395",
"0.70760804",
"0.6595992",
"0.65198547",
"0.6504807",
"0.6470795",
"0.6453197",
"0.63943964",
"0.6391937",
"0.6380108",
"0.63546914",
"0.63495284",
"0.63185066",
"0.62931806",
"0.6260325",
"0.61777973",
"0.61756945",
"0.61107355",
"0.6093892",
"0.60... | 0.89362204 | 0 |
Return all components that match the given type and filter | def queryComponent(type=None, filter=None, all=0): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_components(self, filter_type=None):\n\n if filter_type is None:\n out = self.components\n elif isinstance(filter_type, str):\n out = {}\n cls = co.str_to_comp(filter_type)\n for comp in self.get_components():\n if isinstance(self.comp... | [
"0.7252907",
"0.6754801",
"0.6730381",
"0.66894734",
"0.6564939",
"0.6288751",
"0.6273336",
"0.62642753",
"0.6115402",
"0.5971226",
"0.59191287",
"0.5848749",
"0.58480895",
"0.5832433",
"0.5759755",
"0.5755212",
"0.56894547",
"0.56826574",
"0.5639281",
"0.56076664",
"0.559276... | 0.74276376 | 0 |
checkKey is used to check for authentication | def checkKey(self):
# TO DO for checking API authentication
if self.apikey is None:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_auth_publickey(self, username, key):\n return AUTH_FAILED",
"def _check_key(self, key):\n raise NotImplementedError",
"def api_key_check():\n req_path = request.path\n method_type = request.method\n app.logger.info(\">>> path = {}, method = {}\".format(req_path, method_type))\n... | [
"0.7483722",
"0.7159838",
"0.7102654",
"0.70746124",
"0.70519286",
"0.69825",
"0.69745266",
"0.6936464",
"0.6857674",
"0.6834089",
"0.67978585",
"0.6719186",
"0.661024",
"0.65871054",
"0.64848256",
"0.6452751",
"0.6445985",
"0.644107",
"0.6375559",
"0.6362564",
"0.6354385",
... | 0.76604617 | 0 |
make the cosmos and DES meds files | def make_all_cosmos_des(run, cosmos_config, des_config, catfile, tileid):
flist = files.get_cosmos_flist(tileid)
cosmos_meds = files.get_meds_file(run, tileid, 'cosmos','i')
print('making cosmos MEDS:',cosmos_meds)
maker = CosmosMEDSMaker(
config_path=cosmos_config,
catname=catfile,
flistname=flist,
)
maker.write(cosmos_meds)
for band in ['u','g','r','i','z']:
band_flist = files.get_des_flist(band)
band_meds = files.get_meds_file(run, tileid, 'des',band)
print('making DES MEDS:',band_meds)
maker = CosmosMEDSMaker(
config_path=des_config,
catname=cosmos_meds,
flistname=band_flist,
)
maker.write(band_meds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_data_raw (mdp,do_makedata,filename):\n #\n fin = open(filename,'r')\n for line in fin:\n lsp = line.split(' ')\n if len(lsp) > 1: # skip empty lines\n if lsp[0] == \"for\": # indicates when to get correlator\n lsp.pop(0)\n update_params(mdp,lsp)\n ## -- do_makedata tells it to go ahead with g... | [
"0.637841",
"0.6184567",
"0.6101035",
"0.6063938",
"0.59966964",
"0.5898186",
"0.5831032",
"0.5792886",
"0.56806254",
"0.5673659",
"0.5642974",
"0.56186104",
"0.5612226",
"0.5589771",
"0.55712795",
"0.55688566",
"0.55426204",
"0.5509481",
"0.5476108",
"0.5453811",
"0.5441293"... | 0.7661663 | 0 |
write the cutouts for the specified type | def _write_psf_cutouts_hst(self):
print('writing psf cutouts')
obj_data=self.obj_data
psf_data=self.psf_data
nfile=self.image_info.size
nobj=obj_data.size
cutout_hdu = self.fits['psf']
for iobj in range(nobj):
if (iobj+1) % 100 == 0:
print(' %d/%d' % (iobj+1,obj_data.size))
# HST psf is same for every cutout, in fact ncut should always
# be 1
try:
psf_im = self.psf_data.get_psf(iobj)
except AttributeError:
psf_im = None
ncut=obj_data['ncutout'][iobj]
for icut in range(ncut):
if psf_im is None:
row = obj_data['orig_row'][iobj, icut]
col = obj_data['orig_col'][iobj, icut]
file_id = obj_data['file_id'][iobj,icut]
p = self.psf_data[file_id]
psf_im = p.get_rec(row,col)
expected_psf_shape = (
obj_data['psf_row_size'][iobj,icut],
obj_data['psf_col_size'][iobj,icut],
)
file_id = obj_data['file_id'][iobj, icut]
row = obj_data['orig_row'][iobj, icut]
col = obj_data['orig_col'][iobj, icut]
start_row = obj_data['psf_start_row'][iobj, icut]
if psf_im.shape != expected_psf_shape:
raise ValueError("psf size mismatch, expected %s "
"got %s" % (expected_psf_shape, psf_im.shape))
cutout_hdu.write(psf_im, start=start_row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write_moleculetype(top_file: IO, mol_name: str, nrexcl: int = 3):\n top_file.write(\"[ moleculetype ]\\n\")\n top_file.write(\"; Name\\tnrexcl\\n\")\n top_file.write(f\"{mol_name}\\t{nrexcl}\\n\\n\")",
"def write(self, out):",
"def write_output(self):",
"def write(self):",
"def write(self):",... | [
"0.55175173",
"0.5354752",
"0.53262687",
"0.52530247",
"0.52530247",
"0.5227527",
"0.5203227",
"0.5147186",
"0.5113114",
"0.5088805",
"0.5083531",
"0.5081513",
"0.5079073",
"0.5070704",
"0.5031757",
"0.50116146",
"0.49944216",
"0.4976218",
"0.49679434",
"0.4965163",
"0.496383... | 0.5732155 | 0 |
set the box sizes and start row for each psf image | def _set_psf_layout_hst(self):
print('setting psf layout for HST')
obj_data=self.obj_data
total_psf_pixels = 0
psf_start_row = 0
for iobj in range(obj_data.size):
if (iobj+1) % 100 == 0:
print(' %d/%d' % (iobj+1,obj_data.size))
# note assuming same psf for all "epochs"
psf_im = self.psf_data.get_psf(iobj)
psf_shape = psf_im.shape
psf_npix = psf_im.size
cen = (np.array(psf_shape)-1.0)/2.0
# we will expand the psfs
for icut in range(obj_data['ncutout'][iobj]):
obj_data['psf_row_size'][iobj,icut] = psf_shape[0]
obj_data['psf_col_size'][iobj,icut] = psf_shape[1]
obj_data['psf_cutout_row'][iobj,icut] = cen[0]
obj_data['psf_cutout_col'][iobj,icut] = cen[1]
obj_data['psf_start_row'][iobj,icut] = psf_start_row
psf_start_row += psf_npix
total_psf_pixels += psf_npix
self.total_psf_pixels = total_psf_pixels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_psf_layout_psfex(self):\n\n print('setting psf layout for PSFEx')\n\n obj_data=self.obj_data\n psf_data=self.psf_data\n\n total_psf_pixels = 0\n\n #psf_npix = psf_size*psf_size\n\n psf_start_row = 0\n for iobj in range(obj_data.size):\n for icut ... | [
"0.6761654",
"0.6085298",
"0.6009164",
"0.58949316",
"0.58541226",
"0.58446145",
"0.5767578",
"0.5712032",
"0.5706543",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5668548",
"0.5650026",
"0.5615289",
"0.5615289",
"0.5593645",
"0.55755764",
"0.55713177"... | 0.62900573 | 1 |
set the box sizes and start row for each psf image | def _set_psf_layout_psfex(self):
print('setting psf layout for PSFEx')
obj_data=self.obj_data
psf_data=self.psf_data
total_psf_pixels = 0
#psf_npix = psf_size*psf_size
psf_start_row = 0
for iobj in range(obj_data.size):
for icut in range(obj_data['ncutout'][iobj]):
row = obj_data['orig_row'][iobj, icut]
col = obj_data['orig_col'][iobj, icut]
file_id = obj_data['file_id'][iobj,icut]
p = psf_data[file_id]
pim = p.get_rec(row,col)
cen = p.get_center(row,col)
psf_shape = pim.shape
psf_npix = pim.size
obj_data['psf_row_size'][iobj,icut] = psf_shape[0]
obj_data['psf_col_size'][iobj,icut] = psf_shape[1]
obj_data['psf_cutout_row'][iobj,icut] = cen[0]
obj_data['psf_cutout_col'][iobj,icut] = cen[1]
obj_data['psf_start_row'][iobj,icut] = psf_start_row
psf_start_row += psf_npix
total_psf_pixels += psf_npix
self.total_psf_pixels = total_psf_pixels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_psf_layout_hst(self):\n\n print('setting psf layout for HST')\n obj_data=self.obj_data\n\n total_psf_pixels = 0\n psf_start_row = 0\n\n for iobj in range(obj_data.size):\n if (iobj+1) % 100 == 0:\n print(' %d/%d' % (iobj+1,obj_data.size))\n\n... | [
"0.62900573",
"0.6085298",
"0.6009164",
"0.58949316",
"0.58541226",
"0.58446145",
"0.5767578",
"0.5712032",
"0.5706543",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5674811",
"0.5668548",
"0.5650026",
"0.5615289",
"0.5615289",
"0.5593645",
"0.55755764",
"0.55713177... | 0.6761654 | 0 |
read the cosmos catalog | def _read_catalog(self, catname):
print('loading catalog:',catname)
with fitsio.FITS(catname,lower=True) as fits:
#cat = fits[1][100000:110000]
if 'object_data' in fits:
print('reading from MEDS object data')
ext='object_data'
else:
ext=1
cat = fits[ext][:]
# one cut here based on if we matched to the galsim cat
w, = np.where(
#(cat['mu_class'] < 3)
#&
#(cat['mask']==0)
#&
(cat['gscosmos_index'] >= 0)
)
print('initial cuts %d/%d %g%%' % (w.size,cat.size,w.size/cat.size*100))
cat = cat[w]
return cat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_catalog(catalog):\n with open(catalog, \"r\") as f:\n header = f.readline()\n if header.startswith('#EventID | Time | Latitude | Longitude | Depth/km'):\n catalog = _read_iris(f)\n elif header.startswith('time, latitude, longitude, depth, depthUnits, magnitude'):\n ... | [
"0.69564354",
"0.63602346",
"0.6289939",
"0.6274737",
"0.6120884",
"0.60243875",
"0.5962401",
"0.59330785",
"0.5929398",
"0.59037805",
"0.5888229",
"0.58801526",
"0.58801526",
"0.587579",
"0.586561",
"0.582441",
"0.582154",
"0.57935977",
"0.57935977",
"0.57935977",
"0.5793597... | 0.67307436 | 1 |
add fields from the cat some will not be in the odata but some will. When copy is True We will copy over the ones that are in both, in some cases | def _add_cat_fields(self, odata, copy=True):
# these are required fileds from get_meds_output_dtype
# that we have put into the input catalog
always_copy=[
'id',
'ra',
'dec',
]
cat = self.cat_orig
add_dt = []
for d in cat.dtype.descr:
n = d[0]
if n not in odata.dtype.names:
add_dt.append(d)
obj_data = eu.numpy_util.add_fields(
odata,
add_dt,
)
if copy:
for n in always_copy:
obj_data[n] = cat[n]
for d in add_dt:
n = d[0]
if n in always_copy:
continue
# don't clobber things that should be left at
# their default values
if n not in odata.dtype.names:
obj_data[n] = cat[n]
return obj_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copyAttributes(self, other, add_nxpars=False):\n import copy\n \n self.setTitle(other.getTitle())\n self.setDataSetType(other.getDataSetType())\n self.setAllAxisLabels(other.getAllAxisLabels())\n self.setAllAxisUnits(other.getAllAxisUnits())\n self.setYLabel(oth... | [
"0.60299045",
"0.5626615",
"0.55989486",
"0.55208635",
"0.54832995",
"0.54745245",
"0.5468035",
"0.54594445",
"0.5416989",
"0.54133993",
"0.53944564",
"0.5360663",
"0.5277778",
"0.5271018",
"0.52541333",
"0.5244835",
"0.5185914",
"0.518226",
"0.5180149",
"0.51750094",
"0.5171... | 0.7400884 | 0 |
make a new struct with ncutoutsizedarrays based on the actual maximum ncutout | def _make_resized_data(self, odata):
nmax = odata['file_id'].shape[1]
new_nmax = odata['ncutout'].max()
if new_nmax < 2:
new_nmax = 2
temp_obj_data = odata
nobj = temp_obj_data.size
new_data = meds.util.get_meds_output_struct(
nobj,
new_nmax,
extra_fields=self._get_fields(new_nmax),
)
new_data = self._add_cat_fields(new_data, copy=False)
for name in new_data.dtype.names:
if name in temp_obj_data.dtype.names:
shape = new_data[name].shape
lshape = len(shape)
if lshape > 1 and shape[1] == new_nmax:
new_data[name][:,:] = temp_obj_data[name][:,0:new_nmax]
else:
new_data[name][:] = temp_obj_data[name][:]
del temp_obj_data
return new_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_maxcut_data_model():\n n = 5\n V = np.arange(0, n, 1)\n E = [(0, 1, 3.0), (1, 2, 2.0), (2, 3, 2.0), (3, 4, 3.0), (4, 0, 1.0), (0, 3, 3.0)]\n\n G = nx.Graph()\n G.add_nodes_from(V)\n G.add_weighted_edges_from(E)\n return G",
"def expanding_max_nb(a, minp=1):\n out = np.empty_like(a... | [
"0.5717705",
"0.5661527",
"0.5603735",
"0.5556727",
"0.5533146",
"0.54946077",
"0.54890066",
"0.5484546",
"0.54764545",
"0.5465916",
"0.54387826",
"0.54167676",
"0.5408915",
"0.5392852",
"0.5391776",
"0.53902745",
"0.5386068",
"0.53750616",
"0.5368087",
"0.5362609",
"0.535723... | 0.58375233 | 0 |
get box sizes that are wither 2N or 32N, within the limits set by the user | def _get_box_sizes(self, image_info, cat):
file_id=0
impath=image_info['image_path'][file_id].strip()
ext=image_info['image_ext'][file_id]
wcs_data = fitsio.read_header(impath, ext=ext)
wcs = eu.wcsutil.WCS(wcs_data)
jacob = wcs.get_jacobian(100,100)
dudcol, dudrow, dvdcol, dvdrow = jacob
det = dvdrow*dudcol - dvdcol*dudrow
pixel_scale = np.sqrt(abs(det))
print('found pixel scale:',pixel_scale)
box_size = cat['box_size_arcsec']/pixel_scale
# clip to range
box_size.clip(
min=self['min_box_size'],
max=self['max_box_size'],
out=box_size,
)
box_size = box_size.astype('i4')
w,=np.where( ( (box_size % 2) != 0 ) )
if w.size > 0:
box_size[w] += 1
return box_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_compute_box_size(self):\n def compute_best_size_for(dim):\n size = ((self.element_space[dim]-1)//self.box_space[dim]) + 1\n size += 2 * self.ghost_space[dim]\n while size % Level.BOX_ALIGNMENTS[dim]:\n size += 1\n return size\n\n r... | [
"0.6898253",
"0.67774564",
"0.6747777",
"0.6713784",
"0.6704732",
"0.66019756",
"0.66019756",
"0.65982324",
"0.6596363",
"0.6499011",
"0.64778125",
"0.6461232",
"0.643119",
"0.6366755",
"0.6308479",
"0.6291537",
"0.6291537",
"0.6284666",
"0.6251369",
"0.6221639",
"0.6197825",... | 0.7289415 | 0 |
get the image info structure Set default scale to 1.0. The other fields are 0 for numbers, or blank for strings | def get_image_info_struct(nimage, path_len,
image_id_len=None,
wcs_len=None,
ext_len=None,
extra_dtype=None):
dt = get_image_info_dtype(
path_len,
image_id_len=image_id_len,
wcs_len=wcs_len,
ext_len=ext_len,
extra_dtype=extra_dtype,
)
data = np.zeros(nimage, dtype=dt)
data['scale'] = 1.0
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_info(img):\n\tprint(img.format)\n\tprint(img.size)\n\tprint(img.mode)",
"def image_data_info(page):\n xObject = page['/Resources']['/XObject'].getObject()\n\n for obj_key in xObject:\n obj = xObject[obj_key]\n if obj['/Subtype'] == '/Image':\n width, height = (obj['/Width... | [
"0.647343",
"0.6325045",
"0.6177507",
"0.61103743",
"0.61006016",
"0.60990447",
"0.60865074",
"0.6057824",
"0.6057824",
"0.6057824",
"0.6057824",
"0.6057824",
"0.59974873",
"0.5942097",
"0.5923346",
"0.58519304",
"0.5841813",
"0.5808897",
"0.57983494",
"0.5795056",
"0.5779866... | 0.65033776 | 0 |
get the image_info dtype for the specified path string length and wcs string length | def get_image_info_dtype(path_len,
image_id_len=None,
wcs_len=None,
ext_len=None,
extra_dtype=None):
path_fmt = 'U%d' % path_len
if image_id_len is None:
image_id_descr = 'i8'
else:
image_id_descr = 'U%d' % image_id_len
if ext_len is not None:
ext_descr = 'U%d' % ext_len
else:
ext_descr = 'i2'
dt=[]
for ctype in IMAGE_INFO_TYPES:
path_name = '%s_path' % ctype
ext_name = '%s_ext' % ctype
dt += [
(path_name, path_fmt),
(ext_name,ext_descr),
]
dt += [
('image_id', image_id_descr),
('image_flags', 'i8'),
('magzp', 'f4'),
('scale', 'f4'),
('position_offset','f8'),
]
if wcs_len is not None:
wcs_fmt = 'U%d' % wcs_len
dt += [
('wcs',wcs_fmt),
]
if extra_dtype is not None:
dt += extra_dtype
return dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_info_struct(nimage, path_len,\n image_id_len=None,\n wcs_len=None,\n ext_len=None,\n extra_dtype=None):\n dt = get_image_info_dtype(\n path_len,\n image_id_len=image_id_len,\n w... | [
"0.6820558",
"0.5704018",
"0.5546598",
"0.5516806",
"0.5513057",
"0.54892457",
"0.53587013",
"0.5346659",
"0.5331653",
"0.529922",
"0.5295019",
"0.52838844",
"0.5277544",
"0.5265453",
"0.5226433",
"0.5198636",
"0.51947224",
"0.5194617",
"0.5169112",
"0.51395136",
"0.50898606"... | 0.8044237 | 0 |
Move files out of subdirectories in the current working directory. | def move_file():
# print("\n".join(os.listdir(filepath)))
# folders = [os.path.join(filepath, fld) for fld in os.listdir(filepath)]
# print(filepath + ":\n " + "\n ".join(folders))
folders = filter(os.path.isdir, os.listdir(u"."))
# print("Sub-folders: ", u"\n".join(folders))
for folder in folders:
files = [os.path.join(folder, fn) for fn in os.listdir(folder)]
files = filter(os.path.isfile, files)
for fn in files:
_, filename = os.path.split(fn)
shutil.move(fn, filename)
assert 0 == len(os.listdir(folder)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveFiles(outputDir, files):\n\tfor fn in files:\n\t\tshutil.move(fn, join(outputDir, getFilenameWithoutPath(fn)))",
"def move_recursively(src, dst, overwrite=False, changed_only=True):\n if os.path.isdir(src):\n movetree(src, dst, overwrite, changed_only)\n else:\n movefile(src, dst, ove... | [
"0.68817514",
"0.6756969",
"0.66850746",
"0.6610166",
"0.6560671",
"0.65322196",
"0.65059394",
"0.643787",
"0.6378325",
"0.63559556",
"0.6313153",
"0.62905586",
"0.62528837",
"0.6242785",
"0.62256724",
"0.6196293",
"0.61216223",
"0.611683",
"0.61057925",
"0.61052036",
"0.6077... | 0.7259415 | 0 |
Find duplications in submitted homework. | def find_duplication(homework):
re_id = re.compile(r'(?P<stuid>[0-9]{10,11})')
dup_check = dict()
with open(homework, 'r') as data:
lines = data.readlines()
for ln in lines:
dt = ln.split()
csum, right = dt[0], dt[1]
if csum not in dup_check:
dup_check[csum] = list()
m = re_id.search(right)
if m is not None:
stu_id = m.group('stuid')
dup_check[csum].append(stu_id)
dup_check = filter(lambda k, v: len(v) > 1, dup_check.items())
dup_check = [(key, sorted(val)) for key, val in dup_check]
return dup_check | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_dupes(recs, input, bad_movies, hist_list=[], feedback_list=[]):\n all_rated = input + bad_movies + hist_list + feedback_list\n nonlocal dupes\n dupes = [x for x in recs if x[0] in input]\n return [x for x in recs if x[0] not in all_rated]",
"def find_duplic... | [
"0.6404877",
"0.6166872",
"0.58831835",
"0.5859948",
"0.58292764",
"0.58159447",
"0.57876647",
"0.5782457",
"0.5769974",
"0.5762715",
"0.5746975",
"0.5736089",
"0.5733144",
"0.57238513",
"0.5710152",
"0.5654848",
"0.553705",
"0.5500801",
"0.54478735",
"0.5438873",
"0.54368997... | 0.753223 | 0 |
Display the duplication check results. | def display_dup(dup_result):
lines = [k + ": " + ", ".join(v) for k, v in dup_result]
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_duplicates(self):\n print('++++++++++++ Duplicates Check Start+++++++++++++')\n print('Report for:', self.name)\n if not self.df.empty:\n for column in self.df.columns:\n if self.df.duplicated(column).sum() > 0:\n print('Duplicates found in:... | [
"0.6287719",
"0.5866031",
"0.58241785",
"0.57221144",
"0.56531405",
"0.56339365",
"0.56136125",
"0.5593977",
"0.55925065",
"0.55140984",
"0.5512862",
"0.5487937",
"0.5483856",
"0.5471412",
"0.5454186",
"0.53893715",
"0.5378345",
"0.53769517",
"0.5371023",
"0.5360018",
"0.5356... | 0.67122084 | 0 |
Create a response model to pass to the presenter | def _create_response_model(self, data):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response_model_ctor(self):\n return self._response_model_ctor",
"def create_json_from_model(self):\n json = {\n \"enableAutoReply\": self.enable_auto_reply,\n \"responseSubject\": self.response_subject,\n \"responseBodyPlainText\": self.response_body_plain_text,... | [
"0.70443594",
"0.63880855",
"0.61683625",
"0.61580884",
"0.6102591",
"0.61025757",
"0.60942143",
"0.60272694",
"0.59198946",
"0.5912622",
"0.5899994",
"0.5891911",
"0.58650625",
"0.58380055",
"0.58380055",
"0.58321315",
"0.5831333",
"0.582527",
"0.582527",
"0.58120483",
"0.57... | 0.8459162 | 0 |
takes in a string of columns and places alternating checkers in those columns, starting with 'X' For example, call b.setBoard('012345') to see 'X's and 'O's alternate on the bottom row, or b.setBoard('000000') to see them alternate in the left column. moveString must be a string of integers | def setBoard( self, moveString ):
nextCh = 'X' # start by playing 'X'
for colString in moveString:
col = int(colString)
if 0 <= col <= self.__width:
self.addMove(col, nextCh)
if nextCh == 'X': nextCh = 'O'
else: nextCh = 'X' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setBoard( self, moveString ):\n nextCh = 'X' # start by playing 'X'\n for colString in moveString:\n col = int(colString)\n if 0 <= col <= self.width:\n self.addMove(col, nextCh)\n if nextCh == 'X': nextCh = 'O'\n else: nextCh = 'X'",
"... | [
"0.83378243",
"0.8336306",
"0.83127975",
"0.82836413",
"0.722551",
"0.7191393",
"0.7191393",
"0.7191393",
"0.7188351",
"0.7188351",
"0.71681666",
"0.71523356",
"0.61226887",
"0.6058321",
"0.582009",
"0.5713693",
"0.56568706",
"0.5623423",
"0.5570228",
"0.556483",
"0.5557871",... | 0.83451086 | 0 |
Checks if AutoML can be loaded from a folder | def _check_can_load(self):
if self.results_path is not None:
# Dir exists and can be loaded
if os.path.exists(self.results_path) and os.path.exists(
os.path.join(self.results_path, "params.json")
):
self.load(self.results_path)
self._results_path = self.results_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_load(cls, filename):\n return False",
"def in_folder(self):\n return len(os.path.split(self.file_path)) > 1",
"def is_valid_animation(path, verbose=True):\n try:\n if \"idle\" in os.listdir(path) or \"transition\" in os.listdir(path):\n return True\n else:\n ... | [
"0.64446145",
"0.61130095",
"0.60769767",
"0.6070284",
"0.6070284",
"0.5984742",
"0.57872206",
"0.5693269",
"0.566746",
"0.5642804",
"0.56116366",
"0.5606089",
"0.56005824",
"0.5568455",
"0.5547063",
"0.55245954",
"0.5513016",
"0.54848117",
"0.5477921",
"0.5474287",
"0.545193... | 0.62103647 | 1 |
Append error message to errors.md file. | def _update_errors_report(self, model_name, error_msg):
errors_filename = os.path.join(self._get_results_path(), "errors.md")
with open(errors_filename, "a") as fout:
self.verbose_print(f"There was an error during {model_name} training.")
self.verbose_print(f"Please check {errors_filename} for details.")
fout.write(f"## Error for {model_name}\n\n")
fout.write(error_msg)
link = "https://github.com/mljar/mljar-supervised/issues/new"
fout.write(
f"\n\nPlease set a GitHub issue with above error message at: {link}"
)
fout.write("\n\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_error(self, msg):\n self._add_message(msg, self._errors)",
"def add_error(self, reference_id, error):\n\n with open('runReport.txt', 'a') as report:\n try:\n report.write(\"\\nError: \" + self.domain + \" \" + reference_id + \": \" + error)\n except Exce... | [
"0.68803924",
"0.68077487",
"0.6791102",
"0.6587171",
"0.65130657",
"0.6467027",
"0.6418997",
"0.6406481",
"0.63759094",
"0.6353462",
"0.63198704",
"0.6297876",
"0.62030095",
"0.6134235",
"0.61272323",
"0.60763824",
"0.60648596",
"0.605622",
"0.6027484",
"0.5985176",
"0.59834... | 0.7012683 | 0 |
Gets the current model_time_limit | def _get_model_time_limit(self):
self._validate_model_time_limit()
return deepcopy(self.model_time_limit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timelimit(self):\n return self._timelimit",
"def time_limit(self) -> float:\n return self._time_limit",
"def _get_total_time_limit(self):\n self._validate_total_time_limit()\n if self._get_mode() == \"Optuna\":\n return None # there no training limit for model in the... | [
"0.808775",
"0.7704996",
"0.73726135",
"0.7298717",
"0.72923505",
"0.6901317",
"0.6841979",
"0.66637945",
"0.6617291",
"0.6602201",
"0.6576346",
"0.6545491",
"0.6522294",
"0.6522294",
"0.62877345",
"0.6281024",
"0.62770474",
"0.6243926",
"0.62277204",
"0.62133306",
"0.6213330... | 0.8786821 | 0 |
Gets the current algorithms. If "auto" it is determined | def _get_algorithms(self):
self._validate_algorithms()
if self.algorithms == "auto":
if self._get_mode() == "Explain":
return [
"Baseline",
"Linear",
"Decision Tree",
"Random Forest",
"Xgboost",
"Neural Network",
]
if self._get_mode() == "Perform":
return [
"Linear",
"Random Forest",
"LightGBM",
"Xgboost",
"CatBoost",
"Neural Network",
]
if self._get_mode() == "Compete":
return [
"Decision Tree",
"Linear",
"Random Forest",
"Extra Trees",
"LightGBM",
"Xgboost",
"CatBoost",
"Neural Network",
"Nearest Neighbors",
]
if self._get_mode() == "Optuna":
return [
"Random Forest",
"Extra Trees",
"LightGBM",
"Xgboost",
"CatBoost",
"Neural Network",
]
else:
return deepcopy(self.algorithms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def algorithms():\n algorith_paradigms = ['Divide-and-conquer', 'Backtrackig', 'Greedy-Algorithms', 'Dynamic-programming']\n return algorith_paradigms",
"def get_algorithm(self):\n return self.alg",
"def get_algorithm(self):\n pass",
"def algorithms(self):\n if self._algorithms is ... | [
"0.72617215",
"0.69703907",
"0.6834078",
"0.649296",
"0.64006877",
"0.6347613",
"0.62988967",
"0.62988967",
"0.62693024",
"0.62255967",
"0.6208306",
"0.6183921",
"0.6171044",
"0.6160205",
"0.6155423",
"0.6155423",
"0.60712767",
"0.60712767",
"0.6055243",
"0.6055243",
"0.60232... | 0.79699975 | 0 |
Gets the current train_ensemble | def _get_train_ensemble(self):
self._validate_train_ensemble()
return deepcopy(self.train_ensemble) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensemble(self):\n return self._ensemble",
"def getTrainSet(self):\r\n return self.fTrainData",
"def training_set(self):\n return self._training_set",
"def getTrainInstance(self): #NOTE: Probably faster way of doing this than additional 'if' statement every learning iteration\r\n ... | [
"0.82772297",
"0.6414114",
"0.6375453",
"0.63674873",
"0.62640953",
"0.6179646",
"0.6133189",
"0.6104231",
"0.6051133",
"0.59600097",
"0.5959593",
"0.5959593",
"0.59380734",
"0.59326303",
"0.58842814",
"0.58842814",
"0.58842814",
"0.58842814",
"0.58842814",
"0.58842814",
"0.5... | 0.84837633 | 0 |
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
else:
return deepcopy(self.stack_models) | {
"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,
"shuffle": True,
"stratify": True,
}
elif self._get_mode() == "Perform":
strat = {
"validation_type": "kfold",
"k_folds": 5,
"shuffle": True,
"stratify": True,
}
elif self._get_mode() in ["Compete", "Optuna"]:
strat = {
"validation_type": "kfold",
"k_folds": 10,
"shuffle": True,
"stratify": True,
}
if self._get_ml_task() == REGRESSION:
if "stratify" in strat:
# it's better to always check
# before delete (trust me)
del strat["stratify"]
return strat
else:
strat = deepcopy(self.validation_strategy)
if self._get_ml_task() == REGRESSION:
if "stratify" in strat:
del strat["stratify"]
return strat | {
"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 explain_level | def _get_explain_level(self):
self._validate_explain_level()
if self.explain_level == "auto":
if self._get_mode() == "Explain":
return 2
if self._get_mode() == "Perform":
return 1
if self._get_mode() == "Compete":
return 0
if self._get_mode() == "Optuna":
return 0
else:
return deepcopy(self.explain_level) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_explain(self):\n print(EXPLAIN)",
"def level(self):\n return self.__level",
"def level(self):\n return self.__level",
"def getLevel(self):\n return _libsbml.ASTBasePlugin_getLevel(self)",
"def get_level(self):\n return self.debug_level, self.verbosity",
"def le... | [
"0.62678665",
"0.59786433",
"0.59786433",
"0.5973489",
"0.5863395",
"0.58591205",
"0.58441484",
"0.58441484",
"0.58441484",
"0.58441484",
"0.5830532",
"0.5830532",
"0.57422584",
"0.55639464",
"0.55551803",
"0.55497247",
"0.5544945",
"0.55366",
"0.5531055",
"0.55061364",
"0.54... | 0.86530817 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.