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 |
|---|---|---|---|---|---|---|
Fused `upsample_2d()` followed by `tf.nn.conv2d()`. Padding is performed only once at the beginning, not between the operations. The fused op is considerably more efficient than performing the same calculation using standard TensorFlow ops. It supports gradients of arbitrary order. | def upsample_conv_2d(x, w, k=None, factor=2, gain=1, data_format='NHWC'):
assert isinstance(factor, int) and factor >= 1
# Check weight shape.
assert len(w.shape) == 4
convH = w.shape[0]
convW = w.shape[1]
inC = w.shape[2]
outC = w.shape[3]
assert convW == convH
# Setup filter kernel.
if k is Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_conv_2d(input_tensor, nb_filters, name):\n resize = UpSampling2D(size=(2, 2), interpolation='nearest')(input_tensor)\n paddings = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])\n resize = tf.pad(resize, paddings, \"SYMMETRIC\")\n output_layer = Conv2D(\n filters=nb_filters,\n kernel... | [
"0.73448116",
"0.72331333",
"0.7187507",
"0.69876885",
"0.692806",
"0.6898494",
"0.681928",
"0.6787739",
"0.6780985",
"0.67335194",
"0.66998523",
"0.6665991",
"0.66593987",
"0.6648547",
"0.6643128",
"0.66169435",
"0.6598058",
"0.6569142",
"0.65622747",
"0.65598947",
"0.655656... | 0.66431206 | 15 |
Fused `tf.nn.conv2d()` followed by `downsample_2d()`. Padding is performed only once at the beginning, not between the operations. The fused op is considerably more efficient than performing the same calculation using standard TensorFlow ops. It supports gradients of arbitrary order. | def conv_downsample_2d(x, w, k=None, factor=2, gain=1, data_format='NHWC'):
assert isinstance(factor, int) and factor >= 1
convH, convW, _inC, _outC = w.shape
assert convW == convH
if k is None:
k = [1] * factor
k = _setup_kernel(k) * gain
p = (k.shape[0] - factor) + (convW - 1)
s = [factor, factor]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deconv2d(layer_input, skip_input, filters, f_size=3, dropout_rate=0, padding='same', strides=2):\n u = UpSampling2D(size=2)(layer_input)\n u = Conv2D(filters, kernel_size=f_size, strides=strides, padding=padding, activation='relu')(u)\n if dropout_rate:\n u = Dro... | [
"0.74749357",
"0.7426293",
"0.72263664",
"0.7095035",
"0.7047088",
"0.70270234",
"0.6983599",
"0.6961671",
"0.6943706",
"0.6927744",
"0.6926976",
"0.6905601",
"0.6869988",
"0.685746",
"0.685576",
"0.68433666",
"0.6804358",
"0.68010366",
"0.67909175",
"0.6780132",
"0.67613554"... | 0.0 | -1 |
Open link from action in default operating system browser | def open_url(self, url):
if url is None:
return
QDesktopServices.openUrl(QUrl(url)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_magnet(ctx, link):\n\n system = platform.system().lower()\n if system == 'darwin':\n webbrowser.open(link)\n elif system == 'linux':\n subprocess.Popen(['xdg-open', link]).wait()\n else:\n os.startfile(link)",
"def open(self, event=None, url=None):\n url = ur... | [
"0.7387506",
"0.730704",
"0.7203935",
"0.7029492",
"0.6929588",
"0.6903968",
"0.68708026",
"0.68522924",
"0.682711",
"0.68033195",
"0.67631966",
"0.67479485",
"0.6728832",
"0.6716105",
"0.66869056",
"0.66804665",
"0.6662799",
"0.6615952",
"0.65971243",
"0.6574332",
"0.6570275... | 0.65980226 | 18 |
Method to compute a similarity matrix from original df_matrix | def compute_distance(self, transpose=False):
# Calculate distance matrix
if transpose:
distance_matrix = pdist(self.matrix.T, self.distance)
else:
distance_matrix = pdist(self.matrix, self.distance)
# Remove NaNs
distance_matrix[np.isnan(distance_matrix)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def similarity_matrix(feat_mat):\n sim_mat = cosine_similarity(feat_mat)\n np.fill_diagonal(sim_mat, 0)\n return sim_mat",
"def create_similarity_matrix_euclid(matrix):\n similarity_matrix_euclid = pd.DataFrame(0, index=matrix.index, columns=matrix.index, dtype=float)\n\n for business1 in matrix.i... | [
"0.72516",
"0.70280254",
"0.68708026",
"0.6798223",
"0.6737261",
"0.667538",
"0.66727966",
"0.64972895",
"0.6491153",
"0.64314204",
"0.6426746",
"0.64116955",
"0.63591456",
"0.63516957",
"0.63375753",
"0.63281864",
"0.63021475",
"0.6226184",
"0.6208668",
"0.6207335",
"0.62043... | 0.0 | -1 |
Return a JSON serializable dict representation of object instance. | def serialize_instance(obj):
d = {'__classname__': type(obj).__name__}
d.update(vars(obj))
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self):\n obj_dict = self.__dict__\n obj_dict[\"_class_\"] = self.__class__.__name__\n return obj_dict",
"def toJSON(self):\n return json.dumps(self, default=lambda o: o.__dict__)",
"def to_obj(self):\n return dict()",
"def cls2json(self):\n return json.du... | [
"0.8131718",
"0.7897041",
"0.7894373",
"0.78343606",
"0.78343606",
"0.78280425",
"0.7797795",
"0.77868026",
"0.76484054",
"0.7631654",
"0.7631654",
"0.7631654",
"0.7631654",
"0.7631654",
"0.7631654",
"0.7631654",
"0.76257735",
"0.76257735",
"0.7608427",
"0.7608427",
"0.760842... | 0.0 | -1 |
Return object representation from serialized obj. | def deserialize_object(d):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(obj):\n return serialization_manager.serialize(obj)",
"def serialize(self, obj):\n return obj",
"def serialize_forstorage(cls, obj):\n return misc.serialize_forstorage(obj)",
"def serialize(self, obj):\n pass",
"def deserialize(self, obj):\n raise NotImplemented... | [
"0.81370825",
"0.80581224",
"0.750724",
"0.74576455",
"0.736804",
"0.73665583",
"0.73446584",
"0.73126626",
"0.7253966",
"0.7231121",
"0.7231121",
"0.71811926",
"0.6860704",
"0.68516415",
"0.68265426",
"0.678869",
"0.67699176",
"0.67332315",
"0.6689367",
"0.66850793",
"0.6673... | 0.638828 | 41 |
Return True if the server is powered on. | def is_on(self):
return self._get_state() == ServerState.ON | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_powering_on(self):\n return self._get_state() == ServerState.POWERING_ON",
"def is_on(self):\n if self._power_state == HYSEN_POWERON :\n return True\n else:\n return False",
"def is_host_on(self):\n status = False\n cmd = \"/usr/local/bin/wedge_po... | [
"0.8399855",
"0.79808426",
"0.7749526",
"0.77167827",
"0.7618223",
"0.7210045",
"0.71977913",
"0.7149112",
"0.7001631",
"0.6981783",
"0.6897274",
"0.6875046",
"0.683122",
"0.683122",
"0.683122",
"0.68265486",
"0.6774977",
"0.67701876",
"0.6688752",
"0.66666883",
"0.66666883",... | 0.7692261 | 4 |
Return True if the server is in the process of being powered on. | def is_powering_on(self):
return self._get_state() == ServerState.POWERING_ON | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on(self):\n if self._power_state == HYSEN_POWERON :\n return True\n else:\n return False",
"def is_host_on(self):\n status = False\n cmd = \"/usr/local/bin/wedge_power.sh status\"\n data = run_shell_cmd(cmd)\n Logger.info(\"[FSCD Testing] Exe... | [
"0.7806083",
"0.7783991",
"0.77826375",
"0.7498044",
"0.73826337",
"0.7230849",
"0.7181862",
"0.711774",
"0.70670676",
"0.70519984",
"0.6885925",
"0.68290555",
"0.6812099",
"0.67613184",
"0.67492056",
"0.6744383",
"0.674361",
"0.6732181",
"0.6730665",
"0.67200327",
"0.6720032... | 0.8435485 | 0 |
Return True if the server is in the process of powered off. | def is_powering_off(self):
return self._get_state() == ServerState.POWERING_OFF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_off(self):\n return self._get_state() == ServerState.OFF",
"def is_powered_off(self, instance_name):\n return self._smtclient.get_power_state(instance_name) == 'off'",
"def is_powering_on(self):\n return self._get_state() == ServerState.POWERING_ON",
"def is_on(self):\n run... | [
"0.7824",
"0.7776749",
"0.74727935",
"0.72223604",
"0.70757234",
"0.7032411",
"0.68682",
"0.67982227",
"0.6795486",
"0.6750043",
"0.6710196",
"0.6682203",
"0.66467077",
"0.6633493",
"0.660809",
"0.66007054",
"0.65932846",
"0.6574245",
"0.65727454",
"0.6453709",
"0.6424308",
... | 0.8522721 | 0 |
The Amazon Resource Name (ARN) of the inference scheduler being created. | def inference_scheduler_arn(self) -> Optional[str]:
return pulumi.get(self, "inference_scheduler_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_definition_arn(self) -> str:\n return pulumi.get(self, \"task_definition_arn\")",
"def invoke_arn(self) -> str:\n return pulumi.get(self, \"invoke_arn\")",
"def scheduler(self):\n return self._get_param(\"Scheduler\")",
"def arn(self) -> pulumi.Output[str]:\n return pulum... | [
"0.6681855",
"0.6431098",
"0.6323862",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"0.6243085",
"... | 0.85025364 | 0 |
The Amazon Resource Name (ARN) of a role with permission to access the data source being used for the inference. | def role_arn(self) -> Optional[str]:
return pulumi.get(self, "role_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_arn(self) -> str:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> Optional[pulumi.I... | [
"0.76391274",
"0.76163363",
"0.7521853",
"0.7419875",
"0.7419875",
"0.7419875",
"0.7419875",
"0.7204899",
"0.7161858",
"0.7161858",
"0.7155701",
"0.7134347",
"0.7134347",
"0.705844",
"0.70274127",
"0.69729567",
"0.6923463",
"0.66364956",
"0.650891",
"0.65012205",
"0.65012205"... | 0.7381087 | 7 |
Get requirements from pip requirement files. | def get_requirements(*args):
requirements = set()
with open(get_absolute_path(*args)) as handle:
for line in handle:
# Strip comments.
line = re.sub(r'^#.*|\s#.*', '', line)
# Ignore empty lines
if line and not line.isspace():
requirements.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_requirements():\n with open(\"requirements.txt\", 'r') as f:\n return f.read().splitlines()",
"def get_requirements():\n name = 'pypeit/requirements.txt'\n\n requirements_file = os.path.join(os.path.dirname(__file__), name)\n install_requires = [line.strip().replace('==', '>=') for li... | [
"0.8003665",
"0.7911977",
"0.7836393",
"0.78313106",
"0.7764609",
"0.77159315",
"0.77095985",
"0.770507",
"0.769934",
"0.76833093",
"0.7674127",
"0.76596487",
"0.76507664",
"0.7627373",
"0.7624796",
"0.7618371",
"0.7610089",
"0.75720364",
"0.7549586",
"0.74670756",
"0.7413754... | 0.7113927 | 26 |
Gets and cleans product price from Amazon page. If HTML attribute priceblock_ourprice or priceblock_dealprice is absent, the price is marked as Not Available. | def get_product_price(self):
price = "0.0000"
try:
price = self.trees.get_element_by_id("priceblock_ourprice").text
except:
try:
price = self.trees.get_element_by_id(
"price_inside_buybox").text
except:
try... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_product_price(self, url):\n self.driver.get(url)\n\n try:\n price = self.driver.find_element_by_id(\"priceblock_ourprice\").text\n except:\n pass\n\n try:\n price = self.driver.find_element_by_id(\"priceblock_dealprice\").text\n except:\n ... | [
"0.8162538",
"0.7282369",
"0.7190265",
"0.7157096",
"0.7121404",
"0.6968453",
"0.69036216",
"0.67990875",
"0.67752916",
"0.6698705",
"0.66276175",
"0.6558688",
"0.65288067",
"0.6518755",
"0.64108324",
"0.64075094",
"0.6308097",
"0.6274788",
"0.62374526",
"0.6220259",
"0.62007... | 0.72543967 | 2 |
Quantize the trained model. | def _quantize(self, model: nn.Module) -> nn.Module:
if self.mask:
model_utils.remove_pruning_reparameterization(self.params_all)
# check the accuracy after each epoch
quantized_model = torch.quantization.convert(model.eval(), inplace=False)
quantized_model.eval()
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantize(self, tune_cfg, model, data_loader, q_func=None):\n assert q_func is None, \"quantization aware training has not been supported on ONNXRUNTIME\"\n model = self.pre_optimized_model if self.pre_optimized_model else model\n ort_version = StrictVersion(ort.__version__)\n if ort... | [
"0.7032731",
"0.6743895",
"0.65935856",
"0.6458979",
"0.6284604",
"0.6274341",
"0.60479605",
"0.5958633",
"0.5887666",
"0.5870083",
"0.5844094",
"0.58266145",
"0.57968426",
"0.55845594",
"0.5580447",
"0.5514728",
"0.54966277",
"0.5480121",
"0.5452482",
"0.5435136",
"0.5429144... | 0.67120594 | 2 |
Assert an appropriate exception is raised when UMAP is not installed | def test_umap_unavailable():
from yellowbrick.text.umap_vis import UMAP
assert UMAP is None
with pytest.raises(
YellowbrickValueError, match="umap package doesn't seem to be installed"
):
UMAPVisualizer() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_units(self):\n with self.assertRaises(AssertionError):\n _unit_map(\"WiB\")",
"def test_lookup_exception(self):\n self.assertIsInstance(BuildGraph.TransitiveLookupError(), AddressLookupError)",
"def test_ip_addr_fails(self, mock_ghn, mock_grnam, mock_pwnam):\n # Should ... | [
"0.6245788",
"0.6064388",
"0.5946757",
"0.59312123",
"0.58708656",
"0.58636844",
"0.5819605",
"0.57972056",
"0.5749107",
"0.5747986",
"0.5737053",
"0.573631",
"0.57356614",
"0.57354164",
"0.5728028",
"0.5724836",
"0.5716993",
"0.5716395",
"0.56910515",
"0.56907964",
"0.568734... | 0.7728401 | 0 |
Assert exception is raised when number of labels doesn't match | def test_umap_mismtached_labels(self):
## produce random data
X, y = make_classification(
n_samples=200,
n_features=100,
n_informative=20,
n_redundant=10,
n_classes=3,
random_state=42,
)
## fewer labels than classes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_label_indices_unknown():\n with pytest.raises(ValueError):\n util.get_label_indices(3, \"random_str\")",
"def assert_labels (labels):\n assert labels is not None\n assert (type (labels) is np.ndarray) or (type (labels) is list)",
"def check_number_of_labels(n_labels, n_samples):\n i... | [
"0.70916957",
"0.6875282",
"0.6822198",
"0.6822198",
"0.6760385",
"0.6703675",
"0.66630524",
"0.66359305",
"0.6602931",
"0.66020596",
"0.65820813",
"0.65726197",
"0.655046",
"0.6529117",
"0.6495246",
"0.645682",
"0.64400256",
"0.6415256",
"0.64039",
"0.63822395",
"0.6368232",... | 0.6479535 | 15 |
Given a person's name, returns the person's initials (upper case) | def get_initials(the_fullname):
my_initials = ''
for name in the_fullname.split():
my_initials += name[0].upper()
return my_initials | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_initials(name, force_upper=True):\r\n if force_upper:\r\n return name[0:1].upper()\r\n return name[0:1]",
"def initials(full_name):\r\n\r\n if full_name is not None and len(full_name) > 0:\r\n return ''.join([s[0] for s in full_name.split(' ')]).upper()\r\n else:\r\n retu... | [
"0.851246",
"0.8308822",
"0.79446423",
"0.7922886",
"0.78461766",
"0.7662941",
"0.71286404",
"0.70714873",
"0.6967643",
"0.689337",
"0.68111485",
"0.6800498",
"0.6793752",
"0.66847837",
"0.6642583",
"0.65746474",
"0.6561757",
"0.65394104",
"0.6517746",
"0.6512654",
"0.6505504... | 0.7858368 | 4 |
Configures the learning rate. | def configure_learning_rate(num_samples_per_epoch, global_step):
decay_steps = int(num_samples_per_epoch / hp.batch_size *
hp.num_epochs_per_decay)
if hp.sync_replicas:
decay_steps /= hp.replicas_to_aggregate
if hp.learning_rate_decay_type == 'exponential':
return tf.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat... | [
"0.78593874",
"0.75907296",
"0.742758",
"0.7406107",
"0.739691",
"0.7320627",
"0.7320627",
"0.72974896",
"0.7253351",
"0.7229305",
"0.721023",
"0.72072744",
"0.71990186",
"0.71936136",
"0.7180078",
"0.7170698",
"0.7169669",
"0.7165654",
"0.71405464",
"0.71101654",
"0.71101654... | 0.0 | -1 |
Tests that logging in with invalid username fails | def testLoginUsername(self):
self.assertEquals(models.SUCCESS, self.users.add("userH", "password"))
self.assertEquals(models.ERR_BAD_CREDENTIALS, self.users.login("userHX", "password")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_incorrect_username(db_session):\n assert (login(\"unknown\", \"unknown\") == \"login.failed\")",
"def test_incorrect_username(self):\n input = (\"\", \"password\")\n if is_travis():\n self.login_test(*input, True)\n else:\n self.login_test(*input)",
"def t... | [
"0.83262736",
"0.8228457",
"0.8217461",
"0.78791344",
"0.7858918",
"0.7822418",
"0.77430946",
"0.7682943",
"0.76716906",
"0.7663754",
"0.76538557",
"0.76536644",
"0.76410997",
"0.7623669",
"0.7613545",
"0.75469494",
"0.7545322",
"0.7535239",
"0.749095",
"0.74664295",
"0.74287... | 0.75411457 | 17 |
Tests that logging in with invalid password fails | def testLoginPassword(self):
self.assertEquals(models.SUCCESS, self.users.add("userI", "password"))
self.assertEquals(models.ERR_BAD_CREDENTIALS, self.users.login("userI", "passw0rd")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_password(self):\n pass",
"def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login... | [
"0.837782",
"0.8184153",
"0.8136373",
"0.7952651",
"0.79143053",
"0.79060596",
"0.78909504",
"0.777145",
"0.7755105",
"0.771609",
"0.7670068",
"0.76157063",
"0.75997263",
"0.7555573",
"0.7551886",
"0.75420946",
"0.75355387",
"0.75228673",
"0.75174797",
"0.75021595",
"0.749698... | 0.7347801 | 37 |
Tests that logging in with both an invalid username and invalid password fails | def testLoginBadUsernameAndPassword(self):
self.assertEquals(models.SUCCESS, self.users.add("userJ", "password"))
self.assertEquals(models.ERR_BAD_CREDENTIALS, self.users.login("nobody_user", "nobody_password")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login(\"legionless@yahoo.com\", \"legendchrome\")\n ... | [
"0.82186335",
"0.81208724",
"0.80137014",
"0.8002412",
"0.7950306",
"0.791697",
"0.7853422",
"0.78504646",
"0.7841491",
"0.7744492",
"0.7737247",
"0.7733766",
"0.7724799",
"0.7675062",
"0.7597364",
"0.7575842",
"0.75734806",
"0.7559961",
"0.755887",
"0.7550253",
"0.7546143",
... | 0.8395619 | 0 |
Another test to test database reset | def testResetFixture(self):
self.users.TESTAPI_resetFixture()
self.users.add("katie", "password")
self.assertEqual(len(models.UsersModel.objects.all()), 1)
self.users.TESTAPI_resetFixture()
self.assertEqual(len(models.UsersModel.objects.all()), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def reset_db():\n from alembic... | [
"0.7690104",
"0.7690104",
"0.7690104",
"0.7690104",
"0.7690104",
"0.7690104",
"0.7650381",
"0.762334",
"0.75948405",
"0.75030625",
"0.74882305",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.747528",
"0.7465687",
"0.74607... | 0.70032877 | 64 |
Get the default query operator | def operator(self):
return self.data.get('operator', 'and') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n return pulumi.get(self, \"operator\")",
"def operator(self) -> Optional[str]:\n re... | [
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"0.7510867",
"... | 0.705733 | 28 |
Returns initilizations for controller states, actions, communications, and outputs. | def controller_bookkeeping_vars(self):
# Keeps track of all the controller states.
controller_states = np.zeros(
self._num_communication_turns + 1, self._num_controllers, self._controller_state_size)
# Keeps track of all controllers' selected actions (communication + output).
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInitParams(self):\n return {}",
"def get_initial_state(self, **kwargs):\n return {'successes': np.ones(self.env.nA, dtype=np.int32),\n 'failures': np.ones(self.env.nA, dtype=np.int32)}",
"def _get_controller_parameters(self):\n pass",
"def initialise(self):\n self... | [
"0.6425426",
"0.6151258",
"0.6135855",
"0.60412157",
"0.59889364",
"0.59743536",
"0.5963586",
"0.59514403",
"0.5904424",
"0.58903825",
"0.5870927",
"0.58576226",
"0.5829913",
"0.5769961",
"0.5758137",
"0.57319695",
"0.5729912",
"0.57269716",
"0.5722204",
"0.5721112",
"0.57179... | 0.7170085 | 0 |
Stores the current transition in the metacontroller's replay memory. The transition is stored in the replay memory of the controller. If the transition culminates in a subgoal's completion or a terminal state, a transition for the metacontroller is constructed and stored in its replay buffer. | def store(self, state, output_actions, reward, next_state, terminal, eval=False):
curr_meta_controller_state = self._meta_controller_states()[-1]
action = self._curr_constraint
next_meta_controller_state = self.get_meta_controller_state()
self._meta_controller_reward += reward
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _store_transition(self,\n last_observation,\n action,\n reward,\n is_terminal,\n priority=None,\n episode_end=False):\n if priority is None:\n if self._replay_scheme... | [
"0.6962828",
"0.6946354",
"0.6889669",
"0.6884396",
"0.68102074",
"0.67880714",
"0.6763029",
"0.6523042",
"0.6341487",
"0.62629765",
"0.6228231",
"0.6204338",
"0.61502385",
"0.61025447",
"0.605465",
"0.60425484",
"0.60108894",
"0.6000533",
"0.5960784",
"0.59568983",
"0.593019... | 0.64989936 | 8 |
Splits data frame into trainingvalidationtest data frames. This also calibrates scaling object, and transforms data for each split. | def split_data(self, df, valid_boundary=2016, test_boundary=2018):
stock_count = len(self.sl)
test_ratio = 0.2
print('Stock count:%d'% stock_count)
train_x = []
test_x = []
for label_, d_ in enumerate(self.sl):
stock_train_len = int(len(d_.train_y) * (1 - tes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_val_test_split(df):\n from sklearn.model_selction import train_test_split\n train, test = train_test_split(df, train_size = 0.80, test_size=0.20,\n random_state = 42)\n train, val = train_test_split(train, train_size = 0.70, val_size=0.30)\n print(train.shape, val.shape, test.shape)\n\n ... | [
"0.69305676",
"0.68500185",
"0.6825401",
"0.6820178",
"0.6819639",
"0.6806733",
"0.67640877",
"0.67156935",
"0.6681609",
"0.6675585",
"0.6672727",
"0.6662629",
"0.6619539",
"0.661847",
"0.6615578",
"0.6607513",
"0.65914935",
"0.6542333",
"0.65270346",
"0.6515594",
"0.6490784"... | 0.70878667 | 0 |
Returns default optimised model parameters. | def get_default_model_params(self):
model_params = {
'dropout_rate': 0.3,
'hidden_layer_size': 160,
'learning_rate': 0.01,
'minibatch_size': 64,
'max_gradient_norm': 0.01,
'num_heads': 1,
'stack_size': 1
}
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _default_params(self) -> Dict[str, Any]:\n normal_params = {\n \"temperature\": self.temperature,\n \"max_tokens\": self.max_tokens,\n \"top_p\": self.top_p,\n \"frequency_penalty\": self.frequency_penalty,\n \"presence_penalty\": self.presence_pena... | [
"0.786182",
"0.7648742",
"0.74824107",
"0.74050725",
"0.7169978",
"0.7132334",
"0.71250355",
"0.712289",
"0.7111139",
"0.69280326",
"0.6880837",
"0.6880837",
"0.6880837",
"0.6879771",
"0.68396217",
"0.67895633",
"0.6772952",
"0.67317784",
"0.6703785",
"0.6703785",
"0.6691981"... | 0.81408334 | 0 |
KullbackLeibler divergence for Gaussian distributions. | def kl_gauss(x, y, sig2=1.):
return (x - y) ** 2 / (2 * sig2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kl_divergence(self) -> Tensor:\n return self.variational_strategy.kl_divergence().sum(dim=1).mean()",
"def kl_divergence(self):\n return self._kl_divergence_func",
"def kl_divergence(self) -> Tensor:\n return torch.tensor(0.0)",
"def get_KL_divergence(self):\n KL_loss_W = Vil.... | [
"0.71993107",
"0.7150475",
"0.70763814",
"0.70433336",
"0.6770133",
"0.6741312",
"0.6724703",
"0.66803414",
"0.66392213",
"0.6636185",
"0.65696764",
"0.6521944",
"0.65164226",
"0.65158993",
"0.65092885",
"0.64894134",
"0.64877117",
"0.6473466",
"0.64509773",
"0.6419985",
"0.6... | 0.6169572 | 33 |
Get the input shape of the initiated network. | def get_style_predict_executor_shape(self):
return self.style_predict_executor.get_shape() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_shape(self):\n return self.network.inputs[self.input_blob].shape",
"def input_shape(self):\n return self._ipt_shape",
"def inputShape(self):\n return self.input_shape",
"def get_input_tensor_shape(self):\n return self._engine.get_input_tensor_shape()",
"def get_input_s... | [
"0.8619007",
"0.83440256",
"0.8232005",
"0.80596393",
"0.78816473",
"0.7860703",
"0.77754664",
"0.77754664",
"0.77754664",
"0.7716594",
"0.7552294",
"0.7508812",
"0.7508812",
"0.7508812",
"0.74801916",
"0.74641824",
"0.73884135",
"0.7329301",
"0.72974104",
"0.7270287",
"0.724... | 0.0 | -1 |
Calculates the energy of the input in time domain. | def calculateenergy_timedomain(input_signal_or_spectrum):
if isinstance(input_signal_or_spectrum, (sumpf.Spectrum)):
ip = sumpf.modules.InverseFourierTransform(spectrum=input_signal_or_spectrum).GetSignal()
else:
ip = input_signal_or_spectrum
energy_allchannels = []
for c in ip.GetChanne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].T.val_SI)) / 2\n\n return (i[0] * (o[2] - i[2]) -\n self.A.val * (\n self.E.val... | [
"0.7324751",
"0.7114935",
"0.70875055",
"0.706667",
"0.69541055",
"0.68114966",
"0.67289454",
"0.66545343",
"0.6610675",
"0.66066957",
"0.6573487",
"0.6526363",
"0.65242904",
"0.65220064",
"0.65200627",
"0.64884794",
"0.64629066",
"0.64200455",
"0.63852024",
"0.6382376",
"0.6... | 0.6832 | 5 |
Calculates the energy of the input in frequency domain | def calculateenergy_freqdomain(input_signal_or_spectrum):
if isinstance(input_signal_or_spectrum, (sumpf.Signal)):
ip = sumpf.modules.FourierTransform(signal=input_signal_or_spectrum).GetSpectrum()
else:
ip = input_signal_or_spectrum
energy_allchannels = []
for c in ip.GetChannels():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(data):\n return sum(pow(data, 2))",
"def energy(data):\n\n return np.real(np.mean(np.abs(data)**2, axis=1))",
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=s... | [
"0.7475885",
"0.7411403",
"0.7400063",
"0.73225343",
"0.7300788",
"0.72894627",
"0.72823495",
"0.7146044",
"0.7090532",
"0.7083689",
"0.7059214",
"0.70262027",
"0.69929606",
"0.6953103",
"0.6943929",
"0.6935626",
"0.6933231",
"0.69188",
"0.68774843",
"0.6792547",
"0.6784581",... | 0.71600974 | 7 |
Calculates the energy of input signal between certain frequencies of input signal | def calculateenergy_betweenfreq_freqdomain(input_signal_or_spectrum, desired_frequency_range):
if isinstance(input_signal_or_spectrum, (sumpf.Signal)):
ip = sumpf.modules.FourierTransform(signal=input_signal_or_spectrum).GetSpectrum()
else:
ip = input_signal_or_spectrum
spec = cut_spectrum(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_energy( self, V_a, eos_d ):\n pass",
"def energy(data):\n\n return np.real(np.mean(np.abs(data)**2, axis=1))",
"def energy(data):\n return sum(pow(data, 2))",
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0... | [
"0.7156278",
"0.70854735",
"0.7072889",
"0.6982996",
"0.6869216",
"0.68542844",
"0.6673387",
"0.6663976",
"0.6654134",
"0.66032094",
"0.65374476",
"0.64253825",
"0.6413543",
"0.641109",
"0.64052916",
"0.6382692",
"0.6380916",
"0.63649327",
"0.6344629",
"0.63230044",
"0.628909... | 0.70160437 | 3 |
Get the first output signal. | def GetFirstOutput(self):
return self.__output_signal1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSecondOutput(self):\n return self.__output_signal2",
"def get_output(self):\r\n x = self.query('OUTP?')\r\n if x == None: return None\r\n return int(x)",
"def first_value(self):\n return self._waveforms[0].first_value",
"def output(self):\n try:\n r... | [
"0.72742707",
"0.61670125",
"0.61595243",
"0.60887444",
"0.6058285",
"0.60497797",
"0.6038734",
"0.60080075",
"0.60080075",
"0.5924033",
"0.58593434",
"0.57831407",
"0.57734317",
"0.57566434",
"0.57046473",
"0.56800205",
"0.56345075",
"0.55731976",
"0.5569899",
"0.5553696",
"... | 0.88019943 | 0 |
Computes ``logit(sigmoid(x) sigmoid(y))`` in a numerically stable way. | def logits_and(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
t = (x + y) / 2
f = logaddexp(logaddexp((x - y) / 2, (y - x) / 2), -t)
return t - f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n return 1/(1 + math.exp(-x))",
"def asigmoid(x):\n return -log(1 / x - 1)",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
... | [
"0.7611646",
"0.7602074",
"0.75985694",
"0.7598141",
"0.7582379",
"0.7582379",
"0.75742143",
"0.75742143",
"0.7558715",
"0.755557",
"0.755557",
"0.755557",
"0.755557",
"0.755557",
"0.755557",
"0.7549285",
"0.75255716",
"0.75194734",
"0.7513957",
"0.7510326",
"0.75100285",
"... | 0.6765929 | 90 |
Computes ``logit(sigmoid(x) + sigmoid(y) sigmoid(x) sigmoid(y))`` in a numerically stable way. | def logits_or(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
f = -(x + y) / 2
t = logaddexp(logaddexp((x - y) / 2, (y - x) / 2), -f)
return t - f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asigmoid(x):\n return -log(1 / x - 1)",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n return 1/(1 + math.exp(-x))",
... | [
"0.74321806",
"0.73683155",
"0.73574376",
"0.73574376",
"0.7350426",
"0.7348672",
"0.7323571",
"0.7323571",
"0.73228335",
"0.73228335",
"0.73228335",
"0.73228335",
"0.73228335",
"0.73228335",
"0.7321863",
"0.7314428",
"0.7313854",
"0.7279413",
"0.7278777",
"0.72781396",
"0.72... | 0.68530726 | 53 |
Computes ``log(1 exp(x))`` in a numerically stable way. | def log1mexp(x: torch.Tensor) -> torch.Tensor:
mask = (x < _log05).to(x.dtype)
impl1 = torch.log1p(-torch.exp(x))
impl2 = torch.log(-torch.expm1(x))
return impl1 * mask + impl2 * (1 - mask) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log1p_exp(x):\n x_ = x * x.ge(0).to(torch.float32)\n res = x_ + torch.log1p(torch.exp(-torch.abs(x)))\n return res",
"def log_sum_exp(x):\n x_max = x.max()\n return torch.log(torch.sum(torch.exp(x - x_max), 1, keepdim=True)) + x_max",
"def log_sum_exp(self, x):\n b = numpy.max(x[(x<sy... | [
"0.85669684",
"0.76878935",
"0.768062",
"0.7642967",
"0.7581363",
"0.75357825",
"0.75357825",
"0.74347",
"0.74209934",
"0.73896044",
"0.738145",
"0.7318129",
"0.72950226",
"0.72420496",
"0.7240786",
"0.72397685",
"0.71956825",
"0.7173167",
"0.7148945",
"0.71363455",
"0.712399... | 0.8291577 | 1 |
Strips the whitespace borders of a string. Used inside 'read_config_from_string' function. | def remove_border_spaces(string):
if type(string) != str:
raise TypeError(
"Hey, a non-string object was passed to function "
"'Remove_border_spaces'!")
if string == '':
return string
while string[0] == ' ' or string[0] == '\t':
string = string[1:]
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_whitespace(str):\n return str.strip()",
"def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()",
"def _StripWS(s):\r\n return re.sub('\\s+', '', s)",
"def _StripWS(s):\r\n return re.sub('\\s+', '', s)",
"def remove_black_space(self,string):\n return string[:stri... | [
"0.73446923",
"0.7322427",
"0.7149919",
"0.7149919",
"0.70348865",
"0.70217603",
"0.7011852",
"0.69116235",
"0.68827426",
"0.68558097",
"0.68271023",
"0.6806938",
"0.6769963",
"0.67675215",
"0.6766959",
"0.6755118",
"0.6723759",
"0.67199904",
"0.6715071",
"0.67060345",
"0.666... | 0.70411235 | 4 |
Reads multiple strings separated by commas and removes border spaces. | def read_csv_names(string):
return [remove_border_spaces(name) for name in string.split(',')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_strip_strings_array(strings):\n string_array = strings.strip()\n string_array = string_array.split(',')\n result = []\n for string in string_array:\n string = string.strip()\n if string:\n result.append(string)\n return result",
"def _clean_string(self, string):\n ... | [
"0.6063498",
"0.59767",
"0.5961129",
"0.58939993",
"0.5801716",
"0.56955117",
"0.56331944",
"0.5605717",
"0.5415791",
"0.53999573",
"0.53361046",
"0.53183955",
"0.5304728",
"0.5300823",
"0.52928203",
"0.52311575",
"0.522873",
"0.5206089",
"0.5194998",
"0.5175699",
"0.5159555"... | 0.617661 | 0 |
Initialize instance with dictionary data. | def __init__(self, data, validate=False):
self._validate = validate
super(StyleFormats, self).__init__(data or {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, data):\r\n instance = cls()\r\n for key, value in data.items():\r\n instance.__dict__[key] = value\r\n return instance",
"def from_dict(cls, data):\n instance = cls()\n instance._set_data(data)\n return instance",
"def from_dict(cls, data)... | [
"0.81216985",
"0.7981187",
"0.78408366",
"0.7791419",
"0.7602441",
"0.7602441",
"0.75883996",
"0.758067",
"0.75360405",
"0.7501514",
"0.7431597",
"0.7404611",
"0.7322712",
"0.72948945",
"0.72835225",
"0.7269891",
"0.72496504",
"0.7214453",
"0.71313703",
"0.7086104",
"0.707376... | 0.0 | -1 |
Make a proper FQDN from name | def _ensure_fqdn(self, name):
if name[-1:] != ".":
return "%s." % name
else:
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dns_name ( base_name, name ) :\n return create_r53_name( base_name, name) + '.mse-esp.com'",
"def create_domain_name(self, name):\n return (\"%s.%s.%s\" % (name, \"net\", self.domain)).lower()",
"def create_internal_dns_name ( base_name, name ) :\n name = name + '.internal'\n return cre... | [
"0.75482833",
"0.71567446",
"0.7055514",
"0.6987774",
"0.6612602",
"0.65653723",
"0.65199786",
"0.6346808",
"0.6328137",
"0.62123156",
"0.61994225",
"0.61923176",
"0.6191347",
"0.6179072",
"0.61620694",
"0.61555946",
"0.6129054",
"0.61018264",
"0.6083514",
"0.6032847",
"0.603... | 0.79934853 | 0 |
Return the data as one hot encoded data | def initialization_based(input_array):
# Search for the unique labels in the array
oh_array = np.unique(input_array, return_inverse=True)[1]
# Define the shape of the one hot encoded array
out = np.zeros((oh_array.shape[0], oh_array.max() + 1), dtype=int)
# Set the predicted class on 1, and all t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encoding(data):\r\n encoder = LabelEncoder()\r\n y = encoder.fit_transform(data)\r\n return(y)",
"def one_hot_encoding(data):\n\n data_encoded = pd.get_dummies(data)\n\n return data_encoded",
"def _one_hot_encoder(self):\n ohe = preprocessing.OneHotEncoder()\n ohe.fit(s... | [
"0.8669562",
"0.856274",
"0.79403114",
"0.7927117",
"0.7881383",
"0.78735393",
"0.7752411",
"0.77354425",
"0.76922566",
"0.76709634",
"0.764616",
"0.7620357",
"0.76014364",
"0.75603205",
"0.7559771",
"0.7554686",
"0.75416374",
"0.7537979",
"0.7534504",
"0.75318676",
"0.752316... | 0.0 | -1 |
Return the maximum flux | def max_flux(self):
return np.max(self.flux) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_flux(frame):\n return np.max(frame.fluxes[frame.radii <= max_extent_px])",
"def max_time(self):\n return self.time[np.argmax(self.flux)]",
"def max(self) -> \"Stream[float]\":\n return self.agg(np.max).astype(\"float\")",
"def maximum(x):\n return np.maximum(x, 0)",
"def max... | [
"0.8347883",
"0.74840814",
"0.71864057",
"0.704579",
"0.7015667",
"0.69740826",
"0.6961083",
"0.69556326",
"0.69554335",
"0.69472003",
"0.6935056",
"0.6914028",
"0.68585455",
"0.67920977",
"0.6785096",
"0.6783946",
"0.67707163",
"0.67621744",
"0.6759031",
"0.6694084",
"0.6694... | 0.89036936 | 0 |
Return the maximum flux | def min_flux(self):
return np.min(self.flux) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_flux(self):\n return np.max(self.flux)",
"def max_flux(frame):\n return np.max(frame.fluxes[frame.radii <= max_extent_px])",
"def max_time(self):\n return self.time[np.argmax(self.flux)]",
"def max(self) -> \"Stream[float]\":\n return self.agg(np.max).astype(\"float\")",
... | [
"0.89036936",
"0.8347883",
"0.74840814",
"0.71864057",
"0.704579",
"0.7015667",
"0.69740826",
"0.6961083",
"0.69556326",
"0.69554335",
"0.69472003",
"0.6935056",
"0.6914028",
"0.68585455",
"0.67920977",
"0.6785096",
"0.6783946",
"0.67707163",
"0.67621744",
"0.6759031",
"0.669... | 0.6654236 | 28 |
Return the maximum flux | def range_flux(self):
return self.max_flux - self.min_flux | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_flux(self):\n return np.max(self.flux)",
"def max_flux(frame):\n return np.max(frame.fluxes[frame.radii <= max_extent_px])",
"def max_time(self):\n return self.time[np.argmax(self.flux)]",
"def max(self) -> \"Stream[float]\":\n return self.agg(np.max).astype(\"float\")",
... | [
"0.89036936",
"0.8347883",
"0.74840814",
"0.71864057",
"0.704579",
"0.7015667",
"0.69740826",
"0.6961083",
"0.69556326",
"0.69554335",
"0.69472003",
"0.6914028",
"0.68585455",
"0.67920977",
"0.6785096",
"0.6783946",
"0.67707163",
"0.67621744",
"0.6759031",
"0.6694084",
"0.669... | 0.6935056 | 11 |
Return the time of the maximum flux | def max_time(self):
return self.time[np.argmax(self.flux)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peak_time(self):\n return np.array([self.wftime[ch][self.waveform[ch].argmax()] for ch in range(self.nchannels)])",
"def max(self):\n\n return time_stat(self, stat=\"max\")",
"def max_flux(self):\n return np.max(self.flux)",
"def max_time(self):\n #{{{ function to return time of last samp... | [
"0.75761044",
"0.75565094",
"0.75416726",
"0.75097215",
"0.73423856",
"0.71438485",
"0.7086532",
"0.7000203",
"0.69391656",
"0.68668413",
"0.67839086",
"0.67351854",
"0.66913486",
"0.6666073",
"0.66316026",
"0.6575393",
"0.6508536",
"0.64425504",
"0.64256316",
"0.6416781",
"0... | 0.9051581 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def WhereAreYou(CurLongitude,CurLatitude,LocationLongitude,LocationLatitude,LocationRadius):
# Calculate the great circle distance between two points
# on the earth (specified in decimal degrees)
# 将十进制度数转化为弧度
CurLongitude,CurLatitude,LocationLongitude,LocationLatitude = map(radians, [float(CurLongitude... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.8145448",
"0.78638905",
"0.76325417",
"0.760538",
"0.75962216",
"0.7595357",
"0.7593555",
"0.75710064",
"0.75635517",
"0.7555634",
"0.7529043",
"0.7516842",
"0.74934894",
"0.7466314",
"0.74512833",
"0.7433337",
"0.7390745",
"0.73570377",
"0.7348286",
"0.7330498",
"0.732846... | 0.0 | -1 |
Ensure text does not contain a null character. | def no_null(x):
return "\0" not in x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_text(_str):\n return not _str.strip()",
"def is_blank(text: str) -> bool:\n return len(text.strip()) == 0",
"def is_blank(text):\n all([c.isspace() for c in text])",
"def test_empty_string(self):\n self.assertTrue(all_unique_chars(\"\"))",
"def is_text(value, allow_empty=True):\n ... | [
"0.751114",
"0.7114557",
"0.69901454",
"0.68774647",
"0.67547596",
"0.6748092",
"0.6734975",
"0.66922635",
"0.66739947",
"0.6664471",
"0.6642115",
"0.65837395",
"0.6573296",
"0.6557193",
"0.65454483",
"0.6510237",
"0.64638656",
"0.6456407",
"0.64367396",
"0.64187515",
"0.6415... | 0.6643662 | 10 |
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels | def get_labels(model):
return model._labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(model):\n\treturn next(model.parameters()).is_cuda",
"def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y",
"def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n... | [
"0.6806257",
"0.669914",
"0.65282595",
"0.6442955",
"0.64141417",
"0.6413409",
"0.6413409",
"0.6398103",
"0.6295529",
"0.62921506",
"0.6242659",
"0.62091666",
"0.6193946",
"0.6167976",
"0.61455184",
"0.61455184",
"0.61455184",
"0.61322767",
"0.61322767",
"0.61322767",
"0.6132... | 0.70128405 | 0 |
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels | def get_labels(model):
return model._labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(model):\n\treturn next(model.parameters()).is_cuda",
"def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y",
"def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n... | [
"0.6810129",
"0.6698149",
"0.65257776",
"0.6438587",
"0.64099574",
"0.6408952",
"0.6408952",
"0.6402114",
"0.6291775",
"0.6290124",
"0.6238092",
"0.6206064",
"0.6190825",
"0.61644405",
"0.6142085",
"0.6142085",
"0.6142085",
"0.6127087",
"0.6127087",
"0.6127087",
"0.6127087",
... | 0.7009926 | 1 |
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels | def get_labels(model):
return model._labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(model):\n\treturn next(model.parameters()).is_cuda",
"def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y",
"def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n... | [
"0.6810129",
"0.6698149",
"0.65257776",
"0.6438587",
"0.64099574",
"0.6408952",
"0.6408952",
"0.6402114",
"0.6291775",
"0.6290124",
"0.6238092",
"0.6206064",
"0.6190825",
"0.61644405",
"0.6142085",
"0.6142085",
"0.6142085",
"0.6127087",
"0.6127087",
"0.6127087",
"0.6127087",
... | 0.7009926 | 3 |
model_is_cuda = next(model.parameters()).is_cuda return model.module._labels if model_is_cuda else model._labels | def get_labels(model):
return model._labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cuda(model):\n\treturn next(model.parameters()).is_cuda",
"def get_all_labels(self):\n\t\tself.batch_y=Variable(torch.from_numpy(self.config.batch_y)).cuda()\n\t\treturn self.batch_y",
"def get_label(image, model):\n x = Variable(image, volatile=True)\n label = model(x).data.max(1)[1].numpy()[0]\n... | [
"0.6809078",
"0.6698417",
"0.65264416",
"0.644096",
"0.6411517",
"0.6410953",
"0.6410953",
"0.6400394",
"0.629348",
"0.6290247",
"0.6239902",
"0.6207657",
"0.6191786",
"0.6165828",
"0.6143424",
"0.6143424",
"0.6143424",
"0.6129054",
"0.6129054",
"0.6129054",
"0.6129054",
"0... | 0.7010641 | 2 |
Returns 204 on healthy, otherwise 503, without response body. | def on_get(self, req, resp):
hc = HealthCheckCombined(state_manager=self.state_manager,
orchestrator=self.orchestrator,
extended=False)
return hc.get(req, resp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_healthy():\n status = HEALTH_AGGREGATOR.is_healthy()\n\n if status is True:\n status_code = 200\n else:\n status_code = 503\n\n return Response({}, status_code, mimetype='application/json')",
"def _healthcheck():\n return '', 200",
"def make_unhealthy():\n global _is_... | [
"0.7270507",
"0.7043202",
"0.7034733",
"0.6878567",
"0.67552936",
"0.6561998",
"0.65411353",
"0.6405269",
"0.640016",
"0.6374193",
"0.63574976",
"0.63382876",
"0.6276424",
"0.6240058",
"0.6233894",
"0.61034507",
"0.6058",
"0.6031649",
"0.6016662",
"0.5987242",
"0.59778655",
... | 0.0 | -1 |
Finds the distance between 2 cells. | def distance_between_hex_cells(cell1, cell2):
return even_q_distance(*(cell1 + cell2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure_distance(cell1, cell2):\n\n\tx1, y1 = cell1.location\n\tx2, y2 = cell2.location\n\tx_dist = abs(x1-x2)\n\ty_dist = abs(y1-y2)\n\n\tif x_dist > 5:\n\t\tx_dist = 10-x_dist\n\tif y_dist > 5:\n\t\ty_dist = 10-y_dist\n\n\treturn (x_dist**2 + y_dist**2)**.5",
"def get_distance_between_tiles(self, grid, til... | [
"0.7918727",
"0.7605762",
"0.7557998",
"0.7519129",
"0.74563754",
"0.7389583",
"0.7377468",
"0.73589617",
"0.7321455",
"0.7264371",
"0.7258168",
"0.723552",
"0.7229265",
"0.7216435",
"0.7188728",
"0.717448",
"0.71682304",
"0.715819",
"0.7142229",
"0.7138084",
"0.7126091",
"... | 0.7525517 | 3 |
Tests to see if an object starting at start with a given heading will pass through the target cell | def is_on_course_with(start, heading, target):
v = Volant(*(tuple(start) + (heading,)))
if start == target:
return True
for _ in range(distance_between_hex_cells(start, target)):
v = v.advance()
if v.xyh == (tuple(target) + (heading,)):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atHead(self):\n return self.cursor == self.head",
"def is_header_part(cell: str) -> bool:\n pattern = '|'.join([\n rf'(?:(?:three|3|six|6|nine|9|twelve|12)\\s+months?(?:\\s+periods?)?|quarters?|year|ytd)(?!ly)',\n rf'\\b(?:{MONTH})\\b',\n rf'^(?:end(?:ed|ing))?(?:20)\\s*[0-2]\\... | [
"0.5828779",
"0.5647116",
"0.55674917",
"0.5562699",
"0.5555092",
"0.5537959",
"0.54243815",
"0.5332083",
"0.5316014",
"0.5296079",
"0.5247089",
"0.52382934",
"0.52101386",
"0.5176555",
"0.51518446",
"0.5150946",
"0.5148843",
"0.51462966",
"0.51339036",
"0.5132057",
"0.513002... | 0.70463324 | 0 |
Return the integrationspecific state attributes. | def extra_state_attributes(self) -> dict[str, Any]:
return {
"heat_demand": self._device.heat_demand,
"heat_demands": self._device.heat_demands,
"relay_demands": self._device.relay_demands,
"system_mode": self._device.system_mode,
"tpi_params": self._d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extra_state_attributes(self):\n return self._attributes",
"def extra_state_attributes(self):\r\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n ... | [
"0.74960417",
"0.7403986",
"0.73708117",
"0.73708117",
"0.7299439",
"0.7278566",
"0.7251619",
"0.7247226",
"0.72432846",
"0.7240207",
"0.71969205",
"0.71847296",
"0.7180781",
"0.7171847",
"0.71717787",
"0.715082",
"0.713982",
"0.7118326",
"0.71143836",
"0.7110274",
"0.7083947... | 0.696673 | 30 |
Return the Controller's current operating mode of a Controller. | def hvac_mode(self) -> str | None:
if self._device.system_mode is None:
return # unable to determine
if self._device.system_mode[CONF_SYSTEM_MODE] == SystemMode.HEAT_OFF:
return HVACMode.OFF
if self._device.system_mode[CONF_SYSTEM_MODE] == SystemMode.AWAY:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operating_mode(self):\n return self._read(MX_OPERATING_MODE)",
"def currentMode(self):\n logger.debug(\"Func: currentMode/getter\")\n\n return self._currentsDict[\"currentMode\"]",
"def get_mode(self):\r\n return self._api.get_mode()",
"def get_mode(self) -> str:\n\n re... | [
"0.73384345",
"0.7230776",
"0.7113147",
"0.69116753",
"0.6897765",
"0.6890031",
"0.6890031",
"0.68664366",
"0.68420625",
"0.68345726",
"0.67674077",
"0.6723223",
"0.67001164",
"0.6698578",
"0.6698578",
"0.66798836",
"0.6652333",
"0.66217697",
"0.6592047",
"0.65906334",
"0.659... | 0.6233759 | 55 |
Return the Controller's current preset mode, e.g., home, away, temp. | def preset_mode(self) -> str | None:
if self._device.system_mode is None:
return # unable to determine
return PRESET_TCS_TO_HA[self._device.system_mode[CONF_SYSTEM_MODE]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preset_mode(self):\n return self._preset_mode",
"def preset_mode(self) -> str | None:\n state = self._state\n return state.custom_preset or _PRESETS.from_esphome(\n state.preset_compat(self._api_version)\n )",
"def preset_mode(self) -> str:\n # NOTE: fan speeds... | [
"0.78471833",
"0.76673657",
"0.753882",
"0.7478876",
"0.7445001",
"0.7386489",
"0.716671",
"0.7069131",
"0.7044671",
"0.696538",
"0.68983155",
"0.68345046",
"0.68334395",
"0.6833058",
"0.6833058",
"0.67663866",
"0.67663866",
"0.67208385",
"0.6707816",
"0.6691857",
"0.6678169"... | 0.7250667 | 6 |
Return the integrationspecific state attributes. | def extra_state_attributes(self) -> dict[str, Any]:
return {
"zone_idx": self._device.idx,
"heating_type": self._device.heating_type,
"mode": self._device.mode,
"config": self._device.config,
**super().extra_state_attributes,
"schedule": se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extra_state_attributes(self):\n return self._attributes",
"def extra_state_attributes(self):\r\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n ... | [
"0.74960417",
"0.7403986",
"0.73708117",
"0.73708117",
"0.7299439",
"0.7278566",
"0.7251619",
"0.7247226",
"0.72432846",
"0.7240207",
"0.71969205",
"0.71847296",
"0.7180781",
"0.7171847",
"0.71717787",
"0.715082",
"0.713982",
"0.7118326",
"0.71143836",
"0.7110274",
"0.7083947... | 0.66172945 | 89 |
Return the Zone's current preset mode, e.g., home, away, temp. | def preset_mode(self) -> str | None:
if self._device.tcs.system_mode is None:
return # unable to determine
# if self._device.tcs.system_mode[CONF_SYSTEM_MODE] in MODE_TCS_TO_HA:
if self._device.tcs.system_mode[CONF_SYSTEM_MODE] in (
SystemMode.AWAY,
SystemMo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preset_mode(self) -> str | None:\n state = self._state\n return state.custom_preset or _PRESETS.from_esphome(\n state.preset_compat(self._api_version)\n )",
"def preset_mode(self):\n return self._preset_mode",
"def preset_mode(self):\n dps_mode = self._device.g... | [
"0.74566215",
"0.74438035",
"0.71478873",
"0.70889574",
"0.70163906",
"0.6992599",
"0.69559926",
"0.6906426",
"0.68646806",
"0.6750974",
"0.6643373",
"0.6543945",
"0.6502334",
"0.6471802",
"0.6455682",
"0.6405507",
"0.6283329",
"0.6283329",
"0.62627965",
"0.62500966",
"0.6250... | 0.75515884 | 0 |
Constructor of a Result instance. | def __init__(self, test_case_name):
Result.__init_output_folder()
self.__test_result = {} # Store information of a test case
self.__run = [] # Store information of steps in test case
self.__test_result[Result.__TEST_CASE] = test_case_name
self.__test_result[Result.__RESULT] = S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, result, args, kwargs):\r\n self.name = name\r\n self.result = result\r\n self.args = args\r\n self.kwargs = kwargs",
"def _get_result_constructor(self, names):\r\n def _construct_instance(values):\r\n return ResultObject(zip(names, values))\r... | [
"0.71131027",
"0.7083985",
"0.70355004",
"0.68294877",
"0.6709005",
"0.66231126",
"0.6612615",
"0.6605943",
"0.6605943",
"0.6582213",
"0.65619266",
"0.6502356",
"0.6468194",
"0.6442396",
"0.64226663",
"0.63525116",
"0.6340199",
"0.6249393",
"0.62491214",
"0.6165775",
"0.60785... | 0.6052101 | 25 |
moves along the original x axis decrementing x each time the Tkinter b_decr_x button is pressed | def move_sphere_decr_x(event=None):
x, y, z = sphere.pos
sphere.pos = (x-1, y, z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.pos_x -=1",
"def update(self):\n pygame.event.pump()\n self.pos_x -= 1.5",
"def go_left(self):\n self.change_x = -6",
"def go_left(self):\n self.change_x = -6",
"def update(self, *args):\n self.rect.x -= args[0]",
"def stop(self):\n ... | [
"0.7147512",
"0.646159",
"0.6404823",
"0.6404823",
"0.63748866",
"0.63680136",
"0.63680136",
"0.63680136",
"0.63680136",
"0.63536847",
"0.6333927",
"0.63245386",
"0.6297304",
"0.6297304",
"0.6286764",
"0.6285476",
"0.6285476",
"0.6085678",
"0.6074533",
"0.60482347",
"0.597424... | 0.56429285 | 54 |
Method to create the Flask application | def app():
os.environ["FLASK_ENV"] = "test"
return create_app() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n return create_app()",
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n ... | [
"0.8425609",
"0.83299243",
"0.8236989",
"0.8194401",
"0.8143334",
"0.81381625",
"0.81364083",
"0.8129999",
"0.81136125",
"0.81009966",
"0.80844706",
"0.80825645",
"0.8069962",
"0.8064716",
"0.8053781",
"0.8023567",
"0.8018517",
"0.8012465",
"0.801216",
"0.8010065",
"0.8002879... | 0.0 | -1 |
return the duration of the flow | def duration(self):
return (self.fcip_doc["latest_timestamp"] - self.fcip_doc["packet_timestamps"][0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\n pass",
"def duration(self):\n pass",
"def duration(self):\r\n return self.t2 - self.t1",
"def duration(self) -> float:\n return self.endTime()-self.startTime()",
"def duration(self):\r\n return self.stop - self.start",
"def duration(self) -> int:\n ... | [
"0.7791172",
"0.7791172",
"0.7749886",
"0.7730869",
"0.76913655",
"0.76609594",
"0.7566553",
"0.75586176",
"0.75286144",
"0.7518113",
"0.75019103",
"0.74984384",
"0.7492955",
"0.7466617",
"0.7452982",
"0.74298394",
"0.7422371",
"0.7414813",
"0.7406884",
"0.7403844",
"0.738835... | 0.73078895 | 30 |
Convert a MAC address to a readable/printable string | def _mac_addr(address):
return ':'.join('%02x' % ord(b) for b in address) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_ntoa(mac):\n return '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(map(ord, list(mac)))",
"def mac_addr(address):\n\tprint(':'.join('%02x' % compat_ord(b) for b in address))\n\treturn ':'.join('%s' % format(compat_ord(b), '0>8b') for b in address)",
"def get_mac_string():\n mac_int = getnode()\n mac_s... | [
"0.8274901",
"0.78023726",
"0.7799624",
"0.7411498",
"0.7411498",
"0.7411498",
"0.7411498",
"0.7393615",
"0.72612065",
"0.7243841",
"0.7214834",
"0.71748555",
"0.7040925",
"0.69946724",
"0.6982126",
"0.6982003",
"0.6913715",
"0.67323697",
"0.671812",
"0.6642322",
"0.6640873",... | 0.7819506 | 1 |
Action partial update test | def test_partial_update(self):
action = ActionFactory.create(id=22)
data = {
'name': 'Ação para Melhorar',
'institution': 'Vamos Ajudar',
}
self.assertNotEqual(action.name, data['name'])
self.assertNotEqual(action.institution, data['institution'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partial_update(self):\n self.client.force_authenticate(user=self.admin)\n\n data = {\n 'retreat': reverse(\n 'retreat:retreat-detail', args=[self.retreat.id]\n ),\n 'user': reverse('user-detail', args=[self.user2.id]),\n }\n\n res... | [
"0.7925501",
"0.7703755",
"0.7453596",
"0.7446067",
"0.74410087",
"0.7411792",
"0.7282139",
"0.7279346",
"0.72573346",
"0.72541976",
"0.7236859",
"0.7230735",
"0.7230735",
"0.7230735",
"0.7216292",
"0.7194296",
"0.7185747",
"0.71731967",
"0.7138343",
"0.71002716",
"0.70846397... | 0.8542736 | 0 |
check to see if we should apply thresholding to preprocess the image | def preprocess(img):
#if "thresh" in args["preprocess"]:
image = cv2.threshold(img, 0, 255,
cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
"""
make a check to see if median blurring should be done to remove
noise
"""
#if "blur" in args["preprocess"]:
#image = cv2.medianBlur(gray, 3)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify(self, img, threshold=2.5):\n return (img-self.mu)/numpy.sqrt(self.sigmasqr) > threshold",
"def global_threshold(img, threshold_method):\n pass",
"def thresh_setup():\n pass",
"def apply_thresholding(x):\n return x > threshold_otsu(x)",
"def preprocess_image(self, image, g, c, m... | [
"0.6902314",
"0.6696663",
"0.6598084",
"0.62699246",
"0.6235991",
"0.6163094",
"0.60365695",
"0.6001765",
"0.59255934",
"0.59180653",
"0.58960956",
"0.5891709",
"0.5859457",
"0.58538556",
"0.5842548",
"0.5827132",
"0.57804036",
"0.5778117",
"0.56903183",
"0.5687083",
"0.56831... | 0.6849483 | 1 |
Wrapper for turning tensorflow metrics into keras metrics | def wrapper(self, args, **kwargs):
value, update_op = method(self, args, **kwargs)
K.get_session().run(tf.local_variables_initializer())
with tf.control_dependencies([update_op]):
value = tf.identity(value)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapt_tf_streaming_metric_for_keras(tf_metric, name,\n preprocss_fn=None, postprocess_fn=None,\n **kwargs):\n\n # Inspired from snipped by Ruzhitskiy Bogdan\n # (https://github.com/keras-team/keras/issues/6050#issuecomment-3299... | [
"0.69506645",
"0.64114",
"0.6383206",
"0.6362886",
"0.6128875",
"0.5947736",
"0.59401995",
"0.5889047",
"0.58636826",
"0.5822293",
"0.58184654",
"0.57995015",
"0.57968014",
"0.57885736",
"0.5779893",
"0.577134",
"0.57695305",
"0.576313",
"0.57178736",
"0.57167006",
"0.5708086... | 0.0 | -1 |
Remove stopwords from names | def test_author_validation(self):
self.go200('minus_upload')
self.formfile('minus_upload', 'file', AUDIO_FILE)
self.fv('minus_upload', 'author', 'Дует Співаки')
self.submit200()
#self.assert_equal(smart_str(MinusAuthor.objects.all()[0].name), smart_str('Співаки'))
MinusAu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(data):\n stop_words = stopwords.words('englis... | [
"0.7787802",
"0.7737249",
"0.76696384",
"0.7643887",
"0.76299566",
"0.7623045",
"0.7623045",
"0.7623045",
"0.7623045",
"0.76136905",
"0.758969",
"0.75874805",
"0.75205415",
"0.75115436",
"0.75040805",
"0.7495946",
"0.74942195",
"0.748058",
"0.74342805",
"0.74275386",
"0.74127... | 0.0 | -1 |
Remove stopwords from titles | def test_track_validation(self):
self.go200('minus_upload')
self.formfile('minus_upload', 'file', AUDIO_FILE)
self.fv('minus_upload', 'title', 'мінус тест')
self.submit200()
MinusRecord.objects.get(title = u'Тест')
self.go200('minus_upload')
self.formfile('minus_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def clean_title(self):\n # split into tokens by white space\n ... | [
"0.76233107",
"0.7489482",
"0.74206066",
"0.74203354",
"0.737985",
"0.7364617",
"0.7332475",
"0.73078966",
"0.7279742",
"0.7233722",
"0.72088146",
"0.7197647",
"0.71744",
"0.71591115",
"0.71481913",
"0.71439385",
"0.71439385",
"0.71439385",
"0.71439385",
"0.7135004",
"0.71230... | 0.0 | -1 |
Append self.options['name'] to node['names'] if it exists. Also normalize the name string and register it as explicit target. | def add_name(self, node):
if 'name' in self.options:
name = nodes.fully_normalize_name(self.options.pop('name'))
if 'name' in node:
del(node['name'])
node['names'].append(name)
self.state.document.note_explicit_target(node, node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, name):\n\n # no need to add first_name while adding full_name\n name_list = name.strip().split()[1:]\n name_list.append(name)\n for item in set(name_list):\n node = self.root\n # check for every char in word, i.e. check whether is it in trie\n ... | [
"0.6573605",
"0.607759",
"0.60158175",
"0.59481245",
"0.59406054",
"0.5879365",
"0.5829988",
"0.57405627",
"0.57331866",
"0.5675645",
"0.5675142",
"0.56737715",
"0.5626971",
"0.5610032",
"0.5598339",
"0.555156",
"0.5522539",
"0.5516251",
"0.54982877",
"0.54964846",
"0.5481847... | 0.76973844 | 0 |
Evaluate the assignment (pk=assignment_pk) and makes your evaluation a superevaluation. Assignment seen as eval__ | def supereval_assignment(request, assignment_pk, i):
assignment = Assignment.objects.get(id=assignment_pk)
evalassignment = Evalassignment.objects.filter(assignment=assignment,
is_supereval=True).first()
redirect_url = ('/detail_assignmentype/%s/#assignment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_evalassignment(request, pk, pts):\n student = request.user.student\n evalassignment = Evalassignment.objects.\\\n filter(pk=pk, assignment__student=student).first()\n if evalassignment:\n evalassignment.grade_evaluation = pts\n evalassignment.save()\n redirect_item = '... | [
"0.6541989",
"0.6323441",
"0.6086533",
"0.5994296",
"0.5994296",
"0.5994296",
"0.59660524",
"0.5931263",
"0.5913529",
"0.5844344",
"0.57308245",
"0.572046",
"0.5713599",
"0.56698984",
"0.56081396",
"0.5587459",
"0.55692595",
"0.55667025",
"0.5522861",
"0.551115",
"0.54968995"... | 0.6349211 | 1 |
Returns a function that feeds the input tensor into the model. | def _get_serve_image_fn(model):
@tf.function
def serve_image_fn(image_tensor):
"""Returns the output to be used in the serving signature.
Args:
image_tensor: A tensor represeting input image. The image should have 3
channels.
Returns:
The model's predicto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, *inputs) -> torch.Tensor:\n return self.model(*inputs)",
"def _serving_input_fn(self):\n seq = tf.placeholder(dtype=tf.float32, shape=[None, None], name='seq')\n features = {'seq': seq}\n return tf.estimator.export.build_raw_serving_input_receiver_fn(features)",
"d... | [
"0.70829463",
"0.70727533",
"0.68864447",
"0.6863639",
"0.68614674",
"0.68326",
"0.6824239",
"0.68235976",
"0.6812249",
"0.67601883",
"0.6749556",
"0.672564",
"0.6700228",
"0.66970867",
"0.66903764",
"0.6673246",
"0.66614306",
"0.66592866",
"0.6634871",
"0.6628845",
"0.662684... | 0.59502375 | 80 |
Creates a CNN Keras model based on transfer learning for classifying image data. | def get_model(fn_args) -> tf.keras.Model:
img_shape = (constants.HEIGHT, constants.WIDTH, 3)
# Create the base model from the pre-trained model EfficientNetB3
base_model = tf.keras.applications.EfficientNetB3(
input_shape=img_shape,
include_top=False,
weights=constants.PRETRAINED_WE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_basic_cnn_model(num_classes: int):\n model = Sequential()\n\n # Convolutional + spooling layers\n model.add(Conv2D(64, (5, 5), input_shape=(config.ROI_IMG_SIZE['HEIGHT'], config.ROI_IMG_SIZE['WIDTH'], 1)))\n model.add(MaxPooling2D((2, 2), strides=(2, 2)))\n model.add(Conv2D(32, (5, 5), pa... | [
"0.76311255",
"0.76270074",
"0.75699824",
"0.7553478",
"0.7496673",
"0.74340725",
"0.7409469",
"0.73517096",
"0.7349663",
"0.73448825",
"0.7332532",
"0.7302167",
"0.72767735",
"0.72704864",
"0.7232468",
"0.7205374",
"0.7200796",
"0.71729213",
"0.7133887",
"0.7093395",
"0.7078... | 0.0 | -1 |
Displays the index page accessible at '/' | def index():
return render_template("index.html", content=songs, titles=titles, contentO=songsO, titlesO=titlesO) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_index_page():\n\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_templ... | [
"0.86166644",
"0.8611334",
"0.86094666",
"0.86054945",
"0.86054945",
"0.8584799",
"0.85609347",
"0.8557969",
"0.8545699",
"0.8545521",
"0.8528602",
"0.85182726",
"0.85182726",
"0.84577924",
"0.84494746",
"0.8403144",
"0.84000117",
"0.8382747",
"0.8382747",
"0.8382747",
"0.838... | 0.0 | -1 |
Allow relations if a model in the auth app is involved. | def allow_relation(self, obj1, obj2, **hints):
if self.isAdminApp(obj1) or self.isAdminApp(obj2):
return True
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_relation(self, obj1, obj2, **hints):\n\n result = (obj1._meta.model_name in DefaultRouting.defaultModels and \n obj2._meta.model_name in DefaultRouting.defaultModels)\n return result",
"def allow_relation(self, obj1, obj2, **hints):\n return True",
"def allow_relation(sel... | [
"0.70190156",
"0.6990835",
"0.6919564",
"0.6906994",
"0.69009876",
"0.6783787",
"0.67391515",
"0.67210835",
"0.6704985",
"0.6668281",
"0.6638815",
"0.6542443",
"0.6541121",
"0.65383524",
"0.64997756",
"0.64021367",
"0.6397948",
"0.63407576",
"0.624081",
"0.6170405",
"0.600265... | 0.7264568 | 0 |
Allow relations if a model in the auth app is involved. | def allow_relation(self, obj1, obj2, **hints):
if obj1._meta.db_tablespace == 'emarket' or \
obj2._meta.db_tablespace == 'emarket':
return True
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_relation(self, obj1, obj2, **hints):\n if self.isAdminApp(obj1) or self.isAdminApp(obj2):\n return True\n return None",
"def allow_relation(self, obj1, obj2, **hints):\n\n result = (obj1._meta.model_name in DefaultRouting.defaultModels and \n obj2._meta.model_... | [
"0.7264568",
"0.70190156",
"0.6990835",
"0.6919564",
"0.6906994",
"0.69009876",
"0.6783787",
"0.67391515",
"0.67210835",
"0.6704985",
"0.6668281",
"0.6638815",
"0.6542443",
"0.6541121",
"0.65383524",
"0.64997756",
"0.64021367",
"0.6397948",
"0.63407576",
"0.624081",
"0.617040... | 0.5881211 | 24 |
Returns the current learning rate. Can use self.step to get the current training step. | def lr(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learning_rate(self):\n config = self.config\n cur_lr = Train_model_pipeline.adjust_learning_rate(\n self.optimizer,\n self.epoch,\n config[\"training\"][\"learning_rate\"],\n decay=config[\"training\"][\"lr_decay_rate\"],\n step=config[\"... | [
"0.8446147",
"0.8228322",
"0.77834266",
"0.7697436",
"0.7578119",
"0.75720346",
"0.7558273",
"0.75378335",
"0.75378335",
"0.7497552",
"0.7469696",
"0.7468149",
"0.7296897",
"0.7296897",
"0.7203918",
"0.71397823",
"0.7118171",
"0.7064471",
"0.7045381",
"0.700865",
"0.6984203",... | 0.0 | -1 |
Returns a feed_dict with the learning rate filled in. | def feed_dict(self):
return {self.lr_tensor: self.lr()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self.... | [
"0.65159",
"0.615306",
"0.615306",
"0.6120223",
"0.60584396",
"0.6019127",
"0.59622",
"0.59313875",
"0.59313875",
"0.59218276",
"0.5902011",
"0.5895842",
"0.5883783",
"0.5803965",
"0.57955194",
"0.57940125",
"0.5793272",
"0.5792256",
"0.5776716",
"0.57706064",
"0.5765436",
... | 0.6703134 | 0 |
Returns the current learning rate | def lr(self):
if self.T is None:
return self.lr0
else:
return linear_decay(self.lr0, self.alpha, self.T, self.step) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_learning_rate():\n return 0.00001",
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def get_learning_rate(self):\n config = self.config\n cur_lr = Train_model_pipeline.adjust_learning_rate(\n self.optimizer,\n ... | [
"0.8567903",
"0.8525313",
"0.82729584",
"0.7930401",
"0.7930401",
"0.7906312",
"0.7878462",
"0.7801556",
"0.7798266",
"0.76828873",
"0.7523917",
"0.73423827",
"0.73423827",
"0.72618735",
"0.7247124",
"0.72470224",
"0.71901673",
"0.7178046",
"0.71756256",
"0.71360046",
"0.7128... | 0.67572623 | 34 |
count no of half nodes via level order traversal | def count_half_nodes(self):
queue = [self]
half_nodes = 0
half = False
while queue:
curr_node = queue.pop(0)
if curr_node.left:
queue.append(curr_node.left)
half = not half
if curr_node.right:
q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ht(node):\n n = 0\n while node: n, node = n+1, node.left\n return n",
"def count_nodes(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n if self.get_left():\n if self.get_ri... | [
"0.7206602",
"0.70298666",
"0.6988069",
"0.6873926",
"0.6840664",
"0.67481023",
"0.674637",
"0.66773266",
"0.6636227",
"0.6613095",
"0.65921193",
"0.65709895",
"0.656669",
"0.65418726",
"0.6516444",
"0.6488223",
"0.6473618",
"0.64561695",
"0.64550674",
"0.6419698",
"0.6414584... | 0.7208616 | 0 |
Cumulative_density integrates the probability density along the given values. | def test_cumulative_distribution_fit_df_call_np_array(self):
# Setup
copula = GaussianMultivariate(GaussianUnivariate)
copula.fit(self.data)
X = np.array([2000., 200., 1.])
expected_result = 0.4550595153746892
# Run
result = copula.cumulative_distribution(X)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cum_density_func(xs,norm=True,rank=False,data_range='data',pdf=None):\n if pdf is None:\n pdf = prob_density_func(xs,False,data_range)\n pdfk = sorted(pdf.keys())\n pdfv = map(pdf.get,pdfk)\n if not rank:\n cdfv = np.cumsum(pdfv)\n if norm:\n cdfv = cdfv/np.sum(pdfv)... | [
"0.71780133",
"0.67950886",
"0.6694011",
"0.6519972",
"0.6482798",
"0.6457582",
"0.6303511",
"0.62831527",
"0.62647676",
"0.6240379",
"0.6224983",
"0.6173451",
"0.6173451",
"0.616607",
"0.6164702",
"0.6115248",
"0.6107411",
"0.6094378",
"0.60662365",
"0.6049095",
"0.6039914",... | 0.60374016 | 21 |
Cumulative_density integrates the probability density along the given values. | def test_cumulative_distribution_fit_call_np_array(self):
# Setup
copula = GaussianMultivariate(GaussianUnivariate)
copula.fit(self.data.to_numpy())
X = np.array([2000., 200., 1.])
expected_result = 0.4550595153746892
# Run
result = copula.cumulative_distribution... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cum_density_func(xs,norm=True,rank=False,data_range='data',pdf=None):\n if pdf is None:\n pdf = prob_density_func(xs,False,data_range)\n pdfk = sorted(pdf.keys())\n pdfv = map(pdf.get,pdfk)\n if not rank:\n cdfv = np.cumsum(pdfv)\n if norm:\n cdfv = cdfv/np.sum(pdfv)... | [
"0.71789974",
"0.6796395",
"0.6694117",
"0.65174884",
"0.64808375",
"0.64584243",
"0.6304287",
"0.62825346",
"0.626399",
"0.6238487",
"0.62255764",
"0.61748004",
"0.61748004",
"0.6167548",
"0.6166201",
"0.6116068",
"0.6108685",
"0.60912734",
"0.6065811",
"0.6050183",
"0.60410... | 0.5702993 | 38 |
Cumulative_density integrates the probability density along the given values. | def test_cumulative_distribution_fit_call_pd(self):
# Setup
copula = GaussianMultivariate(GaussianUnivariate)
copula.fit(self.data.to_numpy())
X = np.array([2000., 200., 1.])
expected_result = 0.4550595153746892
# Run
result = copula.cumulative_distribution(X)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cum_density_func(xs,norm=True,rank=False,data_range='data',pdf=None):\n if pdf is None:\n pdf = prob_density_func(xs,False,data_range)\n pdfk = sorted(pdf.keys())\n pdfv = map(pdf.get,pdfk)\n if not rank:\n cdfv = np.cumsum(pdfv)\n if norm:\n cdfv = cdfv/np.sum(pdfv)... | [
"0.7178562",
"0.679526",
"0.6693489",
"0.65184796",
"0.64831656",
"0.6458569",
"0.6303164",
"0.6283906",
"0.62639004",
"0.6239956",
"0.62254405",
"0.61735517",
"0.61735517",
"0.6166034",
"0.6165908",
"0.611555",
"0.61074144",
"0.6093974",
"0.6048896",
"0.60415834",
"0.6035557... | 0.60652953 | 18 |
from_dict generates a new instance from its parameters. | def test_from_dict(self):
# Setup
copula = GaussianMultivariate()
copula.fit(self.data)
copula_dict = copula.to_dict()
# Run
new_copula = GaussianMultivariate.from_dict(copula_dict)
# Asserts
assert isinstance(new_copula, GaussianMultivariate)
as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n ... | [
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"0.8538346",
"... | 0.0 | -1 |
Load example dataset and split between train and test datasets. | def load_data(train_size=30000, random_state=0):
print("Loading adult data from alibi.")
np.random.seed(random_state)
data = alibi.datasets.fetch_adult()
# mix input data
data_perm = np.random.permutation(np.c_[data.data, data.target])
data.data = data_perm[:, :-1]
data.target = data_perm[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_train_and_test_with_py_datasets(data_set, batch_size=cfg['batch_size'], test_size=0.2, num_works=4,\n pin_memory=True):\n num_dataset = len(data_set)\n indices = list(range(num_dataset))\n split = int(np.floor(test_size * num_dataset))\n\n train_idx, t... | [
"0.7459601",
"0.7286661",
"0.72093254",
"0.7204697",
"0.7185885",
"0.71775323",
"0.713085",
"0.7090883",
"0.70757633",
"0.70356494",
"0.70278627",
"0.6986566",
"0.69762176",
"0.69728744",
"0.6953923",
"0.6948851",
"0.6942378",
"0.6940738",
"0.6936725",
"0.69362676",
"0.687992... | 0.0 | -1 |
() > (tf.Placeholder, tf.Placeholder, FeedforwardNetwork) | def make_discriminator():
constraint_shape = Params.environment.constraint_shape()
solution_shape = Params.environment.solution_shape()
joint_shape = constraint_shape[:]
joint_shape[0] += solution_shape[0]
constraint_input = placeholder_node("constraint_input", constraint_shape, 1)
solution_inp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def placeholder_input():\r\n source_placeholder = tf.placeholder(tf.float32, shape=(BATCH_SIZE, 1, S_ENGLISH, T_ENGLISH), name='source')\r\n target_placeholder = tf.placeholder(tf.float32, shape=(BATCH_SIZE, 1, S_FRENCH, T_FRENCH), name='target')\r\n training_placeholder = tf.placeholder(tf.bool, shape=[]... | [
"0.71182024",
"0.6852992",
"0.6753943",
"0.6649212",
"0.66043746",
"0.65968215",
"0.6566806",
"0.6501994",
"0.6468269",
"0.6461248",
"0.6435017",
"0.6414632",
"0.6400236",
"0.6398884",
"0.6380983",
"0.6363863",
"0.6328433",
"0.6326803",
"0.6305797",
"0.62922794",
"0.62553126"... | 0.0 | -1 |
Adds an element at the beginning of the list. | def addFirst(self, element):
if element is None:
raise TypeError('The input element is NoneType')
newNode = Node(element)
if self.__nelems == 0:
self.__head = self.__tail = newNode
else:
newNode.setNext(self.__head)
self.__head = newNode
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend(self, item: Any):\n self.insert(0, item)",
"def prepend(self, element):\n temp = Node(element, None, self.head)\n self.size += 1\n if self.size <= 1:\n self.tail = self.head\n self.head = temp",
"def add_first(self, e):\n self._insert_between(e, ... | [
"0.7558192",
"0.7415956",
"0.74100506",
"0.73160547",
"0.7293984",
"0.72388417",
"0.717138",
"0.70636076",
"0.7036199",
"0.7030934",
"0.70249176",
"0.69642484",
"0.6957349",
"0.686662",
"0.68110585",
"0.6777173",
"0.6763731",
"0.67354023",
"0.67322254",
"0.6682857",
"0.666974... | 0.62586933 | 40 |
Returns the data contained by this node object. | def getData(self):
return self.__data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_data(self):\n return self.node_data_",
"def data(self):\n return self.first_node.data",
"def data(self):\n return self.__data",
"def data(self):\n return self.__data",
"def data(self):\n return self.__data",
"def data(self):\n return self.__data",
"def... | [
"0.8940347",
"0.8575796",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8172365",
"0.8092543",
"0.8092543",
"0.8092543",
"0.8030228",
"0.8030228",
"0.8030228",
"0.8030228",
"0.8027019",
"0.8027019",
"0.8027019",
"... | 0.79970735 | 41 |
return represantation form. only defined generic representation. | def __repr__(self):
return "EC(%s, %s)" % (str(self.coefficient), repr(self.basefield)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_(self):\n description = \"1-form \"\n if self._name is not None:\n description += \"'%s' \" % self._name\n return self._final_repr(description)",
"def _repr_(self):\n description = \"1-form \"\n if self._name is not None:\n description += \"'%s' ... | [
"0.64444286",
"0.64444286",
"0.6208931",
"0.5937106",
"0.58884144",
"0.58884144",
"0.58617705",
"0.5826151",
"0.5823668",
"0.5822231",
"0.58190227",
"0.5810632",
"0.5804474",
"0.5788184",
"0.57732946",
"0.5766647",
"0.5766647",
"0.5729728",
"0.5728019",
"0.5718054",
"0.569605... | 0.0 | -1 |
Return t = p + 1 E(Fp). This method computes t by counting up Legendre symbols and thus needs exponential time. | def naive(self):
if self.ch in (2, 3):
raise TypeError("cannot be defined over characteristic two/three.")
sform = self.simple()
k = 0
f = sform.cubic
for i in range(card(sform.basefield)):
x = sform.basefield.createElement(i)
k += sform.base... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def p(e, t):\n return b * e ** 2",
"def erf(t):\n P = 0.3275911\n A = [0.254829592, -0.284496736, 1.421413741, -1.453152027, 1.061405429]\n T = 1.0 / (1 + P * t)\n Tn = T\n Poly = A[0] * Tn\n for i in range(1, 5):\n Tn = Tn * T\n Poly = Poly * A[i] * Tn\n return 1.0 ... | [
"0.6387187",
"0.6200355",
"0.6119742",
"0.596191",
"0.5905196",
"0.5885376",
"0.5879134",
"0.5788261",
"0.57863253",
"0.57642734",
"0.5734735",
"0.56935084",
"0.56778985",
"0.5652934",
"0.56376207",
"0.5600282",
"0.5592793",
"0.55266684",
"0.54851156",
"0.54676676",
"0.546624... | 0.0 | -1 |
Yield successive nsized chunks from lst. | def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]",
"de... | [
"0.83071756",
"0.81939614",
"0.81910837",
"0.81910837",
"0.8190213",
"0.81267184",
"0.81218547",
"0.81218547",
"0.80773693",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80526286",
"0.80042696",
"0.7871678",
"0.7845623",
"0.7828392",
"0.7827006",
"0.78138447",
"... | 0.80533457 | 27 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input('\nWould you like to see data for.?: Simply type the Name \n-> Chicago \n-> New York\n-> Washington\n').... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time'])
# to_datetime command is used to convert(change) date into date format
df['End Time'] = pd.to_datetime(df['End Time'])
if month != 'all':
months = ['january', 'february',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.75289625 | 88 |
Displays statistics on the most frequent times of travel. | def time_stats(df, month, day):
print('\nCalculating The Most regular Times of Travelling\n Loading Please wait for a while ........\n')
start_time = time.time()
# display the most common month
if(month == 'all'):
most_similar_month = df['Start Time'].dt.month.value_counts().idxmax()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\n******************** Calculating The Most Popular Stations and Trip... *********************\n')
start_time = time.time()
# display most commonly used start station
most_similar_start_station = st.mode(df['Start Station'])
print('\n******************** Mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815502",
"0.76617634",
"0.7553331",
"0.7491147",
"0.747456",
"0.74459386",
"0.7431019",
"0.7423337",
"0.74172765",
"0.7400016",
"0.7387015",
"0.7385145",
"0.73644745",
"0.735896",
"0.7356297",
"0.73543596",
"0.73516876",
"0.73508674",
"0.73499984",
"0.7341763",
"0.7340006... | 0.7264996 | 35 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\n******************** Calculating Trip Duration... *********************\n')
start_time = time.time()
# display total travel time
total_travel_time = df['Trip Duration'].sum()
time1 = total_travel_time
day = time1 // (24 * 3600)
time1 = time1 %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.0 | -1 |
Create a Grid2DIterate (see Grid2DIterate.__new__) from a mask, where only unmasked pixels are included in the grid (if the grid is represented in 2D masked values are (0.0, 0.0)). The mask's pixel_scales and origin properties are used to compute the grid (y,x) coordinates. | def from_mask(
cls,
mask: Mask2D,
fractional_accuracy: float = 0.9999,
relative_accuracy: Optional[float] = None,
sub_steps: Optional[List[int]] = None,
) -> "Grid2DIterate":
grid_slim = grid_2d_util.grid_2d_slim_via_mask_from(
mask_2d=mask, pixe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_grid(self):\n xg, yg = self._build_grid()\n mask = self._build_mask(xg, yg)\n mask = mask.reshape(xg.shape)\n\n return xg, yg, mask",
"def via_mask_from(self, mask: Mask2D) -> Visuals2D:\r\n origin = self.origin_via_mask_from(mask=mask)\r\n mask_visuals = self.... | [
"0.640892",
"0.62864256",
"0.617731",
"0.6063297",
"0.6046105",
"0.5762346",
"0.5672607",
"0.5672142",
"0.55856997",
"0.5567239",
"0.5490645",
"0.5472396",
"0.5471098",
"0.5451633",
"0.5439843",
"0.54312015",
"0.542528",
"0.54130954",
"0.5345164",
"0.5322865",
"0.5314616",
... | 0.7251152 | 0 |
Setup a blurringgrid from a mask, where a blurring grid consists of all pixels that are masked (and therefore have their values set to (0.0, 0.0)), but are close enough to the unmasked pixels that their values will be convolved into the unmasked those pixels. This when computing images from light profile objects. See G... | def blurring_grid_from(
cls,
mask: Mask2D,
kernel_shape_native: Tuple[int, int],
fractional_accuracy: float = 0.9999,
relative_accuracy: Optional[float] = None,
sub_steps: Optional[List[int]] = None,
) -> "Grid2DIterate":
blurring_mask = mask.derive_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_grid(self):\n xg, yg = self._build_grid()\n mask = self._build_mask(xg, yg)\n mask = mask.reshape(xg.shape)\n\n return xg, yg, mask",
"def blurred_image_2d_from_grid_and_psf(self, grid, psf, blurring_grid):\r\n\r\n if not self.has_light_profile:\r\n return ... | [
"0.6808554",
"0.6480119",
"0.60403734",
"0.5912199",
"0.5645802",
"0.5559395",
"0.555485",
"0.555485",
"0.5522488",
"0.5516855",
"0.5453732",
"0.5431576",
"0.5390356",
"0.5356915",
"0.5345018",
"0.5330812",
"0.53234375",
"0.53123385",
"0.5288054",
"0.5263885",
"0.52208006",
... | 0.6980832 | 0 |
Return a ``Grid2D`` where the data is stored its ``slim`` representation, which is an ndarray of shape [total_unmasked_pixels sub_size2, 2]. If it is already stored in its ``slim`` representation it is returned as it is. If not, it is mapped from ``native`` to ``slim`` and returned as a new ``Grid2D``. | def slim(self) -> "Grid2DIterate":
return Grid2DIterate(
values=self,
mask=self.mask,
fractional_accuracy=self.fractional_accuracy,
sub_steps=self.sub_steps,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padded_grid_from(self, kernel_shape_native: Tuple[int, int]) -> \"Grid2DIterate\":\r\n shape = self.mask.shape\r\n\r\n padded_shape = (\r\n shape[0] + kernel_shape_native[0] - 1,\r\n shape[1] + kernel_shape_native[1] - 1,\r\n )\r\n\r\n padded_mask = Mask2D.all_... | [
"0.5512386",
"0.54331136",
"0.52063835",
"0.5182092",
"0.51143974",
"0.4989602",
"0.48805118",
"0.4852229",
"0.4849482",
"0.481266",
"0.48116904",
"0.48049447",
"0.4779547",
"0.47336814",
"0.4730924",
"0.47078955",
"0.4703412",
"0.46861225",
"0.46810302",
"0.46566904",
"0.464... | 0.5710812 | 0 |
Returns a fractional mask from a result array, where the fractional mask describes whether the evaluated value in the result array is within the ``Grid2DIterate``'s specified fractional accuracy. The fractional mask thus determines whether a pixel on the grid needs to be reevaluated at a higher level of subgridding to ... | def threshold_mask_via_arrays_from(
self, array_lower_sub_2d: Array2D, array_higher_sub_2d: Array2D
) -> Mask2D:
threshold_mask = Mask2D.all_false(
shape_native=array_lower_sub_2d.shape_native,
pixel_scales=array_lower_sub_2d.pixel_scales,
invert=True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask_evaluation(annotation_mask, result_mask, idx):\n\n true_positive = np.sum(np.logical_and(annotation_mask == 255, result_mask == 255)) \n false_positive = np.sum(np.logical_and(result_mask == 255, annotation_mask != result_mask))\n false_negative = np.sum(np.logical_and(annotation_mask == 255,... | [
"0.540261",
"0.5198657",
"0.5171135",
"0.5063427",
"0.5014532",
"0.48458305",
"0.4784179",
"0.4779883",
"0.46855587",
"0.46468997",
"0.46343517",
"0.4627272",
"0.46060577",
"0.4589445",
"0.45833278",
"0.45417356",
"0.45366517",
"0.45316955",
"0.44950017",
"0.4484353",
"0.4469... | 0.4411592 | 23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.