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 |
|---|---|---|---|---|---|---|
Change this function if you need to add more routes to your Pylons test app. | def create_routes():
app_dir = os.path.dirname(os.path.abspath(__file__))
controller_dir = os.path.join(app_dir, "controllers")
routes = Mapper(directory=controller_dir)
routes.connect("/", controller="root", action="index")
routes.connect("/body", controller="root", action="body")
routes.connec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_routes(self):\n pass",
"def add_routes(self):\n\n # create a routegroup\n routegroup = MewloRouteGroup('testsite_routegroup')\n # overide the parent import-pack-directory for the urls in this group? if we don't it will use the controller root set in SITE config\n # rout... | [
"0.74145037",
"0.735221",
"0.72461474",
"0.6932494",
"0.69164824",
"0.6872018",
"0.684903",
"0.6841164",
"0.67437196",
"0.67430514",
"0.67142785",
"0.66667706",
"0.6664727",
"0.663452",
"0.6606709",
"0.6588881",
"0.65878725",
"0.6582174",
"0.6534395",
"0.6504288",
"0.65004903... | 0.6148213 | 35 |
rotatePivot(Vector rotation) This function will take a vector rotation and rotate the curently selected objects pivot to match without affecting their physical display Make sure that you rotate around the cursor and have the entire mesh selected or this will not work. This operates on an xyz euler. | def rotatePivot(rotation):
# Rotate in object mode X
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.transform.rotate(value=rotation.x, axis=(1,0,0), constraint_orientation='GLOBAL')
# rotate in edit mode X
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_rotation_pivot(self, rotation_pivot: Pivot):\n pass",
"def Pivot(rotation, axis, angle):\n # Check for an invalid coordinate axis.\n if axis not in [0, 1, 2]:\n raise Error('Invalid axis {}. Must be [0, 1, 2].'.format(axis))\n\n radians = math.radians(angle)\n c = math.cos(ra... | [
"0.74697024",
"0.6728124",
"0.6568968",
"0.6513034",
"0.63447696",
"0.6299606",
"0.6126983",
"0.5978732",
"0.59771883",
"0.5927698",
"0.59080005",
"0.58852196",
"0.5876758",
"0.58229953",
"0.58206",
"0.5766183",
"0.5760986",
"0.57403606",
"0.57333255",
"0.5731726",
"0.5709637... | 0.84249556 | 0 |
In the backward pass we receive a Tensor containing the gradient of the loss with respect to the output, and we need to compute the gradient of the loss with respect to the input. | def backward(self, grad_output):
input, = self.saved_tensors
grad_input = grad_output.clone()
grad_input[input < -1] = 0
grad_input[input > 1] = 0
return grad_input, None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(ctx, grad_output):\n\n ########################\n # PUT YOUR CODE HERE #\n #######################\n # Retrieve saved tensors and constants\n gamma, ivar, mean, input = ctx.saved_tensors\n eps = ctx.saved_tensors\n\n # Check which inputs need gradients\n input_needs_grad, gamm... | [
"0.8171659",
"0.81508464",
"0.7940927",
"0.79316515",
"0.790726",
"0.79029804",
"0.78929776",
"0.7862743",
"0.7845963",
"0.7826248",
"0.78072923",
"0.7788905",
"0.77880204",
"0.7774279",
"0.7774279",
"0.77536577",
"0.76964784",
"0.76917285",
"0.7676619",
"0.7676619",
"0.76470... | 0.72141826 | 59 |
Sets the type of this ZacksAnalystRatingSnapshot. | def type(self, type):
self._type = type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self._type = type",
"def set_type(self, rtype=ALL_USERS):\r\n self.type = rtype",
"def type(self, type):\n if type is None:\n raise Value... | [
"0.63176864",
"0.63176864",
"0.63006794",
"0.61938",
"0.59525114",
"0.59525114",
"0.59525114",
"0.59399176",
"0.59399176",
"0.58475053",
"0.58203775",
"0.57967865",
"0.57967865",
"0.5700211",
"0.5700211",
"0.56928504",
"0.56829816",
"0.5661767",
"0.5613467",
"0.5556663",
"0.5... | 0.59648424 | 17 |
Sets the strong_buys of this ZacksAnalystRatingSnapshot. | def strong_buys(self, strong_buys):
self._strong_buys = strong_buys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_sells(self, strong_sells):\n\n self._strong_sells = strong_sells",
"def buys(self, buys):\n\n self._buys = buys",
"def player_b_rating(self, player_b_rating):\n\n self._player_b_rating = player_b_rating",
"def weightedBoldness(self):\n\n\t\treturn sum([blend.varietal.boldness ... | [
"0.7033873",
"0.5824333",
"0.51823777",
"0.49280098",
"0.48780355",
"0.48700973",
"0.48350552",
"0.4807561",
"0.4807561",
"0.47917977",
"0.47565135",
"0.46617305",
"0.46569103",
"0.46393418",
"0.46238536",
"0.46224138",
"0.46224138",
"0.46091217",
"0.46026292",
"0.4574411",
"... | 0.8174262 | 0 |
Sets the holds of this ZacksAnalystRatingSnapshot. | def holds(self, holds):
self._holds = holds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratings(self, ratings):\n\n self._ratings = ratings",
"def ratings(self, ratings):\n\n self._ratings = ratings",
"def binarize(self):\n total = 0\n count = 0\n avg_rating = 0\n for movie_id, movie in enumerate(self.ratings):\n for user_id, rating in enumerate(movi... | [
"0.5835982",
"0.5835982",
"0.4976238",
"0.48544487",
"0.48544487",
"0.48132378",
"0.4691935",
"0.46543285",
"0.46492696",
"0.4644989",
"0.46391696",
"0.4630273",
"0.46297568",
"0.46284485",
"0.4615285",
"0.45675987",
"0.45078152",
"0.44719487",
"0.44543308",
"0.44518128",
"0.... | 0.6009718 | 0 |
Sets the total of this ZacksAnalystRatingSnapshot. | def total(self, total):
self._total = total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_total(self, valeurs):\r\n \r\n self._total = valeurs",
"def total_seats(self, total_seats):\n\n self._total_seats = total_seats",
"def total_hits(self, total_hits):\n\n self._total_hits = total_hits",
"def total_amount(self, total_amount):\n\n self._total_amount = t... | [
"0.61649764",
"0.59785956",
"0.5950165",
"0.5918118",
"0.5895814",
"0.58351",
"0.58182096",
"0.57719547",
"0.575881",
"0.5749338",
"0.5741158",
"0.57178205",
"0.56936616",
"0.5657782",
"0.56530815",
"0.56514025",
"0.56326056",
"0.5570501",
"0.5563875",
"0.5545594",
"0.5543764... | 0.67269886 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ZacksAnalystRatingSnapshot):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457167",
"0.8393036",
"0.81455255",
"0.8139734",
"0.81333447",
"0.8094964",
"0.8093362",
"0.8093362",
"0.8093362",
"0.80863476",
"0.80863476",
"0.8077286",
"0.8077286",
"0.806682"
] | 0.0 | -1 |
Returns the Resnet34 model | def ResNet34(num_classes=10):
return ResNet(BasicBlock,
[3,4,6,3],
num_classes=num_classes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet34(pretrained=False):\n model = ResNet(BasicBlock, [3, 4, 6, 3])\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet34']))\n return model",
"def resnet():\n return models.resnet152(pretrained=True)",
"def get_model():\n # Load the pretrained model.\n ... | [
"0.74286",
"0.73018",
"0.72224516",
"0.7177756",
"0.70892936",
"0.70892936",
"0.70892936",
"0.6916624",
"0.68879527",
"0.6861554",
"0.6856016",
"0.68004495",
"0.6771675",
"0.6768829",
"0.6721291",
"0.67193204",
"0.67073303",
"0.66100204",
"0.66100204",
"0.66100204",
"0.652768... | 0.5999137 | 74 |
Returns the Resnet34 model | def ResNetLN34(num_classes=10):
return ResNet(BasicLNBlock,[3,4,6,3],
num_classes=num_classes,
norm_type="LN") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet34(pretrained=False):\n model = ResNet(BasicBlock, [3, 4, 6, 3])\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet34']))\n return model",
"def resnet():\n return models.resnet152(pretrained=True)",
"def get_model():\n # Load the pretrained model.\n ... | [
"0.7428876",
"0.73020375",
"0.72233206",
"0.7177809",
"0.7089681",
"0.7089681",
"0.7089681",
"0.69169164",
"0.6888469",
"0.6860939",
"0.6856545",
"0.6801302",
"0.67714906",
"0.6769696",
"0.67215586",
"0.67200243",
"0.6707702",
"0.66098666",
"0.66098666",
"0.66098666",
"0.6526... | 0.61188316 | 55 |
Gets the length of each vector in the output. | def element_count(self):
return self._internal.get_element_count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_len(x):\r\n \r\n length = math.sqrt(x[0]**2 + x[1]**2)\r\n return length",
"def length(self):\n\n return np.array([f.length() for f in self])",
"def len(self):\n return math.sqrt(self.v[0] * self.v[0] + self.v[1] * self.v[1])",
"def getOutputLength(self):\n return len(se... | [
"0.72642845",
"0.71258116",
"0.7064309",
"0.6971056",
"0.6918327",
"0.69082165",
"0.6892824",
"0.6853733",
"0.6819476",
"0.6813605",
"0.6783392",
"0.6782998",
"0.67468464",
"0.6737196",
"0.67022675",
"0.6683858",
"0.6682827",
"0.667626",
"0.6623841",
"0.6610941",
"0.6599437",... | 0.0 | -1 |
Checks if the free term is all zeros. | def zero_free_term(self, zero_free_term):
self._internal.set_zero_free_term(bool(zero_free_term)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_free(self, arr):\n cell_location = self.cartesian_to_cell(arr)\n cell = self.occ_matrix[cell_location[0], cell_location[1]]\n return cell == 0",
"def is_zero(self):\n for t in self:\n if t != TRIT_ZERO:\n return False\n return True",
"def i... | [
"0.7325847",
"0.7018611",
"0.69753647",
"0.6833514",
"0.6762086",
"0.6721247",
"0.6713489",
"0.66665936",
"0.66576236",
"0.6648229",
"0.6641469",
"0.66275036",
"0.6588213",
"0.65584576",
"0.6549519",
"0.65404916",
"0.65361273",
"0.6510658",
"0.6510199",
"0.65079504",
"0.64910... | 0.66308784 | 11 |
Applies batch normalization to this layer. Batch normalization must be deleted from the dnn afterwards and layers which were connected to the batch norm must be connected to this layer. | def apply_batch_normalization(self, layer):
if type(layer) is not BatchNormalization:
raise ValueError('The `layer` must be neoml.Dnn.BatchNormalization.')
self._internal.apply_batch_normalization(layer._internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_norm(inputs, training, data_format):\n # We set fused=True for a significant performance boost. See\n # https://www.tensorflow.org/performance/performance_guide#common_fused_ops\n return tf.compat.v1.layers.batch_normalization(\n inputs=inputs, axis=1 if data_format == 'channels_first' else 3,\n ... | [
"0.71378446",
"0.7028209",
"0.699852",
"0.6959648",
"0.6896941",
"0.68904907",
"0.68822706",
"0.66368127",
"0.66204464",
"0.65987813",
"0.659512",
"0.65843093",
"0.6543911",
"0.65430003",
"0.65364105",
"0.65344566",
"0.65333307",
"0.65062654",
"0.6484016",
"0.6480447",
"0.645... | 0.7985232 | 0 |
Gets the free term vector, of element_count length. | def free_term(self):
return Blob.Blob(self._internal.get_free_term()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_free_term(self):\n return self._internal.get_zero_free_term()",
"def f_vector(self):\n try:\n return self._f_vector\n except AttributeError:\n self._f_vector = vector(ZZ,[len(x) for x in self.face_lattice().level_sets()])\n return self._f_vector",
... | [
"0.6391553",
"0.6213692",
"0.58426434",
"0.5717408",
"0.5716961",
"0.5586635",
"0.55293155",
"0.5515443",
"0.54636407",
"0.54122466",
"0.5402079",
"0.5396786",
"0.5375249",
"0.53743243",
"0.536684",
"0.536628",
"0.5319798",
"0.52847767",
"0.52813905",
"0.52696437",
"0.5250845... | 0.6329039 | 1 |
Returns the max element in the list using recursive algorithm | def max_recursive(S):
if len(S) == 0:
return None
elif len(S) == 1:
return S[0]
else:
max_ele1 = max_recursive(S[:len(S) // 2])
max_ele2 = max_recursive(S[len(S) // 2 :])
if max_ele1 > max_ele2:
return max_ele1
else:
return max_ele2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_max(lst, highest=None):\n if highest is None and len(lst) > 0:\n highest = lst[0]\n if len(lst) <= 1:\n return highest\n highest = max(highest, lst[0])\n return return_max(lst[1:], highest)",
"def recursive_max(A, i):\n if i >= len(A):\n return A[i - 1]\n return ... | [
"0.7946154",
"0.781603",
"0.77671593",
"0.76620716",
"0.76562244",
"0.7628363",
"0.7586594",
"0.75783634",
"0.75137365",
"0.7474688",
"0.7397479",
"0.7348303",
"0.7317633",
"0.7303811",
"0.73008955",
"0.7271742",
"0.72544694",
"0.72401965",
"0.72259885",
"0.7190432",
"0.71743... | 0.7635541 | 5 |
Change neuron weights based on backpropagation described by Paul Werbos in 1974. Each implementation may be a little different but the general idea is in each epoch we want to change weights to be a little closer to the expected output. | def training_algorithm(input_layer, output_layer, epochs, expected_output, acceptance_criteria):
for _ in range(epochs):
# Step 2 and 3: Forward propagation
input_layer.forward()
output_layer.inputs = input_layer.output
output_layer.forward()
# Step 4: Backpropagation
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n activation, activation_p = self.feedforward()\n # initialize delta_weights\n delta_w = np.zeros(2)\n # simultaneous calculate delta_weights\n for i, element in enumerate(self.y):\n delta_w += (activation[i]-element)*(activation_p[i])*self.X[... | [
"0.7639103",
"0.7445134",
"0.7374383",
"0.73074913",
"0.72954476",
"0.7292057",
"0.7277261",
"0.7264991",
"0.7232985",
"0.72091115",
"0.7201249",
"0.71550757",
"0.7090372",
"0.708979",
"0.70602727",
"0.702777",
"0.70201343",
"0.6983927",
"0.68999344",
"0.688583",
"0.6856388",... | 0.0 | -1 |
Try to create a track, with a bad source_id. Returns a 404 response with detail message. | def test_create_with_bad_id(self):
# Count the number of records before the save
existing_records_count = Track.objects.all().count()
post_data = {'source_type': 'spotify', 'source_id': 00}
resp = self.api_client.post('/api/metadata/tracks/', data=post_data)
data = json.loads(res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_with_bad_backend(self):\n # Count the number of records before the save\n post_data = {\n 'source_type': 'test',\n 'source_id': '4bCOAuhvjsxbVBM5MM8oik',\n }\n resp = self.api_client.post('/api/metadata/tracks/', data=post_data)\n data = json... | [
"0.7134957",
"0.65041846",
"0.6113626",
"0.5729739",
"0.55509627",
"0.5464614",
"0.5420374",
"0.5404015",
"0.54009336",
"0.5392408",
"0.5372617",
"0.53524536",
"0.53095245",
"0.53046906",
"0.53046906",
"0.53046906",
"0.53046906",
"0.5304292",
"0.5304292",
"0.5304292",
"0.5272... | 0.7263801 | 0 |
Return a track json object of a given record. | def test_retrieve(self):
track_attrs = self.track_attrs + ('id',)
resp = self.api_client.get('/api/metadata/tracks/1/')
data = json.loads(resp.content)
# Ensure request was successful, and the correct data is returned.
self.assertEqual(resp.status_code, 200)
self.assertT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_record(record):\n return json.dumps(record)",
"def serialize_to_json(self, record, pretty=False):\n return self._json_serializer.to_json(record)",
"def to_json(self, record: Mapping[str, Any]) -> str:\n return self.json_lib.dumps(record, cls=ObjectEncoder)",
"def format(self, reco... | [
"0.68444854",
"0.68274665",
"0.67836183",
"0.6511036",
"0.64021534",
"0.6341375",
"0.6327563",
"0.62412363",
"0.6178721",
"0.60705096",
"0.60145724",
"0.5989447",
"0.5981762",
"0.59348005",
"0.58625954",
"0.58557045",
"0.5839482",
"0.58263636",
"0.5799777",
"0.57918745",
"0.5... | 0.0 | -1 |
Create a Meter from dict object. | def from_dict(cls, d: Dict, method: SerializationType = SerializationType.Status) -> "Meter":
name = d["name"]
min_value = d["min_value"]
max_value = d["max_value"]
meter = Meter(
name=name,
min_value=min_value,
max_value=max_value,
)
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, d):\n return loadd(d, cls)",
"def from_dict(cls, d):\n return cls(**d)",
"def from_dict(cls, data):\n return cls(**data)",
"def fromdict(cls,datadict):\n return cls(fmetric=datadict.get('fmetric'),\n fhost=datadict.get('fhost'),\n ... | [
"0.6572882",
"0.6530952",
"0.6431576",
"0.63849896",
"0.6335211",
"0.630731",
"0.6291888",
"0.6274567",
"0.62618166",
"0.62144405",
"0.6184855",
"0.6163284",
"0.61541444",
"0.61479396",
"0.61479396",
"0.61479396",
"0.61479396",
"0.61479396",
"0.61479396",
"0.61479396",
"0.614... | 0.80224687 | 0 |
Return a subset of `supported_parameters` that are meant to be included in potentials. | def potential_parameters(cls):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supported_parameters(cls):\n raise NotImplementedError()",
"def potential_parameters(cls):\n return [\"k\", \"periodicity\", \"phase\", \"idivf\"]",
"def potential_parameters(cls):\n return [\"k\", \"periodicity\", \"phase\", \"idivf\"]",
"def supported_parameters(cls):\n retu... | [
"0.61632377",
"0.60749733",
"0.60749733",
"0.6045904",
"0.5958558",
"0.59476894",
"0.5931817",
"0.5903901",
"0.5861894",
"0.58335835",
"0.5776701",
"0.5754737",
"0.56521624",
"0.5636197",
"0.56098294",
"0.5578262",
"0.55694485",
"0.55178815",
"0.5493202",
"0.5493202",
"0.5449... | 0.63488674 | 0 |
Setter function to set both queues, the computation table, the content store and the pending interest table after the forwarders have been initialized. | def initialize_executor(self, queue_to_lower: multiprocessing.Queue, queue_from_lower: multiprocessing.Queue, cs: BaseContentStore, classic: bool = False):
self.queue_to_lower = queue_to_lower
self.queue_from_lower = queue_from_lower
self.cs = cs
self.classic = classic | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __post_init__(self) -> None:\n self.gtex += [None]\n self.bm += [None]\n self._q: queue.Queue = queue.Queue(maxsize=self.maxsize)",
"def init_queues(self):\n for step in self.get_children():\n if step.kind == StepKinds.queue:\n step.init_object(self.conte... | [
"0.5736191",
"0.5626406",
"0.56038827",
"0.5558464",
"0.5419374",
"0.5351245",
"0.5282896",
"0.5247835",
"0.5194629",
"0.5175086",
"0.5173235",
"0.5173235",
"0.51386636",
"0.51318306",
"0.5112",
"0.5105093",
"0.5095491",
"0.508927",
"0.50757",
"0.5066557",
"0.5064242",
"0.5... | 0.50812507 | 18 |
Checks if name either starts with '/' or it is the last component of a stream. | def check_name(self, name: str):
if name[0] == "/" or self.check_end_streaming(name):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_streaming(self, arg: str):\n if not arg:\n return False\n elif arg.startswith(\"sdo:\"):\n print(\"[check_streaming] File is for streaming\")\n tmp_list = arg.splitlines()\n tmp_list.pop(0)\n for x in tmp_list:\n if self.... | [
"0.6286656",
"0.61531717",
"0.6124441",
"0.6101799",
"0.6014477",
"0.598726",
"0.58650726",
"0.5787407",
"0.57717556",
"0.57680005",
"0.5682801",
"0.5670426",
"0.5670426",
"0.56299",
"0.5595348",
"0.55865085",
"0.5574163",
"0.55718523",
"0.55560887",
"0.5553138",
"0.553181",
... | 0.81663287 | 0 |
Method to load the attributes and neural network saved under the given directory. | def load_bot(self, prefix="model_data/"):
attributes = np.load(prefix + "model_attributes.npy",
allow_pickle='TRUE').item()
self.num_rounds = attributes["num_rounds"]
self.c = attributes["c"]
self.alpha = attributes["alpha"]
if "loss_history"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_networks(self, dir_weights, idx_load):\n\n path_p = dir_weights + 'p_{}.ckpt'\n path_D = dir_weights + 'D_{}.ckpt'\n path_U = dir_weights + 'U_{}.ckpt'\n\n self.net_p.load_weights(path_p.format(idx_load))\n self.net_D.load_weights(path_D.format(idx_load))\n self.n... | [
"0.69320256",
"0.66557443",
"0.6612585",
"0.6610038",
"0.6567036",
"0.6553782",
"0.6531191",
"0.6518196",
"0.6501824",
"0.6497329",
"0.6464533",
"0.6441552",
"0.63996154",
"0.63624346",
"0.6355021",
"0.6335954",
"0.63271874",
"0.63111204",
"0.63082504",
"0.62769675",
"0.62329... | 0.63873476 | 13 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.774767 | 30 |
Creates a tf.placeholder with the dtype & shape of generator inputs. | def make_generator_ph(self):
info = self._module.get_input_info_dict('generate')['z']
return tf.placeholder(dtype=info.dtype, shape=info.get_shape()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_placeholders(self):\n # \"None\" means the batches may have a variable batch size and length.\n self.x = tf.placeholder(tf.int64, shape=[None, None])",
"def placeholder_input():\r\n source_placeholder = tf.placeholder(tf.float32, shape=(BATCH_SIZE, 1, S_ENGLISH, T_ENGLISH), name='source')\r\... | [
"0.73510855",
"0.6947808",
"0.68811524",
"0.6843197",
"0.6786487",
"0.6739757",
"0.67395514",
"0.6737801",
"0.6683461",
"0.65602267",
"0.6556576",
"0.65447986",
"0.65442115",
"0.654158",
"0.6479429",
"0.64442724",
"0.6391434",
"0.63816166",
"0.63666093",
"0.6313228",
"0.62930... | 0.7611539 | 0 |
Creates a tf.placeholder with the dtype & shape of encoder inputs. | def make_encoder_ph(self):
info = self._module.get_input_info_dict('encode')['x']
return tf.placeholder(dtype=info.dtype, shape=info.get_shape()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_placeholders(self):\n\n\n # encoder part\n self._enc_batch = tf.placeholder(tf.int32, [config.batch_size, None], name='enc_batch')\n self._enc_lens = tf.placeholder(tf.int32, [config.batch_size], name='enc_lens')\n self._enc_padding_mask = tf.placeholder(tf.float32, [config.batch_size, None], ... | [
"0.67486584",
"0.6601982",
"0.6598257",
"0.6536034",
"0.6417243",
"0.6407907",
"0.6378354",
"0.6350807",
"0.63072497",
"0.6267904",
"0.62510544",
"0.6248996",
"0.62423813",
"0.62370676",
"0.62248755",
"0.62113446",
"0.6210726",
"0.6207823",
"0.62027955",
"0.61931306",
"0.6176... | 0.767189 | 0 |
Creates a validated `TPUEstimatorSpec` instance. | def __new__(cls,
mode,
predictions=None,
loss=None,
train_op=None,
eval_metrics=None,
export_outputs=None,
scaffold_fn=None,
host_call=None):
host_calls = {}
if eval_metrics is not None:
host_ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_estimator_spec(self):\n host_calls = {}\n if self.eval_metrics is not None:\n host_calls['eval_metrics'] = self.eval_metrics\n if self.host_call is not None:\n host_calls['host_call'] = self.host_call\n host_call_ret = _OutfeedHostCall.create_cpu_hostcall(host_calls)\n eval_metric_o... | [
"0.58872473",
"0.56756306",
"0.5586498",
"0.5519904",
"0.54025954",
"0.5400498",
"0.53641117",
"0.53511024",
"0.5270698",
"0.52680284",
"0.52115655",
"0.51035535",
"0.5102771",
"0.50725776",
"0.50706977",
"0.5068895",
"0.5065051",
"0.50586456",
"0.5047727",
"0.5010918",
"0.50... | 0.6168227 | 0 |
Creates an equivalent `EstimatorSpec` used by CPU train/eval. | def as_estimator_spec(self):
host_calls = {}
if self.eval_metrics is not None:
host_calls['eval_metrics'] = self.eval_metrics
if self.host_call is not None:
host_calls['host_call'] = self.host_call
host_call_ret = _OutfeedHostCall.create_cpu_hostcall(host_calls)
eval_metric_ops = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_estimator_spec(features, labels, mode):\n if mode not in {\"train\", \"infer\", \"eval\"}:\n raise ValueError('mode should be in {\"train\", \"infer\", \"eval\"}')\n\n logits = get_logits(features)\n preds = tf.argmax(logits, axis=-1)\n probs = tf.nn.softmax(logits, axis=-1)\n predict... | [
"0.653255",
"0.6415198",
"0.62002885",
"0.61464673",
"0.60211784",
"0.59734035",
"0.5882333",
"0.58066183",
"0.57011044",
"0.5623417",
"0.55480283",
"0.55394053",
"0.5519858",
"0.5499919",
"0.54941463",
"0.54804045",
"0.5472486",
"0.5453627",
"0.5434046",
"0.5416209",
"0.5372... | 0.7923026 | 0 |
Converts user provided model_fn` as a single train step on TPU. The user provided `model_fn` takes input tuple (features, labels) and produces the EstimatorSpec with train_op and loss for train `mode`. This usually represents a single train computation on CPU. For TPU training, a train (computation) step is first wrapp... | def convert_to_single_tpu_train_step(self, dequeue_fn):
host_call = _OutfeedHostCall(self._ctx)
captured_scaffold_fn = _CapturedObject()
def train_step(loss):
"""Training step function for use inside a while loop."""
del loss # unused; required in function signature.
inputs = dequeue_fn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _model_fn(features, labels, mode, config, params):\n with self._ctx.with_mode(mode) as ctx:\n model_fn_wrapper = _ModelFnWrapper(model_fn, config, params, ctx)\n\n if mode != model_fn_lib.ModeKeys.PREDICT:\n is_export_mode = False\n else:\n # For export_savedmodel, i... | [
"0.72253805",
"0.68108726",
"0.6774271",
"0.6719611",
"0.65392244",
"0.649606",
"0.64581513",
"0.64381677",
"0.6420198",
"0.6401497",
"0.6346824",
"0.6328738",
"0.6324738",
"0.6315999",
"0.6287701",
"0.6285973",
"0.62623984",
"0.6247418",
"0.61984706",
"0.61869395",
"0.617947... | 0.6929875 | 1 |
Sends the tensors through outfeed and runs the host_fn on CPU. The tensors are concatenated along dimension 0 to form a global tensor across all shards. The concatenated function is passed to the host_fn and executed on the first host. | def create_tpu_hostcall(self):
if not self._names:
return []
ret = {}
# For each i, dequeue_ops[i] is a list containing the tensors from all
# shards. This list is concatenated later.
dequeue_ops = []
tensor_dtypes = []
tensor_shapes = []
for name in self._names:
for _ in se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue_ops_fn():\n control_deps = []\n per_host_sharded_inputs = []\n num_replicas_per_host = ctx.num_of_replicas_per_host\n with ops.device(device):\n if not inputs.is_dataset:\n raise TypeError('`input_fn` must return a `Dataset` for this mode.')\n for _ in range(num_replicas_pe... | [
"0.63360953",
"0.62956405",
"0.6291536",
"0.6241733",
"0.58995396",
"0.5864348",
"0.5839464",
"0.58250535",
"0.56826615",
"0.56309867",
"0.5552339",
"0.548088",
"0.5467413",
"0.5426072",
"0.53615206",
"0.53566736",
"0.5268573",
"0.5245989",
"0.5235768",
"0.5235768",
"0.523125... | 0.6630872 | 0 |
Wraps the ops generated by `op_fn` in tf.while_loop. | def _wrap_computation_in_while_loop(device, op_fn):
def computation(i):
with ops.control_dependencies(op_fn()):
return i + 1
iterations_per_loop_var = _create_or_get_iterations_per_loop()
# By setting parallel_iterations=1, the parallel execution in while_loop is
# basically turned off.
with ops.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def while_loop_op(op):\n return (control_flow_util.IsLoopSwitch(op) or\n control_flow_util.IsLoopMerge(op) or\n control_flow_util.IsLoopEnter(op) or\n control_flow_util.IsLoopExit(op) or\n TensorTracer.loop_cond_op(op) or\n op.type in ('RefNextIterati... | [
"0.69818914",
"0.68200386",
"0.6126418",
"0.6078447",
"0.57636625",
"0.5754965",
"0.57449204",
"0.57445085",
"0.57208353",
"0.57029027",
"0.56025404",
"0.54687613",
"0.54140025",
"0.53947186",
"0.52648926",
"0.5232417",
"0.52252024",
"0.520506",
"0.5199421",
"0.5190266",
"0.5... | 0.7957619 | 0 |
Wraps the ops generated by `op_fn` in tf.while_loop. | def _wrap_computation_in_while_loop_with_stopping_signals(device, op_fn):
def cond(scalar_stopping_signal):
return math_ops.logical_not(
_StopSignals.should_stop(scalar_stopping_signal))
def computation(unused_scalar_stopping_signal):
return_value = op_fn()
execute_ops = return_value['ops']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wrap_computation_in_while_loop(device, op_fn):\n\n def computation(i):\n with ops.control_dependencies(op_fn()):\n return i + 1\n\n iterations_per_loop_var = _create_or_get_iterations_per_loop()\n # By setting parallel_iterations=1, the parallel execution in while_loop is\n # basically turned off.... | [
"0.79564023",
"0.6983191",
"0.612724",
"0.6076993",
"0.5764799",
"0.5756045",
"0.5743793",
"0.5743552",
"0.57225025",
"0.57038134",
"0.5601647",
"0.5468276",
"0.541185",
"0.5393501",
"0.52653897",
"0.52321666",
"0.5223668",
"0.5204587",
"0.51992613",
"0.51906204",
"0.51802576... | 0.6819204 | 2 |
Retrieves the Scaffold from `captured_scaffold_fn`. | def _get_scaffold(captured_scaffold_fn):
with _CapturingContext(message='Inside scaffold_fn'):
scaffold_fn = captured_scaffold_fn.get()
if scaffold_fn:
scaffold = scaffold_fn()
if scaffold is None:
raise ValueError(
'TPUEstimatorSpec.scaffold_fn returns None, which is not allow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scaffold(self, mol: Chem.rdchem.Mol) -> str:\n return MurckoScaffold.MurckoScaffoldSmiles(mol=mol, includeChirality=self.include_chirality)",
"def generate_scaffold(smiles, include_chirality=False):\n mol = Chem.MolFromSmiles(smiles)\n engine = ScaffoldGenerator(include_chirality=include_chi... | [
"0.5962946",
"0.54265267",
"0.5422105",
"0.5317502",
"0.49453947",
"0.49192426",
"0.47882766",
"0.47736388",
"0.46875826",
"0.45953506",
"0.4508714",
"0.4507913",
"0.4507913",
"0.4490961",
"0.44098067",
"0.4358617",
"0.42400393",
"0.41495925",
"0.41405055",
"0.41361576",
"0.4... | 0.8463581 | 0 |
Gets `features` and `labels`. | def features_and_labels(self):
if self.is_dataset:
if self._iterator is None:
raise RuntimeError('Internal error: Must call dataset_initializer_hook '
'before calling features_and_labels(). Please file '
'a bug!')
return _Inputs._parse_inputs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_feature_labels(self):\n return self.feature_labels",
"def get_labels(info):\n return info.features[\"labels\"].names",
"def get_labels(info):\n return info.features[\"labels\"].names",
"def get_features_and_labels(self, dataframe):\n features = dataframe.drop(columns=self._label, ... | [
"0.79877245",
"0.734456",
"0.734456",
"0.7326892",
"0.7230395",
"0.71708345",
"0.71536416",
"0.7029519",
"0.70181954",
"0.7005192",
"0.7003384",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69360304",
"0.69250166",
"0.69... | 0.7678803 | 1 |
Returns the `Signals` from `_Inputs`. | def signals(self):
if self._current_inputs is None:
raise RuntimeError(
'Internal Error: The current inputs have not been properly '
'generated. First call features_and_labels, then call signals.')
signals = self._current_inputs['signals']
self._current_inputs = None
return sig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSignals(cls):\n return []",
"def get_signals(self):\n return QFDataFrame(data=self._signals, index=self._signals_dates)",
"def read_all_signals(self):\n return [pio.sample(signal_idx)\n for signal_idx in self._signals_idx]",
"def inputs(self):\n return self._... | [
"0.7630647",
"0.674216",
"0.66904575",
"0.62987953",
"0.62987953",
"0.62987953",
"0.62970096",
"0.62616074",
"0.62526375",
"0.61903083",
"0.6189783",
"0.6183568",
"0.61779135",
"0.609748",
"0.6075958",
"0.60570484",
"0.60570484",
"0.60570484",
"0.60139763",
"0.6005559",
"0.60... | 0.7737252 | 0 |
Pads out the batch dimension of features and labels. | def pad_features_and_labels(features, labels, batch_size):
real_batch_size = array_ops.shape(
_PaddingSignals._find_any_tensor(features))[0]
batch_size_tensor = constant_op.constant(batch_size, dtypes.int32)
check_greater = check_ops.assert_greater_equal(
batch_size_tensor, real_batch_size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pad_feature_sequences(sequences, pad=PAD, feature_dims=768):\n lengths = [tf.shape(x)[0] for x in sequences]\n padded_size = tf.reduce_max(lengths)\n padded_sequences = tf.stack([\n tf.pad(x,\n paddings=[[0, padded_size - lengths[i]], [0, 0]],\n mode='CONSTANT',\n c... | [
"0.65667975",
"0.6381753",
"0.6247113",
"0.62424535",
"0.6191029",
"0.6129018",
"0.5991808",
"0.5989984",
"0.596495",
"0.59362715",
"0.59317976",
"0.5920891",
"0.5863416",
"0.5861643",
"0.58507115",
"0.5837591",
"0.58372873",
"0.5837181",
"0.5827929",
"0.5821655",
"0.57975",
... | 0.7201086 | 0 |
Turn a list of 2D points into a raster matrix. Returns the pixels as 2D array with 1 or 0 integer entries. Note that the row order is optimized for drawing later, so the first row corresponds to the highest line of pixels. | def render(
xs: np.array,
ys: np.array,
x_min: float,
x_max: float,
y_min: float,
y_max: float,
width: int,
height: int,
) -> np.array:
assert xs.shape == ys.shape
assert x_max > x_min
assert y_max > y_min
assert width > 0
assert height > 0
x_indices = discretize... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list2matrix(image_list):\n\tflatten_list = []\n\tfor image in image_list:\n\t\tflatten_list.append(image.ravel())\n\n\tmatrix = np.vstack(flatten_list)\n\n\treturn matrix",
"def get_pixel_list(img):\n orig_shape = img.shape # Remember the original shape of the img.\n # Store the img as a x by z array ... | [
"0.6348154",
"0.5905795",
"0.58332944",
"0.5748933",
"0.5718201",
"0.5713015",
"0.5713015",
"0.56789947",
"0.5643989",
"0.56383324",
"0.5567054",
"0.5562639",
"0.5494404",
"0.54819834",
"0.5476487",
"0.54572195",
"0.5432794",
"0.5374784",
"0.5373568",
"0.5372549",
"0.5371974"... | 0.0 | -1 |
Change the onehot coding to a single column with numbers for the different categories. Optionally, a given order for the categories can be given in pref_order. | def change_oh_cat(self, target: str, df: DataFrame, pref_order: Dict[int, int] = None):
target_cols = [x for x in df.columns.values if x.split("__")[0] == target]
if pref_order is None:
pref_order = {x: i for i, x in enumerate(target_cols)}
str_row = df[target_cols].idxmax(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\n one_hot[np.arange(one_hot.shape[0]), arr.flatten()] = 1.\n one_hot = one_hot.reshape((*arr.shape, n_labels))\n \n return one_hot",
"def one_hot(df):\r\n # One-h... | [
"0.6983617",
"0.69773835",
"0.68093693",
"0.68003774",
"0.67819285",
"0.67479795",
"0.6716139",
"0.6703055",
"0.66958135",
"0.6672889",
"0.66635156",
"0.66331214",
"0.66331214",
"0.66269517",
"0.6618392",
"0.6598833",
"0.6594095",
"0.6592902",
"0.6586168",
"0.6586168",
"0.658... | 0.0 | -1 |
Construct base AttentionMechanism class. | def __init__(self,
query_layer,
line_memory,
word_memory=None,
probability_fn=None,
line_memory_sequence_length=None,
word_memory_sequence_length=None,
line_memory_layer=None,
word_memory_layer=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n cell,\n attention_mechanism,\n attention_layer_size=None,\n alignment_history=False,\n cell_input_fn=None,\n output_attention=True,\n initial_cell_state=None,\n name=... | [
"0.5867038",
"0.58120334",
"0.57864046",
"0.5717726",
"0.5705828",
"0.57056093",
"0.56592566",
"0.5651803",
"0.5568748",
"0.5554679",
"0.54848045",
"0.5479348",
"0.54663813",
"0.5412661",
"0.5379585",
"0.53481793",
"0.5347217",
"0.53214896",
"0.53214896",
"0.53214896",
"0.532... | 0.54256135 | 13 |
Construct the `AttentionWrapper`. NOTE If you are using the `BeamSearchDecoder` with a cell wrapped in | def __init__(self,
cell,
attention_mechanism,
rl=False,
attention_layer_size=None,
alignment_history=False,
cell_input_fn=None,
output_attention=True,
initial_cell_state=None,
name=None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n cell,\n attention_mechanism,\n attention_layer_size=None,\n alignment_history=False,\n cell_input_fn=None,\n output_attention=True,\n initial_cell_state=None,\n name=... | [
"0.72406137",
"0.61116153",
"0.6106595",
"0.5868271",
"0.58216625",
"0.574263",
"0.5419795",
"0.5395449",
"0.53780705",
"0.5358682",
"0.5326316",
"0.5276871",
"0.52745825",
"0.5269008",
"0.526074",
"0.51900357",
"0.5189963",
"0.5186625",
"0.5131551",
"0.5088417",
"0.50647956"... | 0.7107153 | 1 |
Returns `seq` as tuple or the singular element. Which is returned is determined by how the AttentionMechanism(s) were passed to the constructor. | def _item_or_tuple(self, seq):
t = tuple(seq)
if self._is_multi:
return t
else:
return t[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _item_or_tuple(self, seq):\n t = tuple(seq)\n if self._is_multi:\n return t\n else:\n return t[0]",
"def _item_or_tuple(self, seq):\n t = tuple(seq)\n if self._is_multi:\n return t\n else:\n return t[0]",
"def to_sequence... | [
"0.6926655",
"0.6926655",
"0.58118045",
"0.57991827",
"0.57862526",
"0.56921035",
"0.5684707",
"0.5637408",
"0.5624004",
"0.5592931",
"0.551967",
"0.54796165",
"0.5422755",
"0.53580755",
"0.53534436",
"0.53325117",
"0.53325117",
"0.53325117",
"0.53325117",
"0.53325117",
"0.53... | 0.6938356 | 0 |
The `state_size` property of `AttentionWrapper`. | def state_size(self):
return AttentionWrapperState(
cell_state=self._cell.state_size,
time=tensor_shape.TensorShape([]),
attention=self._attention_layer_size,
alignments=self._item_or_tuple(
a.alignments_size for a in self._attention_mechanisms),
alignment_history... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_size(self):\n raise NotImplementedError(\"Please implement this method\")",
"def state_size(self):\n return AttentionWrapperState(\n cell_state=self._cell.state_size,\n time=tensor_shape.TensorShape([]),\n attention=self._attention_layer_size,\n ... | [
"0.8413178",
"0.83095956",
"0.76917756",
"0.76917756",
"0.76524323",
"0.74709535",
"0.73154217",
"0.724257",
"0.7135943",
"0.70932657",
"0.6971657",
"0.69473106",
"0.6929372",
"0.69267815",
"0.6837609",
"0.67772937",
"0.6741656",
"0.6741119",
"0.6716011",
"0.66940117",
"0.669... | 0.83416754 | 1 |
decorator this decorator generates a new __new__ function that returns a valid Record instance with the fields specified in the decorated class This decorator has been inspired by the decorator | def record(cls=None, /, *, new=True):
def wrap(cls):
return _process_class(cls, new)
if cls is None:
# We're called with parens.
return wrap
# We're called as @record without parens.
return wrap(cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _new_fn(cls_name, fields, *, globals=None):\n\n body_lines = []\n\n body_lines.append(\"mapping = collections.OrderedDict({\" + \", \".join(f\"'{f.name}': {i}\" for i, f in enumerate(fields)) + \"})\")\n body_lines.append('elems = (' + \", \".join(f.name for f in fields) + ')')\n body_lines.append(... | [
"0.7666698",
"0.68805176",
"0.67470175",
"0.6550612",
"0.647901",
"0.6376709",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
"0.6362241",
... | 0.68214905 | 2 |
Copy values from each NDArray in the list l to the numpy array a (in order). | def _copy_to_numpy_array(l, a):
total_size = np.sum([x.size for x in l])
assert total_size == a.size
j = 0
for x in l:
# a[j:j+x.size] = x.asnumpy().reshape((x.size,))
_copy_into(x, a[j:j + x.size])
j += x.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_from_numpy_array(a, l):\n total_size = np.sum([x.size for x in l])\n assert total_size == a.size\n j = 0\n for x in l:\n x[:] = a[j:j + x.size].reshape(x.shape)\n j += x.size",
"def listoflistToarray(l):\n max_dim=max([len(c) for c in l])\n all_array=[np.pad(c,(0,max_dim... | [
"0.8242542",
"0.63269496",
"0.6141394",
"0.5692313",
"0.55791426",
"0.55791426",
"0.55682117",
"0.54690933",
"0.5439151",
"0.5422417",
"0.5382426",
"0.5348696",
"0.5288169",
"0.5280279",
"0.525362",
"0.5152643",
"0.514693",
"0.5124691",
"0.51072955",
"0.5106846",
"0.509638",
... | 0.8206372 | 1 |
Copy values from subarrays of the numpy array a to the NDArrays in the list l. The sizes of the sub arrays correspond to the sizes of the NDArrays, so that this performs a copy in the reverse direction of copy_to_numpy_array(). Entries of l can have different dtype than a. | def _copy_from_numpy_array(a, l):
total_size = np.sum([x.size for x in l])
assert total_size == a.size
j = 0
for x in l:
x[:] = a[j:j + x.size].reshape(x.shape)
j += x.size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _copy_to_numpy_array(l, a):\n total_size = np.sum([x.size for x in l])\n assert total_size == a.size\n j = 0\n for x in l:\n # a[j:j+x.size] = x.asnumpy().reshape((x.size,))\n _copy_into(x, a[j:j + x.size])\n j += x.size",
"def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.nda... | [
"0.824406",
"0.5672978",
"0.56350243",
"0.5510067",
"0.5456553",
"0.52112097",
"0.51868254",
"0.5168819",
"0.51417094",
"0.5063647",
"0.5061758",
"0.49632236",
"0.49518946",
"0.494873",
"0.4942277",
"0.49309397",
"0.49309397",
"0.49226636",
"0.48952842",
"0.4880583",
"0.48740... | 0.8338329 | 0 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
is_mail_enabled = dictionary.get('isMailEnabled')
is_security_enabled = dictionary.get('isSecurityEnabled')
member_count = diction... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.7579973 | 80 |
Sets the news of this NewsList. List of all sites. | def news(self, news: List[News]):
self._news = news | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def news(self) -> List[News]:\n return self._news",
"def insert_into_news_pool(self, news):\n self.news_pool.append(news)",
"def __init__(self, news: List[News]=None):\n self.swagger_types = {\n 'news': List[News]\n }\n\n self.attribute_map = {\n 'news':... | [
"0.655942",
"0.5809342",
"0.57910275",
"0.5721592",
"0.5674233",
"0.5635913",
"0.56231123",
"0.55927944",
"0.54833764",
"0.5420062",
"0.541851",
"0.5358861",
"0.52144605",
"0.5196891",
"0.5148625",
"0.5148489",
"0.51216763",
"0.5053114",
"0.50516135",
"0.50410926",
"0.5041092... | 0.8127856 | 0 |
Retrieves a list of stations using a specific format. Returns a list with all station id's. By default, only ICOS stations will be returned. If `project` is set to 'ALL', all known station ids are returned. Please be aware, that the usage of data associated with nonICOS stations might be different from the CCBY 4.0 Lic... | def _get_id_list(filter: dict = {'project': 'ICOS', 'theme': ['AS', 'ES', 'OS']},
sort: str or list = 'name',
outfmt: str = 'pandas',
icon=None):
if isinstance(filter, dict) and 'project' not in filter.keys():
filter['project'] = 'ICOS'
query = sparqls.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_stations(proj_df, engine, drop_dups=False): \n # Get proj IDs\n assert len(proj_df) > 0, 'ERROR: Please select at least one project.'\n proj_df['project_id'].drop_duplicates(inplace=True)\n proj_ids = proj_df['project_id'].values.astype(int).tolist()\n\n # Query db\n bind_pa... | [
"0.64460933",
"0.63755363",
"0.627025",
"0.62448305",
"0.6232288",
"0.6163553",
"0.61358136",
"0.6079513",
"0.60503054",
"0.60262495",
"0.59749436",
"0.5972143",
"0.59526867",
"0.5941049",
"0.5915399",
"0.5914096",
"0.5889623",
"0.58850324",
"0.5877803",
"0.5841949",
"0.58407... | 0.5545214 | 45 |
Retrieves a list of stations using a specific format. Returns a list with all station ids. By default, only ICOS stations will be returned. If `project` is set to 'all', all known station ids are returned. Please be aware, that the usage of data associated with nonICOS stations might be different from the CCBY 4.0 Lice... | def getIdList(project: str = 'ICOS', theme: list = None, sort: str = 'name', outfmt: str = 'pandas', icon=None):
filter = {'project': project.upper(), 'theme': theme}
return _get_id_list(filter=filter, sort=sort, outfmt=outfmt, icon=icon) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_stations(proj_df, engine, drop_dups=False): \n # Get proj IDs\n assert len(proj_df) > 0, 'ERROR: Please select at least one project.'\n proj_df['project_id'].drop_duplicates(inplace=True)\n proj_ids = proj_df['project_id'].values.astype(int).tolist()\n\n # Query db\n bind_pa... | [
"0.6409361",
"0.64074254",
"0.6334591",
"0.63169533",
"0.6305185",
"0.6301693",
"0.62117225",
"0.61584055",
"0.610052",
"0.6085729",
"0.60446984",
"0.6014364",
"0.6008274",
"0.5986033",
"0.59775",
"0.5976607",
"0.5975381",
"0.5973221",
"0.59616554",
"0.5924774",
"0.5871268",
... | 0.0 | -1 |
Query the SPARQL endpoint for stations, creates an object for each Station and return the list of ICOS stations. By default, all atmosphere, ecosystem and ocean ICOS stations are returned which have been certified (ICOS Class 1, ICOS Class 2 or Associated). | def _station_list(theme: str or list = ['AS', 'ES', 'OS'],
ids: str or list = None,
filter: dict = None):
# list of returned station objects
station_ls = []
# if a list of id's is provided, ignore theme and class.
if ids:
if isinstance(ids, str):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations():\n # Create a link to the session\n session = Session(engine)\n \n # Query all station records\n results = session.query(Stations.station, Stations.name).all()\n \n session.close()\n\n # Create a dictionary from the query results\n all_stations = []\n for station, name ... | [
"0.7173948",
"0.70853263",
"0.70774615",
"0.70569634",
"0.70347184",
"0.6990435",
"0.6959818",
"0.6933618",
"0.69180715",
"0.6909899",
"0.68970037",
"0.6894614",
"0.6885097",
"0.6881524",
"0.6846812",
"0.6821865",
"0.6795644",
"0.6794274",
"0.6767467",
"0.676623",
"0.67305744... | 0.57931924 | 58 |
Query the SPARQL endpoint for stations, create an object for each Station and return the list of stations. By default, all ICOS stations are returned. That is all ocean, ecosystem and atmosphere stations which have been certified (Class 1, 2 or Associated). | def getList(theme=['AS', 'ES', 'OS'], ids=None):
station_ls = []
# if a list of id's is provided, ignore theme and class.
if ids:
for s in tqdm(ids):
station_ls.append(get(s))
return station_ls
default_theme = ['AS', 'ES', 'OS']
# make sure input is a list and in upp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations():\n # Create a link to the session\n session = Session(engine)\n \n # Query all station records\n results = session.query(Stations.station, Stations.name).all()\n \n session.close()\n\n # Create a dictionary from the query results\n all_stations = []\n for station, name ... | [
"0.7756119",
"0.7542171",
"0.74977005",
"0.7493329",
"0.7478253",
"0.7434674",
"0.7419635",
"0.73681176",
"0.73452955",
"0.7325998",
"0.7314134",
"0.7305606",
"0.73045284",
"0.7300724",
"0.7253693",
"0.7188312",
"0.7166452",
"0.7152799",
"0.7143216",
"0.7125833",
"0.71056396"... | 0.0 | -1 |
Tiles x on dimension dim count times. | def tile(x, count, dim=0):
perm = list(range(len(x.size())))
if dim != 0:
perm[0], perm[dim] = perm[dim], perm[0]
x = x.permute(perm).contiguous()
out_size = list(x.size())
out_size[0] *= count
x = x.repeat(count, *(1,) * x.dim()).transpose(0, 1).contiguous().view(*out_size)
if d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tile(x, count, dim=0):\n perm = list(range(len(x.shape)))\n if dim != 0:\n perm[0], perm[dim] = perm[dim], perm[0]\n x = x.permute(perm).contiguous()\n out_size = list(x.shape)\n out_size[0] *= count\n batch = x.shape[0]\n x = x.view(batch, -1) \\\n .transpose(0, 1) \\\n... | [
"0.7995799",
"0.7743472",
"0.72251785",
"0.72251785",
"0.6892366",
"0.68706846",
"0.6489282",
"0.63585883",
"0.6300268",
"0.6292242",
"0.6080058",
"0.606337",
"0.60176843",
"0.59804887",
"0.5967274",
"0.5953083",
"0.5943857",
"0.5932811",
"0.59011155",
"0.58835983",
"0.588350... | 0.8115603 | 0 |
Initializes a resource given its fallthroughs. If the attributes have a property or arg fallthrough but the full resource name is provided to the anchor attribute flag, the information from the resource name is used over the properties and args. This preserves typical resource parsing behavior in existing surfaces. | def Initialize(self, fallthroughs_map, parsed_args=None):
params = {}
# Returns a function that can be used to parse each attribute, which will be
# used only if the resource parser does not receive a fully qualified
# resource name.
def LazyGet(name):
f = lambda: deps_lib.Get(name, fallthrou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: AclBindingRuleArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n args: Optional[AclArgs] = None,\n ... | [
"0.66332495",
"0.6537106",
"0.65020514",
"0.6459604",
"0.62304676",
"0.6204393",
"0.6201695",
"0.618227",
"0.61458963",
"0.6075082",
"0.60665816",
"0.6006086",
"0.5999377",
"0.5999337",
"0.5999146",
"0.59941",
"0.59921694",
"0.5991608",
"0.5982053",
"0.59734714",
"0.5961451",... | 0.69918567 | 0 |
Return matrix whose rows are onehot encodings of integers. | def _onehot(integer_labels):
n_rows = len(integer_labels)
n_cols = integer_labels.max() + 1
onehot = np.zeros((n_rows, n_cols), dtype='uint8')
onehot[np.arange(n_rows), integer_labels] = 1
return onehot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot(y_):\n y_ = y_.reshape(len(y_))\n n_values = int(np.max(y_)) + 1\n n_values = 6\n return np.eye(n_va... | [
"0.7998147",
"0.79739946",
"0.7683423",
"0.7679451",
"0.7678289",
"0.7668003",
"0.76450354",
"0.7635295",
"0.7632391",
"0.7607147",
"0.7602468",
"0.75984865",
"0.7585971",
"0.75856966",
"0.75338763",
"0.7527027",
"0.7517341",
"0.75151235",
"0.751461",
"0.7499463",
"0.74982154... | 0.78553617 | 2 |
Relative path from the build root to the directory of the BUILD file being parsed. | def rel_path(self) -> str:
return os.path.dirname(self._filepath_oracle.filepath()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_relpath(self):\n return join_path(\"..\", self.build_dirname)",
"def relative_path(filename):\n length = len(os.path.abspath(DOC_BUILD_DIR)) + 1\n return os.path.abspath(filename)[length:]",
"def get_project_path():\n file_path = os.path.abspath(__file__)\n root_dir = os.path.join(... | [
"0.7909004",
"0.7707342",
"0.74842525",
"0.74369466",
"0.7353539",
"0.72918737",
"0.7264314",
"0.7264314",
"0.7264314",
"0.7264314",
"0.71964955",
"0.7192894",
"0.7192894",
"0.71719635",
"0.7168885",
"0.7157384",
"0.715053",
"0.7123951",
"0.71163565",
"0.711632",
"0.70777357"... | 0.0 | -1 |
Absolute path of the build root. | def build_root(self) -> str:
return self._build_root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRootPath()->str:\n if '--develop' in sys.argv:\n return eel._get_real_path('public') + '/'\n\n return eel._get_real_path('build') + '/'",
"def project_root() -> Path:\n return PROJECT_ROOT",
"def root_dir():\r\n return Path(__file__).parent.parent",
"def rootdir():\n return util.... | [
"0.8021333",
"0.78543425",
"0.7738131",
"0.7720683",
"0.7663266",
"0.76284367",
"0.75826377",
"0.75826377",
"0.75728923",
"0.7567836",
"0.7567836",
"0.7567836",
"0.7567836",
"0.7560248",
"0.75310045",
"0.7524477",
"0.75162673",
"0.7508164",
"0.7488534",
"0.74853873",
"0.74826... | 0.7162691 | 30 |
deep_cmp compares two objects deeply | def deep_cmp(obj1, obj2):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deep_equals(obja, objb, isequal):\n\n objatree = wo.typedtree(obja)\n objbtree = wo.typedtree(objb)\n match = objatree == objbtree\n ok = match == isequal\n\n if ok:\n s = \"pass\"\n else:\n s = \"fail\"\n\n print(f\"{obja} == {objb} is {match} : {s}\")\n return ok",
... | [
"0.6726066",
"0.66530275",
"0.6527878",
"0.64677584",
"0.6271268",
"0.621182",
"0.6145705",
"0.61302245",
"0.61206347",
"0.60844535",
"0.60643643",
"0.6057797",
"0.6032406",
"0.6009618",
"0.59857124",
"0.59731966",
"0.5950671",
"0.5939408",
"0.5894853",
"0.58666605",
"0.57747... | 0.9118865 | 0 |
returns the string representation of the object | def string(self):
return str(self._dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.obj)",
"def __str__(self):\n return str(self.serialize())",
"def to_string(self):\r\n return self.__str__()",
"def __str__(self):\n return str(self.__dict__)",
"def __... | [
"0.86025834",
"0.8491562",
"0.83294266",
"0.8293169",
"0.82227206",
"0.82227206",
"0.8094874",
"0.8094874",
"0.8094874",
"0.8094874",
"0.8094874",
"0.80924135",
"0.8091359",
"0.803379",
"0.80263066",
"0.8021047",
"0.8009998",
"0.8008937",
"0.8008937",
"0.8008937",
"0.8008937"... | 0.0 | -1 |
Player's name as stored in RS2 WebAdmin. | def name(self) -> str:
try:
return self.stats["Player name"]
except KeyError as ke:
logger.debug(ke, exc_info=True)
logger.warn("unable to get player name")
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return self._player_name",
"def get_player_name(self):\n return self._player_name",
"def getName(self):\n\n return self.player",
"def get_name(self):\n \n # Return the player's name\n return self._name",
"def get_name_from_player(player):\r\n ... | [
"0.85648334",
"0.8449206",
"0.83108515",
"0.8243182",
"0.8002718",
"0.7928115",
"0.7844518",
"0.7789188",
"0.7647284",
"0.7483471",
"0.73169285",
"0.7282102",
"0.72143584",
"0.707426",
"0.70385855",
"0.70370376",
"0.7020151",
"0.70167756",
"0.70124906",
"0.6848722",
"0.684872... | 0.834824 | 2 |
Ban expiration date str to datetime.datetime object. | def _parse_until(until: str) -> datetime.datetime:
return datetime.datetime.strptime(until, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_expiration_date(self):\n expiration_date = self.cleaned_data['expiration_date']\n if expiration_date.date() <= datetime.date.today():\n v_err('elapsed')\n return expiration_date",
"def get_datetime(self, date_str, end=False):\n if date_str == \"now\" or date_str i... | [
"0.6478678",
"0.64274275",
"0.63799465",
"0.6359118",
"0.6178688",
"0.6093202",
"0.6046234",
"0.60014564",
"0.59510314",
"0.59510314",
"0.590472",
"0.58857834",
"0.58606976",
"0.5855868",
"0.5812267",
"0.57926494",
"0.5783314",
"0.5773855",
"0.57633144",
"0.576217",
"0.574328... | 0.5732976 | 21 |
Add the context's user to an existing team. An administrator can also perform the action on a user's behalf. | def join_team_action(request):
# Find the team corresponding to the provided code.
data = request.json_body
team_id = None
if request.by_admin:
# Accept a team_id if the authenticated user is an admin.
if 'team_id' in data:
team_id = data['team_id']
if team_id is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user_to_team(self, for_user, to_manager):\n for_user = User.get_user_by_username(for_user)\n manager = User.get_user_by_username(to_manager)\n # @Todo test inheritance of get_user_by_username\n self.access_handler.check_add_user_to_team(for_user, manager)\n manager.add_us... | [
"0.7410998",
"0.7340358",
"0.721893",
"0.7140146",
"0.7071346",
"0.6567972",
"0.6506552",
"0.6417185",
"0.63913494",
"0.63427335",
"0.633358",
"0.6232267",
"0.6072171",
"0.604059",
"0.5980001",
"0.5960737",
"0.58651173",
"0.5840069",
"0.5826774",
"0.582464",
"0.5807041",
"0... | 0.583924 | 18 |
Delete all drawings and all turtles from the TurtleScreen. No argument. | def clear(self):
self._delayvalue = _CFG["delay"]
self._colormode = _CFG["colormode"]
self._delete("all")
self._bgpic = self._createimage("")
self._bgpicname = "nopic"
self._tracing = 1
self._updatecounter = 0
self._turtles = []
self.bgcolor("white... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n self.clear()\n self._screen._removeTurtle(self)\n del self._turtle",
"def _destroy(self):\n root = self._root\n turtle.Turtle._pen = None\n turtle.Turtle._screen = None\n self._root = None\n self._canvas = None\n turtle.TurtleScr... | [
"0.7634106",
"0.7263678",
"0.7255831",
"0.7144827",
"0.7080676",
"0.70619637",
"0.70619637",
"0.7044186",
"0.69849825",
"0.6956119",
"0.6871878",
"0.6846877",
"0.6835439",
"0.67128783",
"0.665286",
"0.6604478",
"0.6579282",
"0.64678836",
"0.64483804",
"0.6447129",
"0.6366659"... | 0.6761515 | 13 |
Return the colormode or set it to 1.0 or 255. | def colormode(self, cmode=None):
if cmode is None:
return self._colormode
if cmode == 1.0:
self._colormode = float(cmode)
elif cmode == 255:
self._colormode = int(cmode) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def potential_color(self):\n\n return (1., 1., 0.)",
"def get_color(self):\r\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.__color",
"def _get_color(self):\n return self.... | [
"0.61560196",
"0.60476726",
"0.5993631",
"0.5993631",
"0.5993631",
"0.5993631",
"0.59807307",
"0.5946223",
"0.5924161",
"0.5885491",
"0.58824646",
"0.5869164",
"0.58573097",
"0.58573097",
"0.58441573",
"0.58146566",
"0.58009475",
"0.57854545",
"0.5779842",
"0.5760599",
"0.574... | 0.827122 | 0 |
Set or return the line thickness. | def pensize(self, width=None):
if width is None:
return self._pensize
self.pen(pensize=width) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_line_thickness(thickness):\r\n global _current_line_thickness\r\n _current_line_thickness = thickness",
"def line_width(self, width=2.0):\n self._impl.line_width(width)",
"def thickness(self, new_thickness):\n self._thickness = new_thickness",
"def line_width(self, line_width=None... | [
"0.8006099",
"0.72736186",
"0.7272099",
"0.7238912",
"0.711664",
"0.711664",
"0.711664",
"0.70414394",
"0.70130616",
"0.6972364",
"0.6930756",
"0.67800355",
"0.6697596",
"0.64931923",
"0.6482506",
"0.6389454",
"0.62123317",
"0.61871856",
"0.615542",
"0.6148339",
"0.6148339",
... | 0.61773634 | 18 |
Return or set the pencolor. | def pencolor(self, *args):
if args:
color = self._colorstr(args)
if color == self._pencolor:
return
self.pen(pencolor=color)
else:
return self._color(self._pencolor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pencolor(self):\n return self._pencolor",
"def penColor( self ):\n return self._penColor",
"def color(self):\n assert False, 'Pen does not have a color; use pencolor or fillcolor'",
"def set_pen_color(self, color: tuple) -> Rectangle:\n self.pen.color = color\n return s... | [
"0.8674572",
"0.86046463",
"0.7887014",
"0.7069951",
"0.68271434",
"0.66679335",
"0.6458769",
"0.64352345",
"0.6340983",
"0.6337949",
"0.6298875",
"0.628542",
"0.62732375",
"0.6248982",
"0.62481725",
"0.62107986",
"0.6202098",
"0.61905146",
"0.6189081",
"0.61830723",
"0.61378... | 0.8215226 | 2 |
Delete the Myturtle's drawings from the screen. Do not move Myturtle. | def clear(self):
self._clear()
self._update() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n self._screen._removePen(self)\n del self._turtle",
"def __del__(self):\n self.clear()\n self._screen._removeTurtle(self)\n del self._turtle",
"def clear(self):\n self._turtle.clear()",
"def clear(self):\n self._turtle.clear()",
"def _cle... | [
"0.7829366",
"0.77479243",
"0.765006",
"0.765006",
"0.72360367",
"0.7118578",
"0.6998968",
"0.69926476",
"0.6930714",
"0.69287616",
"0.69137317",
"0.68801063",
"0.68782204",
"0.68240714",
"0.67524093",
"0.6740653",
"0.67177784",
"0.6652443",
"0.66228133",
"0.65513486",
"0.651... | 0.0 | -1 |
Serialize the string date to a datetime value. | def serialize_date(value):
return datetime.strptime(value, '%d %b %Y') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _serialize_date(val):\n return date_to_iso8601(val)",
"def _serialize_datetime(val):\n return datetime_to_iso8601(val)",
"def serialize(date):\n # From database to client\n\n # Convert date-object to datetime\n # See: https://stackoverflow.com/questions/1937622/convert-date-to-da... | [
"0.71354926",
"0.68498755",
"0.66490716",
"0.6419961",
"0.6376044",
"0.63656783",
"0.6365236",
"0.63495934",
"0.6346184",
"0.634235",
"0.6338759",
"0.62420154",
"0.62168455",
"0.62115145",
"0.619565",
"0.6186587",
"0.6179467",
"0.61690307",
"0.6158575",
"0.6152683",
"0.614988... | 0.7412838 | 0 |
Construct a new Game object. | def __init__(self, ui, player1, player2, istournament=False, tournamentgame=None):
self.player1 = player1
self.player2 = player2
self.istournament = istournament
self.tournamentgame = tournamentgame
self.gameState = [0, 0, 0,
0, 0, 0,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_game(self):\n game = Game(self.data['gamename'])\n self.game = game\n return game",
"def new_game(cls, user):\n game = Game(user=user,\n game_state=\".........\",\n game_over=False)\n game.put()\n return game",
"def __init... | [
"0.8163467",
"0.73820204",
"0.7202412",
"0.71297854",
"0.7106909",
"0.6993725",
"0.6883957",
"0.6864464",
"0.6828935",
"0.6828252",
"0.676304",
"0.6754849",
"0.6748863",
"0.6718435",
"0.6622979",
"0.66210175",
"0.6544912",
"0.65061146",
"0.6501085",
"0.6491872",
"0.64916265",... | 0.0 | -1 |
Displays the Game's user interface | def displayBoard(self, ui):
#self.ui.mainArea.fill(self.ui.color_background)
self.board = Board(ui, self.player1, self.player2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def livesScreen(self):\n # creates welcome screen if state is STATE_INACTIVE\n if self.getState() == STATE_ACTIVE or self.getState() == STATE_PAUSED \\\n or self.getState() == STATE_COMPLETE:\n label = GLabel(text=\"Lives:\", x = GAME_WIDTH-150,\n y = GAME_HEIGHT-55, font... | [
"0.72549546",
"0.7166619",
"0.70820117",
"0.70417875",
"0.69980276",
"0.69968146",
"0.6986281",
"0.6962793",
"0.69164854",
"0.68110585",
"0.68033487",
"0.6802761",
"0.67709804",
"0.6757567",
"0.6744227",
"0.6731687",
"0.67310107",
"0.6719924",
"0.6701467",
"0.6687314",
"0.668... | 0.62091523 | 77 |
Helper method for validating parameters to the order API function. Raises an UnsupportedOrderParameters if invalid arguments are found. | def validate_order_params(self,
asset,
amount,
limit_price,
stop_price,
style):
if not self.initialized:
raise OrderDuringInitialize(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_params(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def test_order_by_params_invalid_fields(self):\n order_params = {\"payer_tenant_id\": \"asc\", \"invalid\": \"param\"}\n serializer = OCIOrderBySerializer(data=order_params)\n with self.as... | [
"0.6636582",
"0.6345305",
"0.6313103",
"0.6259812",
"0.6242581",
"0.6218742",
"0.6149283",
"0.6104184",
"0.61031353",
"0.6085997",
"0.60799956",
"0.6077466",
"0.6047742",
"0.6022429",
"0.5990912",
"0.59871674",
"0.5983017",
"0.59744316",
"0.5950495",
"0.59372354",
"0.59253174... | 0.63049257 | 3 |
Convert number of shares to an integer. By default, truncates to the integer share count that's either within .0001 of amount or closer to zero. E.g. 3.9999 > 4.0; 5.5 > 5.0; 5.5 > 5.0 | def round_order(amount):
return int(round_if_near_integer(amount)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_of_shares(stock, investment):\n return int(investment // float(stock['Price']))",
"def mrshare(value):\n\n value = value or 0\n value = int(round(value * 100))\n return '{:05d}'.format(value)",
"def core_to_shares(self, amount):\n return amount / self.core_per_share()",
"def ge... | [
"0.67373264",
"0.61609375",
"0.61355007",
"0.6099697",
"0.6079421",
"0.59069866",
"0.588042",
"0.58553237",
"0.584114",
"0.58375764",
"0.57477015",
"0.5659492",
"0.55840784",
"0.5569909",
"0.5567995",
"0.5551532",
"0.5543079",
"0.5540987",
"0.5514151",
"0.54940414",
"0.546563... | 0.49203765 | 97 |
Set a limit on the maximum leverage of the algorithm. | def set_max_leverage(self, max_leverage):
control = MaxLeverage(max_leverage)
self.register_account_control(control) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_limit_max():\n limit_max = request.params.get(\"limit_max\", 0, type=float)\n output = request.params.get(\"output\", 1, type=int)\n retval = RP_LIB.rp_LimitMax(output, ctypes.c_float(limit_max))\n if retval != 0:\n LOG.error(\"Failed to set maximum output voltage. Error code: %s\", ERRO... | [
"0.724919",
"0.7016326",
"0.7016326",
"0.6927392",
"0.6867965",
"0.6846231",
"0.6833265",
"0.6795299",
"0.67814326",
"0.67062867",
"0.6705914",
"0.66737866",
"0.6662624",
"0.6634589",
"0.6630519",
"0.6624588",
"0.65863127",
"0.6568773",
"0.6564483",
"0.6545328",
"0.6545328",
... | 0.78781945 | 0 |
Set a limit on the number of shares and/or dollar value held for the given sid. Limits are treated as absolute values and are enforced at the time that the algo attempts to place an order for sid. This means that it's possible to end up with more than the max number of shares due to splits/dividends, and more than the ... | def set_max_position_size(
self,
asset=None,
max_shares=None,
max_notional=None,
on_error='fail'):
control = MaxPositionSize(asset=asset,
max_shares=max_shares,
max_notional=max_notion... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_max_order_size(self,\n asset=None,\n max_shares=None,\n max_notional=None,\n on_error='fail'):\n control = MaxOrderSize(asset=asset,\n max_shares=max_shares,\n ... | [
"0.58254945",
"0.57328945",
"0.5616859",
"0.56055886",
"0.55913866",
"0.5477389",
"0.5474759",
"0.5452816",
"0.544505",
"0.5440137",
"0.5430443",
"0.53757983",
"0.5367433",
"0.5353589",
"0.5353589",
"0.5353589",
"0.5323049",
"0.53221196",
"0.52891105",
"0.5288626",
"0.5286153... | 0.57122827 | 2 |
Set a limit on the number of shares and/or dollar value of any single order placed for sid. Limits are treated as absolute values and are enforced at the time that the algo attempts to place an order for sid. If an algorithm attempts to place an order that would result in exceeding one of these limits, raise a TradingC... | def set_max_order_size(self,
asset=None,
max_shares=None,
max_notional=None,
on_error='fail'):
control = MaxOrderSize(asset=asset,
max_shares=max_shares,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strict_limit(self, strict_limit):\n\n self._strict_limit = strict_limit",
"def limit_chase(self, oq, max_chase=3.0, failsafe=False, double_check=False):\n ret = self.send_order(oq=oq, ot='limit', price=None)\n order_id = ret[0]['orderID']\n last_price = ret[0]['price']\n si... | [
"0.5921895",
"0.57735974",
"0.5725143",
"0.57079554",
"0.56382525",
"0.5630813",
"0.55486006",
"0.5509752",
"0.54923606",
"0.5483896",
"0.5443233",
"0.54388654",
"0.5404075",
"0.53903586",
"0.5376704",
"0.5374852",
"0.53745776",
"0.53409106",
"0.53382504",
"0.53382504",
"0.53... | 0.5819131 | 1 |
Set a limit on the number of orders that can be placed in a single day. | def set_max_order_count(self, max_count, on_error='fail'):
control = MaxOrderCount(on_error, max_count)
self.register_trading_control(control) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit(self, limit):\n self._limit = limit",
"def daily_limit(self, daily_limit):\n\n self._daily_limit = daily_limit",
"def limit(self, limit):\n self._evaluated = False\n self._limit = limit\n return self",
"def limit(self, limit):\n\n self._limit = limit",
"def limit(sel... | [
"0.5920616",
"0.5796291",
"0.57857776",
"0.57729465",
"0.57729465",
"0.57729465",
"0.5689899",
"0.56892693",
"0.56762534",
"0.55805606",
"0.55784273",
"0.5574961",
"0.55657625",
"0.5558245",
"0.54324776",
"0.53949493",
"0.5382494",
"0.53180015",
"0.530283",
"0.530172",
"0.527... | 0.5653127 | 9 |
Set a rule specifying that this algorithm cannot take short positions. | def set_long_only(self, on_error='fail'):
self.register_trading_control(LongOnly(on_error)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule_invalid(self, idx: int, line: Statement) -> None:\n #TODO: this is a print while not all rules are handled yet\n print(NotARule(f'No such rule: {line.rule.value!r}'))",
"def add_rule(self, rule, on=None, off=None, strength=1.):\n\n self.x[on:off, :, get_rule_index(rule, self.config)... | [
"0.5636999",
"0.54516774",
"0.53249186",
"0.51604575",
"0.5085428",
"0.5016277",
"0.49744147",
"0.4972528",
"0.49579895",
"0.49396747",
"0.4932018",
"0.49248123",
"0.4913955",
"0.48481235",
"0.4841069",
"0.48339123",
"0.48304284",
"0.48224288",
"0.481223",
"0.47957873",
"0.47... | 0.49705797 | 8 |
Evaluate the L1 norm of X Returns the max over the sum of each column of X | def L1Norm(X):
return max(np.sum(X,axis=0)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm1(x):\n n, p = x.shape\n if p == 1 or n == 1:\n return np.sum(np.abs(x))\n else:\n return np.max(np.sum(np.abs(x), axis=0))",
"def norm1(X):\r\n # pass\r\n if X.shape[0]*X.shape[1] == 0:\r\n return 0\r\n return abs(X).sum()\r\n # return LA.norm(X, 1)\r",
"def n... | [
"0.75343716",
"0.73331046",
"0.7129455",
"0.7089392",
"0.67368776",
"0.6676168",
"0.6675522",
"0.6635472",
"0.6539204",
"0.65240026",
"0.6478929",
"0.6411275",
"0.6410474",
"0.640039",
"0.6349481",
"0.6343169",
"0.6333034",
"0.6278802",
"0.62678295",
"0.6257422",
"0.6254585",... | 0.8427064 | 0 |
Display the dbkeeper home page. | def index(request):
return render(request, "dbkeeper/index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n dbcreate.generatedb()\n return render_template('home.html')",
"def home():\n return render_template(\n 'index.html',\n title='Automation Center',\n year=datetime.now().year,\n message='Welcome to the Automation Center'\n )",
"def home():\n\n\treturn render_... | [
"0.7827154",
"0.7621188",
"0.75967497",
"0.7385952",
"0.73590857",
"0.72912216",
"0.7278725",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.7273532",
"0.725441",
"0.7251205",
"0.72255385",
"0.72004193",... | 0.69971615 | 40 |
Home page view for piservice. Since this is a service, we could return 404, or we could put up a helpful page with some options. | def station_status(request):
refreshInterval = Setting.get("STATION_STATUS_REFRESH_INTERVAL_MS", default="5000")
return render(request, "dbkeeper/station_status.html",
{"PAGE_REFRESH_INTERVAL": refreshInterval}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n response.view_title = myconf.get('app.name') + ' Home Page'\n return dict(message='')",
"def home():\n makes = edmunds.get_makes()\n return render_template(\"service/index.html\",\n makes=makes)",
"def home():\n payload = manager.get_payload()\n return... | [
"0.7152464",
"0.71061397",
"0.6833184",
"0.6780633",
"0.6746276",
"0.66947967",
"0.6686471",
"0.66533434",
"0.6648833",
"0.66471297",
"0.66425675",
"0.66325754",
"0.6609107",
"0.6592536",
"0.6565279",
"0.65492463",
"0.65477824",
"0.65467834",
"0.6535404",
"0.65289575",
"0.652... | 0.0 | -1 |
Plot loss and val loss. | def plot_loss():
df = pd.read_csv('data/loss.csv', encoding='utf-8')
loss = df['loss'].values
val_loss = df['val_loss'].values
x = [i for i in range(1, len(loss) + 1)]
plt.plot(x, loss, label='Train loss')
plt.plot(x, val_loss, label='Val loss')
plt.xlabel('Epochs')
plt.ylabel('Contras... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_plot(train_loss, val_loss, filename):\n\tplt.plot(train_loss)\n\tplt.plot(val_loss)\n\tplt.ylabel('Loss')\n\tplt.xlabel('Epochs')\n\tplt.legend(['Train', 'Val'], loc='upper right')\n\tplt.savefig(filename)\n\tplt.close()",
"def plot_loss(stats):\r\n plt.plot(stats['train_loss_ind'], stats['train_loss... | [
"0.82998466",
"0.82797426",
"0.80859876",
"0.7981037",
"0.7693412",
"0.76680315",
"0.7617962",
"0.7617048",
"0.75987184",
"0.75846845",
"0.7553299",
"0.7551096",
"0.7526244",
"0.74546194",
"0.73826283",
"0.73073465",
"0.72436315",
"0.72190005",
"0.71932274",
"0.71717453",
"0.... | 0.84513193 | 0 |
Randomly rolls the lightcurve, moving starting elements to the end. | def roll_lightcurve(lightcurve: np.ndarray) -> np.ndarray:
shift = np.random.randint(0, len(lightcurve))
return np.roll(lightcurve, shift) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll(self):\n return random.randrange(1, sides + 1)",
"def roll(self):\n\t\treturn randint(1, self.num_sides)",
"def move(self):\n if self._z >= 75:\n a = random.random()\n print(str(a))\n if a < 0.2:\n self._z += 1\n if a > 0.2 and a... | [
"0.6308937",
"0.5868974",
"0.5851354",
"0.58155835",
"0.5804617",
"0.5804617",
"0.5804617",
"0.5804617",
"0.57860935",
"0.57860935",
"0.5687163",
"0.568123",
"0.5665804",
"0.5656522",
"0.5652201",
"0.5631834",
"0.56227976",
"0.5609408",
"0.5596563",
"0.5579034",
"0.55781525",... | 0.72958153 | 0 |
Generates the inference dataset. | def generate_inference_dataset(self, inference_directory: str) -> (List[str], List[np.ndarray]):
example_paths = [os.path.join(inference_directory, file_name) for file_name in
os.listdir(inference_directory) if file_name.endswith('.npy')]
examples = []
for example_path i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inference(self, dataset, model_dir):\n raise NotImplementedError",
"def _generate_datasets(self):\n\n degrade_test = False\n if self._opts['degrade_step'] == 'test':\n degrade_test = True\n\n use_trainset_for_tests = UseTrainForTest.IDENTICAL # can be different in few shot workflow\n\... | [
"0.70093894",
"0.69909495",
"0.6928356",
"0.6926274",
"0.6896347",
"0.67475426",
"0.674132",
"0.6666809",
"0.6626222",
"0.6601015",
"0.6595752",
"0.650644",
"0.6476092",
"0.6369744",
"0.6369523",
"0.63629127",
"0.6321151",
"0.6296114",
"0.62868357",
"0.6279205",
"0.62599283",... | 0.65938 | 11 |
Formula(self) + Formula(other) When adding \'intercept\' to a factor, this just returns Formula(self, namespace=self.namespace) | def __add__(self, other):
if isinstance(other, Term) and other.name is 'intercept':
return Formula(self, namespace=self.namespace)
else:
return Term.__add__(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, other):\n \n if other.name is 'intercept':\n return formula(self, namespace=self.namespace)\n else:\n return term.__add__(self, other)",
"def __add__(self, other):\n\n other = Formula(other)\n terms = self.terms + other.terms\n pie... | [
"0.892706",
"0.7850612",
"0.7582543",
"0.7247086",
"0.6729214",
"0.6699146",
"0.6654158",
"0.6565891",
"0.6484925",
"0.64614576",
"0.6342464",
"0.63215107",
"0.6316699",
"0.62675995",
"0.62595725",
"0.62517965",
"0.6236327",
"0.6232033",
"0.62143403",
"0.61953527",
"0.6192967... | 0.90075254 | 0 |
This returns a formula whose columns are the pairwise product of the columns of self and other. | def __mul__(self, other, nested=False):
other = Formula(other)
selftermnames = self.termnames()
othertermnames = other.termnames()
I = len(selftermnames)
J = len(othertermnames)
terms = []
termnames = []
for i in range(I):
for j in range(J... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mul__(self, othertr):\n res = self.dot(othertr)\n return res",
"def __mul__(self, other, nested=False):\n\n other = formula(other, namespace=self.namespace)\n\n selftermnames = self.termnames()\n othertermnames = other.termnames()\n\n I = len(selftermnames)\n ... | [
"0.64140505",
"0.63255924",
"0.6279798",
"0.6277444",
"0.6248262",
"0.62374085",
"0.6095252",
"0.6049075",
"0.6034012",
"0.6012328",
"0.59264356",
"0.5915682",
"0.5843071",
"0.5842043",
"0.5837421",
"0.5814968",
"0.5803651",
"0.57777655",
"0.5762164",
"0.57367915",
"0.5723196... | 0.6386615 | 1 |
Sets my id. Should be 32 byte | def vscr_ratchet_group_session_set_my_id(self, ctx, my_id):
vscr_ratchet_group_session_set_my_id = self._lib.vscr_ratchet_group_session_set_my_id
vscr_ratchet_group_session_set_my_id.argtypes = [POINTER(vscr_ratchet_group_session_t), vsc_data_t]
vscr_ratchet_group_session_set_my_id.restype = Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_id(self, value):\n pass",
"def _set_id(self):\n raise NotImplementedError()",
"def set_id(self, id):\n self.__id = id",
"def set_ID(self, x):\n x = str(x)\n if self.ID != x:\n self.ID = x",
"def setID(self, idf):\n self.id = idf",
"def set_id(... | [
"0.82120085",
"0.79981655",
"0.78234476",
"0.7817312",
"0.78071094",
"0.77935666",
"0.778286",
"0.7728128",
"0.7726666",
"0.7678479",
"0.7650383",
"0.7610367",
"0.7603059",
"0.75629497",
"0.75530535",
"0.75516313",
"0.75436354",
"0.74994",
"0.7493894",
"0.7493894",
"0.7493894... | 0.0 | -1 |
This is a single skewgaussian. Note the order of parameters in skewnorm.pdf! | def single_peak(x, mean, sigma, alpha):
return skewnorm.pdf(x, alpha, mean, sigma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skew(self):\n \n v = self.v; w = self.w;\n \n # the following matrix is at odds with H&Z pg. 72\n return np.array([\n [ 0, v[2], -v[1], w[0]],\n [-v[2], 0 , v[0], w[1]],\n [ v[1], -v[0], 0, w[2]],\n [-w[0... | [
"0.674505",
"0.66976744",
"0.6640447",
"0.6623652",
"0.6584539",
"0.6427872",
"0.6412529",
"0.62533915",
"0.6249454",
"0.6234948",
"0.61091375",
"0.6008516",
"0.59874296",
"0.59580714",
"0.5949116",
"0.5941515",
"0.5933472",
"0.5910465",
"0.5851475",
"0.58444244",
"0.58373636... | 0.5826407 | 21 |
CDF for the skewgaussian. Additional safety to filter out large arguments. | def single_peak_cdf(x, mean, sigma, alpha):
z = np.clip((x-mean)/sigma, -10, 10)
return skewnorm.cdf(z, alpha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_cdf(x, _erf=erf):\n return (1 + _erf(x / math.sqrt(2))) / 2",
"def cdf(X, parameters):\n check_data_type_column_data(X)\n check_model_params_dict(parameters)\n\n sigma = (1.0/parameters['rho'])**.5\n\n return norm.cdf(X,parameters['mu'],sigma)",
"def std_norm_cdf(x):... | [
"0.65131265",
"0.6186629",
"0.6161622",
"0.6146133",
"0.6136695",
"0.6125919",
"0.6050933",
"0.60233885",
"0.60069877",
"0.59550256",
"0.5927398",
"0.5910854",
"0.5899473",
"0.5862627",
"0.58616513",
"0.5841404",
"0.5840815",
"0.58182883",
"0.5798016",
"0.5798016",
"0.5788954... | 0.63566905 | 1 |
kolmogorov distance is the maximum distance between two probability distributions. This calculates the KD of two pdfs in the form of numpy arrays. | def kolmogorov_distance(pdfx, pdfy):
cdfx = np.cumsum(pdfx)/np.sum(pdfx)
cdfy = np.cumsum(pdfy)/np.sum(pdfy)
return np.max(np.abs(cdfx - cdfy)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(p0, p1):\n return( numpy.sqrt( (p0[0]-p1[0])**2 + \n (p0[1]-p1[1])**2 + \n (p0[2]-p1[2])**2 ) )",
"def dist(p1,p2):\n\n return sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)",
"def distance (p1,p2):\n return np.sqrt(np.sum(np.power(p2-p1,2)))",
"de... | [
"0.6695389",
"0.6530534",
"0.6528139",
"0.6474828",
"0.64736056",
"0.6458455",
"0.6420905",
"0.63969034",
"0.63817",
"0.6379324",
"0.6358662",
"0.6355999",
"0.63409716",
"0.63376147",
"0.6327973",
"0.63198674",
"0.6312635",
"0.6306476",
"0.62971365",
"0.6286765",
"0.6282493",... | 0.7690672 | 0 |
This is like Kolmogorov distance, just measured horizontally. It gives RMS deviation of random samples from the two distributions. | def q_distance(pdfx, pdfy, index):
cdfx = np.cumsum(pdfx)/np.sum(pdfx)
cdfy = np.cumsum(pdfy)/np.sum(pdfy)
d = np.linspace(0.0, 1.0, 20, endpoint = False) + 1/40
xd = np.interp(d, cdfx, index)
yd = np.interp(d, cdfy, index)
return np.sqrt(simps((xd - yd)**2, d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rmsd(x, y):\n\n # get the length of the dataset\n n, = x.shape\n\n return np.sqrt(np.sum((x-y)**2)/n)",
"def rmsd(a,b):\n\tDi=[]\n\tfor i in range(len(a)):\n\t\tD=((a[i][0]-b[i][0])**2+(a[i][1]-b[i][1])**2+(a[i][2]-b[i][2])**2)\n\t\tDi.append(D)\n\tRMSD=sqrt(0.01*fsum(Di))\n\treturn RMSD",
"def rm... | [
"0.6893147",
"0.6576826",
"0.6480194",
"0.64296967",
"0.6415051",
"0.6357996",
"0.6308826",
"0.6232067",
"0.6223963",
"0.61897767",
"0.6183281",
"0.61781615",
"0.61781615",
"0.61410296",
"0.6104852",
"0.6093155",
"0.60658133",
"0.6050865",
"0.59986156",
"0.59874195",
"0.59612... | 0.0 | -1 |
Look for terms presented in both list and the pvaleu is even better in the combined list S_old is the set of genes in Old set, if None, set to all genes in t_old table This method is to be used by analyze_key_terms. | def key_terms(self, t_old, t_new, t_union, S_old=None, t_over=None):
if t_old is None or t_new is None or t_union is None:
return None
print("Old: %d, New: %d, Union: %d" % (len(t_old), len(t_new), len(t_union)))
if S_old is None:
S_old=set([y for x in [ t_old.ix[i, 'Gen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_missing(self, set_tweets, original_sents):\n res = []\n full_original_sents = [\" \".join(s[\"tokens\"]) for s in original_sents]\n for s1, s2 in zip(set_tweets, full_original_sents):\n if not s1:\n res.append([s2]) # add the original as candidate if no candid... | [
"0.5270499",
"0.5263518",
"0.52220106",
"0.52068335",
"0.51452315",
"0.50743026",
"0.50405735",
"0.5016303",
"0.50064653",
"0.49099362",
"0.48987463",
"0.48954973",
"0.48942754",
"0.48571077",
"0.4847399",
"0.48385495",
"0.48297605",
"0.47905686",
"0.47897458",
"0.47897458",
... | 0.6873936 | 0 |
Close this dictionary and any underlying database connections. | def close(self):
if self._con is not None:
self._commit()
self._con.close()
self._con = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.__database__.close()",
"def close(self):\n self.clean()\n\n for conn in self.conn__.values():\n try:\n conn.commit()\n conn.close()\n except sqlite3.ProgrammingError:\n pass",
"def close(self):\n ... | [
"0.7752083",
"0.7741661",
"0.77213484",
"0.76694363",
"0.76694363",
"0.76694363",
"0.7661544",
"0.7645213",
"0.7641986",
"0.7629023",
"0.7536173",
"0.7535401",
"0.74795544",
"0.7435751",
"0.73724425",
"0.7361781",
"0.7358463",
"0.73512524",
"0.722918",
"0.71652156",
"0.714848... | 0.65036047 | 94 |
Total amount of posts loaded. | def count_total(self):
with self._c_lock: # I can't believe I implemented a lock for a counter. Safety first, I guess...
return self._total_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_posts(self):\n\n return FlicketTicket.query.filter_by(started_id=self.id).count() + FlicketPost.query.filter_by(\n user_id=self.id).count()",
"def posts_count(self):\n return Post.objects.filter(user__username = self.user.username).count()",
"async def _set_total_posts_in_domai... | [
"0.7457904",
"0.73846537",
"0.69664824",
"0.6819613",
"0.6797854",
"0.67948675",
"0.6775799",
"0.6681046",
"0.66759866",
"0.6626322",
"0.66191894",
"0.65930974",
"0.6592763",
"0.65409946",
"0.65301406",
"0.65273756",
"0.64973515",
"0.6465976",
"0.6465976",
"0.6465976",
"0.646... | 0.0 | -1 |
Gets the next element in the list. Returns Null on timeout, or raises Empty when finished. | def next_ele(self):
try:
ret = self._queue.get(block=True, timeout=0.5)
self._queue.task_done()
return ret
except queue.Empty:
if not self.isAlive():
raise
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_ele(self):\n\t\ttry:\n\t\t\tret = self._queue.get(block = True, timeout=0.5)\n\t\t\tself._queue.task_done()\n\t\t\treturn ret\n\t\texcept queue.Empty:\n\t\t\tif not self.is_running():\n\t\t\t\traise\n\t\t\telse:\n\t\t\t\treturn None",
"def get_next_item(self, timeout=None):\n if self.current_item... | [
"0.8053774",
"0.7185805",
"0.71605355",
"0.69760185",
"0.6794046",
"0.6730466",
"0.6636796",
"0.6606605",
"0.6502341",
"0.64677364",
"0.64234453",
"0.6394917",
"0.6389111",
"0.6373149",
"0.63690454",
"0.6351756",
"0.6346494",
"0.63144475",
"0.6292954",
"0.6280215",
"0.6276917... | 0.8092506 | 0 |
Test bills page (/bills) | def test_bills_page(self):
self.make_request("/bills", follow_redirects=True)
headings = [
"Current Bills",
"All Tabled Bills",
"Private Member & Committee Bills",
"All Tabled & Draft Bills",
"Draft Bills",
"Bills Explained"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bill_page(self):\n bill = self.fx.BillData.food\n self.make_request(\"/bill/%d/\" % bill.id, follow_redirects=True)\n self.assertIn(bill.type.name, self.html)\n # Check if \"na\" stage is in page\n self.assertIn(\"stage2\", self.html)\n # Check if plenary event is... | [
"0.7680774",
"0.70165765",
"0.67381495",
"0.671697",
"0.6493225",
"0.6169521",
"0.6162236",
"0.61248475",
"0.60678047",
"0.5941131",
"0.5916215",
"0.58462006",
"0.5843386",
"0.5824207",
"0.5804087",
"0.5803388",
"0.57419884",
"0.57244706",
"0.5711201",
"0.5695939",
"0.5693122... | 0.8518053 | 0 |
Test draft bills page (/bills/draft/) redirects to current year's draft bills page. | def test_draft_bills_page(self):
response = self.make_request("/bills/draft/", follow_redirects=False)
self.assertEqual(302, response.status_code)
current_year = datetime.datetime.today().year
self.assertEqual(
urlparse(response.location).path, "/bills/draft/year/%d/" % curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_draft_bills_page_for_year(self):\n year = 2019\n response = self.make_request(\n \"/bills/draft/year/%d/\" % year, follow_redirects=True\n )\n self.assertEqual(200, response.status_code)\n bill = self.fx.BillData.draft\n self.assertIn(bill.title, self.h... | [
"0.796481",
"0.70448816",
"0.70290816",
"0.665954",
"0.6471485",
"0.6356927",
"0.635401",
"0.632725",
"0.6307408",
"0.61629856",
"0.6149977",
"0.58866006",
"0.57728565",
"0.5759125",
"0.568433",
"0.5669418",
"0.5656988",
"0.560628",
"0.55976933",
"0.550295",
"0.54979414",
"... | 0.8807852 | 0 |
Test draft bills page for a year (/bills/draft/). | def test_draft_bills_page_for_year(self):
year = 2019
response = self.make_request(
"/bills/draft/year/%d/" % year, follow_redirects=True
)
self.assertEqual(200, response.status_code)
bill = self.fx.BillData.draft
self.assertIn(bill.title, self.html) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_draft_bills_page(self):\n response = self.make_request(\"/bills/draft/\", follow_redirects=False)\n self.assertEqual(302, response.status_code)\n current_year = datetime.datetime.today().year\n self.assertEqual(\n urlparse(response.location).path, \"/bills/draft/year... | [
"0.84138995",
"0.7889149",
"0.6775302",
"0.65236485",
"0.62575066",
"0.6029107",
"0.5984826",
"0.59390867",
"0.58819306",
"0.5876933",
"0.5722013",
"0.5572942",
"0.5545011",
"0.5518728",
"0.5517939",
"0.5496567",
"0.54783195",
"0.54646355",
"0.5458014",
"0.54177934",
"0.53996... | 0.88270897 | 0 |
changes the least significant bit of an image. tbh, this could be done with normal bytes by just incrementing the byte by 1 (or potentially substracting by 1/ keeping it the same) index the index of the byte | def lsb_update(self, index, new_lsb):
self.set_bit(index, self.binary_size - 1, new_lsb) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updatebyte(byte, bit, value):\n if value == 0:\n return byte & ~(1 << bit)\n elif value == 1:\n return byte | (1 << bit)",
"def shift_lowest_unset_bit_bit_array(x, bit_array):\n\n if (x == -1):\n return -1\n\n return (x * bit_array) // get_lowest_unset_bit(x)"... | [
"0.6086328",
"0.5938387",
"0.5833486",
"0.575217",
"0.57242626",
"0.56190455",
"0.55813783",
"0.55642325",
"0.5526287",
"0.55246127",
"0.5518347",
"0.550134",
"0.54977727",
"0.5472975",
"0.5464234",
"0.5430284",
"0.5414866",
"0.54116887",
"0.5402095",
"0.5372441",
"0.5372322"... | 0.0 | -1 |
Prepend a value to the beginning of the list. | def prepend(self, value):
if self.head is None:
self.head = Node(value)
return
new_node = Node(value)
new_node.next = self.head
self.head = new_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend(self, value):\n pass",
"def prepend(self, item: Any):\n self.insert(0, item)",
"def prepend(self, x):\n self.insert(0, x)",
"def prepend(self, *args):\n return _libsbml.ListWrapperSBase_prepend(self, *args)",
"def prepend(self, in_items):\n\n items = self.list... | [
"0.8317461",
"0.7703864",
"0.76706845",
"0.74701613",
"0.7348015",
"0.7225708",
"0.7132274",
"0.689888",
"0.6890011",
"0.687966",
"0.6816932",
"0.6731809",
"0.67170197",
"0.6663008",
"0.6539581",
"0.6505828",
"0.65012324",
"0.6495",
"0.64920115",
"0.6425391",
"0.6424154",
"... | 0.77495795 | 1 |
Insert value at pos position in the list. If pos is larger than the length of the list, append to the end of the list. | def insert(self, value, pos):
if self.head is None:
self.head = Node(value)
return
if pos == 0:
self.prepend(value)
return
index = 0
node = self.head
while node.next and index <= pos:
if (pos - 1) == inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, pos, item):\n \n if pos == 0:\n self.add(item)\n \n elif pos >= self.length():\n self.append(item)\n \n else:\n previous = None\n current = self.head\n \n for _ in range(pos):\n ... | [
"0.7365507",
"0.71653986",
"0.7131035",
"0.70607984",
"0.7060087",
"0.6903673",
"0.6818579",
"0.67716753",
"0.6679426",
"0.66339636",
"0.6624288",
"0.6520374",
"0.6493936",
"0.6466639",
"0.64303565",
"0.63194513",
"0.6312773",
"0.62931496",
"0.6289725",
"0.6266714",
"0.626271... | 0.7602359 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.