query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Saves a relevant log file in json format to the output directory | def save_log(self):
Log.info_chk(self.logger, msg_saving_run_info.format(PATH=self.log_name))
log_json = self.get_log_json()
json.dump(log_json, open(self.get_log_path(), 'w'), indent=4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_log(json_data):\n path_output = 'output/logs.json'\n file_exists = os.path.isfile(path_output)\n if file_exists == True:\n with open(path_output,'r+') as file: \n file_data = json.load(file)\n # get last id\n last_id = file_data[\"logs\"][-1][\"i... | [
"0.76173985",
"0.73427063",
"0.6948355",
"0.6854301",
"0.6833896",
"0.68257606",
"0.6781587",
"0.6675194",
"0.66672677",
"0.6636572",
"0.6572001",
"0.6564143",
"0.6562928",
"0.65398955",
"0.6534344",
"0.652223",
"0.65060544",
"0.64985126",
"0.64869314",
"0.6483456",
"0.648312... | 0.7233968 | 2 |
It appends a dataframe based on 'id_siniestro' using join left. Also it returns the column names of the new dataframe so in the next step we can evaluate missing values | def append_df(self: pd.DataFrame, df_add: pd.DataFrame, on_var: str = 'id_siniestro', on_var_type=int,
how='left'):
self[on_var] = self[on_var].map(on_var_type)
df_add[on_var] = df_add[on_var].map(on_var_type)
base_columns = self.columns.values.tolist()
base_column... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_join(mother, child):\r\n df_temp = pd.DataFrame(index = mother.index)\r\n df_temp1 = df_temp.join(child)\r\n df_temp1 = df_temp1.replace('null', np.nan)\r\n df_temp1.fillna(method='ffill', inplace=True)\r\n df_temp1.fillna(method='backfill', inplace=True)\r\n return df_temp1",
"def joi... | [
"0.5727537",
"0.5703375",
"0.56689537",
"0.5506983",
"0.546218",
"0.5374442",
"0.53460705",
"0.53339666",
"0.52894187",
"0.5233599",
"0.5199231",
"0.5169216",
"0.51657754",
"0.5162361",
"0.5162291",
"0.5162291",
"0.5144676",
"0.51216346",
"0.51078206",
"0.5090312",
"0.5087143... | 0.6190217 | 0 |
returns length of protein | def getlen(self):
return self.length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_length(dna):\n \n return len (dna)",
"def get_length(dna):\n return len(dna)",
"def get_length(dna):\n return len(dna)",
"def get_length(dna):\n return len(dna)",
"def aaCount(self):\n return len(self.protein) # returns the length of the protein sequence when method is called... | [
"0.74660885",
"0.7415641",
"0.7415641",
"0.7415641",
"0.71909314",
"0.7189932",
"0.6872425",
"0.6872425",
"0.6872425",
"0.685472",
"0.68357414",
"0.6827571",
"0.67791885",
"0.67721385",
"0.6751908",
"0.66598934",
"0.66567135",
"0.66302717",
"0.662541",
"0.661628",
"0.6615723"... | 0.65197694 | 25 |
Define values for board. Previous is parental state for path checking. | def __init__(self, board_width: int, board_height: int, cars: List['Car'],
goal: (int, Position), previous=None):
self.board_height = board_height
self.board_width = board_width
self.previous = previous
if previous is not None:
self.count = previous.count + 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defGoalState(self, row, col, boxes):\n self.goalState.row = row\n self.goalState.col = col\n self.goalState.boxes = boxes",
"def __init__(self):\n self.board = [[\"\",\"\",\"\"],[\"\",\"\",\"\"],[\"\",\"\",\"\"]]\n self.current_state = \"UNFINISHED\" # Possible states are \... | [
"0.6534844",
"0.6473652",
"0.61324847",
"0.61320496",
"0.6115429",
"0.6059408",
"0.604128",
"0.6020854",
"0.601361",
"0.5989",
"0.598446",
"0.5976817",
"0.5952188",
"0.5925392",
"0.59134513",
"0.58955276",
"0.58874637",
"0.58866835",
"0.58795965",
"0.5858561",
"0.58226264",
... | 0.0 | -1 |
Return current panels parent. | def get_parent_panel():
panel = cmds.getPanel(up=True)
if cmds.panel(panel, q=True, ex=True):
panel_layout = cmds.layout(panel, q=True, p=True)
while not cmds.paneLayout(panel_layout, q=True, ex=True):
panel_layout = cmds.control(panel_layout, q=True, p=True)
if cmds.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent(self):\n return self.parent",
"def get_parent(self):\n return self.parent",
"def get_parent(self):\n return self.parent",
"def get_parent(self) :\n return self.parent",
"def get_parent(self):\n return self.parent",
"def get_parent(self):\r\n re... | [
"0.7907527",
"0.7907527",
"0.7907527",
"0.78901863",
"0.7879021",
"0.7809082",
"0.7801771",
"0.7748114",
"0.77389544",
"0.7641577",
"0.76358294",
"0.7601543",
"0.7581958",
"0.7579248",
"0.7579248",
"0.7579248",
"0.7579248",
"0.7579248",
"0.7579248",
"0.7579248",
"0.7579248",
... | 0.8096542 | 0 |
Home view for the homepage of portfolio. | def home(request):
# if not logged in, redirect to login page.
username = request.session.get('username', '')
if not username:
return redirect('authenticate/login')
request.username = username
order_history = None
context = dict()
# if a query object exist in session, add i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template(\n 'home.html',\n personal_url = personal_url,\n home_url = url_for('home'),\n title = \"Home\",\n projects = projList,\n resume_rel_url = resume_rel_url\n )",
"def home_index(request):\n return render(request, 'projects/... | [
"0.806782",
"0.7725667",
"0.771735",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7666344",
"0.7619767",
"0.7598955",
"0.7535168",
"0.75198513",
"0.7497796",
"0.7484336",
"0.7483889",
"0.74747497",
"0.7473684",
"... | 0.0 | -1 |
Test that ref_date only works when apply_modulus=False | def test_calc_solar_local_time_inconsistent_keywords(self, name, caplog):
# Instantiate instrument and load data
self.py_inst = pysat.Instrument(platform='pysat', name=name,
num_samples=1)
self.py_inst.load(date=self.inst_time)
with caplog.at_leve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filtered_date_attribute(self):\n\n self.ref_time = dt.datetime.utcnow()\n self.out = dt.datetime(self.ref_time.year, self.ref_time.month,\n self.ref_time.day)\n self.testInst.date = self.ref_time\n assert self.out == self.testInst.date\n ret... | [
"0.61722773",
"0.61215687",
"0.5940999",
"0.58953494",
"0.5870615",
"0.58063173",
"0.577989",
"0.5771568",
"0.5716873",
"0.5716829",
"0.5677642",
"0.5651543",
"0.55908066",
"0.55664885",
"0.54460764",
"0.53577626",
"0.5322044",
"0.53156227",
"0.53053665",
"0.52903044",
"0.525... | 0.0 | -1 |
Test that the output shape produced by the tape matches the expected output shape. | def test_output_shapes_single(self, measurement, expected_shape, shots):
if shots is None and measurement.return_type is qml.measurements.Sample:
pytest.skip("Sample doesn't support analytic computations.")
num_wires = 3
dev = qml.device("default.qubit", wires=num_wires, shots=shots... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shape_consistency(self):\n with self.test_session():\n for data_format, output in self.outputs.items():\n call_assert(\n self.assertEqual,\n output.eval(feed_dict={\n self.images: self.test_images[data_for... | [
"0.761224",
"0.74638647",
"0.7030042",
"0.7030042",
"0.69235486",
"0.68076557",
"0.67768025",
"0.6757729",
"0.67301553",
"0.6679041",
"0.6660278",
"0.66267985",
"0.66145164",
"0.6602452",
"0.65029955",
"0.64722484",
"0.6368974",
"0.6322064",
"0.6299484",
"0.62797767",
"0.6266... | 0.66916746 | 9 |
Test that the output shape produced by the tape matches the output shape of a QNode for a single measurement. | def test_output_shapes_single_qnode_check(self, measurement, expected_shape, shots):
if shots is None and measurement.return_type is qml.measurements.Sample:
pytest.skip("Sample doesn't support analytic computations.")
dev = qml.device("default.qubit", wires=3, shots=shots)
a = np.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shapes_single(self, measurement, expected_shape, shots):\n if shots is None and measurement.return_type is qml.measurements.Sample:\n pytest.skip(\"Sample doesn't support analytic computations.\")\n\n num_wires = 3\n dev = qml.device(\"default.qubit\", wires=num_wire... | [
"0.73700315",
"0.7277032",
"0.72398305",
"0.7223867",
"0.71800184",
"0.71452147",
"0.6831834",
"0.6592273",
"0.6529377",
"0.6489572",
"0.6354399",
"0.6354399",
"0.61553025",
"0.6105361",
"0.61007655",
"0.6022192",
"0.5981444",
"0.59548396",
"0.5938066",
"0.59338975",
"0.59135... | 0.78933144 | 0 |
Test that the expected output shape is obtained when using multiple expectation value, variance and probability measurements with a shot vector. | def test_multi_measure_shot_vector(self, measurements, expected):
if measurements[0].return_type is qml.measurements.Probability:
num_wires = set(len(m.wires) for m in measurements)
if len(num_wires) > 1:
pytest.skip(
"Multi-probs with varying number o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shapes_shot_vector(self, measurement, expected_shape):\n num_wires = 3\n shot_vector = [10, 20, 30]\n dev = qml.device(\"default.qubit\", wires=num_wires, shots=shot_vector)\n\n assert measurement.shape(dev) == expected_shape",
"def test_multiple_expectation_values(sel... | [
"0.74083585",
"0.7172975",
"0.7088372",
"0.7041406",
"0.6814399",
"0.65830517",
"0.6456956",
"0.64400727",
"0.63821",
"0.63330096",
"0.60750026",
"0.6012633",
"0.6007292",
"0.59748495",
"0.5947791",
"0.593449",
"0.59311897",
"0.5921358",
"0.5904852",
"0.59009355",
"0.5890105"... | 0.7249113 | 1 |
Test that the output shape produced by the tape matches the expected output shape for a single measurement and parameter broadcasting | def test_broadcasting_single(self, measurement, expected_shape, shots):
if shots is None and measurement.return_type is qml.measurements.Sample:
pytest.skip("Sample doesn't support analytic computations.")
if (
measurement.return_type in {State, MutualInfo, VnEntropy}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shape_consistency(self):\n with self.test_session():\n for data_format, output in self.outputs.items():\n call_assert(\n self.assertEqual,\n output.eval(feed_dict={\n self.images: self.test_images[data_for... | [
"0.6742509",
"0.65486926",
"0.65119195",
"0.64795154",
"0.6477197",
"0.6445235",
"0.6442861",
"0.6405345",
"0.6371481",
"0.63404053",
"0.63396835",
"0.6338488",
"0.627311",
"0.6238954",
"0.62028044",
"0.6200956",
"0.61935425",
"0.6182332",
"0.6178893",
"0.615461",
"0.61521447... | 0.7058524 | 0 |
Test that the output shape produced by the tape matches the expected output shape for multiple measurements and parameter broadcasting | def test_broadcasting_multi(self, measurement, expected, shots):
if shots is None and measurement.return_type is qml.measurements.Sample:
pytest.skip("Sample doesn't support analytic computations.")
if measurement.return_type in {State, MutualInfo, VnEntropy}:
pytest.skip("Densi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shape_consistency(self):\n with self.test_session():\n for data_format, output in self.outputs.items():\n call_assert(\n self.assertEqual,\n output.eval(feed_dict={\n self.images: self.test_images[data_for... | [
"0.6984651",
"0.68838406",
"0.6686449",
"0.6623096",
"0.6547631",
"0.65164876",
"0.6394197",
"0.6390116",
"0.6370484",
"0.6357471",
"0.63546187",
"0.63494396",
"0.6302886",
"0.6302231",
"0.6244265",
"0.62387717",
"0.6207817",
"0.6206423",
"0.6205796",
"0.6197146",
"0.6182181"... | 0.6729437 | 2 |
Test that getting the output shape of a tape that uses parameter broadcasting along with a device with a shot vector raises an error. | def test_raises_broadcasting_shot_vector(self):
dev = qml.device("default.qubit", wires=3, shots=(1, 2, 3))
with qml.queuing.AnnotatedQueue() as q:
qml.RY(np.array([0.1, 0.2]), wires=0)
qml.RX(np.array([0.3, 0.4]), wires=0)
qml.expval(qml.PauliZ(0))
tape = q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_output_shapes_shot_vector(self, measurement, expected_shape):\n num_wires = 3\n shot_vector = [10, 20, 30]\n dev = qml.device(\"default.qubit\", wires=num_wires, shots=shot_vector)\n\n assert measurement.shape(dev) == expected_shape",
"def test_no_trainable_params_tape(self, ... | [
"0.64436907",
"0.64192784",
"0.6127642",
"0.60349727",
"0.60316664",
"0.5996239",
"0.5943686",
"0.59035945",
"0.58587223",
"0.5850026",
"0.584892",
"0.58423775",
"0.58238405",
"0.58164895",
"0.5798936",
"0.5791654",
"0.5789508",
"0.57748216",
"0.57656735",
"0.57525206",
"0.57... | 0.7320864 | 0 |
Test that a tape with qml.state correctly determines that the output domain will be complex. | def test_complex_state(self, ret):
dev = qml.device("default.qubit", wires=3)
a, b = 0.3, 0.2
ops = [qml.RY(a, 0), qml.RZ(b, 0)]
qs = QuantumScript(ops, [ret])
result = qml.execute([qs], dev, gradient_fn=None)[0]
# Double-check the domain of the QNode output
as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_state_shape_and_dtype(self, wires):\n\n dev = qml.device(\"default.qubit\", wires=wires)\n\n @qml.qnode(dev)\n def func():\n return state()\n\n state_val = func()\n assert state_val.shape == (2**wires,)\n assert state_val.dtype == np.complex128",
"def... | [
"0.66257125",
"0.61928993",
"0.60220295",
"0.60091877",
"0.6006891",
"0.59278524",
"0.5922678",
"0.5872896",
"0.5872615",
"0.586306",
"0.58397573",
"0.5834876",
"0.57323885",
"0.5719791",
"0.5717349",
"0.57112885",
"0.57047117",
"0.5682923",
"0.56659913",
"0.56642765",
"0.565... | 0.7357288 | 0 |
Prepares transformation, which turns predicted probabilities to uniform in [0, 1] distribution. | def plot_flattened_probs(probs, labels, weights, label=1, check_input=True):
if check_input:
probs, labels, weights = numpy.array(probs), numpy.array(labels), numpy.array(weights)
assert probs.shape[1] == 2
assert numpy.in1d(labels, [0, 1]).all()
signal_probs = probs[:, 1]
flatt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expected_trans(self, sequence, normed_forward_probs, normed_backward_probs, normalizers):\n states = range(len(self.init_probs))\n result = np.ones((len(sequence)-1, len(states), len(states)))\n result *= normed_forward_probs[:-1,:,np.newaxis] \n result *= self.emit_probs[:,sequence... | [
"0.6146011",
"0.58907676",
"0.5679714",
"0.564897",
"0.55682164",
"0.5555819",
"0.5528582",
"0.5521852",
"0.550635",
"0.5499464",
"0.5481778",
"0.5477267",
"0.5465816",
"0.5462183",
"0.5460556",
"0.54379183",
"0.5436471",
"0.5410731",
"0.5389651",
"0.53830856",
"0.5374029",
... | 0.0 | -1 |
Calculate AUC score for data and AUC full score for data and untag data (p(B+) for untag data is set to 0.5) | def calculate_auc_with_and_without_untag_events(Bsign, Bprobs, Bweights):
N_B_not_passed = get_N_B_events() - sum(Bweights)
Bsign_not_passed = [-1, 1]
Bprobs_not_passed = [0.5] * 2
Bweights_not_passed = [N_B_not_passed / 2.] * 2
auc_full = roc_auc_score(union(Bsign, Bsign_not_passed), union(Bpr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AUC(all_item_scores, dataset, test_data):\n dataset: BasicDataset\n r_all = np.zeros((dataset.m_items,))\n r_all[test_data] = 1\n r = r_all[all_item_scores >= 0]\n test_item_scores = all_item_scores[all_item_scores >= 0]\n from sklearn.metrics import roc_auc_score\n return roc_auc_score(r,... | [
"0.70107657",
"0.6804467",
"0.67127573",
"0.6663403",
"0.6627716",
"0.65728307",
"0.6570875",
"0.65446156",
"0.64274776",
"0.638658",
"0.63746357",
"0.6287335",
"0.6267512",
"0.62156725",
"0.6197594",
"0.61895",
"0.6177556",
"0.61769634",
"0.61551857",
"0.6145467",
"0.6139142... | 0.0 | -1 |
Generate a sample static site project using React. | def static_react(ctx, **_):
# type: (click.Context, Any) -> None
src = TEMPLATES / "static-react"
dest = Path.cwd() / "static-react"
copy_sample(ctx, src, dest)
LOGGER.success("Sample static React site repo created at %s", dest)
LOGGER.notice("See the README for setup and deployment instructio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n return render_template('index.html')",
"def index():\n return send_from_directory(BUILD_DIR, 'index.html')",
"def publish_static_webapp(session):\n build_frontend(session)\n session.run(\"git\", \"checkout\", \"gh-pages\", external=True)\n session.run(\"rm\", \"-rf\", \"connect/\... | [
"0.6319295",
"0.63055617",
"0.6236494",
"0.6166826",
"0.6124664",
"0.610511",
"0.60758424",
"0.60737526",
"0.60351086",
"0.6032332",
"0.602048",
"0.6017022",
"0.60081214",
"0.5984265",
"0.59829336",
"0.59627545",
"0.5946704",
"0.5933121",
"0.59284765",
"0.59163207",
"0.591549... | 0.8279316 | 0 |
Get the name of the user's primary group. | def get_primary_group(user=None):
try:
gid = getpwnam(user or getuser()).pw_gid
return getgrgid(gid).gr_name
except KeyError:
# User may not exist on this host, e.g. daos_server, so just return the user name
return user or getuser() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(self):\n return self.name",
"def group_name(self) -> Optional[str]:\n return pulumi.get(self, \"group_name\")",
"def primary_group(self):\n return self._prof.get(\"primaryclanid\")",
"def group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"group_... | [
"0.73892814",
"0.7253815",
"0.72360367",
"0.7096706",
"0.7081813",
"0.70806843",
"0.7077857",
"0.7037714",
"0.7037714",
"0.7026947",
"0.68830436",
"0.6879772",
"0.68662447",
"0.6846672",
"0.68283",
"0.68283",
"0.6820803",
"0.6802685",
"0.68022203",
"0.67781574",
"0.67781574",... | 0.7576749 | 0 |
Copies the model parameters of one estimator to another. | def copy_model_parameters(sess, estimator1, estimator2):
e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)]
e1_params = sorted(e1_params, key=lambda v: v.name)
e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator2.scope)]
e2_params = sorte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_model_parameters(sess, estimator1, estimator2):\n start = time.time()\n e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)]\n e1_params = sorted(e1_params, key=lambda v: v.name)\n e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimat... | [
"0.7736119",
"0.65300107",
"0.6408559",
"0.62743574",
"0.623574",
"0.6190618",
"0.6162067",
"0.6071642",
"0.60608965",
"0.5963028",
"0.5963028",
"0.5963028",
"0.59614927",
"0.59309113",
"0.589295",
"0.589295",
"0.589295",
"0.58643776",
"0.5841669",
"0.58324397",
"0.58179855",... | 0.7852635 | 0 |
Visualize bounding boxes inside image. | def vis_bbox(img, bbox, label=None, score=None, ax=None):
label_names = list(VOC_BBOX_LABEL_NAMES) + ['bg']
if label is not None and not len(bbox) == len(label):
raise ValueError('The length of label must be same as that of bbox')
if score is not None and not len(bbox) == len(score):
raise V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_bboxes(img, bounding_boxes, facial_landmarks=[]):\n\n img_copy = np.copy(img)\n\n for b in bounding_boxes:\n x1, y1, x2, y2 = int(b[0]), int(b[1]), int(b[2]), int(b[3])\n cv2.rectangle(img_copy,(x1, y1),(x2, y2),(255,255,255),2)\n\n for p in facial_landmarks:\n for i in range... | [
"0.7470627",
"0.7418052",
"0.74033767",
"0.734234",
"0.731655",
"0.72548467",
"0.7245545",
"0.7239387",
"0.7212617",
"0.7204073",
"0.72030056",
"0.71829563",
"0.7175265",
"0.7149846",
"0.7137878",
"0.7129731",
"0.71107274",
"0.7087191",
"0.7046634",
"0.7007515",
"0.69924164",... | 0.6771298 | 41 |
brief Convert a Matplotlib figure to a 4D numpy array with RGBA channels and return it | def fig2data(fig):
# draw the renderer
fig.canvas.draw()
# Get the RGBA buffer from the figure
w, h = fig.canvas.get_width_height()
buf = np.fromstring(fig.canvas.tostring_argb(), dtype=np.uint8)
buf.shape = (w, h, 4)
# canvas.tostring_argb give pixmap in ARGB mode. Roll the ALPHA channel ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fig2data ( fig ):\r\n # draw the renderer\r\n fig.canvas.draw()\r\n \r\n # Get the RGBA buffer from the figure\r\n w,h = fig.canvas.get_width_height()\r\n\r\n# buf = np.fromstring ( fig.canvas.tostring_argb(), dtype=np.uint8 )\r\n buf = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8)... | [
"0.7519006",
"0.75164324",
"0.73877156",
"0.73680097",
"0.72398174",
"0.72343117",
"0.7227456",
"0.7218334",
"0.72182506",
"0.71626323",
"0.71562564",
"0.71338725",
"0.68690383",
"0.6564304",
"0.63812155",
"0.62049234",
"0.6117509",
"0.60424393",
"0.6029768",
"0.5902103",
"0.... | 0.73287416 | 4 |
Flatten a 4dtensor into a 3dtensor by joining width and height. | def flatten4d3d(x):
xshape = shape_list(x)
result = tf.reshape(x, [xshape[0], xshape[1] * xshape[2], xshape[3]])
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_reshape_4d_to_3d(x):\n x_shape = common_layers.shape_list(x)\n is_4d = False\n if len(x_shape) == 4:\n x = tf.reshape(x, [x_shape[0], x_shape[1]*x_shape[2], x_shape[3]])\n is_4d = True\n return x, x_shape, is_4d",
"def expand_shape_3d(a):\n return expand_shape(a, 3)",
"def ggml_reshape_4... | [
"0.65151536",
"0.57421607",
"0.5731885",
"0.5663764",
"0.5641131",
"0.55625284",
"0.55570906",
"0.54796505",
"0.5427768",
"0.5299165",
"0.52617663",
"0.52461433",
"0.52337456",
"0.5181203",
"0.5174638",
"0.5161617",
"0.51511765",
"0.51405627",
"0.51244736",
"0.5116884",
"0.50... | 0.7200359 | 0 |
Compute the length of each sequence in the batch. | def length_from_embedding(emb):
return tf.cast(tf.reduce_sum(mask_from_embedding(emb), [1, 2, 3]), tf.int32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_length(self):\n length = 0\n for item in self._data:\n length += 1\n self.length = length",
"def seq_len(self) -> int:\n if self.shape == \"linear\":\n return int(self.input_dim / len(self.features))\n elif self.shape == \"sequence\":\n ... | [
"0.7350677",
"0.72616357",
"0.72206014",
"0.7192455",
"0.7173056",
"0.7166429",
"0.71569806",
"0.7072728",
"0.7070469",
"0.7057502",
"0.7049687",
"0.70115924",
"0.70115924",
"0.6986661",
"0.69753706",
"0.695112",
"0.692289",
"0.6921085",
"0.69196826",
"0.69063395",
"0.6887336... | 0.0 | -1 |
Return list of dims, statically where possible. | def shape_list(x):
x = tf.convert_to_tensor(x)
# If unknown rank, return dynamic shape
if x.get_shape().dims is None:
return tf.shape(x)
static = x.get_shape().as_list()
shape = tf.shape(x)
ret = []
for i in range(len(static)):
dim = static[i]
if dim is None:
dim = shape[i]
ret.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def static_dimensions(self):\n dimensions = []\n for dim in self.kdims:\n if len(set(self[dim.name])) == 1:\n dimensions.append(dim)\n return dimensions",
"def _dims(self):\n return [col._dims for col in self.columns]",
"def dims(cls):\n\t\treturn",
"def ... | [
"0.8077291",
"0.7767376",
"0.7441595",
"0.72366506",
"0.7203564",
"0.7192951",
"0.7109078",
"0.71029323",
"0.7099788",
"0.7017162",
"0.7008497",
"0.6953006",
"0.68890697",
"0.6768938",
"0.67284244",
"0.6618788",
"0.6602099",
"0.65830654",
"0.6536778",
"0.64925957",
"0.6489836... | 0.6375631 | 27 |
Return whether the backend is set to `test_backend`. `test_backend` may be a string of the name of the backend or its class. | def using_backend(test_backend):
require_set_backend()
if isinstance(test_backend, str):
return backend.BACKEND_NAME == test_backend
return isinstance(backend, test_backend) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_backend_setting(cls):\n\n return BACKEND in cls.AVAILABLE_BACKENDS",
"def isbackend(c):\n m = getattr(c, \"__module__\", \"\")\n return isinstance(c, type) and (m == \"pydra.cluster.tasks.datasource.backend\")",
"def hasBackendCommand():\n\thasbackend = False\n\ttry:\n\t\tif (getBackendC... | [
"0.71963495",
"0.71303296",
"0.7039218",
"0.68452394",
"0.66186285",
"0.65550643",
"0.64997864",
"0.6499249",
"0.64840865",
"0.6476762",
"0.6445964",
"0.64069533",
"0.62812805",
"0.6224529",
"0.62243307",
"0.61906123",
"0.61673033",
"0.6137998",
"0.6111241",
"0.60991466",
"0.... | 0.90973437 | 0 |
This just returns the matrix of weights for 1 graph. | def getWeightMatrix(self, g):
return numpy.kron(g1.getWeightMatrix(), g2.getWeightMatrix()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):\n pass",
"def weights(self):\n return np.array(self._weights)",
"def get_weights(self):\r\n return self.weights",
"def get_weights(self):\r\n return self.weights",
"def get_weights(self):\r\n return self.weights",
"def get_weights(self):\r\n\t\tre... | [
"0.7531794",
"0.7505469",
"0.7458031",
"0.7458031",
"0.7458031",
"0.7397707",
"0.7396026",
"0.7396026",
"0.7364992",
"0.72912693",
"0.7286968",
"0.7286968",
"0.72788423",
"0.72347647",
"0.71988577",
"0.71988577",
"0.7196217",
"0.7095303",
"0.70430464",
"0.70305836",
"0.701655... | 0.6895446 | 27 |
Encodes a tree to a single string. | def serialize(self, root):
if root == None:
return ''
stack = [root]
ret_val = ''
SEP = ','
while stack:
node = stack.pop()
ret_val += (str(node.val) + SEP)
if node.right:
stack.append(node.right)
if node... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7053364",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69672054",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6664... | 0.6614389 | 30 |
Encodes a tree to a single string. | def serialize(self, root):
if root == None:
return ''
stack = [root]
ret_val = ''
SEP = ','
while stack:
node = stack.pop()
ret_val += (str(node.val) + SEP)
if node.right:
stack.append(node.right)
if node... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78280586",
"0.7516276",
"0.7130188",
"0.7052725",
"0.70311403",
"0.70000505",
"0.6998995",
"0.69671047",
"0.6933562",
"0.6884066",
"0.6866091",
"0.6854299",
"0.680947",
"0.68020624",
"0.6797827",
"0.6773512",
"0.6766139",
"0.67545193",
"0.67511314",
"0.67459255",
"0.666489... | 0.6615221 | 29 |
Returns the normal at time t (0>1) along the line. | def normalAtTime(self,t):
return self.tangentAtTime(t).rotated(Point(0,0),math.pi/2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_at(self, t, world=True):\n point = self.point_at(t, world=False)\n f1 = Point(+self.semifocal, 0, 0)\n f2 = Point(-self.semifocal, 0, 0)\n normal = (f1 - point).unitized() + (f2 - point).unitized()\n normal.unitize()\n if world:\n normal.transform(sel... | [
"0.72490674",
"0.67459995",
"0.6457344",
"0.6305554",
"0.6181061",
"0.61805177",
"0.617699",
"0.6112421",
"0.61054754",
"0.6077127",
"0.6002652",
"0.5963256",
"0.5952823",
"0.59513795",
"0.5939865",
"0.59379804",
"0.5896347",
"0.58704233",
"0.5856498",
"0.57889324",
"0.574994... | 0.7875011 | 0 |
Returns the t (0>1) value of the given point, assuming it lies on the line, or 1 if it does not. | def tOfPoint(self, point, its_on_the_line_i_swear=False):
# Just find one and hope the other fits
# point = self.start * (1-t) + self.end * t
if not isclose(self.end.x, self.start.x):
t = (point.x - self.start.x) / (self.end.x-self.start.x)
elif not isclose(self.end.y, self.start.y):
t = (po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def side_point_on_line(self, point):\r\n a = self.end_points[0]\r\n b = self.end_points[1]\r\n c = point\r\n if not np.isclose(np.cross(b-a, c-a), 0):\r\n raise ValueError('Given point not on line.')\r\n dist_ab = utils.geometry.distance(a, b)\r\n dist_ac = util... | [
"0.63249296",
"0.62436366",
"0.6000542",
"0.593349",
"0.5857964",
"0.5743949",
"0.57239324",
"0.5717135",
"0.57142293",
"0.5695851",
"0.56305844",
"0.55996585",
"0.55558914",
"0.5553838",
"0.5538424",
"0.55337363",
"0.5527717",
"0.54901266",
"0.54847205",
"0.5478164",
"0.5460... | 0.77159643 | 0 |
Return a new square array of size, with the diagonal elements set to 1 and the other elements set to 0. If k is given, the diagonal is shifted by the specified amount. | def eye(
size: int, *, M: Optional[int] = None, k: int = 0, dtype: _DType = ulab.numpy.float
) -> ulab.numpy.ndarray:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _diagk(X, k):\n X = np.asanyarray(X)\n s = X.shape\n if len(s) > 1:\n D = np.diag(X, k)\n else:\n D = np.array([])\n\n return D",
"def diagonal(self, k=0):\n return self.tocsr().diagonal(k=k)",
"def numberer(self, k):\n return np.diag(np.arange(self.n_dims[k]))",
... | [
"0.69011813",
"0.6392721",
"0.63846123",
"0.61784345",
"0.60284615",
"0.59773123",
"0.5928625",
"0.58977354",
"0.58387613",
"0.5766936",
"0.5727855",
"0.56746334",
"0.5621576",
"0.5533009",
"0.5531304",
"0.5526279",
"0.55121773",
"0.54930973",
"0.546282",
"0.5456925",
"0.5438... | 0.0 | -1 |
Return the index of the minimum element of the 1D array | def argmin(array: _ArrayLike, *, axis: Optional[int] = None) -> int:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min(mtx):\n\tminIdx = argmin(mtx)\n\treturn unravel_index(minIdx, mtx.shape)",
"def findMinimumIndex(arr):\r\n\r\n min_pos = arr.index(min(arr))\r\n\r\n max_pos = arr.index(max(arr))\r\n\r\n # printing the array and position\r\n print(F'The max is {arr[max_pos]} at position {max_pos + 1}')\... | [
"0.80746686",
"0.7755699",
"0.76328063",
"0.75507647",
"0.7408197",
"0.7391053",
"0.7271593",
"0.7256994",
"0.7191887",
"0.71845996",
"0.7157437",
"0.711939",
"0.7115297",
"0.7110676",
"0.70933527",
"0.7088588",
"0.70475113",
"0.70355463",
"0.702866",
"0.69221646",
"0.6896882... | 0.70930094 | 15 |
Return the cross product of two vectors of length 3 | def cross(a: ulab.numpy.ndarray, b: ulab.numpy.ndarray) -> ulab.numpy.ndarray:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_cross(vec1: vec3d, vec2: vec3d) -> vec3d:\n return np.cross(vec1, vec2)",
"def cross_product(vector_a, vector_b):\n return vector_a[0] * vector_b[1] - vector_a[1] * vector_b[0]",
"def cross(a, b):\n c1 = a[1]*b[2] - a[2]*b[1]\n c2 = a[2]*b[0] - a[0]*b[2]\n c3 = a[0]*b[1] - a[1]*b[0]\n ... | [
"0.8355948",
"0.8311195",
"0.8290301",
"0.8272786",
"0.8246926",
"0.81810653",
"0.8026755",
"0.80107063",
"0.7966149",
"0.7944937",
"0.7901319",
"0.7901319",
"0.77492917",
"0.76389605",
"0.7637301",
"0.761122",
"0.75766337",
"0.7521467",
"0.7515794",
"0.75010914",
"0.74964684... | 0.75725436 | 17 |
Return the minimum element of the 1D array | def min(array: _ArrayLike, *, axis: Optional[int] = None) -> _float:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self, dim=None, keepdim=False):\n return array_funcs.min(self, dim, keepdim)",
"def min(self) -> np.number:\n if self._data.shape[0] == 0:\n return np.inf\n else:\n return self._data.min()",
"def calc_min(signal):\n return np.min(signal)",
"def extract_min(se... | [
"0.77877617",
"0.7727527",
"0.7535068",
"0.7493072",
"0.7420615",
"0.7405595",
"0.7386862",
"0.7345659",
"0.7335045",
"0.7319035",
"0.72815794",
"0.72714204",
"0.7229101",
"0.7209369",
"0.7208615",
"0.7198514",
"0.7193085",
"0.7192143",
"0.7176489",
"0.7174585",
"0.71634454",... | 0.7753227 | 1 |
Shift the content of a vector by the positions given as the second argument. If the ``axis`` keyword is supplied, the shift is applied to the given axis. The array is modified in place. | def roll(
array: ulab.numpy.ndarray, distance: int, *, axis: Optional[int] = None
) -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift(vector, n_shift=1, inplace=False):\n if not inplace:\n vector = vector.copy()\n # Shift elements over to empty space.\n vector[0:-n_shift] = vector[n_shift:]\n # Set last element to 0.\n vector[-n_shift:] = 0\n return vector",
"def arrshift(x, shift, axes=None):\n y = np.asa... | [
"0.6518247",
"0.6272395",
"0.59628713",
"0.59226114",
"0.589129",
"0.58442503",
"0.5746137",
"0.5608256",
"0.556186",
"0.55231476",
"0.5518388",
"0.54987526",
"0.549103",
"0.547786",
"0.5473638",
"0.54705685",
"0.5457986",
"0.54231966",
"0.5417354",
"0.53937376",
"0.53713256"... | 0.0 | -1 |
Sort the array along the given axis, or along all axes if axis is None. The array is modified in place. | def sort(array: ulab.numpy.ndarray, *, axis: int = -1) -> ulab.numpy.ndarray:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argsort(array: ulab.numpy.ndarray, *, axis: int = -1) -> ulab.numpy.ndarray:\n ...",
"def sort(a, axis=-1, kind=None, order=None):\n if axis is None:\n # flatten returns (1, N) for np.matrix, so always use the last axis\n a = asanyarray(a).flatten()\n axis = -1\n try:\n ... | [
"0.72395754",
"0.7162273",
"0.68239635",
"0.67801404",
"0.6648683",
"0.65317154",
"0.64700496",
"0.64080477",
"0.61748713",
"0.61411196",
"0.6118073",
"0.608749",
"0.6061318",
"0.5834122",
"0.56185615",
"0.56044406",
"0.5593283",
"0.55251014",
"0.54653066",
"0.53683877",
"0.5... | 0.7962226 | 0 |
Return the sum of the array, as a number if axis is None, otherwise as an array. | def sum(
array: _ArrayLike, *, axis: Optional[int] = None
) -> Union[_float, int, ulab.numpy.ndarray]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(a, axis=None):\n return np.sum(np.array(a),axis=axis)",
"def sum(arr, axis=0):\n if _isPhysical(arr):\n return arr.sum(axis)\n elif isinstance(arr, type(MA.array((0)))):\n return MA.sum(arr, axis)\n else:\n if type(arr) in (float, int) or len(arr) == 0 or 0 in arr.sha... | [
"0.77503717",
"0.77476317",
"0.75189996",
"0.72242355",
"0.7128267",
"0.7051543",
"0.6983518",
"0.6921053",
"0.69203144",
"0.6904519",
"0.6902239",
"0.6887176",
"0.6885399",
"0.6768763",
"0.66445935",
"0.6598692",
"0.6567179",
"0.6530893",
"0.65092295",
"0.6492456",
"0.645279... | 0.786926 | 0 |
Computes the exponent function. | def exp(a: _ArrayLike) -> ulab.numpy.ndarray:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponent(num, power=2):\n\treturn num ** power",
"def exp(x):\r\n\r\n return math.exp(x)",
"def exponentiation(x, y):\n return x ** y",
"def exp(x):\n return _func(\"exp\", TFloat64(), x)",
"def exp(x):\n return np.e**x",
"def exp(a):\n return math.exp(a)",
"def exponential(x):\n ... | [
"0.7800109",
"0.758699",
"0.734436",
"0.7241224",
"0.7218165",
"0.72101295",
"0.71547633",
"0.7109176",
"0.7068119",
"0.7048565",
"0.7010293",
"0.68917483",
"0.68686557",
"0.67681974",
"0.674924",
"0.6732345",
"0.6698136",
"0.6645668",
"0.6629962",
"0.6610721",
"0.66087383",
... | 0.0 | -1 |
Rescale the likelihood array using a Sorted Cumulative Sum function (e.g., for making contours) Construct an array "sumabove" such that the cell at index i in sumabove is equal to the sum of all cells from the input array "a" that have a cell value higher than a[i] | def rescale_likelihood(a):
# Collapse the array into 1 dimension
sumabove = deepcopy(a).ravel()
# Sort the raveled array by descending cell value
iravelsorted = sumabove.argsort(axis=0)[::-1]
# Reassign each cell to be the cumulative sum of all
# input array cells with a higher value :
sum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rolling_sum_array(self, arr, w):\n n = len(arr)\n cs = np.cumsum(arr)\n return cs[int(w)-1:] - np.concatenate((np.array([0.0]), cs[:n-int(w)]))",
"def topx(array, top_size):\n\n sorted_and_reduced_array = sorted_and_reduce(array.copy())\n position = len(sorted_and_reduced_array) -... | [
"0.5540595",
"0.53680676",
"0.5341936",
"0.5295214",
"0.526032",
"0.52561444",
"0.52341807",
"0.5111039",
"0.51082736",
"0.50463074",
"0.50240785",
"0.5021775",
"0.49963585",
"0.49929675",
"0.49827227",
"0.49406242",
"0.49374923",
"0.493653",
"0.49027413",
"0.48943353",
"0.48... | 0.8000494 | 0 |
Create a fisher matrix using params, based on the overarching survey parameters. | def survey_fisher(self, params, dx=1e-6):
def _take_deriv(p2, p2name, p1, p1name):
return deriv(deriv_like, p1, dx=dx,
args=(p2, [p1name, p2name], self.zl, self.zs, self.dTc,
self.cosmo_truths['Om0'], self.cosmo_truths['Ok'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_params(self):\n \n self.W_1 = rand_mat(self.IL,self.HL_1)\n self.W_2 = rand_mat(self.HL_1,self.HL_2)\n self.W_3 = rand_mat(self.HL_2,self.OL)\n self.f_1 = np.matrix(np.ones((1,self.HL_1))) / 2\n self.f_2 = np.matrix(np.ones((1,self.HL_2))) / 2\n self.... | [
"0.56783044",
"0.54804134",
"0.5437754",
"0.5226976",
"0.5154135",
"0.51397574",
"0.51073074",
"0.50981313",
"0.50835794",
"0.50653577",
"0.5027744",
"0.49944094",
"0.49759993",
"0.4966824",
"0.49621502",
"0.49489975",
"0.49403688",
"0.4930667",
"0.49303442",
"0.49282128",
"0... | 0.7132004 | 0 |
Covariance matrix, by definition the inverse of the Fisher matrix | def cov(self):
return np.linalg.inv(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covariance(self):\n return np.eye(self.dim) * self._covariance",
"def _inverse_covariance_matrix(self, sigma_m_z=None):\n # here is the option for adding an additional covariance matrix term of the calibration and/or systematic\n # errors in the evolution of the Sne population\n i... | [
"0.7157563",
"0.7121453",
"0.7088178",
"0.69609785",
"0.68430763",
"0.67814815",
"0.6618057",
"0.6542951",
"0.6510171",
"0.6479719",
"0.64235824",
"0.6387867",
"0.6370277",
"0.6365546",
"0.63292956",
"0.630388",
"0.62865967",
"0.628517",
"0.628517",
"0.6247664",
"0.621776",
... | 0.70286083 | 3 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def harversine(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])
# harversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = math.sin(dlat/2.)**2. + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2.)**2.
c =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle_distance(latitudes1: float, longitudes1: float, latitudes2: float, longitudes2: float) -> float:\n dlat = math.radians(latitudes1 - latitudes2)\n dlon = math.radians(longitudes1 - longitudes2)\n alat = math.radians((latitudes1 + latitudes2) / 2)\n R = 3958.8\n x = dlon * math.cos(al... | [
"0.8263065",
"0.7902882",
"0.76503116",
"0.76352596",
"0.7599816",
"0.754315",
"0.753433",
"0.7533532",
"0.75246805",
"0.74979705",
"0.7495939",
"0.745955",
"0.74054193",
"0.73624384",
"0.73535967",
"0.7324299",
"0.7322554",
"0.7296266",
"0.7267024",
"0.7264583",
"0.7217569",... | 0.6958018 | 51 |
Create a new ThreatIntelSet. ThreatIntelSets consist of known malicious IP addresses. GuardDuty generates findings based on ThreatIntelSets. | def create_threat_intel_set(self, Activate: bool, DetectorId: str, Format: str, Location: str, Name: str, ClientToken: str = None) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_threat_intel_set(self, DetectorId: str, ThreatIntelSetId: str) -> Dict:\n pass",
"def ti(self) -> ThreatIntelligence:\n return ThreatIntelligence(self.session)",
"def delete_threat_intel_set(self, DetectorId: str, ThreatIntelSetId: str) -> Dict:\n pass",
"def create_tile_set():\n... | [
"0.59023696",
"0.5619383",
"0.53175026",
"0.5214492",
"0.5185965",
"0.50022113",
"0.484885",
"0.48344296",
"0.48004672",
"0.47593856",
"0.47587684",
"0.46969444",
"0.4623778",
"0.46218032",
"0.46121094",
"0.45898136",
"0.4579296",
"0.45120108",
"0.450619",
"0.44867116",
"0.44... | 0.6277876 | 0 |
Retrieves an Amazon GuardDuty detector specified by the detectorId. | def get_detector(self, DetectorId: str) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_detector_parameterisation(self, experiment_id):\n\n param_set = self._exp_to_param[experiment_id]\n dp = None\n if param_set.det_param is not None:\n dp = self._detector_parameterisations[param_set.det_param]\n\n return dp",
"def delete_detector(self, DetectorId: str) -> Dict:\n ... | [
"0.54046404",
"0.5180014",
"0.503798",
"0.48902473",
"0.48772573",
"0.48753133",
"0.4856543",
"0.4835218",
"0.48185468",
"0.48170578",
"0.47826526",
"0.47539708",
"0.47080407",
"0.4703021",
"0.46822488",
"0.46782535",
"0.46367413",
"0.46158525",
"0.45832002",
"0.4552347",
"0.... | 0.68970937 | 0 |
Returns the details of the filter specified by the filter name. | def get_filter(self, DetectorId: str, FilterName: str) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterInfo(self, name):\n return self.__filters[name] if name in self.__filters else None",
"def get_filter(self, name):\n for flter in self.get_filters():\n if flter.name == name:\n return flter",
"def get_filter(self, name=constants.STRING_FILTER):\n try:\n ... | [
"0.8330836",
"0.7479784",
"0.6959221",
"0.6864468",
"0.676144",
"0.66311884",
"0.63032854",
"0.62118095",
"0.6133188",
"0.610993",
"0.6067023",
"0.6035042",
"0.5990015",
"0.5990015",
"0.5979609",
"0.5899671",
"0.58614147",
"0.58200336",
"0.58136696",
"0.58024514",
"0.57822335... | 0.719438 | 2 |
Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID. | def get_threat_intel_set(self, DetectorId: str, ThreatIntelSetId: str) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_sticker_set(\n self,\n set_id: int,\n *,\n request_id: str = None,\n request_timeout: int = None,\n skip_validation: bool = False\n ) -> StickerSet:\n _constructor = GetStickerSet.construct if skip_validation else GetStickerS... | [
"0.55020714",
"0.53290147",
"0.5305308",
"0.5276175",
"0.5078037",
"0.50355744",
"0.49736193",
"0.47728395",
"0.45853713",
"0.45600474",
"0.4541864",
"0.45205337",
"0.45191658",
"0.44648796",
"0.44500923",
"0.4440346",
"0.44197968",
"0.44005358",
"0.43745556",
"0.43745032",
"... | 0.6483026 | 0 |
Updates the filter specified by the filter name. | def update_filter(self, DetectorId: str, FilterName: str, Action: str = None, Description: str = None, FindingCriteria: Dict = None, Rank: int = None) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_filter(self, publisher_scope, publisher_name, filter_to_update):\n url_path = \"/\" + publisher_scope + \"/publishers/\" + publisher_name + \"/filters/\" + filter_to_update.name + \".xml\"\n return self.__parse_response(self.__do_http_put(url_path, filter_to_update.to_xml()))",
"def __up... | [
"0.78817785",
"0.66973495",
"0.66973495",
"0.6581714",
"0.6579827",
"0.6575244",
"0.6564854",
"0.6452288",
"0.63680255",
"0.62143534",
"0.61429876",
"0.613201",
"0.6109878",
"0.6056815",
"0.59947807",
"0.59758663",
"0.5946884",
"0.5933692",
"0.5928276",
"0.59079057",
"0.58649... | 0.74173355 | 1 |
Performs a readthroughcache lookup to determine whether a given feature is currently enabled. | def is_enabled(self, feature_name):
cache_key = self.FEATURE_CACHE_KEY.format(feature_name=feature_name)
# Try to fetch the result from cache
cached_result = cache.get(cache_key)
if cached_result is None:
# Get the result from the database, and cache it
cached... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_feature_available(self, feature: Feature) -> bool:\n return self.feature_flags[feature]",
"def request(self):\n try:\n if self.config[\"cache\"] and self.key in CACHE and self.config_key in CACHE[self.key]:\n return CACHE[self.key][self.config_key]\n feat... | [
"0.6329544",
"0.60026675",
"0.584523",
"0.5794747",
"0.5714718",
"0.5685161",
"0.54499286",
"0.5407959",
"0.5407157",
"0.54052925",
"0.5389228",
"0.53808624",
"0.5313572",
"0.5309725",
"0.528926",
"0.52530414",
"0.5250565",
"0.5229395",
"0.52248544",
"0.50980943",
"0.5084513"... | 0.7099202 | 0 |
LMR RxFCf Step/100 msec | def LmrRxFcfStepPer100mSec(self):
return self._get_attribute('lmrRxFcfStepPer100mSec') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_fn(step):\n lr = base\n\n progress = (step - warmup_steps) / float(total_steps - warmup_steps)\n progress = jnp.clip(progress, 0.0, 1.0)\n if decay_type == \"linear\":\n lr = linear_end + (lr - linear_end) * (1.0 - progress)\n elif decay_type == \"cosine\":\n lr = lr * 0.5 * (1. +... | [
"0.6173643",
"0.61093384",
"0.5962029",
"0.58752275",
"0.5872341",
"0.5693199",
"0.5683694",
"0.56644464",
"0.5635137",
"0.55809265",
"0.5550853",
"0.5490244",
"0.5488012",
"0.5475506",
"0.5464437",
"0.54640806",
"0.54459697",
"0.5433994",
"0.5431321",
"0.5430923",
"0.5429523... | 0.6257769 | 0 |
change date format like 'May 03 2020' INTO '2020_05_03' | def formatdate(single_date):
temp = time.strptime(single_date,'%b %d %Y')
return time.strftime('%Y_%m_%d',temp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], self.date[0:2])",
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], \\\n self.date[0:2])",
"def convert_date(self):\n self.date = '%s-%s-%... | [
"0.67402357",
"0.67121863",
"0.67121863",
"0.6662628",
"0.6593368",
"0.65505797",
"0.64755964",
"0.6473269",
"0.63454056",
"0.63440377",
"0.6257083",
"0.60439736",
"0.60415727",
"0.6035371",
"0.5996141",
"0.5983207",
"0.59788704",
"0.59647226",
"0.59632593",
"0.59404993",
"0.... | 0.6240411 | 11 |
Acquire all covid statistics of all countries up to the current day make sure database has been created for storing data | def updateMysql(port='localhost',user='root',pw=None,db='COVID_UPDATE'):
today = '_'.join([str('%02d'%_) for _ in time.localtime()[:3]])
url = 'https://www.worldometers.info/coronavirus/'
web = access_web(today, url)
trs = get_target(web)
urls = all_url(trs)
all_countries = []
for country, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_global_stats():\n print(\"Collecting global COVID-19 case statistics\")\n response = get_request(const.COVID19_API_URL + \"/summary\")[\"Global\"]\n global_stats = {\"totals\": None, \"new\": None}\n global_stats[\"totals\"] = {\n \"cases\": response[\"TotalConfirmed\"],\n \"d... | [
"0.655654",
"0.64588606",
"0.6430078",
"0.6403466",
"0.63846105",
"0.6366454",
"0.6340908",
"0.63297987",
"0.6313494",
"0.62270397",
"0.61315125",
"0.61213404",
"0.6117618",
"0.61007655",
"0.60181344",
"0.5929325",
"0.58572555",
"0.5839887",
"0.58394057",
"0.58349836",
"0.581... | 0.0 | -1 |
Return the value expanded (unabbreviated and with case corrected) and checked, as appropriate. Expansion of abbreviations and correction of case are controlled by ignoreCase and abbrevOK, flags supplied to __init__. | def expandValue(self, value, doCheck=True, descr = "value"):
if value is None:
return
try:
value = self._matchItem.getUniqueMatch(value)
except ValueError as e:
if doCheck:
raise ValueError("invalid %s: %s" % (descr, RO.StringUtil.strFromExcep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_abbreviate_on_valid_case(self):\n print('\\nTesting abbreviate on valid case mode...')\n # get data\n file_name = 'maya_nodes.json'\n data_path = os.path.join(__file__, os.pardir, os.pardir, 'data')\n file_path = os.path.join(os.path.abspath(data_path), file_name)\n ... | [
"0.5630218",
"0.5331933",
"0.5175146",
"0.51573336",
"0.50903994",
"0.5070003",
"0.5044939",
"0.50435704",
"0.5019854",
"0.5007162",
"0.4991188",
"0.49577814",
"0.49280718",
"0.49098006",
"0.48770982",
"0.48620215",
"0.48514748",
"0.48380303",
"0.481511",
"0.48135787",
"0.480... | 0.5310557 | 2 |
Return True if current value matches the default value. | def isDefault(self):
return str(self._var.get()) == (self._defValue or "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_default (self):\n \n return self.Default == self.value",
"def is_init_default(cls, value):\n return value is cls._DEFAULT",
"def has_default_value(self):\n return self._default_value != NULL_VALUE",
"def has_default(self):\n return self._default is not NOT_PROVIDED",... | [
"0.7726625",
"0.7478379",
"0.7136511",
"0.70053476",
"0.68749624",
"0.67996305",
"0.67852855",
"0.67560536",
"0.67491084",
"0.6642717",
"0.6434752",
"0.64181775",
"0.63976157",
"0.63882846",
"0.63798636",
"0.63798636",
"0.6373089",
"0.635171",
"0.6202259",
"0.6105039",
"0.608... | 0.74118686 | 2 |
One hot encode a list of sample labels. Return a onehot encoded vector for each label. | def one_hot_encode(x):
# TODO: Implement Function
out = encoder.transform(x).astype(np.float32)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encoding(labels: np.ndarray) -> np.ndarray:\n counts = Counter(labels)\n vocab = sorted(counts, key=counts.get, reverse=True)\n vocab_to_int = {word: ii for ii, word in enumerate(vocab, 0)}\n int_encoded = [vocab_to_int[ii] for ii in labels]\n one_hot = list()\n for value in int_encod... | [
"0.8544275",
"0.84696496",
"0.8252604",
"0.8191945",
"0.8138875",
"0.81052375",
"0.8096329",
"0.8086957",
"0.80858636",
"0.807541",
"0.8060732",
"0.803778",
"0.8017688",
"0.8009606",
"0.7927839",
"0.791351",
"0.7905109",
"0.79028136",
"0.7900995",
"0.78970677",
"0.78970677",
... | 0.0 | -1 |
For adjusting the lateral weights. Only adjusts nonnan weights. | def getAdjustedLateralWeights(lat_weight_adjustment, bright_lat_weights, dark_lat_weights):
if args.lat_weight_adjustment != 0:
adjusted_dark_lat_weights = dark_lat_weights + args.lat_weight_adjustment * np.nanmean(dark_lat_weights)
adjusted_bright_lat_weights = bright_lat_weights + args.lat_weight_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_nans_to_weights(weights):\n\n # Taken from @trondkr and adapted by @raphaeldussin to use `lil`.\n # lil matrix is better than CSR when changing sparsity\n m = weights.data.to_scipy_sparse().tolil()\n # replace empty rows by one NaN value at element 0 (arbitrary)\n # so that remapped element ... | [
"0.7232946",
"0.66984904",
"0.66984904",
"0.6671197",
"0.63119763",
"0.626736",
"0.62355924",
"0.62205476",
"0.6193902",
"0.61304665",
"0.60979986",
"0.60918593",
"0.6076311",
"0.603094",
"0.6022941",
"0.60026026",
"0.5997604",
"0.5989117",
"0.5985948",
"0.5967133",
"0.594419... | 0.666392 | 4 |
Render a surface onto the screen. | def blit(self, surface, x, y):
self.screen.blit(surface, (x + self.offset.x, y + self.offset.y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self, surface):\n self.renderer.draw()",
"def draw(self, surface=None):\n self.blit_surface.blit(self.surface, self.rect)",
"def render(self, surface):\r\n surface.blit(self._image, self._rect)",
"def display(self,surface):\n\n if self._shown:\n self._image.dis... | [
"0.8545959",
"0.84493566",
"0.83942467",
"0.8024755",
"0.8016849",
"0.8016849",
"0.8016849",
"0.8016849",
"0.8016849",
"0.8016849",
"0.8016849",
"0.79827553",
"0.7947875",
"0.7947875",
"0.7947875",
"0.78941315",
"0.786541",
"0.78227",
"0.77971953",
"0.7770867",
"0.77258354",
... | 0.7216676 | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.